From 9b5db69c9561acc1e75ade3bc1c52a1d99950143 Mon Sep 17 00:00:00 2001 From: Floris <f.k.h.vandezande@students.uu.nl> Date: Mon, 9 Dec 2024 13:15:49 +0100 Subject: [PATCH] update --- PuzzlePlayer/Skyscrapers.cs | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/PuzzlePlayer/Skyscrapers.cs b/PuzzlePlayer/Skyscrapers.cs index 5a2e141..c3b6351 100644 --- a/PuzzlePlayer/Skyscrapers.cs +++ b/PuzzlePlayer/Skyscrapers.cs @@ -13,18 +13,22 @@ namespace PuzzlePlayer_Namespace internal class Skyscrapers : Board { public int[,] visionState; + public string[,] candidateState; public Skyscrapers(int boardSize = 6) { boardState = GetClearBoard(boardSize); lastGeneratedBoard = GetClearBoard(boardSize); + candidateState = new string[boardSize, boardSize]; description = "lol"; drawFactor = 1; + candidateState[1, 1] = "123"; + candidateState[2, 3] = "1734"; + candidateState[4, 4] = "123456789"; } public override void Draw(Graphics gr, Rectangle r) { - gr.TextRenderingHint = TextRenderingHint.AntiAlias; Size tilesize = new Size(r.Width / boardState.GetLength(0), r.Height / boardState.GetLength(1)); - int stringsize = Math.Min(tilesize.Height / 2, tilesize.Width) * 2 * 1 / 2; + int stringsize = Math.Min(tilesize.Height / 2, tilesize.Width); StringFormat stringFormat = new StringFormat(); stringFormat.LineAlignment = StringAlignment.Center; stringFormat.Alignment = StringAlignment.Center; @@ -61,6 +65,19 @@ namespace PuzzlePlayer_Namespace (int)(r.Y + ((double)j + 0.5) * tilesize.Height), stringFormat); } + else + { + if (candidateState[i, j] == null) continue; + foreach (char c in candidateState[i, j]) + { + gr.DrawString(Convert.ToString(c), + new Font("Verdana", stringsize / 3), + Brushes.Black, + (int)(r.X + ((double)i + 0.25 * ((char.GetNumericValue(c) - 1) % 3 + 1)) * tilesize.Width), + (int)(r.Y + ((double)j + 0.25 * Math.Ceiling(char.GetNumericValue(c) / 3)) * tilesize.Height), + stringFormat); + } + } } } } @@ -73,7 +90,14 @@ namespace PuzzlePlayer_Namespace public override void Generate() { - throw new NotImplementedException(); + int[] remaining = new int[boardState.GetLength(0)]; + for (int i = 0; i < remaining.Length; i++) + remaining[i] = i + 1; + for (int i = 0; i < boardState.GetLength(0); i++) + { + + } + return; } public override void TileInput(Point? p, Keys k) @@ -82,7 +106,7 @@ namespace PuzzlePlayer_Namespace double center = ((double)boardState.GetLength(0) - 1) / 2; if (Math.Abs(((Point)p).X - center) == center && Math.Abs(((Point)p).Y - center) == center) return; int num = (int)k - 48; - if (num > 0 && num <= boardState.GetLength(0)) boardState[((Point)p).X, ((Point)p).Y] = num; + if (num > 0 && num <= boardState.GetLength(0) - 2) boardState[((Point)p).X, ((Point)p).Y] = num; } protected override List<Move> GetSolveList(int[,] boardToSolve) -- GitLab