Beispiel #1
0
        public int Score(BoardClass Board)
        {
            int Score = 0;

            foreach (var c in Hand)
            {
                Score += c.ScoreValue;
            }
            foreach (var c in DiscardPile)
            {
                Score += c.ScoreValue;
            }
            foreach (var c in Board.GetOccupiedTiles(ID))
            {
                Score += c.ScoreValue;
            }
            return(Score);
        }
Beispiel #2
0
        public override List <PossibleMove> PossibleMoves(int x, int y, BoardClass Board, int PlayerID)
        {
            var res = new List <PossibleMove>();

            var Occupied = Board.GetOccupiedTiles(PlayerID).Select(o => o.Type).ToList();

            for (int i = 0; i < Board.TilesX; i++)
            {
                for (int j = 0; j < Board.TilesY; j++)
                {
                    if (Board.IsWalkable(i, j))
                    {
                        if (!Occupied.Contains(Board.Tiles[i, j].Type))
                        {
                            res.Add(new PossibleMove()
                            {
                                FromX = x, FromY = y, ToX = i, ToY = j, ScoreValue = Board.Tiles[i, j].ScoreValue, Card = this, Destination = Board.Tiles[i, j]
                            });
                        }
                    }
                }
            }

            if (Board.Players[PlayerID].AI)
            {
                var newres = new List <PossibleMove>();
                var Types  = res.Select(o => new { Move = o, Type = Board.Tiles[o.ToX, o.ToY].Type }).Where(o => o.Type != CardType.Trap).GroupBy(o => o.Type).Select(o => o.ToList()).ToList();

                foreach (var g in Types)
                {
                    g.Shuffle();
                    newres.AddRange(g.Take(3).Select(o => o.Move));
                }
                res = newres;
            }

            return(res);
        }