Beispiel #1
0
    def __init__(self):
        self.gui_turn = 0
        self.vs = self.for_ch
        self.selection = ('model', 'random')

        self.for_convert = [(0, 0), (1, 0), (2, 0), (3, 0), (4, 0), (5, 0),
                            (6, 0), (7, 0), (0, 1), (1, 1), (2, 1), (3, 1),
                            (4, 1), (5, 1), (6, 1), (7, 1), (0, 2), (1, 2),
                            (2, 2), (3, 2), (4, 2), (5, 2), (6, 2), (7, 2),
                            (0, 3), (1, 3), (2, 3), (3, 3), (4, 3), (5, 3),
                            (6, 3), (7, 3), (0, 4), (1, 4), (2, 4), (3, 4),
                            (4, 4), (5, 4), (6, 4), (7, 4), (0, 5), (1, 5),
                            (2, 5), (3, 5), (4, 5), (5, 5), (6, 5), (7, 5),
                            (0, 6), (1, 6), (2, 6), (3, 6), (4, 6), (5, 6),
                            (6, 6), (7, 6), (0, 7), (1, 7), (2, 7), (3, 7),
                            (4, 7), (5, 7), (6, 7), (7, 7)]

        wx.Frame.__init__(self, None, wx.ID_ANY, 'Reversi', size=(728, 700))
        icon = wx.Icon('img/icon.ico', wx.BITMAP_TYPE_ICO)
        wx.Frame.SetIcon(self, icon)
        self.main_Panel = wx.Panel(self)
        self.board_Panel = wx.Panel(self.main_Panel,
                                    pos=(0, 0),
                                    size=(560, 560))
        self.control_Panel = wx.Panel(self.main_Panel,
                                      pos=(560, 0),
                                      size=(560, 700))
        self.control_Panel.SetBackgroundColour('#7fbfff')
        self.status_Panel = wx.Panel(self.main_Panel,
                                     pos=(0, 560),
                                     size=(560, 140))
        self.status_Panel.SetBackgroundColour('#8484ff')
        self.othello = game_master()
        self.board_make()
        self.make_status()
        self.make_control()

        main_layout = wx.GridBagSizer()
        main_layout.Add(self.board_Panel, (0, 0), (1, 1))
        main_layout.Add(self.control_Panel, (0, 1), (2, 1))
        main_layout.Add(self.status_Panel, (1, 0), (1, 1))
        main_layout.AddGrowableRow(0)
        main_layout.AddGrowableRow(1)
        main_layout.AddGrowableCol(0)
        main_layout.AddGrowableCol(1)
        self.main_Panel.SetSizer(main_layout)

        self.board_color_update()
Beispiel #2
0
        tmp_3 = []
    elif che == 'WD':
        list_dwin_battle.extend(tmp_3)
        list_dwin_battle.append(END)
        tmp_3 = []
    else:
        tmp_3.append(che)
    ppc += 1
#  ボード復元
if sha == 'b_win' or 'b':
    shi = list_bwin_battle
elif sha == 'b_lose' or 'l':
    shi = list_wwin_battle
tmp1 = []
tmp_2 = []
othello = game_master()
shi_len = len(shi)
g = 0
while not len(shi) == 0:
    print(str(g) + '/' + str(shi_len))
    d = shi.pop(0)
    if d == 'B':
        turn = BLACK
        continue
    elif d == 'W':
        turn = WHITE
        continue
    elif d == END:
        judge, score_B, score_W = othello.end()
        if ttt == 'n':
            list_bboard.extend(copy.deepcopy(t_list_bboard))