Esempio n. 1
0
 internal void NextTurn(IGameTable gameTable)
 {
     if (!_playerEnumerator.MoveNext())
     {
         _playerEnumerator.Reset();
         _playerEnumerator.MoveNext();
     }
 }
Esempio n. 2
0
 public ChessTableViewModel(IEventAggregator eg, IGameTable gt)
 {
     MoveAllowed      = true;
     _gameTable       = gt;
     _eventAggregator = eg;
     _gameTable.StartNewGame();
     InitializeTableSquares();
     InitializeEventHandlers();
     RedrawTable();
 }
Esempio n. 3
0
 public MenuViewModel(IGameTable gt, IEventAggregator ea)
 {
     _eventAggregator    = ea;
     _gameTable          = gt;
     LoadGameCommand     = new DelegateCommand(LoadGameFromFen);
     SaveGameCommand     = new DelegateCommand(SaveGame);
     OptionsCommand      = new DelegateCommand(OptionsExecute);
     UndoLastMoveCommand = new DelegateCommand(UndoLastMove);
     NewGameCommand      = new DelegateCommand(NewGame);
     MoveCommand         = new DelegateCommand(MoveExecute);
     UserCommand         = new DelegateCommand(UserExecute);
     // UserExecute();
 }
Esempio n. 4
0
        public void Act(IGameTable gameTable)
        {
            _gameTable = gameTable;
            var result       = Gateway.GenerateMove(gameTable.GetFen(), gameTable.Difficulty);
            var fromPosition = new Position(result.FromRank, result.FromFile);
            var toPosition   = new Position(result.ToRank, result.ToFile);
            var promotedTo   = result.PromotedTo;

            _gameTable.SetSelectedPiece(fromPosition);
            _gameTable.ParseInput(toPosition);
            if (promotedTo != ' ')
            {
                _gameTable.GetPieces().First(p => p.CurrentPosition == toPosition).Type = Helper.GetType(promotedTo);
            }
            _eventAggregator.GetEvent <RefreshTableEvent>().Publish(gameTable);
        }
Esempio n. 5
0
 private void InitializeRules(IGameTable gameTable)
 {
     _rules = new Dictionary <string, IRule>();
     _rules.Add(RuleNames.Mate, new MateRule(() => gameTable.GetFen()));
     _rules.Add(RuleNames.Chess, new ChessRule(gameTable));
 }
Esempio n. 6
0
 public RuleProvider(IGameTable gameTable)
 {
     InitializeRules(gameTable);
 }
Esempio n. 7
0
 public void Act(IGameTable g)
 {
 }
Esempio n. 8
0
 public NotificationViewModel(IEventAggregator evt, IGameTable gameTable)
 {
     _eventAggregator = evt;
     _gameTable       = gameTable;
     InitializeEventHandlers();
 }
Esempio n. 9
0
        public void Act(IGameTable gameTable)
        {
            var moveTask = new Task(GenerateMove, gameTable);

            moveTask.Start();
        }
Esempio n. 10
0
 public Game(IGameTable table, int interval = 1000)
 {
     this.interval    = interval;
     this.table       = table;
     CurrentDirection = Direction.None;
 }
Esempio n. 11
0
 public ChessRule(IGameTable gameTable)
 {
     _gameTable = gameTable;
 }