Skip to content

Commit

Permalink
♻️: add Depth const
Browse files Browse the repository at this point in the history
  • Loading branch information
VsIG-official committed Nov 3, 2021
1 parent a726786 commit 8f5191d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions Quoridor.Model/Player/MinimaxAlgorithm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ public class MinimaxAlgorithm
private const string MoveCommand = "move";
private const string JumpCommand = "jump";
private const string WallCommand = "wall";
private const int Depth = 1;

public MinimaxAlgorithm(QuoridorGame game)
{
Expand All @@ -30,7 +31,7 @@ public MinimaxAlgorithm(QuoridorGame game)
continue;
}

int score = Minimax(1, int.MinValue, int.MaxValue, false);
int score = Minimax(Depth, int.MinValue, int.MaxValue, false);

_game.UnplaceWall(wall);

Expand All @@ -46,7 +47,7 @@ public MinimaxAlgorithm(QuoridorGame game)
{
var beforeMove = _game.CurrentPlayer.CurrentCell;
_game.MakeMove(move);
int score = Minimax(1, int.MinValue, int.MaxValue, false);
int score = Minimax(Depth, int.MinValue, int.MaxValue, false);
_game.UnmakeMove(beforeMove);

if (score >= bestScore)
Expand All @@ -61,7 +62,7 @@ public MinimaxAlgorithm(QuoridorGame game)
{
var beforeMove = _game.CurrentPlayer.CurrentCell;
_game.MakeMove(jump, true);
int score = Minimax(1, int.MinValue, int.MaxValue, false);
int score = Minimax(Depth, int.MinValue, int.MaxValue, false);
_game.UnmakeMove(beforeMove);

if (score >= bestScore)
Expand Down

0 comments on commit 8f5191d

Please sign in to comment.