Skip to content

Commit

Permalink
change x to variant. #33
Browse files Browse the repository at this point in the history
  • Loading branch information
y-tetsu committed Jan 3, 2025
1 parent e8a1fac commit 02eb8df
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 490 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ $ install_reversi_examples
- [07_minmax_strategy.py](https://github.com/y-tetsu/reversi/blob/master/reversi/examples/07_minmax_strategy.py) - MinMax法で手を選ぶAIを実装するサンプル
- [08_alphabeta_strategy.py](https://github.com/y-tetsu/reversi/blob/master/reversi/examples/08_alphabeta_strategy.py) - AlphaBeta法で手を選ぶAIを実装するサンプル
- [09_genetic_algorithm.py](https://github.com/y-tetsu/reversi/blob/master/reversi/examples/09_genetic_algorithm.py) - 遺伝的アルゴリズムを使ってテーブルの重みを求めるサンプル
- [10_x_elucidator.py](https://github.com/y-tetsu/reversi/blob/master/reversi/examples/10_x_elucidator.py) - 変則ボードの解析ツール
- [10_variant_elucidator.py](https://github.com/y-tetsu/reversi/blob/master/reversi/examples/10_variant_elucidator.py) - 変則ボードの解析ツール

サンプルの実行方法はそれぞれ下記のとおりです。
```
Expand All @@ -138,7 +138,7 @@ $ python 06_table_strategy.py
$ python 07_minmax_strategy.py
$ python 08_alphabeta_strategy.py
$ python 09_genetic_algorithm.py
$ python 10_x_elucidator.py
$ python 10_variant_elucidator.py
```


Expand Down
4 changes: 2 additions & 2 deletions reversi/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from .board import Board, BitBoard, PyListBoard, PyBitBoard, MIN_BOARD_SIZE, MAX_BOARD_SIZE
from .color import C
from .move import Move, LOWER, UPPER
from .x import X
from .variant import V
from .player import Player
from .display import ConsoleDisplay, NoneDisplay, WindowDisplay
from .game import Game
Expand All @@ -26,7 +26,7 @@
'Move',
'LOWER',
'UPPER',
'X',
'V',
'Player',
'ConsoleDisplay',
'NoneDisplay',
Expand Down
12 changes: 6 additions & 6 deletions reversi/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import threading
from platform import system

from reversi import BitBoard, Player, Window, WindowDisplay, ConsoleDisplay, Game, ErrorMessage, strategies, X, Recorder
from reversi import BitBoard, Player, Window, WindowDisplay, ConsoleDisplay, Game, ErrorMessage, strategies, V, Recorder


class Reversi:
Expand Down Expand Up @@ -375,7 +375,7 @@ def _get_board_type(self):
"""
self._clear_screen()

board_list = list(X.keys())
board_list = list(V.keys())

print('select board type')
print('-----------------------------')
Expand Down Expand Up @@ -416,10 +416,10 @@ def __play(self):
self._clear_screen()

# ボード準備
size = X[self.board_type]['size']
hole = X[self.board_type]['hole']
ini_black = X[self.board_type]['ini_black']
ini_white = X[self.board_type]['ini_white']
size = V[self.board_type]['size']
hole = V[self.board_type]['hole']
ini_black = V[self.board_type]['ini_black']
ini_white = V[self.board_type]['ini_white']
board = BitBoard(size=size, hole=hole, ini_black=ini_black, ini_white=ini_white)

# プレイヤー準備
Expand Down
271 changes: 0 additions & 271 deletions reversi/examples/10_x_elucidator.py

This file was deleted.

12 changes: 6 additions & 6 deletions reversi/simulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import itertools
from multiprocessing import Pool

from reversi import BitBoard, PyListBoard, Player, NoneDisplay, Game, X
from reversi import BitBoard, PyListBoard, Player, NoneDisplay, Game, V
from reversi.strategies import RandomOpening


Expand Down Expand Up @@ -140,11 +140,11 @@ def __init__(
self.hole = 0x0000000000000000
self.ini_black = None
self.ini_white = None
if self.board_name in X:
self.board_size = X[self.board_name]['size']
self.hole = X[self.board_name]['hole']
self.ini_black = X[self.board_name]['ini_black']
self.ini_white = X[self.board_name]['ini_white']
if self.board_name in V:
self.board_size = V[self.board_name]['size']
self.hole = V[self.board_name]['hole']
self.ini_black = V[self.board_name]['ini_black']
self.ini_white = V[self.board_name]['ini_white']
print(f'[{self.board_name}]')

print(BitBoard(self.board_size, hole=self.hole, ini_black=self.ini_black, ini_white=self.ini_white))
Expand Down
Loading

0 comments on commit 02eb8df

Please sign in to comment.