I'm Making A Simulation Of A Monopoly Board, But Something's N

5 replies to this topic

#1 Alfie Stoppani

Alfie Stoppani

Newbie

• Members
• 13 posts
• Gender:Male

• Calculators:
Fx-9750Gii (with OS 2.00.0200 updated and installed)

Posted 28 August 2012 - 08:55 PM

Hello,

I'm trying to use strategy when playing Monopoly by simulating many moves on the board and seeing which properties are landed on the most. I have read that it is the Orange properties, but I want to test this for myself.

I have started small and tried to code the basic moving around the board for the first 10 moves of the game. I will take into account jail, change & community chest cards later. Note: this simulation is for one player only, so it's just one simulated player rolling, and moving around the board.

Here's what I have so far:

```1->J
40->Dim List 1
0->N
Lbl 1
N+1->N
If N>11
Then Goto 3
Else
RanInt#(1,6)->A
RanInt#(1,6)->B
A+B->C
J+C->J
If J>40
Then J-40->J
Else List 1[J]+1->List 1[J]
Goto 1
Lbl 3
List 1(display command triangle symbol is here)
```

But when I run the program, instead of a list as normally displayed, I get just a single displayed number in the top right, as with normal, non list values.

So what's wrong? I have played around with the code, and when I remove the 'Goto 1' part, i.e it doesn't loop back but instead simulates only one move, it does work, and the list display is shown as normal; how I want.

Now I'll explain what I expected each line to do compared to a real life game of Monopoly:

I used 'J' as a variable to represent which space the player is currently on. There are 40 spaces on the Monopoly board so J is set to whichever of the 40 spaces the player is currently on. The program sets J to 1, the 'Go' space on the board to begin.
I used 'N' to represent what number turn the player is on. This is set to 0.
Then the program sets a 40 length list with each element set to 0. I planned to use this as a tally so that when a new space is landed on, it counts up the numbers, counting how many times that space is landed on.
Lbl 1 is the main loop: Rolling the dice, the RanInt #(1,6) are obviously the throwing of each die.
So N starts counting, and with every new throw, N increases, counting the amount of turns.
The two dice scores are added together and J is summed to this value so that the new J represent the new space. Because the board is a loop, and you return back to 'Go' after landing on 'Mayfair' the next line subtracts 40 from J if J gets larger than 40, thus resetting the value back to the 'Go' space or whichever is the new space on the new cycle.
The next line is supposed to increase the element that represents the new landed on space by one. This therefore is the same value as J and so J is used to change this.
Lbl 3 is jumped to when N exceed a certain limit, in this example '11', after 10 turns. I will change this to larger limits to simulate many more turns. The last part of Lbl 1 is what I believe is the cause to this not working, but I can't see what's wrong.

I hope this made sense, and I hope you are able to help.

Alfie.

#2 flyingfisch

flyingfisch

Casio Maniac

• Deputy
• 1891 posts
• Gender:Male
• Location:OH,USA
• Interests:Aviation, Skiing, Programming, Mountain Biking.

• Calculators:
fx-9860GII
fx-CG10 PRIZM

Posted 28 August 2012 - 09:09 PM

Hmm, how about you try displaying the list after everything is done?

#3 hayzel

hayzel

Newbie

• Members
• 10 posts

Posted 28 August 2012 - 09:13 PM

I didn't tried it on the calc, but I think you have errors in the If-Then-Else statements.
You don't use any IfEnd.
```If N>11
Then Goto 3
Else
...blah blah...
IfEnd```
Same thins one the last If:
```If N>40
Then ....
....
IfEnd
```

• Alfie Stoppani likes this

#4 Alfie Stoppani

Alfie Stoppani

Newbie

• Members
• 13 posts
• Gender:Male

• Calculators:
Fx-9750Gii (with OS 2.00.0200 updated and installed)

Posted 28 August 2012 - 09:22 PM

Hmm, how about you try displaying the list after everything is done?

I put the display command triangle, i.e the Shift, PRGM, F5 symbol after the last 'List 1' at the end. Doesn't work.
Is this what you mean?

#5 Alfie Stoppani

Alfie Stoppani

Newbie

• Members
• 13 posts
• Gender:Male

• Calculators:
Fx-9750Gii (with OS 2.00.0200 updated and installed)

Posted 28 August 2012 - 09:28 PM

I didn't tried it on the calc, but I think you have errors in the If-Then-Else statements.
You don't use any IfEnd.

```If N>11
Then Goto 3
Else
...blah blah...
IfEnd```
Same thins one the last If:
```If N>40
Then ....
....
IfEnd
```

Yes, that works! Thank you.

I thought that 'IfEnd's stopped the program if the 'If' was true, that's why I thought it would be fine without. <:3D~

Lesson learned. I'm sure I'll be posting for more help soon when I continue this program. <:3D~

#6 Forty-Two

Forty-Two

Casio Overlord

• Deputy
• 528 posts
• Gender:Male
• Location:Well, The sign says "You are here"...

• Calculators:
Casio fx-CG10 Prizm
Casio fx-9860GII
TI-84+ SE

Posted 28 August 2012 - 10:30 PM

The basic reference in the Casio fx9860GII Manual is very informative, and has a comprehensive list of tokens.

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users