Author Topic: Monopoly  (Read 7353 times)

0 Members and 1 Guest are viewing this topic.

Offline sjasogun1

  • LV3 Member (Next: 100)
  • ***
  • Posts: 88
  • Rating: +8/-1
    • View Profile
Monopoly
« on: May 30, 2011, 12:58:36 pm »
I created a small program to simulate walking over a 40 square monopoly board (without the cards and special squares of course). The odd thing is that after I let it run for one-and-a-half hour (100.000 dice rolls) there were some really big deviations from the expected 2500 per square. They occur with intervals of 7 squares and are in pairs, the first of the pair being around 3100, the second one being around 2000.
They occur on 1, 8-9, 16-17, 24-25, 32-33, 40 (40 and 1 are also a pair). Does anybody know where this comes from? Here is the code (not that complex really):
Code: [Select]
For 1-->A To 40
0-->List 11[A]
Next
0-->A:1-->B:0-->C
Lbl 0
RanInt#(1,6)+RanInt(1,6)-->A
A+B-->B
B>40==>B-40-->B
List 11[B]+1-->List 11[B]
C+1-->C
Locate 1,1,C
Goto 0
Veni, vidi, cecidi
(I came, I saw, I fell down dead)
MSPAFORUMS: http://www.mspaforums.com/
HOMESTUCK: http://www.mspaintadventures.com/?s=6&p=001901

Offline ruler501

  • Meep
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2475
  • Rating: +66/-9
  • Crazy Programmer
    • View Profile
Re: Monopoly
« Reply #1 on: May 30, 2011, 02:51:01 pm »
dice rolls of 7 are 6 times as likely as dice rolls of 12. so numbers closest to 7 are most likely causing that strange phenomenon
I currently don't do much, but I am a developer for a game you should totally try out called AssaultCube Reloaded download here https://assaultcuber.codeplex.com/
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCM/CS/M/S d- s++: a---- C++ UL++ P+ L++ E---- W++ N o? K- w-- o? !M V?
PS+ PE+ Y+ PGP++ t 5? X R tv-- b+++ DI+ D+ G++ e- h! !r y

Offline sjasogun1

  • LV3 Member (Next: 100)
  • ***
  • Posts: 88
  • Rating: +8/-1
    • View Profile
Re: Monopoly
« Reply #2 on: May 31, 2011, 03:29:59 am »
I thought about that already, but if you assume there are only rolls of 7 you'll notice it'll pass every single square on the board once, so that shouldn't be causing it. Besides, investigations by others (with almost 1 billion rolls) confirmed every square will be passed the same amount of times (within two standard deviations of course).
Veni, vidi, cecidi
(I came, I saw, I fell down dead)
MSPAFORUMS: http://www.mspaforums.com/
HOMESTUCK: http://www.mspaintadventures.com/?s=6&p=001901

Offline jsj795

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1105
  • Rating: +84/-3
    • View Profile
Re: Monopoly
« Reply #3 on: May 31, 2011, 04:08:46 am »
Do u think the random seed is what's causing it? Change the random seed number and try again


Spoiler For funny life mathematics:
1. ROMANCE MATHEMATICS
Smart man + smart woman = romance
Smart man + dumb woman = affair
Dumb man + smart woman = marriage
Dumb man + dumb woman = pregnancy
2. OFFICE ARITHMETIC
Smart boss + smart employee = profit
Smart boss + dumb employee = production
Dumb boss + smart employee = promotion
Dumb boss + dumb employee = overtime
3. SHOPPING MATH
A man will pay $2 for a $1 item he needs.
A woman will pay $1 for a $2 item that she doesn't need.
4. GENERAL EQUATIONS & STATISTICS
A woman worries about the future until she gets a husband.
A man never worries about the future until he gets a wife.
A successful man is one who makes more money than his wife can spend.
A successful woman is one who can find such a man.
5. HAPPINESS
To be happy with a man, you must understand him a lot and love him a little.
To be happy with a woman, you must love her a lot and not try to understand her at all.
6. LONGEVITY
Married men live longer than single men do, but married men are a lot more willing to die.
7. PROPENSITY TO CHANGE
A woman marries a man expecting he will change, but he doesn't.
A man marries a woman expecting that she won't change, and she does.
8. DISCUSSION TECHNIQUE
A woman has the last word in any argument.
Anything a man says after that is the beginning of a new argument.

Girls = Time * Money (Girls are a combination of time and money)
Time = Money (Time is money)
Girls = Money squared (So, girls are money squared)
Money = sqrt(Evil) (Money is also the root of all evil)
Girls = sqrt(Evil) squared (So, girls are the root of all evil squared)
Girls = Evil (Thus, girls are evil)
*Girls=Evil credit goes to Compynerd255*

Offline sjasogun1

  • LV3 Member (Next: 100)
  • ***
  • Posts: 88
  • Rating: +8/-1
    • View Profile
Re: Monopoly
« Reply #4 on: May 31, 2011, 06:40:37 am »
Do u think the random seed is what's causing it? Change the random seed number and try again

I'm sorry, I don't understand. You mean I should input something like RanInt(3,11) instead?
Veni, vidi, cecidi
(I came, I saw, I fell down dead)
MSPAFORUMS: http://www.mspaforums.com/
HOMESTUCK: http://www.mspaintadventures.com/?s=6&p=001901

Offline ruler501

  • Meep
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2475
  • Rating: +66/-9
  • Crazy Programmer
    • View Profile
