mirror of
https://gitlab.com/oloturia/damastodon.git
synced 2025-01-06 21:47:15 +01:00
Merge branch 'connect4' into 'main'
bugfix See merge request oloturia/damastodon!11
This commit is contained in:
commit
179296fc03
1 changed files with 4 additions and 4 deletions
|
@ -82,7 +82,7 @@ def lobby(notification,content,account,extension):
|
||||||
|
|
||||||
if extension == "draughts": #Draughts init
|
if extension == "draughts": #Draughts init
|
||||||
board = dama.init_board()
|
board = dama.init_board()
|
||||||
mastodon.status_post("◾: @"+account+" ◽: @"+challenger+" \nturn ◽\n"+dama.draw_checkerboard(board,space,white_norm,white_knight,black_norm,black_knight,empty,column,frstrow),visibility="direct")
|
mastodon.status_post("◾: @"+account+" \n◽: @"+challenger+" \nturn ◽\n"+dama.draw_checkerboard(board,space,white_norm,white_knight,black_norm,black_knight,empty,column,frstrow),visibility="direct")
|
||||||
elif extension == "conn4": #Conn4 init
|
elif extension == "conn4": #Conn4 init
|
||||||
board = four_engine.initChequerboard()
|
board = four_engine.initChequerboard()
|
||||||
mastodon.status_post("⚪: @"+account+" \n⚫: @"+challenger+" \nturn ⚪\n"+four_engine.drawChequerboard(board,players=[white_knight,black_knight],space=empty,toprow=conn4row),visibility="direct")
|
mastodon.status_post("⚪: @"+account+" \n⚫: @"+challenger+" \nturn ⚪\n"+four_engine.drawChequerboard(board,players=[white_knight,black_knight],space=empty,toprow=conn4row),visibility="direct")
|
||||||
|
@ -185,7 +185,7 @@ def check_message(notification):
|
||||||
|
|
||||||
#Draughts
|
#Draughts
|
||||||
if os.path.exists(save_position+account+".draughts"): #We are in a game, so movements are parsed and lobby commands are disabled
|
if os.path.exists(save_position+account+".draughts"): #We are in a game, so movements are parsed and lobby commands are disabled
|
||||||
start,black,white,turn,board = load_status(account,"conn4")
|
start,black,white,turn,board = load_status(account,"draughts",content)
|
||||||
if not(start):
|
if not(start):
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -209,7 +209,7 @@ def check_message(notification):
|
||||||
colour = "◾"
|
colour = "◾"
|
||||||
winner = dama.checkWin(board) #Check for winner
|
winner = dama.checkWin(board) #Check for winner
|
||||||
if winner == (False,False): #No one is winning yet
|
if winner == (False,False): #No one is winning yet
|
||||||
mastodon.status_post("◾: "+black+" ◽: "+white+" \nturn "+colour+"\n"+dama.draw_checkerboard(board,space,white_norm,white_knight,black_norm,black_knight,empty,column,frstrow),visibility="direct")
|
mastodon.status_post("◾: "+black+" \n◽: "+white+" \nturn "+colour+"\n"+dama.draw_checkerboard(board,space,white_norm,white_knight,black_norm,black_knight,empty,column,frstrow),visibility="direct")
|
||||||
return
|
return
|
||||||
else: #Someone won
|
else: #Someone won
|
||||||
if winner == (True,False):
|
if winner == (True,False):
|
||||||
|
@ -218,7 +218,7 @@ def check_message(notification):
|
||||||
winner_t = "BLACK"
|
winner_t = "BLACK"
|
||||||
os.remove(save_position+black[1:]+".draughts")
|
os.remove(save_position+black[1:]+".draughts")
|
||||||
os.remove(save_position+white[1:]+".draughts")
|
os.remove(save_position+white[1:]+".draughts")
|
||||||
mastodon.status_post("◾: "+black+" ◽: "+white+"\n"+winner_t+" WINS!\n"+dama.draw_checkerboard(board,space,white_norm,white_knight,black_norm,black_knight,empty,column,frstrow),visibility="direct")
|
mastodon.status_post("◾: "+black+" \n◽: "+white+"\n"+winner_t+" WINS!\n"+dama.draw_checkerboard(board,space,white_norm,white_knight,black_norm,black_knight,empty,column,frstrow),visibility="direct")
|
||||||
return
|
return
|
||||||
else: #We moved in a wrong turn
|
else: #We moved in a wrong turn
|
||||||
mastodon.status_post("@"+account+" \nIt's not your turn.",visibility="direct")
|
mastodon.status_post("@"+account+" \nIt's not your turn.",visibility="direct")
|
||||||
|
|
Loading…
Reference in a new issue