public override void UpdateMemoryBlocks() { Bitmaps.Count = 0; Bitmaps.Count += LoadAndGetBitmapSize(TEXTURE_SET + "taleEmpty.png"); Bitmaps.Count += LoadAndGetBitmapSize(TEXTURE_SET + "taleO.png"); Bitmaps.Count += LoadAndGetBitmapSize(TEXTURE_SET + "taleX.png"); MapTales.Count = SX * SY; MapTales.ColumnHint = SX; EventOOutput.Count = 3; EventXOutput.Count = 3; StateOutput.Count = SX * SY; VISIBLE_HEIGHT = SY * RES; VISIBLE_WIDTH = SX * RES; Visual.Count = SX * SY * RES * RES; Visual.ColumnHint = SX * RES; INIT_STATE = new int[SX * SY]; m_currentState = (int[])INIT_STATE.Clone(); game = new MyTicTacToeGame(m_currentState); r = new Random(); }
public override void UpdateMemoryBlocks() { ActionOutput.Count = MyTicTacToeWorld.NO_POSITIONS; m_currentState = new int[MyTicTacToeWorld.NO_POSITIONS]; game = new MyTicTacToeGame(m_currentState); r = new Random(); }
public override void Execute() { PreSimulationStep(); // signal that the game ended, just to publish signals to both players if (m_stepsToEnd >= 0) { // all signals sent, new game if (m_stepsToEnd == 0) { ResetGame(); PostSimulationStep(true); return; } m_stepsToEnd--; PostSimulationStep(true); return; } int action = DecodeAction(); if (!Owner.game.ApplyAction(action, m_justPlayed, Owner.m_currentState)) { Owner.GetOutput((int)m_justPlayed + 1).Host[Owner.INCORRECT_MOVE_POS] = 1; PostSimulationStep(false); return; } if (Owner.game.CheckWinner(m_justPlayed, Owner.m_currentState)) { m_stepsToEnd = 1; Owner.GetOutput((int)m_justPlayed + 1).Host[Owner.REWARD_POS] = 1; Owner.GetOutput((int)m_justNotPlayed + 1).Host[Owner.PUNISHMENT_POS] = 1; PostSimulationStep(true); return; } if (MyTicTacToeGame.NoFreePlace(Owner.m_currentState)) { m_stepsToEnd = 0; } PostSimulationStep(true); }
public override void Execute() { Owner.DecodeState(); UpdateDifficulty(); if (MyTicTacToeGame.NoFreePlace(Owner.m_currentState)) { Owner.m_selectedAction = 0; Owner.EncodeAction(); return; } Owner.m_selectedAction = m_computer.GenerateAction(Owner.m_currentState); while (!Owner.game.ApplyAction(Owner.m_selectedAction, Owner.Me, Owner.m_currentState)) { Owner.m_selectedAction = m_computer.GenerateAction(Owner.m_currentState); } Owner.EncodeAction(); }
public MyEngineA(float difficulty, MyTicTacToeGame game) { this.m_game = game; this.UpdateDifficulty(difficulty); }
public MyEngineA(float difficulty, MyTicTacToeGame game) { this.m_game = game; this.UpdateDifficulty(difficulty); }