Re: Monopoly
« Reply #5 on: May 31, 2011, 06:43:11 am »
No you have to have a seed for random numbers. I don't know how this works on calc just n comp, but that seed can define all the random numbers so you need to try again with a different seed to see if that was the problem
I currently don't do much, but I am a developer for a game you should totally try out called AssaultCube Reloaded download here https://assaultcuber.codeplex.com/
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCM/CS/M/S d- s++: a---- C++ UL++ P+ L++ E---- W++ N o? K- w-- o? !M V?
PS+ PE+ Y+ PGP++ t 5? X R tv-- b+++ DI+ D+ G++ e- h! !r y

Ashbad

  • Guest
Re: Monopoly
« Reply #6 on: May 31, 2011, 09:38:36 am »
RandInt(1,6)+RandInt(1,6) isn't the greatest idea, since the most hit pseudo-random number for each will be 3-4. and while it's similar to RandInt(1,12), it's not always the same.  I would test around with things like this:

Code: [Select]
(RandInt(1,3) * RandInt(1,2)) + (RandInt(1,4) + RandInt(1,2))
Test around with weird setups like these until you hit a consistency that you're aiming towards :)

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Monopoly
« Reply #7 on: May 31, 2011, 01:13:53 pm »
I think he's doing it that way to simulate actual dice ;)

Ashbad

  • Guest
Re: Monopoly
« Reply #8 on: May 31, 2011, 04:11:41 pm »
Yeah I know, but based on what platform you're on the RNG may not be truly random, and have certain "sticky places" that are called upon most often.  If you mess around with smaller seeds, though, you may be able to counteract it in many cases :)

Offline sjasogun1

  • LV3 Member (Next: 100)
  • ***
  • Posts: 88
  • Rating: +8/-1
    • View Profile
Re: Monopoly
« Reply #9 on: June 01, 2011, 04:11:27 am »
I don't know how to change the random number seed; the only thing I know is that when I reset my calc the random number sequence will reset itself as well, but that'd only make things worse, wouldn't it?
Veni, vidi, cecidi
(I came, I saw, I fell down dead)
MSPAFORUMS: http://www.mspaforums.com/
HOMESTUCK: http://www.mspaintadventures.com/?s=6&p=001901

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Monopoly
« Reply #10 on: June 03, 2011, 09:02:39 pm »
Is it even possible to change the number seed at all on Casio calcs? On the 83+ I know you could do for example 17->Rand, but I'm not sure about Casio

Offline z80man

  • Casio Traitor
  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 977
  • Rating: +85/-3
    • View Profile
Re: Monopoly
« Reply #11 on: June 05, 2011, 10:24:18 pm »
Is it even possible to change the number seed at all on Casio calcs? On the 83+ I know you could do for example 17->Rand, but I'm not sure about Casio

Yes you can, by using Ran# (any integer between 1 and 9) which generates a number between 0 and 1. You can also use 0 as a seed but then 0 is always generated.

List of stuff I need to do before September:
1. Finish the Emulator of the Casio Prizm (in active development)
2. Finish the the SH3 asm IDE/assembler/linker program (in active development)
3. Create a partial Java virtual machine  for the Prizm (not started)
4. Create Axe for the Prizm with an Axe legacy mode (in planning phase)
5. Develop a large set of C and asm libraries for the Prizm (some progress)
6. Create an emulator of the 83+ for the Prizm (not started)
7. Create a well polished game that showcases the ability of the Casio Prizm (not started)

Offline m1ac4

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 106
  • Rating: +8/-0
    • View Profile
Re: Monopoly
« Reply #12 on: June 06, 2011, 08:19:44 am »
Is it even possible to change the number seed at all on Casio calcs? On the 83+ I know you could do for example 17->Rand, but I'm not sure about Casio

Yes you can, by using Ran# (any integer between 1 and 9) which generates a number between 0 and 1. You can also use 0 as a seed but then 0 is always generated.
That will come in handy.  I was having problems with my RPG where I couldn't tell whether the battle system was working or not because the damages dealt didn't "feel" random enough.  Although that perception is subjective this method is still worth a try to make things a bit more random.

Offline z80man

  • Casio Traitor
  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 977
  • Rating: +85/-3
    • View Profile
Re: Monopoly
« Reply #13 on: June 07, 2011, 10:52:31 am »
Now is there any sort of timer command available in BASIC because that's what I'd use as a seed. Otherwise you could also use Rmdr to find the modulus of the previous random as a seed. The syntax is (last random) Rmdr 10

List of stuff I need to do before September:
1. Finish the Emulator of the Casio Prizm (in active development)
2. Finish the the SH3 asm IDE/assembler/linker program (in active development)
3. Create a partial Java virtual machine  for the Prizm (not started)
4. Create Axe for the Prizm with an Axe legacy mode (in planning phase)
5. Develop a large set of C and asm libraries for the Prizm (some progress)
6. Create an emulator of the 83+ for the Prizm (not started)
7. Create a well polished game that showcases the ability of the Casio Prizm (not started)

Offline sjasogun1

  • LV3 Member (Next: 100)
  • ***
  • Posts: 88
  • Rating: +8/-1
    • View Profile
Re: Monopoly
« Reply #14 on: June 07, 2011, 11:54:22 am »
Never mind, problem solved, somehow the results were random and just appeared not to be. Every other run of the program returned normal results (95% of the values within 2 standard deviations of the average, checked with CALC1). I also removed the lines involving C since the program runs 4 times as fast without the counter on-screen.
Veni, vidi, cecidi
(I came, I saw, I fell down dead)
MSPAFORUMS: http://www.mspaforums.com/
HOMESTUCK: http://www.mspaintadventures.com/?s=6&p=001901