public Connect4(CompPlayer cp, OknoGry og) { this.og = og; this.ai = cp; Console.WriteLine(ai.symbol); this.width = 7; this.height = 6; grid = new char[height, width]; for (int i = 0; i < height; i++) { for (int j = 0; j < width; j++) { grid[i, j] = '.'; } } }
public void startGame(object sender, EventArgs e) { // MessageBox.Show((cbg1.SelectedItem as ComboBoxItem).Content.ToString() + " " + (cbg2.SelectedItem as ComboBoxItem).Content.ToString()); if ((cbg1.SelectedItem as ComboBoxItem).Content.ToString().Equals("Alfa-Beta") || (cbg2.SelectedItem as ComboBoxItem).Content.ToString().Equals("Alfa-Beta") || (cbg2.SelectedItem as ComboBoxItem).Content.ToString().Equals("Człowiek")) { MessageBox.Show("Zaimplementowane rozgrywki: Człowiek vs MinMax oraz MinMax vs MinMax"); } else { Window parentWindow = Window.GetWindow(this); var okn = new OknoGry((cbg1.SelectedItem as ComboBoxItem).Content.ToString(), (cbg2.SelectedItem as ComboBoxItem).Content.ToString(), (cbalg1.SelectedItem as ComboBoxItem).Content.ToString(), (cbalg2.SelectedItem as ComboBoxItem).Content.ToString(), (cbheur1.SelectedItem as ComboBoxItem).Content.ToString(), (cbheur2.SelectedItem as ComboBoxItem).Content.ToString()); if ((cbg1.SelectedItem as ComboBoxItem).Content.ToString().Equals("Człowiek")) { CompPlayerMM cp = new CompPlayerMM(Convert.ToInt32((cbalg2.SelectedItem as ComboBoxItem).Content.ToString())); // okn.msg((Convert.ToInt32((cbalg2.SelectedItem as ComboBoxItem).Content.ToString())).ToString()); Connect4 c4 = new Connect4(cp, okn); cp.setC4(c4); cp.setSymbol('Y'); okn.Con4 = c4; // okn.msg("start"); } if ((cbg1.SelectedItem as ComboBoxItem).Content.ToString().Equals("MinMax")) { CompPlayerMM cp = new CompPlayerMM(Convert.ToInt32((cbalg1.SelectedItem as ComboBoxItem).Content.ToString())); CompPlayerMM cp2 = new CompPlayerMM(Convert.ToInt32((cbalg2.SelectedItem as ComboBoxItem).Content.ToString())); // okn.msg((Convert.ToInt32((cbalg2.SelectedItem as ComboBoxItem).Content.ToString())).ToString()); Connect4 c4 = new Connect4(cp, cp2, okn); cp.setC4(c4); cp.setSymbol('Y'); cp2.setC4(c4); cp2.setSymbol('R'); okn.Con4 = c4; // okn.msg("start"); } okn.Show(); parentWindow.Close(); } }