Пример #1
0
        /// <summary>
        /// This is ran at every tick to display up to date stats based on the agent.
        /// </summary>
        public override void UpdateConsole()
        {
            Console.Clear();
            Console.ForegroundColor = ConsoleColor.Blue;
            Console.WriteLine("================== LUCPAC-SCRIPTED ==================");
            Console.ForegroundColor = ConsoleColor.Gray;
            string _pacmanPosition = string.Format("Pacman: {0},{1}", _gameState.Pacman.Node.X, _gameState.Pacman.Node.Y);

            //m_GameState.Pacman.ImgX.ToString(),m_GameState.Pacman.ImgY.ToString()

            foreach (var ghost in _gameState.Ghosts)
            {
                Console.WriteLine(string.Format("{0}: {1},{2}", ghost.GetType().ToString(),
                                                ghost.Node.X,
                                                ghost.Node.Y));
            }

            Console.ForegroundColor = ConsoleColor.White;
            Console.WriteLine(string.Format("PILLS REMAINING: {0}", _gameState.Map.PillNodes.Where(n => n.Type != Node.NodeType.None && n.Type != Node.NodeType.Wall).Count().ToString()));
            Console.WriteLine(string.Format("PILLS LEFT(INT): {0}", _gameState.Map.PillsLeft.ToString()));
            Console.WriteLine(string.Format("PREVIOUS STATE: {0}", _previousAgentState.ToString()));
            Console.WriteLine(string.Format("STATE: {0}", _currentAgentState.ToString()));

            Console.ForegroundColor = ConsoleColor.Gray;

            Console.WriteLine("=================== TEST DATA ==============");
            if (_testStats.TotalGames >= MaxTestGames)
            {
                Console.ForegroundColor = ConsoleColor.Green;
                Console.WriteLine("** TEST COMPLETE **");
            }
            else
            {
                Console.ForegroundColor = ConsoleColor.Yellow;
                Console.WriteLine("** TEST IN PROGRESS **");
            }

            Console.ForegroundColor = ConsoleColor.Gray;
            // Output the test information as it goes a long
            Console.WriteLine(string.Format("SESSION ID: {0}", _testSessionId));
            Console.WriteLine(string.Format("MAX PILLS EATEN: {0}", _testStats.MaxPillsTaken));
            Console.WriteLine(string.Format("MIN PILLS EATEN: {0}", _testStats.MinPillsTaken));
            Console.WriteLine(string.Format("GAMES PLAYED: {0}", _testStats.TotalGames));
            Console.WriteLine(string.Format("HIGHEST SCORE: {0}", _testStats.MaxScore));
            Console.WriteLine(string.Format("AVERAGE SCORE: {0}", _testStats.AverageScore));
            Console.WriteLine(string.Format("LOWEST SCORE: {0}", _testStats.MinScore));
            Console.WriteLine(string.Format("MINIMUM GHOSTS EATEN: {0}", _testStats.MinGhostsEaten));
            Console.WriteLine(string.Format("AVERAGE GHOSTS EATEN: {0}", _testStats.AverageGhostsEaten));
            Console.WriteLine(string.Format("MAXIMUM GHOSTS EATEN: {0}", _testStats.MaxGhostsEaten));

            Console.ForegroundColor = ConsoleColor.Red;
            Console.WriteLine("=================== LOG ====================");
            Console.ForegroundColor = ConsoleColor.White;

            // Output the items that have been sorted in the list.
            for (int i = 0; i < _logOutput.Count; i++)
            {
                Console.WriteLine(_logOutput[i]);
            }
        }
Пример #2
0
 public Human()
 {
     hunger         = 100;
     hungerTick     = 0.05f;
     currentState   = new FiniteState();
     nextHungerTick = Time.time + hungerTick;
     stateName      = currentState.ToString();
     hungry         = false;
     ID             = -1;
 }
Пример #3
0
        // Update the state and lead the output know about it
        public Direction ChangeState(FiniteState pNewState, bool pLog, GameState gs)
        {
            if (pLog)
            {
                OutputLog(string.Format("New State: {0}", pNewState.ToString()), true, true);
            }

            // Based on the counts from the state.
            switch (pNewState)
            {
            case FiniteState.Wander:
                WanderChangeCount++;
                break;

            case FiniteState.Ambush:
                AmbushChangeCount++;
                break;

            case FiniteState.EndGame:
                EndgameChangeCount++;
                break;

            case FiniteState.Hunt:
                HuntChangeCount++;
                break;

            case FiniteState.Flee:
                FleeChangeCount++;
                break;
            }

            // Store the previous FSM state.
            _previousAgentState = _currentAgentState;

            // Call the functions that are defined for the respective states.
            _states[_currentAgentState].OnSuspend(this, null, gs);
            _states[pNewState].OnBegin(this, null, gs);
            _currentAgentState = pNewState;
            return(CallState(_currentAgentState, gs));
        }
Пример #4
0
        // Update the state and lead the output know about it
        public Direction ChangeState(FiniteState pNewState, bool pLog, GameState gs)
        {
            if (pLog)
            {
                OutputLog(string.Format("New State: {0}", pNewState.ToString()), true, true);
            }

            // Based on the counts from the state.
            switch (pNewState)
            {
            case FiniteState.Wander:
                WANDER_CHANGE_COUNT++;
                break;

            case FiniteState.Ambush:
                AMBUSH_CHANGE_COUNT++;
                break;

            case FiniteState.EndGame:
                ENDGAME_CHANGE_COUNT++;
                break;

            case FiniteState.Hunt:
                HUNT_CHANGE_COUNT++;
                break;

            case FiniteState.Flee:
                FLEE_CHANGE_COUNT++;
                break;
            }

            // Store the previous FSM state.
            m_PreviousFSMState = m_CurrentState;

            // Call the functions that are defined for the respective states.
            m_States[m_CurrentState].OnSuspend(this, null, gs);
            m_States[pNewState].OnBegin(this, null, gs);
            m_CurrentState = pNewState;
            return(CallState(m_CurrentState, gs));
        }
Пример #5
0
 public string GetStateString()
 {
     return(currentState.ToString());
 }