|
using System;
using System.Windows.Forms;
namespace WarGameSimulation
{
public partial class Form1 : Form
{
WarCardGame newWarGame = new WarCardGame();
public Form1()
{
InitializeComponent();
}
private void btnNewGameStart_Click(object sender, EventArgs e)
{
//GenerateGameData(1000); //Use for testing and analysis
btnAutoGameStart.Enabled = true;
btnBattleManStart.Enabled = true;
newWarGame.StartGame();
DisplayGameResults();
}
private void btnAutoGameStart_Click(object sender, EventArgs e)
{
btnAutoGameStart.Enabled = false;
btnBattleManStart.Enabled = false;
newWarGame.AutoGame();
DisplayGameResults();
}
private void btnBattleManStart_Click(object sender, EventArgs e)
{
if (newWarGame.Battle() == false)
{
btnBattleManStart.Enabled = false;
}
DisplayGameResults();
}
private void DisplayGameResults()
{
lblShuffledDeckDsply.Text = newWarGame.DisplayDeck(newWarGame.ShuffledDeck);
lblPlayer1DeckDsply.Text = newWarGame.DisplayDeck(newWarGame.Player1Deck);
lblPlayer2DeckDsply.Text = newWarGame.DisplayDeck(newWarGame.Player2Deck);
lblBattleDeck.Text = newWarGame.DisplayDeck(newWarGame.CardsOnTheTable);
lblGameStatusDsply.Text = newWarGame.DisplayResults();
}
/// <summary>
/// For testing and collecting stats for analysis in Excel
/// </summary>
private void GenerateGameData(int gamesToRun)
{
Clipboard.Clear();
for (int counter = 0; counter < gamesToRun; counter++)
{
newWarGame.StartGame();
newWarGame.AutoGame();
Clipboard.SetText(Clipboard.GetText() + "\n" + newWarGame.DataToClipboard());
}
MessageBox.Show("Game data generated", "Status",
MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
I am a senior software developer, architect, and project manager, specializing in .NET, JavaScript, Java, and database development, and build automation. I am currently a Lead Developer (.NET) / Developer IV for Paychex Enterprise Business Solutions. Paychex (PAYX) provides payroll, human resources, and benefits outsourcing and web-based solutions to business.
Prior to Paychex, I served as Lead Software Engineer, Operations Manager, and Technical Product Manager at Bio-Optronics. Bio-Optronics develops, deploys and operates information technology solutions to help healthcare professionals manage and optimize workflow to enhance quality, productivity, and patient and staff satisfaction and safety. Previously, I held positions of President, COO, Chief Technology Officer (CTO), and SVP of Technology for Lazer Incorporated. Lazer is a successful, digital imaging and Internet-based content management services provider.