Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
puzzleplayer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Floris
puzzleplayer
Commits
17862fc8
Commit
17862fc8
authored
3 months ago
by
bionic85
Browse files
Options
Downloads
Patches
Plain Diff
snelle push
parent
4ad417af
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
PuzzlePlayer/Maze.cs
+11
-12
11 additions, 12 deletions
PuzzlePlayer/Maze.cs
with
11 additions
and
12 deletions
PuzzlePlayer/Maze.cs
+
11
−
12
View file @
17862fc8
using
System
;
using
System.Buffers.Binary
;
using
System.Collections.Generic
;
using
System.Diagnostics
;
using
System.Drawing
;
using
System.Linq
;
using
System.Security.Policy
;
using
System.Text
;
using
System.Threading.Tasks
;
using
System.Xml.XPath
;
using
static
System
.
Runtime
.
InteropServices
.
JavaScript
.
JSType
;
namespace
PuzzlePlayer_Namespace
{
...
...
@@ -44,9 +38,7 @@ namespace PuzzlePlayer_Namespace
public
Maze
(
int
size
=
6
)
{
// init all 2D array's
boardState
=
GetClearBoard
(
size
);
mazeState
=
GetClearBoard
(
size
);
visitedCells
=
GetClearBoard
(
size
);
Reset
(
size
);
/*
// example thingy (DELETE LATER)
...
...
@@ -64,6 +56,13 @@ namespace PuzzlePlayer_Namespace
*/
}
private
void
Reset
(
int
size
)
{
boardState
=
GetClearBoard
(
size
);
mazeState
=
GetClearBoard
(
size
);
visitedCells
=
GetClearBoard
(
size
);
}
// two funcions to go from number to walls and back
private
int
getNumberFromWalls
((
bool
top
,
bool
right
,
bool
bottom
,
bool
left
)
cell
)
{
...
...
@@ -144,8 +143,8 @@ namespace PuzzlePlayer_Namespace
// https://en.wikipedia.org/wiki/Maze_generation_algorithm#Randomized_depth-first_search
public
override
void
Generate
()
{
//
clear
visitedCell
s
visitedCells
=
GetClearBoard
(
mazeState
.
GetLength
(
0
));
//clear
the board and all 2D array'
s
Reset
(
mazeState
.
GetLength
(
0
));
Random
rnd
=
new
Random
();
int
x
=
rnd
.
Next
(
mazeState
.
GetLength
(
0
));
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment