The Artima Developer Community
Sponsored Link

Java Answers Forum
help, need help for assignment

1 reply on 1 page. Most recent reply: Jun 4, 2004 6:35 AM by Jeroen Wenting

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 1 reply on 1 page
Betty Pui

Posts: 2
Nickname: rainbowval
Registered: May, 2004

help, need help for assignment Posted: May 30, 2004 5:11 PM
Reply to this message Reply
Advertisement
I don't know what to do this first assignment of mine.
1 REFERENCES Page 1 of 2

Strip Jack Naked
EC100 Assignment
Version 20040324-1




1 References

1. The Card Game Web Site, [online], [http://www.pagat.com/war/beggar_my_neighbour.html], [20 March 2004]


2 Background

Simulation is an important application area in Engineering involving the development of computer models to provide insight into real-world events. This problem involves the simulation of a simple card game Strip Jack Naked.


3 Overview

For this assignment you are to implement the card game ”Strip Jack Naked sometimes known as Beggar My Neighbour or Beat Your Neighbour Out Of Doors”. The original game rules can obtained from [1] The game is played as follows

A standard deck is shuffled and dealt face down to the two players, the first card to the non-dealer, the second to the dealer, and so on until each player has 26 cards. The dealer receives the last card. A standard deck (or pack) of cards contains 52 cards. These are divided into 4 suits—Spades, Hearts, Diamonds and Clubs.

Within each suit there are 13 cards—Ace (A), 2–9, Ten (T), Jack (J), Queen (Q) and King (K). Players take turns to expose their top card. The non-dealer starts the game by playing the top card of their deck (the second last card dealt) face up on the table. The dealer then covers it by playing their top card face up, thus forming a pile of cards on the table. Play continues in this fashion until a pay card (Ace, King, Queen or Jack) is played. The next player must then pay for that card, by playing several times in succession.
The payment rates are:

• 4 cards for an ace
• 3 cards for a king
• 2 cards for a queen
• 1 card for a jack

If a pay card is played at any stage during this sequence, the previous pay card is cancelled and play switches and the other player must pay for that card. When this sequence has ended, the player who exposed the last pay card takes the entire pile, placing it face down under their existing deck. She then starts the next round by playing one card face up as before. Play continues until one player cannot play when called upon to do so, because they have no more cards. The player who first runs out of card loses.


4 Requirements

The student shall define, develop, document, prototype, test and modify as required the software system.



The system shall:
• implement that card game Strip jack Naked as described above including:
o shuffling the cards;
o dealing the cards;
o paying for a card;

• prompt the user, in this order, for:
o the number of games to simulate
o the number of shuffles to perform on the deck

• be a console based Java application (no GUI dialogues etc).
• be called StripJackNaked
• be written in Java
• be executed by typing the following: java StripJackNaked
• run on a Engineering Common First Year Laboratory Machine
• at the completion of all games, display to the screen a summary of the games. The format of the output is as follows (These numbers are fictitious, that is they are made them up):


Results of Strip Jack Naked simulation:
+------+-------+------------+--------+---------+
| GAME | TURNS | PAY RATIO | WINNER | CARDS IN|
| | | P1:P2 | | HAND |
+------+-------+------------+--------+---------+
| 1 | 120 | 24:56 | P1 | 44 |
+------+-------+------------+--------+---------+
| 2 | 220 | 84:42 | P2 | 52 |
+------+-------+------------+--------+---------+
| ... | ... | ... | ... | .... |
+------+-------+------------+--------+---------+
| 35 | 20 | 28:11 | P2 | 50 |
+------+-------+------------+--------+---------+

Simulation Statistics
Number of Shuffles : 35
Number of Games : 35
Total Turns : 7689
Turns Per Game : 219.69
Win Ratio (P1:P2) : 21:14
Payout Ratio (P1:P2) : 1245:3456
Average Cards Paid : 135
Average Cards In Hand : 48


Jeroen Wenting

Posts: 88
Nickname: jwenting
Registered: Mar, 2004

Re: help, need help for assignment Posted: Jun 4, 2004 6:35 AM
Reply to this message Reply
what about thinking for a while and coding something that implements that specification?

Maybe if and when you get up to SPECIFIC problems about details people might be willing to assist you with hints about how to solve those, but please don't insult us by asking us to reduce the quality of the average programmer by making more idiots who don't know an int from a float to enter the profession by doing your entire homework for you.

Flat View: This topic has 1 reply on 1 page
Topic: Dynamic class reloading Previous Topic   Next Topic Topic: about singleton classes uses

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use