public HareAndTortoise_Form() { InitializeComponent(); HareAndTortoise_Game.SetUpGame(); ResizeGameBoard(); SetUpGuiGameBoard(); dataGridView1.DataSource = HareAndTortoise_Game.Players; MapPlayers(true); Trace.Listeners.Add(new ListBoxTraceListener(listBox)); comboBox1.SelectedIndex = comboBox1.FindString("6"); }
public HareAndTortoise_Form() { InitializeComponent(); HareAndTortoise_Game.SetUpGame(); ResizeGameBoard(); SetUpGuiGameBoard(); DataGridView.DataSource = HareAndTortoise_Game.Players; UpdatePlayerSquares(KEEP); Trace.Listeners.Add(new ListBoxTraceListener(lbDebug)); // Set default value of player count cbNumberOfPlayers.SelectedIndex = cbNumberOfPlayers.FindString("6"); }
private void RollDiceActions() { comboBox1.Enabled = false; HareAndTortoise_Game.playOneRound(); buttonRollDice.Enabled = false; MapOnePlayer(); MapPlayers(false); MapPlayers(true); if (HareAndTortoise_Game.endCheck()) { comboBox1.Enabled = true; buttonRollDice.Enabled = false; } else { buttonRollDice.Enabled = true; } OutputPlayersDetails(); UpdateDataGridView(); }
private void btnRollDice_Click(object sender, EventArgs e) { // update form elements cbNumberOfPlayers.Enabled = false; btnReset.Enabled = true; // Remove previous player tokens UpdatePlayerSquares(REMOVE); // Call method to play one round - if true game is over if (HareAndTortoise_Game.PlayOneRound()) { HareAndTortoise_Game.CalculateWinners(); btnReset.Enabled = true; btnRollDice.Enabled = false; } // Update squares UpdatePlayerSquares(KEEP); OutputPlayersDetails(); UpdateDataGridView(); }
private void OutputPlayersDetails() { HareAndTortoise_Game.OutputAllPlayerDetails(); listBox.Items.Add(""); listBox.SelectedIndex = listBox.Items.Count - 1; }