Ejemplo n.º 1
0
        /// <summary>
        /// Vypocet skore sa odvija od finalneho stavu hry a urovne v ktorej je dosiahnuty
        /// </summary>
        /// <returns>Skore pre danu cast stromu</returns>
        private int GetScore()
        {
            int myScore = 0;

            //ak si posledny v zozname, vyrataj svoje skore, inak si zober najvyssie skore svojich listov
            if (tree.Count == 0)
            {
                myScore = GameEngine.GetGameState(this.map) == GameState.WIN_COMPUTER ? 10 : GameEngine.GetGameState(this.map) == GameState.WIN_PLAYER ? -10 : 0;
                myScore = myScore * 10 * (9 - level);
            }
            else
            {
                foreach (AItree leaf in tree)
                {
                    if (Math.Abs(leaf.score) > Math.Abs(myScore))
                    {
                        myScore = leaf.score;
                    }
                }
            }
            return(myScore);
        }