void GameRef_GameCycleEvent(MazeCycleOutcome mazeCycle, Traveler traveler) { // A Cycle Ended, Mark the Score, then make your next move // determine score double score = WRONG_SCORE; if (mazeCycle.GameOver) { score = CORRECT_SCORE * 2; } else if (!mazeCycle.BumpedIntoWall) { score = CORRECT_SCORE; } rnn_net.ScoreCycle(currentCycleID, score); // start next AI's move var inputs = new List <rnn_io_with_value>() { new rnn_io_with_value(rnn_net.Inputs.First(a => a.Name == "X"), traveler.location.X.ToString()), new rnn_io_with_value(rnn_net.Inputs.First(a => a.Name == "Y"), traveler.location.Y.ToString()), new rnn_io_with_value(rnn_net.Inputs.First(a => a.Name == "BumpedIntoWall"), mazeCycle.BumpedIntoWall.ToString()) }; rnn_cycle cycle = new rnn_cycle(); cycle.RunCycle(rnn_net, currentSessionID, inputs, learn); }
void GameRef_GameStartEvent(Traveler traveler) { //Start AI Training Cycle currentSessionID = rnn_net.SessionStart(); //Make your first move var initial_inputs = new List <rnn_io_with_value>() { new rnn_io_with_value(rnn_net.Inputs.First(a => a.Name == "X"), traveler.location.X.ToString()), new rnn_io_with_value(rnn_net.Inputs.First(a => a.Name == "Y"), traveler.location.Y.ToString()), new rnn_io_with_value(rnn_net.Inputs.First(a => a.Name == "BumpedIntoWall"), false.ToString()) }; rnn_cycle cycle = new rnn_cycle(); cycle.RunCycle(rnn_net, currentSessionID, initial_inputs, learn); }