View difference between Paste ID: 737gvW1E and 4P00L7QV
SHOW: | | - or go back to the newest paste.
1
enum Player{
2
X,
3
O,
4
None
5
}
6
7
/*
8
0 | 1 | 2
9
----------
10
3 | 4 | 5
11
----------
12
6 | 7 | 8
13
*/
14
15
Player winner(Player[] board){
16
17
	foreach (var line in winLines){}
18
		var marks = line.select(e => board[e]);
19
		if (marks.unique().except(Player.None).size() == 1)
20
				return marks.first();
21
		}
22
	}
23
	return Player.None;
24
}
25
26
static int[][] winLines = {
27
	{0,1,2},
28
	{3,4,5},
29
	{6,7,8},
30
	{0,3,6},
31
	{1,4,7},
32
	{2,5,8},
33
	{0,4,8},
34
	{2,4,6}	
35
	};
36
37
}