diff --git a/PuzzlePlayer/Binary.cs b/PuzzlePlayer/Binary.cs index 0f954f4f33ab2ccea0cdf0044efcb1687e1c6c0c..385aa0c30b273f8b2d312fb20b96a88523315644 100644 --- a/PuzzlePlayer/Binary.cs +++ b/PuzzlePlayer/Binary.cs @@ -26,7 +26,7 @@ namespace PuzzlePlayer_Namespace description = "Binary puzzle is played on any even-numbered square grid, with some cells initially containing black or white circles. The goal of the puzzle is to fill all cells such that:\r\nâ— More than two circles of the same color cannot be adjacent\r\nâ— Each row and column must contain an equal number of black and white circles\r\nâ— Each row and column cannot appear multiple times on the board"; // clear the board (fill it in with -1) - Clear(); + //Clear(false); } public override void Draw (Graphics gr, Rectangle r) //draws board in rectangle R. warning: will stretch image unless FitBoard() is used for rectangle size diff --git a/PuzzlePlayer/Board.cs b/PuzzlePlayer/Board.cs index 739b48af62f14fe0bedc6700cb7fe3387286292b..85245dde2bb7215873d54cf055a769d0d28f6a22 100644 --- a/PuzzlePlayer/Board.cs +++ b/PuzzlePlayer/Board.cs @@ -51,7 +51,7 @@ namespace PuzzlePlayer_Namespace { int[,] copy = boardState; boardState = newState; - if (IsBoardValid(newState) && Solve() == SOLUTIONS.UNIQUE) + if (IsBoardValid(newState) && Solve(false) == SOLUTIONS.UNIQUE) return true; else { @@ -115,7 +115,7 @@ namespace PuzzlePlayer_Namespace public abstract void Generate(); // abstract methode for checking if a imputed boardstate is valid - public abstract bool IsBoardValid(int[,] boardToCheck); + public virtual bool IsBoardValid(int[,] boardToCheck) { return true; } // changes tile P to value X public abstract void TileInput(Point p, int x); diff --git a/PuzzlePlayer/PuzzleForm.cs b/PuzzlePlayer/PuzzleForm.cs index dde1ea08cf464db52f64c8b1ce59135635bbd6de..8f1033b7bc22e761c95ad7c56ed91ae7be1a8153 100644 --- a/PuzzlePlayer/PuzzleForm.cs +++ b/PuzzlePlayer/PuzzleForm.cs @@ -21,6 +21,7 @@ namespace PuzzlePlayer_Namespace private readonly BufferedGraphics bufferedGraphics; private Board board; public Board Board //updating the Board member will immediately call board.Draw method so that the board is updated visually + { get { return board; } set @@ -31,6 +32,13 @@ namespace PuzzlePlayer_Namespace } private readonly Button UPDATEBUTTON; + public string puzzleType { get; } + public PuzzleForm(Board b) + { + board = b; + puzzleType = b.GetType().Name; + } + public PuzzleForm(Board b, Size s = default) //takes Board and Size parameter and sets up the PuzzleForm window. { if (s == default) s = new Size(700, 420); @@ -104,7 +112,6 @@ namespace PuzzlePlayer_Namespace hintbutton.Text = "Hint"; hintbutton.MouseClick += (object sender, MouseEventArgs mea) => { - board.Draw(graphics, boardP, boardS); MessageBox.Show("Hint: geef op"); Board = Board; }; @@ -112,7 +119,7 @@ namespace PuzzlePlayer_Namespace solvebutton.Text = "Solve"; solvebutton.MouseClick += (object sender, MouseEventArgs mea) => { - Board.Solve(); + Board.Solve(false); Board = Board; }; diff --git a/PuzzlePlayer/PuzzlePlayer.cs b/PuzzlePlayer/PuzzlePlayer.cs index 865952b8349b0cc1494fd6a7fc6d8e734e58cb77..9f617b41879335126098755dcfe0938127aec0da 100644 --- a/PuzzlePlayer/PuzzlePlayer.cs +++ b/PuzzlePlayer/PuzzlePlayer.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using System.Diagnostics; using System.Drawing; using System.Windows.Forms; -using static System.Windows.Forms.DataFormats; namespace PuzzlePlayer_Namespace { @@ -11,7 +10,7 @@ namespace PuzzlePlayer_Namespace { internal static void Main(string[] args) { - Application.Run(new MainForm()); + Application.Run(new PuzzleForm(new Binary())); } } @@ -29,9 +28,9 @@ namespace PuzzlePlayer_Namespace { for (int i = 0; i < 5; i++) { - puzzleForms.Add(new PuzzleForm(new Binair())); + puzzleForms.Add(new PuzzleForm(new Binary())); } - puzzleForms.Add(new PuzzleForm(new Binair())); + puzzleForms.Add(new PuzzleForm(new Binary())); } private void SetUpUI() diff --git a/PuzzlePlayer/Resources/Binair.jpg b/PuzzlePlayer/Resources/Binary.jpg similarity index 100% rename from PuzzlePlayer/Resources/Binair.jpg rename to PuzzlePlayer/Resources/Binary.jpg diff --git a/PuzzlePlayer/Resources/BinairGray.jpg b/PuzzlePlayer/Resources/BinaryGray.jpg similarity index 100% rename from PuzzlePlayer/Resources/BinairGray.jpg rename to PuzzlePlayer/Resources/BinaryGray.jpg