add cross condition
This commit is contained in:
parent
73495ae7e4
commit
d6dbdeea7b
@ -33,9 +33,11 @@ class TicTacToeEnv(gym.Env):
|
|||||||
|
|
||||||
# check game over
|
# check game over
|
||||||
for i in range(3):
|
for i in range(3):
|
||||||
# horizontals and verticals
|
# horizontals and verticals and cross
|
||||||
if ((board[i * 3] == p and board[i * 3 + 1] == p and board[i * 3 + 2] == p)
|
if ((board[i * 3] == p and board[i * 3 + 1] == p and board[i * 3 + 2] == p)
|
||||||
or (board[i + 0] == p and board[i + 3] == p and board[i + 6] == p)):
|
or (board[i + 0] == p and board[i + 3] == p and board[i + 6] == p)
|
||||||
|
or (board[0] == p and board[4] == p and board[8] == p)
|
||||||
|
or (board[2] == p and board[4] == p and board[6] == p)):
|
||||||
reward = p
|
reward = p
|
||||||
done = True
|
done = True
|
||||||
break
|
break
|
||||||
|
Loading…
Reference in New Issue
Block a user