From 06d44a04457703e7102b0727645b387d3cbd7d75 Mon Sep 17 00:00:00 2001 From: sn99 Date: Sat, 13 Oct 2018 00:04:20 +0530 Subject: [PATCH] bug fix in game diagonal logic --- src/main.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/main.rs b/src/main.rs index c529419..eb6a1e3 100644 --- a/src/main.rs +++ b/src/main.rs @@ -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 {