private void Reset() { minefield = new Minefield(); minesweeper = null; DestroyGeneticsWindow(); DestroyKnowledgeWindow(); }
private void Window_KeyDown(object sender, KeyEventArgs e) { switch (e.Key) { case Key.Space: if (minesweeper != null) { int code = minesweeper.NextMove(); if (code == 1) { minefield.disarmAt(minesweeper.GetX(), minesweeper.GetY()); } else if (code == 2 && minefield.fieldArray[minesweeper.GetX(), minesweeper.GetY()].explosive != null) { minesweeper.Recognize(minefield.fieldArray[minesweeper.GetX(), minesweeper.GetY()].explosive.frame); } } break; case Key.R: Reset(); break; case Key.G: InitializeGeneticsWindow(); break; case Key.Enter: if (geneticsWindow != null) { InitializeKnowledgeWindow(); minesweeper = new Minesweeper(geneticsWindow.getCurrentChromosome()); minesweeper.minefield = minefield.generateMinefieldFrame(); minefield.WriteToFile("diag"); minesweeper.Search(); } break; } Redraw(); }
public void Perform(Minesweeper minesweeper) { minesweeper.actionName(); }