{"title":"Object-Oriented Design","authors":"Salvatore A. Buono","doi":"10.1201/9781315272962-5","DOIUrl":null,"url":null,"abstract":"The Game of War Illustrate the process of designing an object-oriented solution to a small problem by simulating War, a two-person game for children that uses a deck of playing cards. The rules of the game act as an initial specification of the problem. A card deck consists of 52 playing cards, each of which has a numeric value between 1 and 13, called the rank of the card, and one of four suits (clubs, diamonds, hearts, and spades). To play the game we deal the entire deck of cards to two players. Each player has a pile of 26 cards face down on the table. During a turn of the game, the players show the top cards from their piles, and the player with the higher-ranking card wins both of the cards, putting them face-up in a pile. For the purpose of comparison, aces count as highest. If the cards shown by the players have the same rank, each player places the number of cards equal to that rank face down on the table.","PeriodicalId":440493,"journal":{"name":"C# and Game Programming","volume":"99 1","pages":"0"},"PeriodicalIF":0.0000,"publicationDate":"2019-05-20","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"C# and Game Programming","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.1201/9781315272962-5","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 0
Abstract
The Game of War Illustrate the process of designing an object-oriented solution to a small problem by simulating War, a two-person game for children that uses a deck of playing cards. The rules of the game act as an initial specification of the problem. A card deck consists of 52 playing cards, each of which has a numeric value between 1 and 13, called the rank of the card, and one of four suits (clubs, diamonds, hearts, and spades). To play the game we deal the entire deck of cards to two players. Each player has a pile of 26 cards face down on the table. During a turn of the game, the players show the top cards from their piles, and the player with the higher-ranking card wins both of the cards, putting them face-up in a pile. For the purpose of comparison, aces count as highest. If the cards shown by the players have the same rank, each player places the number of cards equal to that rank face down on the table.