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

update

- improved minesweeper/sudoku text alignment
- changed minesweeper/maze description
parent e8deee8d
No related branches found
No related tags found
No related merge requests found
......@@ -40,14 +40,14 @@ namespace PuzzlePlayer_Namespace
Point playerPos;
List<Point> shortestPath;
public Maze(int sizeX = 6, int sizeY = 4)
public Maze(int sizeX = 16, int sizeY = 12)
{
drawFactor = 1;
// init all 2D array's
Reset(sizeX, sizeY);
lastGeneratedBoard = GetClearBoard(sizeX, sizeY);
description = "Maze is played on a grid containing walls. You need to navigate through the maze until you reach the end. Use the arrow keys or WASD to move the blue square to the end goal";
description = "Maze is played on a grid containing walls. You have to navigate through the maze until you reach the end. Use the arrow keys or WASD to move the blue square to the end!";
}
private void Reset(int sizeX, int sizeY)
......
......@@ -16,7 +16,7 @@ namespace PuzzlePlayer_Namespace
private static Random random = new Random();
private bool[,] mineState;
private bool isFirstClick;
public Minesweeper(int width = 6, int height = 6)
public Minesweeper(int width = 16, int height = 12)
{
if (width <= 1 || height <= 1) throw new ArgumentOutOfRangeException(); // breedte 1 mag niet door optimisatie bij Reveal()
boardState = GetClearBoard(width, height);
......@@ -24,7 +24,7 @@ namespace PuzzlePlayer_Namespace
mineState = new bool[width, height];
isFirstClick = false;
description = "zoek het uit";
description = "In Minesweeper, the number of a tile indicates the amount of adjacent mines.\r\n● You can place flags on suspected mines with right-click\r\n● Unlike the classic version of minesweeper, there is not a set number of mines and you will survive after clicking on a mine, at the cost of gaining less points \r\n● The first click is always safe!";
drawFactor = 1;
}
......@@ -71,7 +71,7 @@ namespace PuzzlePlayer_Namespace
case -2:
gr.DrawString("⚑",
new Font("Verdana", stringsize),
Brushes.Black,
Brushes.DarkRed,
(int)(r.X + ((double)i + 0.5) * tilesize.Width),
(int)(r.Y + ((double)j + 0.5) * tilesize.Height),
stringFormat);
......@@ -81,13 +81,26 @@ namespace PuzzlePlayer_Namespace
gr.DrawString("✸",
new Font("Verdana", stringsize),
Brushes.Black,
(int)(r.X + ((double)i + 0.5) * tilesize.Width),
(int)(r.Y + ((double)j + 0.5) * tilesize.Height),
(int)(r.X + ((double)i + 0.52) * tilesize.Width),
(int)(r.Y + ((double)j + 0.54) * tilesize.Height),
stringFormat);
break;
}
}
/*gr.DrawLine(Pens.Red,
(int)(r.X + ((double)i + 0.5) * tilesize.Width),
(int)(r.Y + ((double)j + 0.0) * tilesize.Height),
(int)(r.X + ((double)i + 0.5) * tilesize.Width),
(int)(r.Y + ((double)j + 1.0) * tilesize.Height)
);
gr.DrawLine(Pens.Red,
(int)(r.X + ((double)i + 0.0) * tilesize.Width),
(int)(r.Y + ((double)j + 0.5) * tilesize.Height),
(int)(r.X + ((double)i + 1.0) * tilesize.Width),
(int)(r.Y + ((double)j + 0.5) * tilesize.Height)
);*/
gr.DrawRectangle(Pens.DarkGray,
r.X + i * tilesize.Width,
r.Y + j * tilesize.Height,
......@@ -128,7 +141,7 @@ namespace PuzzlePlayer_Namespace
}
return false;
bool Reveal(Point p, bool ForceOpen)
bool Reveal(Point p, bool ForceOpen) //just set ForceOpen to false when using
{
if (ForceOpen && boardState[p.X, p.Y] == -2) { boardState[p.X, p.Y] = emptySpace; Reveal(p, false); }
if (boardState[p.X, p.Y] != emptySpace) return false;
......
......@@ -12,7 +12,7 @@ namespace PuzzlePlayer_Namespace.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.11.0.0")]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.12.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
......
......@@ -10,7 +10,7 @@ namespace PuzzlePlayer_Namespace
{
internal static void Main(string[] args)
{
Application.Run(new PuzzleForm(new Minesweeper()));
Application.Run(new PuzzleForm(new Sudoku()));
}
}
......
......@@ -15,7 +15,7 @@ namespace PuzzlePlayer_Namespace
private static int boardLength;
private static int rootBoardLength;
private static Random random = new Random();
public Sudoku(int boardSize = 4)
public Sudoku(int boardSize = 16)
{
boardState = GetClearBoard(boardSize, boardSize);
lastGeneratedBoard = GetClearBoard(boardSize, boardSize);
......@@ -35,44 +35,32 @@ namespace PuzzlePlayer_Namespace
};
Size tilesize = new Size(r.Width / boardState.GetLength(0), r.Height / boardState.GetLength(1));
Pen border = new Pen(Color.Black, 2);
Brush textcolor;
gr.FillRectangle(Brushes.Beige, r.X, r.Y, tilesize.Width * boardState.GetLength(0), tilesize.Height * boardState.GetLength(1));
for (int i = 0; i < boardState.GetLength(0); i++)
{
for (int j = 0; j < boardState.GetLength(1); j++)
{
gr.DrawRectangle(Pens.LightGray,
r.X + i * tilesize.Width,
r.Y + j * tilesize.Height,
tilesize.Width,
tilesize.Height);
if (boardState[i,j] != -1)
if (boardState[i,j] != emptySpace)
{
if (lastGeneratedBoard[i, j] != Board.emptySpace)
{
gr.DrawString(
(boardState[i, j]).ToString(),
new Font("Arial", tilesize.Width / 2),
Brushes.Black,
(int)(r.X + (i + 0.27) * tilesize.Width + tilesize.Width / 4),
(int)(r.Y + (j + 0.33) * tilesize.Height + tilesize.Height / 4),
format);
}
else
{
gr.DrawString(
(boardState[i, j]).ToString(),
new Font("Arial", tilesize.Width / 2),
Brushes.DarkBlue,
(int)(r.X + (i + 0.27) * tilesize.Width + tilesize.Width / 4),
(int)(r.Y + (j + 0.33) * tilesize.Height + tilesize.Height / 4),
format);
}
if (lastGeneratedBoard[i, j] == Board.emptySpace) textcolor = Brushes.DarkBlue; else textcolor = Brushes.Black;
gr.DrawString(
(boardState[i, j]).ToString(),
new Font("Arial", tilesize.Width / 2),
textcolor,
(int)(r.X + (i + 0.52) * tilesize.Width),
(int)(r.Y + (j + 0.54) * tilesize.Height),
format);
}
}
}
for (int i = 1; i < Math.Sqrt(boardState.GetLength(0)); i++)
for (int i = 1; i < Math.Sqrt(boardState.GetLength(0)); i++) //draws box lines
{
gr.DrawLine(Pens.Black,
r.X + i * (int)Math.Sqrt((double)boardState.GetLength(0)) * tilesize.Width,
......
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