Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 A little help plz?
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Jickman




PostPosted: Mon May 14, 2007 5:11 pm   Post subject: A little help plz?

hi, i've made a program with my brother on board games, and theres a problem, we don't know how to use 2 dice and also to make the figure go on the block, do i need to declare the block as a variable, can u gimme a lil help? a small example would be the best!
plz thank u
Sponsor
Sponsor
Sponsor
sponsor
Clayton




PostPosted: Mon May 14, 2007 5:54 pm   Post subject: RE:A little help plz?

I'm not too sure what you mean. What exactly is a 'block' and how are you trying to use two dice? If you could show us what your code looks like currently, people may be able to give you a bit more help and direction with your problem. As it stands, your motives are quite foggy.
Jickman




PostPosted: Mon May 14, 2007 10:36 pm   Post subject: RE:A little help plz?

ok hmm what i mean is that u now in board games for example monopoly, to have a blocks such as illinois avenue, etc rite? u get what i mean? and i want to know if u roll 2 numbers and u use those 2 numbers to move on the total. THe figure is to idicate ur little object to represent u in the game.
Cervantes




PostPosted: Mon May 14, 2007 11:01 pm   Post subject: RE:A little help plz?

If you're doing monopoly, you should probably have a one dimensional array (from 0 up to n-1, where n is the number of "blocks") of "blocks", as you call them.
Each player will have a number associated with them that represents the number of the block they are on.
When you roll the two dice (using Rand.Int), add the result to the player's position number, mod n.
code:

player_position := (player_position + sum_of_dice) mod number_of_blocks

The mod serves to move the player back to the first tile after he's moved all the way around the board.

Check out the Turing Walkthrough if you're not familiar with arrays or records.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 4 Posts ]
Jump to:   


Style:  
Search: