diff --git a/PuzzlePlayer/Binary.cs b/PuzzlePlayer/Binary.cs index defa72c44efa97875adc07938a6770640880ddc6..b0b50f788492e46b495580f717122c0400e60877 100644 --- a/PuzzlePlayer/Binary.cs +++ b/PuzzlePlayer/Binary.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Drawing; using System.Runtime.CompilerServices; namespace PuzzlePlayer_Namespace @@ -20,12 +21,38 @@ namespace PuzzlePlayer_Namespace // create a board with the specifide size boardState = new int[boardSize,boardSize]; - Info = ""; + 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(); } + public void Draw (Graphics gr, Point p, Size s) + { + for (int i = 0; i<boardState.GetLength(0); i++) + { + for(int j = 0; j<boardState.GetLength(1); j++) + { + gr.DrawRectangle(Pens.Beige, p.X+i*s.Width, p.Y+j*s.Height, s.Width, s.Height); + if (boardState[i,j] == 0) + { + gr.DrawEllipse(Pens.White, + (int)(p.X+((double)i+0.25)*s.Width), + (int)(p.Y+((double)j+0.25)*s.Height), + s.Width/2,s.Height/2); + return; + } + if (boardState[i, j] == 1) + { + gr.DrawEllipse(Pens.Black, + (int)(p.X + ((double)i + 0.25) * s.Width), + (int)(p.Y + ((double)j + 0.25) * s.Height), + s.Width / 2, s.Height / 2); + } + } + } + } + private void Clear() { int size = boardState.GetLength(0); diff --git a/PuzzlePlayer/Board.cs b/PuzzlePlayer/Board.cs index d0658e1bd6c6c1e8ca3834b68246308e26c981d5..a350641813909f2bf8c17e6a06d015e0ffe378ec 100644 --- a/PuzzlePlayer/Board.cs +++ b/PuzzlePlayer/Board.cs @@ -16,7 +16,7 @@ namespace PuzzlePlayer_Namespace public abstract class Board { protected const int emptySpace = -1; // for every puzzle -1 represents a empty space - public string Info; + public string description; // a property for getting and setting the boardsstate. The boardstate should only be setted if the imputed int[,] is valid. public int[,] boardState