Im going to do a game of dart 501, the game is gonna have 1 player and 1 computer player that throws random.

Every throw can give 0 - 60 points, so max 180 a round.

The players points its written manually while the computers is automatic generated.

First one to reach 501 or over is gonna win, and all his throws is gonna be displayed after the victory.

I need to do this with 3 classes that i got UML for:

Been sitting with this for many days but i feel my skills is outnumbered to this problem, have only read c# for a month.

Any help would be a lifesaver.

3
Contributors
4
Replies
32
Views
4 Years
Discussion Span
Last Post by Ketsuekiame
1. Instantiate a Player object per player.
2. On each player's turn. Use a random number generator between 0 -> 60 (there's an example of an RNG call in the picture)
3. Save each indidual score as an arrow in the Arrows class (You have three; arrowOne, arrowTwo, arrowThree)
4. Save the "Arrows" object into the list of arrows for that player.

The rest is easy :)

Something to keep in mind, in the game 501 the winning player is the one that reaches exactly 501. If a player goes over, that turn is forfeited.

Another thing to remember is that not all the scores from 0-60 are valid. Only the 1, 2 and 3 multiples of 0-20. For instance 23 is impossible to reach with 1 dart. You might want 2 random variables, the base value, 0-20, and the multiplier, 1-3.

Edited by tinstaafl

Oops forgot aboput the bullseye. All the 1,2, and 3 multiples of 0-20 plus 25 and 50 A list of all possible scores, then grabbing a random index from it to get the score for one arrow, might work better.

Edited by tinstaafl

Hi tinstaafl. That's not a requirement for his assignment, but might score him extra marks :)

Given that he OP is struggling with the basics, might be wiser to get the core going before defining the extra rules.

If you're interested, here is the Translation of the assignment I was going by:

It starts with to lay to all players who will be involved by entering their name

If you write the name Computer will he become a player whose throw randomly instead of writing them

Players roll sequentially. When it's a player's turn to throw the star his name on the screen

The player throws three darts that can give 0-60 points per arrow (180p per round) each caste are laid manually enter the computer except if the computer plays

Since then it's the next player's turn.

The player whose total sum on any roll is over 501 points first wins. (We do not care about that you have to go still out)

When one player has to be handy name appears on the screen after which all his darts printed for the way he threw. Varke series of three darts to appear so we can understand how each omgang was thrown.

The other father does not play clearly. But when you press ENTER, the program quits

Not brilliant, but it's enough to work out the general gist of it :)

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.