From 9937a9ba1b1eb9e90af911ca3152ca1c8701c2bc Mon Sep 17 00:00:00 2001 From: DoubleQ <1243026909@qq.com> Date: Sat, 3 Sep 2022 08:47:54 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E4=BA=86=E5=A4=A7=E5=B0=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SafariChess_Gamev1.0.py | 17 +++++++++-------- SafariChess_backend.py | 1 + 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/SafariChess_Gamev1.0.py b/SafariChess_Gamev1.0.py index c86901c..c5894e1 100644 --- a/SafariChess_Gamev1.0.py +++ b/SafariChess_Gamev1.0.py @@ -40,7 +40,7 @@ def loadImages():#加载图片,a,b双方分别有象狮豹狼狐鹰鼠七个角 "b7", "b6", "b5", "b4", "b3", "b2", "b1", ] for piece in pieces:#字典的形式存储图片 - IMAGES[piece] = pg.transform.scale(pg.image.load("./Image/pieces/pieces_rb/" + piece + ".png"), (SIZE, SIZE)) + IMAGES[piece] = pg.transform.scale(pg.image.load("./Image/pieces/pieces_rb/" + piece + ".png"), (SIZE - 10, SIZE - 10)) tools = ["trap", "home1","home2"] for tool in tools: @@ -78,7 +78,8 @@ def drawPieces(screen,board): for column in range(DIMENSION_COLUMNS): piece = board[row][column] if piece != "00": - screen.blit(IMAGES[piece], pg.Rect((column * SIZE) + 10, (row * SIZE) + 200, SIZE, SIZE)) + screen.blit(IMAGES[piece], pg.Rect((column * SIZE) + bias_left + 5, (row * SIZE) + bias_top + 5, SIZE - 10, SIZE - 10)) + # square_selected 是当前选中的可以移动的棋子的位置 def protrudeSquares(screen,game_state,square_selected,valid_moves): @@ -117,12 +118,12 @@ def startGamePage():#开始游戏界面,Human/AI WELCOME TO - ____ ___________ _____ _ - / __/ ___/ ___| / __ \ | - |__| |___| |____ | / / |___ ___ ___ ___ - \__ | ___| ___ | | | _ \/ _ \/ __/ __| - __| | | | | | \__/\ | | | __/\__ \__ | - |____/_| |_| \_____/_| |_|\___||___/___/ + ____ ____________ _____ _ + / __/ ___/ __ | / __ \ | + |__| |___| |__| | | / / |___ ___ ___ ___ + \__ | ___| _ / | | | _ \/ _ \/ __/ __| + __| | | | | \ \ | \__/\ | | | __/\__ \__ | + |____/_| |_| \__| \_____/_| |_|\___||___/___/ ################################################################ diff --git a/SafariChess_backend.py b/SafariChess_backend.py index 257ad5d..b34fffd 100644 --- a/SafariChess_backend.py +++ b/SafariChess_backend.py @@ -199,6 +199,7 @@ class GameState: if self.board[3][0][0] == 'r' or self.board[3][8][0] == 'b': self.conquered = True return self.conquered + #移动操作 def makeMove(self,move):#cur是当前位置,nxt是下一个位置,参数传入为元组 self.board[move.end_row][move.end_col] = self.board[move.start_row][move.start_col]