PYTHON五子棋(悔棋部分出问题)

import copy
import pygame

pygame.init()
screen = pygame.display.set_mode((750,850))
pygame.display.set_caption("这是我自己做的五子棋")

border_left = 25    #左边缘
border_right = 725  #右边缘
border_top = 25     #上边缘
border_bottom = 725 #下边缘
width = 50          #宽度
height = 50         #高度

border_right1 = 750
border_bottom1 = 750

map = [0]*16
for i in range(16):
    map[i] = [0]*16

player = 1
winner = 0

running = True

font = pygame.font.SysFont('Simhei',24)

class Button:
    def __init__(self,x,y,width,height,text,color,click_color,text_color) -> None:
        self.text = text
        self.color = color
        self.click_color = click_color
        self.text_color = text_color
        self.rect = pygame.Rect(x,y,width,height)
        self.clicked = False

    def draw(self,screen):
        if self.clicked:
            pygame.draw.rect(screen, self.click_color, self.rect)
        else:
            pygame.draw.rect(screen,self.color,self.rect)

        text_surface = font.render(self.text, True, self.text_color)
        text_rect = text_surface.get_rect(center = self.rect.center)
        screen.blit(text_surface, text_rect)


def check(row,col):
    #判断左右方向是否五子连线
    score = 1
    for i
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值