Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- enum Player{
- X,
- O,
- None
- }
- /*
- 0 | 1 | 2
- ----------
- 3 | 4 | 5
- ----------
- 6 | 7 | 8
- */
- Player winner(Player[] board){
- foreach (var line in winLines){}
- var marks = line.select(e => board[e]);
- if (marks.unique().except(Player.None).size() == 1)
- return marks.first();
- }
- }
- return Player.None;
- }
- static int[][] winLines = {
- {0,1,2},
- {3,4,5},
- {6,7,8},
- {0,3,6},
- {1,4,7},
- {2,5,8},
- {0,4,8},
- {2,4,6}
- };
- }
Add Comment
Please, Sign In to add comment