Skip to content
Snippets Groups Projects
Commit e47030f0 authored by PowerfulShuffle's avatar PowerfulShuffle
Browse files

merge changes

parent 159f0f81
No related branches found
No related tags found
No related merge requests found
......@@ -46,6 +46,8 @@ namespace PuzzlePlayer_Namespace
public int[,] lastGeneratedBoard;
public int[,] solution;
protected static readonly Random random = new();
// static meathode for filling a int[,] with -1
public static int[,] GetClearBoard(int boardSizeX, int boardSizeY)
{
......@@ -106,9 +108,9 @@ namespace PuzzlePlayer_Namespace
int col;
bool hintPossible = false;
for (int i = 0; i < boardLength; i++)
for (int i = 0; i < boardState.GetLength(0); i++)
{
for (int j = 0; j < boardLength; j++)
for (int j = 0; j < boardState.GetLength(1); j++)
{
if (boardState[i, j] == emptySpace)
{
......@@ -119,8 +121,8 @@ namespace PuzzlePlayer_Namespace
while (hintPossible)
{
row = RandomNumber(boardLength) - 1;
col = RandomNumber(boardLength) - 1;
row = RandomNumber(boardState.GetLength(0) - 1);
col = RandomNumber(boardState.GetLength(1) - 1);
if (boardState[row, col] == emptySpace)
{
......
......@@ -166,7 +166,7 @@ namespace PuzzlePlayer_Namespace
hintbutton.Text = "Hint";
hintbutton.MouseClick += (object sender, MouseEventArgs mea) =>
{
MessageBox.Show("Hint: geef op");
Board.Hint();
Draw();
};
CreateButton(solvebutton);
......
......@@ -14,7 +14,6 @@ namespace PuzzlePlayer_Namespace
{
private readonly int boardLength;
private readonly int rootBoardLength;
private static readonly Random random = new();
private readonly double removeDensity = 0.5;
public Sudoku(int boardSize = 4)
{
......
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