Commit ccf99b58 by adbaga

yes

parent 7cf525b9
......@@ -51,6 +51,7 @@
<option value="$PROJECT_DIR$/Game/CellState.cs" />
<option value="$PROJECT_DIR$/MenuSystem/Menu.cs" />
<option value="$PROJECT_DIR$/ConsoleUserInt/GameUI.cs" />
<option value="$PROJECT_DIR$/Game/CheckCell.cs" />
<option value="$PROJECT_DIR$/IDoMinesweeper/Program.cs" />
<option value="$PROJECT_DIR$/Game/Engine.cs" />
</list>
......@@ -118,7 +119,8 @@
<workItem from="1570969640551" duration="4588000" />
<workItem from="1571052402368" duration="4070000" />
<workItem from="1571651125428" duration="10380000" />
<workItem from="1571827801729" duration="4988000" />
<workItem from="1571827801729" duration="8314000" />
<workItem from="1571984846202" duration="7667000" />
</task>
<task id="LOCAL-00001" summary="yes">
<created>1570973690674</created>
......@@ -148,7 +150,14 @@
<option name="project" value="LOCAL" />
<updated>1571657780059</updated>
</task>
<option name="localTasksCounter" value="5" />
<task id="LOCAL-00005" summary="mines">
<created>1571842780536</created>
<option name="number" value="00005" />
<option name="presentableId" value="LOCAL-00005" />
<option name="project" value="LOCAL" />
<updated>1571842780536</updated>
</task>
<option name="localTasksCounter" value="6" />
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
......@@ -174,7 +183,8 @@
<MESSAGE value="Adding validation input: Doesn't accept non int and set maximum size of the board" />
<MESSAGE value="commit 3" />
<MESSAGE value="yes" />
<option name="LAST_COMMIT_MESSAGE" value="yes" />
<MESSAGE value="mines" />
<option name="LAST_COMMIT_MESSAGE" value="mines" />
</component>
<component name="XDebuggerManager">
<breakpoint-manager>
......
......@@ -9,7 +9,8 @@ namespace Engine
public int BoardWidth { get; }
public int BoardHeight { get; }
private bool _minesSet;
public BoardDim(int boardHeight, int boardWidth)
{
......@@ -51,64 +52,58 @@ namespace Engine
//private static Random random = new Random();
public int[,] MinesSetter(int height, int width)
{
Random random = new Random();
int[,] mineLoc = new int[height,width];
int mineCount = 0;
int numOfMines = height * width / 3;
Console.WriteLine($"There are {numOfMines} mines");
Console.WriteLine($"The size is {height} x {width}");
var results = new int[width, height];
do
{
int minePosX = random.Next(width);
int minePosY = random.Next(height);
// Make sure we haven't already set this position
if (mineLoc[minePosX, minePosY] != 1)
{
mineLoc[minePosX, minePosY] = 1;
mineCount++;
}
} while (mineCount <= numOfMines);
public class Mines
{
public int[,] MineLoc { get; set; }
public int minePosY { get; }
public int minePosX { get; }
var done = true;
do{
private static Random random = new Random();
public static int[,] MinesSetter(int height, int width)
{
int mineCount = 0;
int numOfMines = height * width / 8;
//int[,] mineLoc = new int[width, height];
Console.WriteLine("Check the tile");
Console.WriteLine("Y location:");
int playerMoveY = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("X location:");
int playerMoveX = Convert.ToInt32(Console.ReadLine());
var placed = 0;
int[,] checkMines = new int[playerMoveY,playerMoveX];
int[,] mineLoc = new int[width, height];
{
do
{
int minePosY = random.Next(width);
int minePosX = random.Next(height);
// Make sure we haven't already set this position
if (checkMines == mineLoc)
if (mineLoc[minePosY, minePosX] != 1)
{
done = false;
mineLoc[minePosY, minePosX] = 1;
mineCount++;
}
} while (mineCount <= numOfMines);
}
} while (done = true);
Console.WriteLine(mineLoc.Length);
/*foreach (var x in mineLoc)
{
Console.WriteLine(mineCount);
}
*/
return mineLoc;
}
}
......@@ -120,5 +115,5 @@ namespace Engine
}
......@@ -79,7 +79,6 @@ namespace IDoMinesweeper
static string TestGame()
{
WriteLine("Board height (Min. 8): ");
WriteLine(">");
var checkHeight = ReadLine();
......@@ -91,15 +90,12 @@ namespace IDoMinesweeper
else
{
height = Convert.ToInt32(checkHeight);
}
WriteLine("Board width (Min. 8): ");
WriteLine(">");
......@@ -147,21 +143,14 @@ namespace IDoMinesweeper
var game = new BoardDim(height, width);
GameUI.PrintBoard(game);
game.MinesSetter(height, width);
Console.WriteLine();
//var mine = new Mines(height, width);
Mines.MinesSetter(height,width);
/*var done = false;
var done = true;
do{
Clear();
Console.WriteLine("Check the tile");
......@@ -169,19 +158,16 @@ namespace IDoMinesweeper
int playerMoveY = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("X location:");
int playerMoveX = Convert.ToInt32(Console.ReadLine());
game.checkTile(playerMoveY, playerMoveX);
int[,] checkMines = new int[playerMoveY,playerMoveX];
GameUI.PrintBoard(game);
//done = userYint == 0 && userXint == 0;
//done when it gets one mine at least. it'll turn the value from -1 to 0
} while (true);
*/
} while (done = true);
Console.WriteLine("GameOver");
......@@ -189,11 +175,17 @@ namespace IDoMinesweeper
return "";
}
}
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment