Skip to content
Snippets Groups Projects
Commit 17862fc8 authored by bionic85's avatar bionic85
Browse files

snelle push

parent 4ad417af
No related branches found
No related tags found
No related merge requests found
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 visitedCells
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));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment