static void Main(string[] args) { bool gameFinished = false; while (!gameFinished) { Console.WriteLine("Welcome to the SUDOKU RESOLVE!"); SudokuGame theGame = new SudokuGame(); gameFinished = theGame.ResolveSudoku(); } }
private string Move() { if (Games != null) { SudokuGame game = Games.Get(new Guid(GameId)); if (!game.Move(this)) { return(String.Format("error_move#{0}#{1}", X, Y)); } } return(""); }
private string Exit() { if (Games != null) { SudokuGame game = Games.Get(new Guid(GameId)); if (game != null) { game.RemovePlayer(Name); } } return(""); }
private string Join() { if (Games != null) { SudokuGame game = Games.Get(new Guid(GameId)); if (!game.AddPlayer(new Player(Name, WebSocket))) { return("error#Такой игрок уже в игре"); } return(String.Format("{0}#{1}#{2}#{3}", "join", game.Id, game.SudokuGrid.ToString(), Name)); } return(""); }
private string New() { if (Games != null) { int size = Convert.ToInt32(GameId); int difficult = Convert.ToInt32(X); SudokuGame game = new SudokuGame(new SudokuGrid(size, difficult), Games); game.Name = Y; game.AddPlayer(new Player(Name, WebSocket)); return(String.Format("{0}#{1}#{2}#{3}", "new", game.Id, game.SudokuGrid.ToString(), Name)); } return(""); }
public void Remove(SudokuGame game) { Games.Remove(game.Id); }
public void Add(SudokuGame game) { Games.Add(game.Id, game); }
public MainWindow() { InitializeComponent(); SudokuGame game = new SudokuGame(BoardGrid, NewGameButton, HintButton, SolveButton); }
private void MulaiBaru_Click(object sender, RoutedEventArgs e) { if (k != 0) { MessageBoxResult yakin = System.Windows.MessageBox.Show("Permainan belum berakhir, Anda ingin mulai baru?", "Mulai Baru", System.Windows.MessageBoxButton.YesNo); if (yakin == MessageBoxResult.No) { return; } } if (sw.IsRunning) { sw.Stop(); dt.Stop(); sw.Reset(); time.Text = "00:00:00"; } Random random = new Random(); if (level.Text.Equals("Demo")) { K = 5; } else if (level.Text.Equals("Normal")) { K = random.Next(20, 41); } else { K = 0; } SudokuGame = new SudokuGame(K); k = K; hint = 0; mistake = 0; SudokuGame.generate(); isEnabledAll(true); for (int i = 0; i < 9; ++i) { for (int j = 0; j < 9; ++j) { answer[i, j] = string.Format("{0}", SudokuGame.solution[i, j]); question[i, j] = string.Format("{0}", SudokuGame.arr[i, j]); if (question[i, j].Equals("0")) { question[i, j] = ""; } TextBox tb = (TextBox)this.FindName(string.Format("Cell{0}{1}", i, j)); tb.Text = question[i, j]; tb.Foreground = Brushes.Black; if (question[i, j].Equals(answer[i, j])) { tb.IsEnabled = false; } } } sw.Start(); dt.Start(); }