-
Notifications
You must be signed in to change notification settings - Fork 52
/
t051.py
32 lines (30 loc) · 933 Bytes
/
t051.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
from reversi2022.reversi import *
import random
class O51AI(object):
def name(self):
return 'AI'
def play(self, board, color):
point = [[6,2,5,4,4,5,2,6],
[2,1,3,3,3,3,1,2],
[5,3,3,3,3,3,3,5],
[4,3,3,0,0,3,3,4],
[4,3,3,0,0,3,3,4],
[5,3,3,3,3,3,3,5],
[2,1,3,3,3,3,1,2],
[6,2,5,4,4,5,2,6]]
sx = 0
sy = 0
p = 0
for y in range(board.N):
for x in range(board.N):
if board.can_put(color):
if point[y][x] > p:
p = point[y][x]
sx = x
sy = y
x=sx
y=sy
for y in range(board.N):
for x in range(board.N):
if board.put_and_reverse(x, y, color, reverse=False) > 0:
return(x, y)