Skip to content

Commit

Permalink
Merge pull request #4 from dhrumilp15/quiqui
Browse files Browse the repository at this point in the history
Quiqui
  • Loading branch information
dhrumilp15 authored Dec 25, 2019
2 parents 5ec9f8a + 1e7d1c9 commit 3591957
Show file tree
Hide file tree
Showing 80 changed files with 2,035 additions and 135 deletions.
268 changes: 133 additions & 135 deletions cc_maze/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,26 +40,26 @@ class _MyHomePageState extends State<MyHomePage> {
@override
void initState() {
super.initState();
gen(startrows,startcols);
gen(startrows,startcols);
}

void gen(rows, cols, {String algValue = ''}) {
maze = Maze(rows, cols);
iter = maze.generate(algValue).iterator;
Timer.periodic(Duration(milliseconds: 2), onTick); // for the delay effect
Timer.periodic(Duration(milliseconds: 2), onTick); // for the delay effect
}

void onTick(Timer timer) {
if (iter.moveNext())
{
var visited = iter.current;
setState(() {});
debugPrint('visited: (${visited.row},${visited.col})');
} else {
timer.cancel();
iter = null;
setState(() {});
}
{
var visited = iter.current;
setState(() {});
debugPrint('visited: (${visited.row},${visited.col})');
} else {
timer.cancel();
iter = null;
setState(() {});
}
}

String algValue = 'simple';
Expand All @@ -77,139 +77,138 @@ class _MyHomePageState extends State<MyHomePage> {
backgroundColor: Colors.black12,
appBar: AppBar(title: Text('CC Maze')),
floatingActionButton: FloatingActionButton(
onPressed: () {
if (rows == 0 && cols == 0)
{
gen(startrows,startcols);
}
else if (iter == null)
{
gen(rows, cols, algValue: algValue);
}
else return null;
},
child: Icon(Icons.autorenew),
onPressed: () {
if (rows == 0 && cols == 0)
{
gen(startrows,startcols);
}
else if (iter == null)
{
gen(rows, cols, algValue: algValue);
} else return null;
},
child: Icon(Icons.autorenew),
),
drawer: Drawer(
child: ListView(
padding: EdgeInsets.zero,
children: <Widget>[
DrawerHeader(
child: Text('Maze Menu',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 50.0,
color: Colors.white.withOpacity(0.7),
)
),
decoration: BoxDecoration(
color: Colors.blue,
),
),
Center(
child: Text('Algorithm'),
),
DropdownButtonHideUnderline(
child: ButtonTheme(
alignedDropdown: true,
child: DropdownButton<String>(
isExpanded: true,
hint: new Text('Algorithm'),
elevation: 16,
value: algValue,
onChanged: (String newValue) {
setState(() {
algValue = newValue;
});
},
items: _algValue.map((String value) {
return new DropdownMenuItem<String>(
value: value,
child: Text(value),
);
}).toList(),
),
)
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Text('Row'),
Text('x'),
Text('Col')
]
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
DropdownButtonHideUnderline(
child: ButtonTheme(
alignedDropdown: true,
child: DropdownButton<String>(
hint: Text('rows'),
value: rows.toString(),
elevation: 16,
onChanged: (String newValue) {
setState(() {
rows = int.parse(newValue);
});
},
items: _rows.map((int value) {
return new DropdownMenuItem<String>(
value: value.toString(),
child: Text(value.toString()),
);
}).toList(),
child: ListView(
padding: EdgeInsets.zero,
children: <Widget>[
DrawerHeader(
child: Text('Maze Menu',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 50.0,
color: Colors.white.withOpacity(0.7),
)
),
)
decoration: BoxDecoration(
color: Colors.blue,
),
),
Center(
child: Text('Algorithm'),
),
Text('x'),
DropdownButtonHideUnderline(
child: ButtonTheme(
child: ButtonTheme(
alignedDropdown: true,
child: DropdownButton<String>(
hint: Text('row'),
value: cols.toString(),
elevation: 16,
onChanged: (String newValue) {
setState(() {
cols = int.parse(newValue);
});
},
items: _cols.map((int value) {
return new DropdownMenuItem<String>(
value: value.toString(),
child: Text(value.toString()),
);
}).toList(),
isExpanded: true,
hint: new Text('Algorithm'),
elevation: 16,
value: algValue,
onChanged: (String newValue) {
setState(() {
algValue = newValue;
});
},
items: _algValue.map((String value) {
return new DropdownMenuItem<String>(
value: value,
child: Text(value),
);
}).toList(),
),
)
)
),
]
)
]
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Text('Row'),
Text('x'),
Text('Col')
]
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
DropdownButtonHideUnderline(
child: ButtonTheme(
alignedDropdown: true,
child: DropdownButton<String>(
hint: Text('rows'),
value: rows.toString(),
elevation: 16,
onChanged: (String newValue) {
setState(() {
rows = int.parse(newValue);
});
},
items: _rows.map((int value) {
return new DropdownMenuItem<String>(
value: value.toString(),
child: Text(value.toString()),
);
}).toList(),
),
)
),
Text('x'),
DropdownButtonHideUnderline(
child: ButtonTheme(
alignedDropdown: true,
child: DropdownButton<String>(
hint: Text('row'),
value: cols.toString(),
elevation: 16,
onChanged: (String newValue) {
setState(() {
cols = int.parse(newValue);
});
},
items: _cols.map((int value) {
return new DropdownMenuItem<String>(
value: value.toString(),
child: Text(value.toString()),
);
}).toList(),
)
)
),
]
)
]
),
),
body: Center(
child: AspectRatio(
aspectRatio: 1,
child: Column(
children: [
for (var row = 0; row != maze.rows; ++row)
Expanded(
child: Row(
children: [
for (var col = 0; col != maze.cols; ++col)
Expanded(
child: CellView(maze.getCell(row, col))
)
]
)
)
],
)
),
)
child: AspectRatio(
aspectRatio: 1,
child: Column(
children: [
for (var row = 0; row != maze.rows; ++row)
Expanded(
child: Row(
children: [
for (var col = 0; col != maze.cols; ++col)
Expanded(
child: CellView(maze.getCell(row, col))
)
]
)
)
],
)
),
)
);
}

