public MainWindow(int mazeId, PlayerType type, Boolean learn = false, int temp_num_sessions = 1, int currentIteration = 1, int totalIterations = 1, int startRandomness = 1, int endRandomness = 1) { InitializeComponent(); mazerepo = new MazeRepo(); mazeInfo = mazerepo.GetByID(mazeId); RandomnessOver = temp_num_sessions; ClosedDueToGameOver = false; Learn = learn; Type = type; if (Type == PlayerType.Human) { this.Title = "Human Player"; StatusText.Visibility = Visibility.Visible; } else if (Type == PlayerType.RNN) { if (learn) { Temp_num_sessions = totalIterations; StartRandomness = startRandomness; EndRandomness = endRandomness; this.Title = "RNN Learning"; statGrid.Visibility = Visibility.Visible; lblMazeName.Content = mazeInfo.Name; lblTotalSession.Content = totalIterations; lblCurrentSession.Content = CurrentIteration = currentIteration; lblScore.Content = LastScore; lblMoves.Content = LastMovesCount; } else { this.Title = "RNN Player"; } } else { this.Title = "Encog Player"; } game = new MazeGameLib.MazeGame(); maze = new Maze(); game.InitGame(mazeInfo); //Initialize Grid game.TheMazeGrid = mazeInfo.Grid; maze.InitializeMaze(game, mazeGrid); //Init Game //game.InitGame(this.MainGrid, new RunThreadUI_Delegate(RunUIThread)); //Send Keys to Game if (Type == PlayerType.Human) { this.KeyDown += MainWindow_KeyDown; } // reset static session count if (currentIteration == 1) { //RNNMazeTraveler.ResestStaticSessionData(); } //Send shutdown event to game //this.Closed += MainWindow_Closed; }
//For windowless training public void InitGame() { maze = new Maze(); //Set Goal Location GoalLocation.X = 49; GoalLocation.Y = 24; }