Esempio n. 1
0
        /// <summary>
        /// Determines if the given state is the winning one.
        /// </summary>
        /// <param name="session">GameSession object</param>
        /// <param name="field">Current click position</param>
        /// <param name="state">Current state (player)</param>
        /// <param name="size">Size of the grid</param>
        /// <returns>
        /// GridItemState.Empty if no winner has been found; 
        /// otherwise GridItemState.Player1 or GridItemState.Player1
        /// </returns>
        public static GridItemState GetWinningState(
            GameSession session, 
            Field field, 
            GridItemState state, 
            int size)
        {
            // TODO: Determine whether the given state is the winning one

            return GridItemState.Empty;
        }
Esempio n. 2
0
        /// <summary>
        /// Sets turn.
        /// </summary>
        /// <param name="session">Current GameSession</param>
        /// <param name="playerNumber">Player number</param>
        private void SetTurn(GameSession session, int playerNumber)
        {
            Clients[session.Player1Id].setTurn(playerNumber);
            Clients[session.Player2Id].setTurn(playerNumber);

            if (playerNumber == 0)
            {
                Clients[session.Player1Id].addMessage("Your turn.");
                Clients[session.Player2Id].addMessage("Wait. Current turn: Player " + (playerNumber + 1));
            }
            else
            {
                Clients[session.Player2Id].addMessage("Your turn.");
                Clients[session.Player1Id].addMessage("Wait. Current turn: Player " + (playerNumber + 1));
            }
        }