diff options
author | vehme003 <vehme003@umn.edu> | 2021-04-12 15:03:57 -0500 |
---|---|---|
committer | GitHub Enterprise <noreply-github@umn.edu> | 2021-04-12 15:03:57 -0500 |
commit | afad54aaba1427f93aba3b1c4487a0f64ea2a060 (patch) | |
tree | 7c96486fee309d23169bceed8a240dd292a480e6 /board2.py | |
parent | Update board2.py (diff) | |
download | csci4511w-afad54aaba1427f93aba3b1c4487a0f64ea2a060.tar csci4511w-afad54aaba1427f93aba3b1c4487a0f64ea2a060.tar.gz csci4511w-afad54aaba1427f93aba3b1c4487a0f64ea2a060.tar.bz2 csci4511w-afad54aaba1427f93aba3b1c4487a0f64ea2a060.tar.lz csci4511w-afad54aaba1427f93aba3b1c4487a0f64ea2a060.tar.xz csci4511w-afad54aaba1427f93aba3b1c4487a0f64ea2a060.tar.zst csci4511w-afad54aaba1427f93aba3b1c4487a0f64ea2a060.zip |
Update board2.py
Diffstat (limited to '')
-rw-r--r-- | board2.py | 14 |
1 files changed, 13 insertions, 1 deletions
@@ -3,6 +3,8 @@ from random import * class Board: #A class for managing different situations and states happening in the game and on the board
def __init__(self, board):
self.board=board
+ def get_board(self):
+ return self.board
def print_board(self):
for i in self.board:
for j in i:
@@ -44,6 +46,10 @@ class Board: #A class for managing different situations and states happening in self.board[c][8]="|"
else:
self.board[c][12]="|"
+ if(self.check_fill()):
+ return 1
+ else:
+ return 0
def check_fill(self):
x=0
while(x<=4):
@@ -52,10 +58,16 @@ class Board: #A class for managing different situations and states happening in if(self.board[x][y+2]=='-' and self.board[x+1][y]=='|' and self.board[x+1][y+4]=='|' and self.board[x+2][y+2]=='-'):
if(self.board[x+1][y+2]!='X'):
self.board[x+1][y+2]='X'
-
+ return True
y=y+4
x=x+2
return False
+ def is_legal(self,v1,v2): # we might not need this
+ if(v1<v2 and (v2-v1==4 or ((v2%4 != 1) and (v2-v1==1))):
+ return True
+ else:
+ return False
+
|