アットウィキロゴ

あおおお

import pygame
from pygame.locals import *
import sys
import game 
 
def faststep():
 
    global pos
    global hand
    global mode
 
    pos=[2,1,3,8,7,9] 
    hand=["先手","先手","先手","後手","後手","後手"]
    mode="先手"
 
 
koma=["王","金","銀","王","金","銀"]
ban=[]
ban.append([0,0])
for y1 in [1,2,3]:
    for x1 in [1,2,3]:
        ban.append([x1,y1])
pos=[2,1,3,8,7,9] 
hand=["先手","先手","先手","後手","後手","後手"]
mode="先手"
 
pygame.init()                                   # Pygameの初期化
sc = pygame.display.set_mode((500, 500))    # 大きさ400*300の画面を生成
pygame.display.set_caption("将棋")              # タイトルバーに表示する文字
font = pygame.font.Font("ipaexg.ttf", 70) 
while (1):
 
    pygame.time.delay(3000)
 
    sub=game.game()
    sub.pos=pos
    sub.hand=hand
    sub.mode=mode
    sub.ban=ban
    sub.koma=koma
    sub.makedata()
    mode=sub.mode
    pos=sub.pos
    hand=sub.hand
 
    if mode=="先手勝利":
       faststep()
    if mode=="後手勝利":
       faststep()
    sc.fill((0,0,0), Rect(0,0,500,500))
    for i in range(6):
 
        t1 = font.render(koma[i], True, (255,0,0)) 
        p1=pos[i]
        x1=100*ban[p1][0]
        y1=400-100*ban[p1][1]
        if p1>0:
           sc.blit(t1, [x1, y1])
 
    pygame.display.update()     # 画面を更新
    for event in pygame.event.get():
        if event.type == QUIT:  # 閉じるボタンが押されたら終了
            pygame.quit()       # Pygameの終了(画面閉じられる)
            sys.exit()
最終更新:2018年01月20日 12:15