#### Archived

This topic is now archived and is closed to further replies.

# Monopoly...

This topic is 6252 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

i''am trying to make a monopoly game but i don''t know how to make the player move the correct number of stepps from one street to another (hope you understand) so please any tips...

##### Share on other sites

int board_location[ N_BOARD_LOCATIONS ];
int player_location = 0; // GO

// roll the dice -- put result in d

player_location = (player_location + d) % N_BOARD_LOCATIONS;

##### Share on other sites
Beware, that''s a hasbro game

You know, I never wanted to be a programmer...

Alexandre Moura

##### Share on other sites
Okey thanks...
But then i got another question (i don''t know what happend to my brian, it doesn''t work ) what is the best way to make the streets "Struct or Class" and how to make the game count it''s way. If i''m standing on Go and is going to move 2 steps how do i make the game know what Stru/Class to use...

##### Share on other sites
Use the same struct / class for each board location. Here are some ideas for the type of fields it should have:

flag indicating it''s type: real estate / draw a card / railroad / luxury tac, etc.

it''s price to purchase

fields indicating its payment schedules (houses, hotels, and so on)

methods to be called for the player action: draw a card, pay income tax, go to jail, etc.

I''ve never programmed a Moniopoly game, but it seems pretty straightforward. There''s probably only about 7 different types of things a player has to do: Just brute force it with a specific type of function for each if you have to.

##### Share on other sites
// rolling the dice

d = rand () % 6 + rand () % 6 + 2;

1. 1
Rutin
46
2. 2
3. 3
4. 4
5. 5
JoeJ
18

• 13
• 10
• 12
• 10
• 13
• ### Forum Statistics

• Total Topics
632998
• Total Posts
3009803
• ### Who's Online (See full list)

There are no registered users currently online

×