Design, implement, test, and debug

Design, implement, test, and debug

Design, implement, test, and debug a C# program to simulate playing the card game War. Utilizing the C# random number generator, deal 26 sets of 2 cards each. This should be accomplished with only one click of a button. The "cards" should be values 1 through 13; 1 is an ace, two is a two, etc.; and 11 is a jack, 12 is a queen, and 13 is a king. Keep two counters - one for player 1 and one for player 2. As you deal the cards (ie, generate the numbers in a loop), if the first card is larger than the second, add 1 to player 1's counter. If the second card is larger than the first, add 1 to player 2's counter. For the purposes of this program, a 2 will beat an ace. Also, as you deal the cards, write the results to a text file. The results should contain the values of both cards dealt and which player won that deal. For example, the record written to the text file could say "Player 1 dealt 3, player 2 dealt 11, player 2 wins". It is not necessary to translate a 1 into "ace", an 11 into "jack", a 12 into "queen", or a 13 into "king". After 26 deals of cards, the results will be read from the text file and displayed on the form. The type of application to be developed is a Windows Forms application. Please note that graphics are not needed. This program is only a simulation; it is not intended to actually look like the user is dealing cards. Also please note that no complicated algorithms or logic is needed. You do not need to do any logic to ensure that 52 unique cards are dealt or anything related to the suit of the card. The assignment is simply to see how you do with the key concepts for this week.

When the user clicks a Deal Cards button, the program will write the values of the cards "dealt" to each of the players as noted above. If I open the text file written, I should see 26 records, with three things on each record (the value of each card and the winner of the deal). If the deal is a tie, note it in the results.

Notify the user in some way that the game is done and the file is written.

After the file is written, the user may click a Display Game Results button to read the items back in and display the results in a textbox or listbox. When I look at the form after I click the Display Game Results button, I should see 26 entries on the form. Also create 2 labels on the form. In the first label, display the number of deals won by player 1 (such as "Player 1 won 10 deals"). In the second label, display the number of deals won by player 2.

Include identifying information in the form of block comments at the top of each class in the project (programmer name, date, program description). Include adequate comments throughout the program, utilize meaningful names for controls, variables, fields, and forms. Include white space for readability purposes in the code. The focus of the project is on learning the C#.Net syntax. However, ensure the form is simple and easy to understand for the user. Refer to the Individual Assignment grading form  to view grading criteria.

Powered by