[program-l] Re: small board game advice requested

  • From: "Roger Woolgrove" <rawoolgrove@xxxxxxxxx>
  • To: <program-l@xxxxxxxxxxxxx>
  • Date: Wed, 10 Oct 2012 15:04:33 +0100

Roll die
Add result to current location
If (current location > 40)
{
Current location = current location - 40
Collect200quid()
}

This should work where current position is a variable holding the relevant 
integer

Roger



-----Original Message-----
From: program-l-bounce@xxxxxxxxxxxxx [mailto:program-l-bounce@xxxxxxxxxxxxx] On 
Behalf Of Homme, James
Sent: 10 October 2012 13:14
To: program-l@xxxxxxxxxxxxx
Subject: [program-l] Re: small board game advice requested

Hi,
For some reason, I'm not understanding what you're asking, but as I was reading 
your message I thought about something. There must be some formula for figuring 
this out, but I'm not coming up with it right now. In Monopoly, there are 40 
spaces on the board. On the dice, there are 11 numbers from 2 to 12.  You can 
never roll a 1, because you are actually throwing two dice, and each one is 
going to show a number from 1 to 6. You are going to roll the dice and get a 
number that is going to move you past the 40th slot in the array. You have to 
be able to figure out how to jump back to the first slot and start to move back 
up to slot 40. For example, let's say you are on slot 39 and roll a 2. Instead 
of 41, you have to go back to slot 1. I just remembered as I wrote this that 
arrays start at slot 0, but you get the idea.

Thanks.

Jim


-----Original Message-----
From: program-l-bounce@xxxxxxxxxxxxx [mailto:program-l-bounce@xxxxxxxxxxxxx] On 
Behalf Of Florian-achtige
Sent: Tuesday, October 09, 2012 4:31 PM
To: program-l
Subject: [program-l] small board game advice requested

Hello list,

For an assignment I am trying to create a text-based self-playing board game. I 
intend to have two variables update themselves while iterating through an array 
which is the board. I however keep getting the loops confused and am wondering 
if there is a simpler way to do this. Here's my outline:

First, player a rolls a die. I use the Random class for this, the
nextInt() function set to 6, for a six-sided die.
Then, the variable updates itself by adding the number of points on the die to 
its total. Also, the corresponding index of the array must be accessed, because 
some array elements have certain expressions to benefit or hinder the player, 
think the obstacles on a monopoly game board.
These two keep getting tangled up in my mind though when I attempt to do both 
...The two player variables I use because I use a while loop to continue the 
game until one of the two exceeds 60.

I am using the Java programming language and would like to ask for a few hints. 
If you just want to point me at some resources that is fine too, I am just 
stuck and not sure where I should be looking for a solution.

Thanks a lot in advance,
Florian
** To leave the list, click on the immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=unsubscribe]
** If this link doesn't work then send a message to:
** program-l-request@xxxxxxxxxxxxx
** and in the Subject line type
** unsubscribe
** For other list commands such as vacation mode, click on the
** immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=faq]
** or send a message, to
** program-l-request@xxxxxxxxxxxxx with the Subject:- faq

________________________________

This e-mail and any attachments to it are confidential and are intended solely 
for use of the individual or entity to whom they are addressed. If you have 
received this e-mail in error, please notify the sender immediately and then 
delete it. If you are not the intended recipient, you must not keep, use, 
disclose, copy or distribute this e-mail without the author's prior permission. 
The views expressed in this e-mail message do not necessarily represent the 
views of Highmark Inc., its subsidiaries, or affiliates.
Njïïïïïvzïâïïïïïïzïïïïï!ïïzÂïjïïïïïïzïïïyïïïïnïïïïïïïïjïyrïïïïïïïjïïïï~ïïï

** To leave the list, click on the immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=unsubscribe]
** If this link doesn't work then send a message to:
** program-l-request@xxxxxxxxxxxxx
** and in the Subject line type
** unsubscribe
** For other list commands such as vacation mode, click on the
** immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=faq]
** or send a message, to
** program-l-request@xxxxxxxxxxxxx with the Subject:- faq

Other related posts: