private void BoardStoneStylesSettings_Load(object sender, EventArgs e) { this.white_style_id = Properties.Settings.Default.board_white_stone_image_ID; this.black_style_id = Properties.Settings.Default.board_black_stone_image_ID; white_stone_style_picturebox.Image = StoneStyleImage.FromIDAndColor(white_style_id, PlayerColor.White); black_stone_style_picturebox.Image = StoneStyleImage.FromIDAndColor(black_style_id, PlayerColor.Black); this.demo_board = new Chessboard(ref demo_board_panel, Properties.Settings.Default.board_size); demo_board.Load(); demo_board.PositionateStart(); }
private void black_stone_style_picturebox_Click(object sender, EventArgs e) { Image new_style_image = StoneStyleImage.FromIDAndColor(++black_style_id, PlayerColor.Black); if (new_style_image == null) { new_style_image = StoneStyleImage.FromIDAndColor(black_style_id = 0, PlayerColor.Black); } black_stone_style_picturebox.Image = new_style_image; this.demo_board.BlackStoneStyle = new_style_image; }
private void white_stone_style_picturebox_Click(object sender, EventArgs e) { Image new_style_image = StoneStyleImage.FromIDAndColor(++white_style_id, PlayerColor.White); if (new_style_image == null) { new_style_image = StoneStyleImage.FromIDAndColor(white_style_id = 0, PlayerColor.White); } white_stone_style_picturebox.Image = new_style_image; this.demo_board.WhiteStoneStyle = new_style_image; }
public Chessboard(ref Panel panel, Size size = new Size(), Pair <Color> color_pair = null, Pair <Image> stone_style_pair = null) { this.panel = panel; if (size.IsEmpty) { this.size = Properties.Settings.Default.board_size; } else { this.size = size; } //this.color_pair = color_pair ?? new Pair<Color>(Color.Green, Color.FromArgb(215, 188, 156)); //this.stone_style_pair = stone_style_pair ?? new Pair<Image>(Properties.Resources.white, Properties.Resources.black); this.color_pair = color_pair ?? new Pair <Color>(Properties.Settings.Default.board_colorA, Properties.Settings.Default.board_colorB); this.stone_style_pair = stone_style_pair ?? new Pair <Image>(StoneStyleImage.FromIDAndColor(Properties.Settings.Default.board_white_stone_image_ID, PlayerColor.White), StoneStyleImage.FromIDAndColor(Properties.Settings.Default.board_black_stone_image_ID, PlayerColor.Black)); }
private void OverTheBoardSettings_Load(object sender, EventArgs e) { user_name_textbox.Text = Properties.Settings.Default.offline_user_name; opponents_name_textbox.Text = Properties.Settings.Default.offline_opponents_name; game_duration_combobox.SelectedItem = Properties.Settings.Default.offline_game_time_control.ToString(); this.user_playing_color = Properties.Settings.Default.playing_color == "black" ? PlayerColor.Black : PlayerColor.White; if (user_playing_color == PlayerColor.White) { user_stone_picturebox.Image = StoneStyleImage.FromIDAndColor(Properties.Settings.Default.board_white_stone_image_ID, PlayerColor.White); opponents_stone_picturebox.Image = StoneStyleImage.FromIDAndColor(Properties.Settings.Default.board_black_stone_image_ID, PlayerColor.Black); } else if (user_playing_color == PlayerColor.Black) { user_stone_picturebox.Image = StoneStyleImage.FromIDAndColor(Properties.Settings.Default.board_black_stone_image_ID, PlayerColor.Black); opponents_stone_picturebox.Image = StoneStyleImage.FromIDAndColor(Properties.Settings.Default.board_white_stone_image_ID, PlayerColor.White); } }
private void MachineSettings_Load(object sender, EventArgs e) { machine_level_trackbar.Value = Properties.Settings.Default.machine_level; if (Properties.Settings.Default.playing_color == "white") { this.user_color = PlayerColor.White; stone_picturebox.Image = this.white_stone_style = StoneStyleImage.FromIDAndColor(Properties.Settings.Default.board_white_stone_image_ID, PlayerColor.White); this.black_stone_style = StoneStyleImage.FromIDAndColor(Properties.Settings.Default.board_black_stone_image_ID, PlayerColor.Black); } else { this.user_color = PlayerColor.Black; stone_picturebox.Image = this.black_stone_style = StoneStyleImage.FromIDAndColor(Properties.Settings.Default.board_black_stone_image_ID, PlayerColor.Black); this.white_stone_style = StoneStyleImage.FromIDAndColor(Properties.Settings.Default.board_white_stone_image_ID, PlayerColor.White); } }
private void playing_color_combobox_SelectedIndexChanged(object sender, EventArgs e) { switch (playing_color_combobox.SelectedItem.ToString()) { case "Black": playing_color_picturebox.Image = StoneStyleImage.FromIDAndColor(Properties.Settings.Default.board_black_stone_image_ID, PlayerColor.Black); break; case "White": playing_color_picturebox.Image = StoneStyleImage.FromIDAndColor(Properties.Settings.Default.board_white_stone_image_ID, PlayerColor.White); break; case "Random": playing_color_picturebox.Image = Properties.Resources.unknown; break; } }
private void GameVsMachine_Load(object sender, EventArgs e) { computer_name_label.Text = $"Computer (lvl {this.computer_level}.)"; if (user_color == PlayerColor.White) { user_stone_picturebox.Image = StoneStyleImage.FromIDAndColor(Properties.Settings.Default.board_white_stone_image_ID, PlayerColor.White); computer_stone_picturebox.Image = StoneStyleImage.FromIDAndColor(Properties.Settings.Default.board_black_stone_image_ID, PlayerColor.Black); } else { computer_stone_picturebox.Image = StoneStyleImage.FromIDAndColor(Properties.Settings.Default.board_white_stone_image_ID, PlayerColor.White); user_stone_picturebox.Image = StoneStyleImage.FromIDAndColor(Properties.Settings.Default.board_black_stone_image_ID, PlayerColor.Black); } this.board = new Chessboard(ref board_panel); board.Load(); board.PositionateStart(); switch (this.computer_level) { case 0: this.algorithm = new Machine_LVL_0_Algorithm(this); break; case 1: this.algorithm = new Machine_LVL_1_Algorithm(this); break; case 2: this.algorithm = new Machine_LVL_2_Algorithm(this); break; case 3: this.algorithm = new Machine_LVL_3_Algorithm(this); break; default: this.algorithm = new Machine_LVL_3_Algorithm(this); break; } algorithm.Apply(); }