def commit(self):
     savepoint = {
         "explorer": Explorer(self._board),
         "current_player": self._game.getCurrentPlayer(),
         "errors": self._game.getErrors(),
         "warnings": self._game.getWarnings()
     }
     self._save_points.append(savepoint)
     return self
예제 #2
0
 def setInfoForChessmenUnderAttack(self):
     for chessman in Explorer(self._board).getChessmenUnderAttack(
             self._currentPlayer):
         attack_pos = self._board.getChessmanPosition(chessman)
         if not chessman:
             continue
         if chessman.getColor() != self._currentPlayer:
             continue
         if isinstance(chessman, King):
             self.setWarning("CHECK!")
         self._board.setCellInfo(attack_pos["x"],
                                 attack_pos["y"],
                                 info1="!")
예제 #3
0
 def _getAvailablePositions(self, chessman: IChessman):
     king = False
     for row in self._board.get():
         for el in row:
             if el:
                 if isinstance(el, King):
                     if el.getColor() == chessman.getColor():
                         king = el
                         break
     position = self._board.getChessmanPosition(chessman)
     result = []
     for av_pos in chessman.getAvailablePositions():
         if king:
             explorer = Explorer(self._board)
             doesUnderAttack = explorer.move(
                 position, av_pos).doesChessmenUnderAttack(king)
             explorer.reverse()
             if doesUnderAttack:
                 continue
         result.append(av_pos)
     return result
예제 #4
0
from Explorer import *
from View import *
from Controller import *

model = Explorer("C")
controller = Controller(model)
view = View(model, controller)
view.mainloop()
예제 #5
0
argparser.add_argument("-M",
                       "--impact",
                       help="Enable impact statistics.",
                       action="store_true")
argparser.add_argument(
    "--config",
    help="Set another option; Group.Option:value;Group2.Option:value",
    type=str)

# @todo More config overrides...

args = argparser.parse_args()

start_time = time.time()
print("Creating the explorer...")
explorer = Explorer.Explorer(path=args.repo_path)

print("Loading configurations...")
explorer.loadConfigs(args.ini_file)

# Override configs
print("Performing command line overrides...")
if args.enable_cache:
    print("\tEnabling cache...")
    explorer.setConfig('General', 'enable_cache', 'true')

if args.cache_file is not None:
    print("\tSetting Caching.cache_file to: %s..." % (args.cache_file))
    explorer.setConfig('Caching', 'cache_file', args.cache_file)

if args.tops: