Skip to content

Commit

Permalink
bug fix in game diagonal logic
Browse files Browse the repository at this point in the history
  • Loading branch information
sn99 committed Oct 12, 2018
1 parent f466221 commit 06d44a0
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,20 @@ impl MainState {
check = false;
self.winner_declare(2);
}
if grid[0][2].option == Some(true)
&& grid[1][1].option == Some(true)
&& grid[2][0].option == Some(true)
{
check = false;
self.winner_declare(1);
}
if grid[0][2].option == Some(false)
&& grid[1][1].option == Some(false)
&& grid[2][0].option == Some(false)
{
check = false;
self.winner_declare(2);
}

// check for draw
if check {
Expand Down

0 comments on commit 06d44a0

Please sign in to comment.