Example #1
0
        /// <summary>
        /// Iterate over all the checkers that the users has and accumulate all the moves available.
        /// eventually, returned the distinct moves.
        /// </summary>
        /// <param name="i_Player">The player in question</param>
        /// <returns>All available moves of said player</returns>
        private List <Move> getPlayerAvailableMoves(eCheckerColor i_PlayerColor)
        {
            List <Move> moves = new List <Move>();

            for (int i = 0; i < Board.BoardSize; i++)
            {
                for (int j = 0; j < Board.BoardSize; j++)
                {
                    if (Board.Matrix[j, i].Color == i_PlayerColor)
                    {
                        moves.AddRange(GetAllAvailableMovesOfChecker(new Point(i, j)));
                    }
                }
            }

            return(moves.Distinct().ToList());
        }
Example #2
0
 public CheckerLabel(eCheckerColor i_Color)
 {
     this.ForeColor = i_Color == eCheckerColor.Black ? Color.Black : Color.FromArgb(182, 0, 0);
     this.Font      = new Font("Impact", 15);
 }
Example #3
0
 public HumanPlayer(string i_Name, eCheckerColor i_Color) : base(i_Name, i_Color)
 {
 }
Example #4
0
 private Point[] getAllAvailableSourcesOnBoardThatEat1Checker(eCheckerColor i_PlayerColor)
 {
     // We get all the available moves of the player, we filter them to those with only 1 eaten checker and we fetch the source
     Point[] sourcesOnBoardThatEat1Checker = getPlayerAvailableMoves(i_PlayerColor).Where(move => move.CheckersEaten.Count == 1).Select(move => move.Source).ToArray();
     return(sourcesOnBoardThatEat1Checker);
 }
Example #5
0
 public Square(eCheckerColor i_Color)
 {
     this.m_Color = i_Color;
     this.m_King  = false;
 }
Example #6
0
 public Player(string i_Name, eCheckerColor i_Color)
 {
     this.m_Name  = i_Name;
     this.m_Color = i_Color;
 }