예제 #1
0
        /// <summary>
        ///     Funkce generujici veskere mozne tahy na hraci desce
        /// </summary>
        /// <param name="gb">Instance tridy hraci deska</param>
        /// <returns>Vraci pole hracich poli, kde na lichem miste je ulozeno pole odkud bylo tazeno a na sudem miste pole, kam bylo tazeno</returns>
        private List <Fairway> generateMoves(Gameboard gb)
        {
            List <Fairway> movable = rules.choosableFigures(gb);
            var            moves   = new List <Fairway>();

            foreach (var fw in movable)
            {
                List <string> dests = gb.possibleMoves(fw);

                foreach (var destination in dests)
                {
                    moves.Add(fw);
                    moves.Add(gb.getFigure(destination));
                }
            }
            return(moves);
        }
예제 #2
0
        // funkce obarvujici figurky, jemiz je mozne tahnout
        public void colorUp()
        {
            List <Fairway> figures = rules.choosableFigures(this);

            for (int i = 0; i < GlobalVariables.size; i++)
            {
                for (int j = 0; j < GlobalVariables.size; j++)
                {
                    Fairway chosen = Board[i, j];
                    if (figures.Contains(chosen) && ShowMoveHelp)
                    {
                        chosen.BackgroundImage = Resources.board_dark_active_figure;
                    }
                    else
                    {
                        chosen.BackgroundImage = ((i + j) % 2 == 1) ? Resources.board_dark : Resources.board_light;
                    }
                }
            }
        }