Пример #1
0
        public AIResult[] BackHand()
        {
            switch (HistoryHands.Count)
            {
            case 0:
                return(null);

            case 1:
                var onlyHand = HistoryHands[0];
                _boardElements[onlyHand.Row, onlyHand.Column] = null;
                HistoryHands.RemoveAt(0);
                AnalyzeBoard();
                return(new[] { ConstructNullResult(onlyHand) });

            default:
                var lastHand     = HistoryHands[HistoryHands.Count - 1];
                var previousHand = HistoryHands[HistoryHands.Count - 2];
                _boardElements[lastHand.Row, lastHand.Column]         = null;
                _boardElements[previousHand.Row, previousHand.Column] = null;
                HistoryHands.Remove(lastHand);
                HistoryHands.Remove(previousHand);
                AnalyzeBoard();
                return(new[] { ConstructNullResult(lastHand), ConstructNullResult(previousHand) });
            }
        }
Пример #2
0
 public void CurrentHand(int row, int column)
 {
     _boardElements[row, column] = NextHandContent;
     HistoryHands.Add(new Element(row, column, NextHandContent));
     NextHand();
     AnalyzeBoard();
 }