public void AddTransition(int from, int to, int symbol, int action) { AssertRange(from, 0, NumOfStates - 1); AssertRange(to, 0, NumOfStates - 1); AssertRange(symbol, 0, NumOfSymbols - 1); AssertRange(action, 0, NumOfActions - 1); m_transitionTable[from, to, symbol] = new FiniteTransducerTransition(from, to, symbol, action); }
// the school framework will paint the FOV black before PresentNewTrainingUnit is called - I need to re-paint // what ExecuteStepAfterEvaluation painted into the FOV. public override void PresentNewTrainingUnit() { m_importantActionsToTake = 1; m_importantActionsTaken = 0; if (m_lastTransition == null) // true for the very first training unit { FiniteTransducerTransition t = m_ft.pickNextTransitionRandomly(); m_ft.UseTransition(t); m_lastTransition = t; } DisplayLastTransitionSymbol(); }
public override void Init() { m_importantActions = new HashSet <int>(); CreateTransducer(); m_ft.Start(); m_stepIsCorrect = true; m_currentObject = null; m_lastTransition = null; base.Init(); }
public override void ExecuteStepAfterEvaluation() { if (m_currentObject != null) { WrappedWorld.RemoveGameObject(m_currentObject); } FiniteTransducerTransition t = m_ft.pickNextTransitionRandomly(); m_ft.UseTransition(t); m_lastTransition = t; DisplayLastTransitionSymbol(); }
public FiniteTransducerTransition pickNextTransitionRandomly() { FiniteTransducerTransition picked = null; List <FiniteTransducerTransition> options = new List <FiniteTransducerTransition>(NumOfStates); // some default capacity for (int i = 0; i < NumOfStates; i++) { for (int j = 0; j < NumOfSymbols; j++) { if (m_transitionTable[m_currentState, i, j] != null) { options.Add(m_transitionTable[m_currentState, i, j]); } } } if (options.Count > 0) { picked = options[m_rnd.Next(0, options.Count)]; } return(picked); }
public void UseTransition(FiniteTransducerTransition t) { Debug.Assert(t.from == m_currentState); m_currentState = t.to; }