猫史档案馆


有没有python的大佬帮我一下

用户:bilibiliDE小号bilibiliDE小号查看:0 回复:0 评论:0 创建时间:2023-11-23T14:54:03


我想实现落一下黑子在落白子再落黑子依此类推但结果是这样的: 代码是这样:importpygamepygame.init()screen=pygame.display.set_mode((750,750))map=[0]*15foriinrange(15):map[i]=[0]*15player=1ruming=Truewhileruming:  foreventinpygame.event.get():    ifevent.type==pygame.QUIT:      ruming=False    elifevent.type==pygame.MOUSEBUTTONDOWN:      x,y=pygame.mouse.get_pos()      col=round((x-25)/50)      row=round((y-25)/50)      map[row][col]=player  ifplayer==1:    player=0   else:    player=1    screen.fill("#AC710C")   forxinrange(15):     pygame.draw.line(screen,"#000000",[25+50*x,25],[25+50*x,725],4)   foryinrange(15):     pygame.draw.line(screen,"#000000",[25,25+50*y],[725,25+50*y],4)   pygame.draw.circle(screen,"#000000",[25+50*7,25+50*7],10)   x,y=pygame.mouse.get_pos()   x=round((x-25)/50)*50+25   y=round((y-25)/50)*50+25   pygame.draw.rect(screen,"#FFFFFF",[x-25,y-25,50,50],2)forrowinrange(15):   forcolinrange(15):      ifmap[row][col]==1:         pygame.draw.circle(screen,"#000000",[col*50+25,row*50+25],25)         elifmap[row][col]==0:         pygame.draw.circle(screen,"#FFFFFF",[col*50+25,row*50+25],25)      pygame.display.update()pygame.quit() 有没有python的大佬帮我一下imgsrc="https://static.codemao.cn/emoji/codemao/%E7%BC%96%E7%A8%8B%E7%8C%AB_%E7%BF%BB%E7%99%BD%E7%9C%BC.gif"alt="emotion_编程猫_翻白眼"


回复

上一页1 页 / 共 0下一页