Commit 7f3afe5d by adbaga

yes

parent 714a0dee
...@@ -3,8 +3,14 @@ ...@@ -3,8 +3,14 @@
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="a128ca0c-796d-4da2-8db0-062a4837d105" name="Default Changelist" comment=""> <list default="true" id="a128ca0c-796d-4da2-8db0-062a4837d105" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/.idea/.idea.IDoMinesweeper/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/.idea.IDoMinesweeper/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/.idea.IDoMinesweeper/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/.idea.IDoMinesweeper/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ConsoleUserInt/GameUI.cs" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleUserInt/GameUI.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ConsoleUserInt/bin/Debug/netcoreapp3.0/ConsoleUserInt.dll" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleUserInt/bin/Debug/netcoreapp3.0/ConsoleUserInt.dll" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ConsoleUserInt/bin/Debug/netcoreapp3.0/ConsoleUserInt.pdb" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleUserInt/bin/Debug/netcoreapp3.0/ConsoleUserInt.pdb" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ConsoleUserInt/bin/Debug/netcoreapp3.0/Game.dll" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleUserInt/bin/Debug/netcoreapp3.0/Game.dll" afterDir="false" /> <change beforePath="$PROJECT_DIR$/ConsoleUserInt/bin/Debug/netcoreapp3.0/Game.dll" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleUserInt/bin/Debug/netcoreapp3.0/Game.dll" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ConsoleUserInt/bin/Debug/netcoreapp3.0/Game.pdb" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleUserInt/bin/Debug/netcoreapp3.0/Game.pdb" afterDir="false" /> <change beforePath="$PROJECT_DIR$/ConsoleUserInt/bin/Debug/netcoreapp3.0/Game.pdb" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleUserInt/bin/Debug/netcoreapp3.0/Game.pdb" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ConsoleUserInt/obj/Debug/netcoreapp3.0/ConsoleUserInt.csprojAssemblyReference.cache" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleUserInt/obj/Debug/netcoreapp3.0/ConsoleUserInt.csprojAssemblyReference.cache" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ConsoleUserInt/obj/Debug/netcoreapp3.0/ConsoleUserInt.dll" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleUserInt/obj/Debug/netcoreapp3.0/ConsoleUserInt.dll" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ConsoleUserInt/obj/Debug/netcoreapp3.0/ConsoleUserInt.pdb" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleUserInt/obj/Debug/netcoreapp3.0/ConsoleUserInt.pdb" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Game/Engine.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Game/Engine.cs" afterDir="false" /> <change beforePath="$PROJECT_DIR$/Game/Engine.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Game/Engine.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Game/bin/Debug/netcoreapp3.0/Game.dll" beforeDir="false" afterPath="$PROJECT_DIR$/Game/bin/Debug/netcoreapp3.0/Game.dll" afterDir="false" /> <change beforePath="$PROJECT_DIR$/Game/bin/Debug/netcoreapp3.0/Game.dll" beforeDir="false" afterPath="$PROJECT_DIR$/Game/bin/Debug/netcoreapp3.0/Game.dll" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Game/bin/Debug/netcoreapp3.0/Game.pdb" beforeDir="false" afterPath="$PROJECT_DIR$/Game/bin/Debug/netcoreapp3.0/Game.pdb" afterDir="false" /> <change beforePath="$PROJECT_DIR$/Game/bin/Debug/netcoreapp3.0/Game.pdb" beforeDir="false" afterPath="$PROJECT_DIR$/Game/bin/Debug/netcoreapp3.0/Game.pdb" afterDir="false" />
...@@ -12,6 +18,8 @@ ...@@ -12,6 +18,8 @@
<change beforePath="$PROJECT_DIR$/Game/obj/Debug/netcoreapp3.0/Game.dll" beforeDir="false" afterPath="$PROJECT_DIR$/Game/obj/Debug/netcoreapp3.0/Game.dll" afterDir="false" /> <change beforePath="$PROJECT_DIR$/Game/obj/Debug/netcoreapp3.0/Game.dll" beforeDir="false" afterPath="$PROJECT_DIR$/Game/obj/Debug/netcoreapp3.0/Game.dll" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Game/obj/Debug/netcoreapp3.0/Game.pdb" beforeDir="false" afterPath="$PROJECT_DIR$/Game/obj/Debug/netcoreapp3.0/Game.pdb" afterDir="false" /> <change beforePath="$PROJECT_DIR$/Game/obj/Debug/netcoreapp3.0/Game.pdb" beforeDir="false" afterPath="$PROJECT_DIR$/Game/obj/Debug/netcoreapp3.0/Game.pdb" afterDir="false" />
<change beforePath="$PROJECT_DIR$/IDoMinesweeper/Program.cs" beforeDir="false" afterPath="$PROJECT_DIR$/IDoMinesweeper/Program.cs" afterDir="false" /> <change beforePath="$PROJECT_DIR$/IDoMinesweeper/Program.cs" beforeDir="false" afterPath="$PROJECT_DIR$/IDoMinesweeper/Program.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/IDoMinesweeper/bin/Debug/netcoreapp3.0/ConsoleUserInt.dll" beforeDir="false" afterPath="$PROJECT_DIR$/IDoMinesweeper/bin/Debug/netcoreapp3.0/ConsoleUserInt.dll" afterDir="false" />
<change beforePath="$PROJECT_DIR$/IDoMinesweeper/bin/Debug/netcoreapp3.0/ConsoleUserInt.pdb" beforeDir="false" afterPath="$PROJECT_DIR$/IDoMinesweeper/bin/Debug/netcoreapp3.0/ConsoleUserInt.pdb" afterDir="false" />
<change beforePath="$PROJECT_DIR$/IDoMinesweeper/bin/Debug/netcoreapp3.0/Game.dll" beforeDir="false" afterPath="$PROJECT_DIR$/IDoMinesweeper/bin/Debug/netcoreapp3.0/Game.dll" afterDir="false" /> <change beforePath="$PROJECT_DIR$/IDoMinesweeper/bin/Debug/netcoreapp3.0/Game.dll" beforeDir="false" afterPath="$PROJECT_DIR$/IDoMinesweeper/bin/Debug/netcoreapp3.0/Game.dll" afterDir="false" />
<change beforePath="$PROJECT_DIR$/IDoMinesweeper/bin/Debug/netcoreapp3.0/Game.pdb" beforeDir="false" afterPath="$PROJECT_DIR$/IDoMinesweeper/bin/Debug/netcoreapp3.0/Game.pdb" afterDir="false" /> <change beforePath="$PROJECT_DIR$/IDoMinesweeper/bin/Debug/netcoreapp3.0/Game.pdb" beforeDir="false" afterPath="$PROJECT_DIR$/IDoMinesweeper/bin/Debug/netcoreapp3.0/Game.pdb" afterDir="false" />
<change beforePath="$PROJECT_DIR$/IDoMinesweeper/bin/Debug/netcoreapp3.0/IDoMinesweeper.dll" beforeDir="false" afterPath="$PROJECT_DIR$/IDoMinesweeper/bin/Debug/netcoreapp3.0/IDoMinesweeper.dll" afterDir="false" /> <change beforePath="$PROJECT_DIR$/IDoMinesweeper/bin/Debug/netcoreapp3.0/IDoMinesweeper.dll" beforeDir="false" afterPath="$PROJECT_DIR$/IDoMinesweeper/bin/Debug/netcoreapp3.0/IDoMinesweeper.dll" afterDir="false" />
...@@ -48,10 +56,10 @@ ...@@ -48,10 +56,10 @@
<option value="$PROJECT_DIR$/GameUI/Class1.cs" /> <option value="$PROJECT_DIR$/GameUI/Class1.cs" />
<option value="$PROJECT_DIR$/ConsoleUserInt/Class1.cs" /> <option value="$PROJECT_DIR$/ConsoleUserInt/Class1.cs" />
<option value="$PROJECT_DIR$/Game/CellState.cs" /> <option value="$PROJECT_DIR$/Game/CellState.cs" />
<option value="$PROJECT_DIR$/ConsoleUserInt/GameUI.cs" />
<option value="$PROJECT_DIR$/MenuSystem/Menu.cs" /> <option value="$PROJECT_DIR$/MenuSystem/Menu.cs" />
<option value="$PROJECT_DIR$/Game/Engine.cs" /> <option value="$PROJECT_DIR$/ConsoleUserInt/GameUI.cs" />
<option value="$PROJECT_DIR$/IDoMinesweeper/Program.cs" /> <option value="$PROJECT_DIR$/IDoMinesweeper/Program.cs" />
<option value="$PROJECT_DIR$/Game/Engine.cs" />
</list> </list>
</option> </option>
</component> </component>
...@@ -114,7 +122,9 @@ ...@@ -114,7 +122,9 @@
<workItem from="1570541467008" duration="1357000" /> <workItem from="1570541467008" duration="1357000" />
<workItem from="1570543449378" duration="28421000" /> <workItem from="1570543449378" duration="28421000" />
<workItem from="1570828559519" duration="1080000" /> <workItem from="1570828559519" duration="1080000" />
<workItem from="1570969640551" duration="3567000" /> <workItem from="1570969640551" duration="4588000" />
<workItem from="1571052402368" duration="4070000" />
<workItem from="1571651125428" duration="6192000" />
</task> </task>
<task id="LOCAL-00001" summary="yes"> <task id="LOCAL-00001" summary="yes">
<created>1570973690674</created> <created>1570973690674</created>
...@@ -130,7 +140,14 @@ ...@@ -130,7 +140,14 @@
<option name="project" value="LOCAL" /> <option name="project" value="LOCAL" />
<updated>1570997742575</updated> <updated>1570997742575</updated>
</task> </task>
<option name="localTasksCounter" value="3" /> <task id="LOCAL-00003" summary="commit 3">
<created>1570999581348</created>
<option name="number" value="00003" />
<option name="presentableId" value="LOCAL-00003" />
<option name="project" value="LOCAL" />
<updated>1570999581348</updated>
</task>
<option name="localTasksCounter" value="4" />
<servers /> <servers />
</component> </component>
<component name="TypeScriptGeneratedFilesManager"> <component name="TypeScriptGeneratedFilesManager">
...@@ -143,7 +160,9 @@ ...@@ -143,7 +160,9 @@
<map> <map>
<entry key="MAIN"> <entry key="MAIN">
<value> <value>
<State /> <State>
<option name="COLUMN_ORDER" />
</State>
</value> </value>
</entry> </entry>
</map> </map>
...@@ -153,7 +172,8 @@ ...@@ -153,7 +172,8 @@
<option name="LOCAL_CHANGES_DETAILS_PREVIEW_SHOWN" value="true" /> <option name="LOCAL_CHANGES_DETAILS_PREVIEW_SHOWN" value="true" />
<MESSAGE value="yes" /> <MESSAGE value="yes" />
<MESSAGE value="Adding validation input: Doesn't accept non int and set maximum size of the board" /> <MESSAGE value="Adding validation input: Doesn't accept non int and set maximum size of the board" />
<option name="LAST_COMMIT_MESSAGE" value="Adding validation input: Doesn't accept non int and set maximum size of the board" /> <MESSAGE value="commit 3" />
<option name="LAST_COMMIT_MESSAGE" value="commit 3" />
</component> </component>
<component name="XDebuggerManager"> <component name="XDebuggerManager">
<breakpoint-manager> <breakpoint-manager>
......
...@@ -8,9 +8,9 @@ namespace ConsoleUserInt ...@@ -8,9 +8,9 @@ namespace ConsoleUserInt
{ {
public static class GameUI public static class GameUI
{ {
private static readonly string _verticalSeparator = "|"; private static readonly string _verticalSeparator = "";
private static readonly string _horizontalSeparator = "-"; private static readonly string _horizontalSeparator = "-";
private static readonly string _centerSeparator = "+"; private static readonly string _centerSeparator = "";
public static void PrintBoard(Engine.BoardDim game) public static void PrintBoard(Engine.BoardDim game)
{ {
......
...@@ -51,29 +51,45 @@ namespace Engine ...@@ -51,29 +51,45 @@ namespace Engine
public void MinesLocator(int posY, int posX) //to generate mines randomly public void MinesSetter(int height, int width) //to generate mines randomly
{ {
int mineCount = 0; int mineCount = 0;
int numOfMines = (height*width) / 8;
Random random = new Random(); Random random = new Random();
do do
{ {
int minePosY = random.Next(height);
int minePosX = random.Next(width);
int[,] mineLoc = new int[minePosY,minePosX];
int mineY = random.Next(BoardHeight);
int mineX = random.Next(BoardWidth);
int[,] mineLoc = new int[mineY,mineX];
mineCount++; mineCount++;
}
while (mineCount <= numOfMines) ;
/* for (int y = 0; y < height; y++)
{
for (int x = 0; x < width; x++)
{
Console.Write(string.Format("{0}\t", mineLoc[minePosY, minePosX]));
}
} }
while (mineCount < 7) ;
*/
_minesSet = !_minesSet; _minesSet = !_minesSet;
Console.WriteLine($"There are {numOfMines} mines ");
} }
......
...@@ -148,7 +148,7 @@ namespace IDoMinesweeper ...@@ -148,7 +148,7 @@ namespace IDoMinesweeper
} while (doIt = false); } while (doIt = false);
//still need improvement. If I put string, it'll say not only not int //still need improvement. If I put string, it'll say not only "not int"
//but also "Too small" which is weird //but also "Too small" which is weird
//and do while doesn't work as my expectation yet //and do while doesn't work as my expectation yet
//I guess it's time to start making better architecture'' //I guess it's time to start making better architecture''
...@@ -168,13 +168,14 @@ namespace IDoMinesweeper ...@@ -168,13 +168,14 @@ namespace IDoMinesweeper
Clear(); Clear();
GameUI.PrintBoard(game); GameUI.PrintBoard(game);
game.MinesSetter(height, width);
game.MinesLocator(height, width);
Console.WriteLine("Check the tile"); Console.WriteLine("Check the tile");
Console.WriteLine("Y location:"); Console.WriteLine("Y location:");
int playerMoveY = Convert.ToInt32(Console.ReadLine()); int playerMoveY = Convert.ToInt32(Console.ReadLine());
...@@ -193,6 +194,8 @@ namespace IDoMinesweeper ...@@ -193,6 +194,8 @@ namespace IDoMinesweeper
return "GAME OVER!!"; return "GAME OVER!!";
......
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