public GameSolver(FrontEndInterface frontEnd, WordDict wordDict, Board boardConfig) { mFrontEnd = frontEnd; mWordDict = wordDict; mBoardLetters = CharInfo.ConvertBoardToCharInfoArr(boardConfig.BoardLetters); mAvailableLetters = boardConfig.AvailableLetters; }
private void SetBoardConfig(Board board) { if (this.InvokeRequired) { MethodInvoker del = delegate { SetBoardConfig(board); }; Invoke(del); } else { mSolutionsListView.Items.Clear(); mAvailableLettersTxt.Text = new String(board.AvailableLetters); for (int i = 0; i < GameVals.BOARD_SIZE; i++) { for (int j = 0; j < GameVals.BOARD_SIZE; j++) { mGameTextBoxes[i, j].Text = board.BoardLetters[i, j].ToString(); } } } }
private void LoadMenuItemOnClick(object sender, EventArgs e) { using (OpenFileDialog ofd = new OpenFileDialog()) { ofd.Filter = "Game Board (*.wwf)|*.wwf"; DialogResult result = ofd.ShowDialog(); if (result == DialogResult.OK) { string filename = ofd.FileName; if (!File.Exists(filename)) { MessageBox.Show("File does not exist"); return; } Board board = Board.Load(filename); CurrentBoardConfig = board; } } }
private void ClearMenuItemOnClick(object sender, EventArgs e) { Board clearBoard = new Board(new char[GameVals.BOARD_SIZE, GameVals.BOARD_SIZE], new char[0]); CurrentBoardConfig = clearBoard; mSolutionsListView.Items.Clear(); }