Expand All @@ -232,8 +231,7 @@ class CellView extends StatelessWidget {
);
}

BorderSide getside(Walls wall) =>
BorderSide(
BorderSide getside(Walls wall) => BorderSide(
width: 2.0,
style: cell.walls[wall.index] ? BorderStyle.solid : BorderStyle.none,
);
Expand Down
73 changes: 73 additions & 0 deletions quiqui/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.atom/
.buildlog/
.history
.svn/

# IntelliJ related
*.iml
*.ipr
*.iws
.idea/

# The .vscode folder contains launch configuration and tasks you configure in
# VS Code which you may wish to be included in version control, so this line
# is commented out by default.
#.vscode/

# Flutter/Dart/Pub related
**/doc/api/
.dart_tool/
.flutter-plugins
.packages
.pub-cache/
.pub/
/build/

# Android related
**/android/**/gradle-wrapper.jar
**/android/.gradle
**/android/captures/
**/android/gradlew
**/android/gradlew.bat
**/android/local.properties
**/android/**/GeneratedPluginRegistrant.java

# iOS/XCode related
**/ios/**/*.mode1v3
**/ios/**/*.mode2v3
**/ios/**/*.moved-aside
**/ios/**/*.pbxuser
**/ios/**/*.perspectivev3
**/ios/**/*sync/
**/ios/**/.sconsign.dblite
**/ios/**/.tags*
**/ios/**/.vagrant/
**/ios/**/DerivedData/
**/ios/**/Icon?
**/ios/**/Pods/
**/ios/**/.symlinks/
**/ios/**/profile
**/ios/**/xcuserdata
**/ios/.generated/
**/ios/Flutter/App.framework
**/ios/Flutter/Flutter.framework
**/ios/Flutter/Generated.xcconfig
**/ios/Flutter/app.flx
**/ios/Flutter/app.zip
**/ios/Flutter/flutter_assets/
**/ios/Flutter/flutter_export_environment.sh
**/ios/ServiceDefinitions.json
**/ios/Runner/GeneratedPluginRegistrant.*

# Exceptions to above rules.
!**/ios/**/default.mode1v3
!**/ios/**/default.mode2v3
!**/ios/**/default.pbxuser
!**/ios/**/default.perspectivev3
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
10 changes: 10 additions & 0 deletions quiqui/.metadata
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled and should not be manually edited.

version:
revision: 2d2a1ffec95cc70a3218872a2cd3f8de4933c42f
channel: stable

project_type: app
Loading

0 comments on commit 3591957

Please sign in to comment.