Exemplo n.º 1
0
        public int GetCard(ProgramCardType cardType)
        {
            foreach (var card in Cards)
            {
                if (ProgramCard.GetCardByPriority(card) == cardType)
                    return card;
            }

            return -1;
        }
Exemplo n.º 2
0
Arquivo: Deck.cs Projeto: wbish/wirk
        public ProgramCard GetCard(ProgramCardType cardType)
        {
            foreach (var card in Cards.Where(card => card.CardType == cardType))
            {
                Cards.Remove(card);
                return card;
            }

            return null;
        }
Exemplo n.º 3
0
        private Robot RobotForMoveTest(ProgramCardType cardType)
        {
            int card = GetCardOfType(cardType);
            var position = new Coordinate {X = 1, Y = 0};
            var robot = new Robot { Position = position, Facing = Orientation.Right };
            robot.DealCard(card);
            robot.PlaceCard(card, 1 /* register */);
            var game = new Game(new Map {Squares = Maps.GetMap(Maps.MapLayouts.ScottRallyMap)}, new List<Robot> {robot});
            game.Initialize();

            return robot;
        }
Exemplo n.º 4
0
 private int GetCardOfType(ProgramCardType cardType)
 {
     return ProgramCard.ProgramCardPriorities.First(x => x.Item1 == cardType).Item2.First();
 }
Exemplo n.º 5
0
        internal void ExecuteMove(ProgramCardType card)
        {
            ITile currentTile = Game.Board.GetTile(Position);
            if (currentTile == null)
                return; // This robot is not on the board

            switch (card)
            {
                case ProgramCardType.UTurn:
                    UTurn();
                    break;
                case ProgramCardType.RotateLeft:
                    RotateLeft();
                    break;
                case ProgramCardType.RotateRight:
                    RotateRight();
                    break;
                case ProgramCardType.BackUp:
                    BackUp();
                    break;
                case ProgramCardType.Move1:
                    Move1();
                    break;
                case ProgramCardType.Move2:
                    Move2();
                    break;
                case ProgramCardType.Move3:
                    Move3();
                    break;
                default:
                    throw new InvalidOperationException("Invalid move");
            }
        }