Jump to content



Photo
- - - - -

Guesser [fx-5800P]

fx-5800P

  • Please log in to reply
3 replies to this topic

#1 Tritonio

Tritonio

    Casio Fan

  • Members
  • PipPip
  • 36 posts
  • Gender:Male

  • Calculators:
    FX-5800P, FX-991ES+, FX-991EX, HP Prime

Posted 11 September 2019 - 09:28 PM

Inspired by https://www.youtube....h?v=ud_frfkt1t0 I made a program/game.

 

You think of two positive numbers. No limits in how big they can be as long as you can type them in the calculator. They can be integers, reals, whatever. Just make sure you know which number is the first one, and which one is the second one that you thought of. Eg. the first number can be 190 and the second number can be 42.

 

Then the program will ask you to give it one of this two numbers. Eg it will ask for the second number, so you will type in 42.

 

Then the program will make a prediction, either it will say that this is the smallest of the two numbers, or it will say that it is the biggest. It will ask you whether the prediction was correct so that it can keep score.

 

The "paradox" is that the calculator will have >50% score when you'd expect that there is no way to be more than 50% correct in such a game. Check the video for an explanation on why this is possible.

0➔W:0➔T:0➔A
Lbl 0
50➔G
T⇒(0.5+Ran# )x(A÷T)➔G
"THINK OF 2 NUMS"◢
If RanInt#(0,1):Then
"WHAT IS THE 2ND"?➔N
Else
"WHAT IS THE 1ST"?➔N
IfEnd
"IS THIS THE"
If N<G:Then
"SMALLEST ONE?"
Else
"BIGGEST ONE?"
IfEnd
"1=YES 0=NO"?➔R
R=1⇒W+1➔W
T+1➔T
A+N➔A
"WIN RATIO:"
W÷T◢
Goto 0

Edited by Tritonio, 11 September 2019 - 10:12 PM.


#2 Tritonio

Tritonio

    Casio Fan

  • Members
  • PipPip
  • 36 posts
  • Gender:Male

  • Calculators:
    FX-5800P, FX-991ES+, FX-991EX, HP Prime

Posted 11 September 2019 - 10:35 PM

Depending on how you select your random numbers, the following line:

 

T⇒(0.5+Ran# )x(A÷T)➔G

 

Might be better to be replaced by:

 

TA÷T➔G



#3 CalcLoverHK

CalcLoverHK

    Casio Freak

  • Members
  • PipPipPipPip
  • 149 posts
  • Gender:Male
  • Location:Hong Kong
  • Interests:Playing video games (especially Minecraft), calculators, programming (Casio Basic/Basic-like,Scratch), watching memes, IT research, mathematics...

  • Calculators:
    fx-50FHII
    fx-9860GII Emulator (trial)
    fx-CG50 Emulator (trial)

Posted 14 September 2019 - 12:06 PM

Hi Tritonio,
 

 You should better rearrange your program like this:

0➔W:0➔T:0➔A
Lbl 0
50➔G
T⇒A÷T➔G
"THINK OF 2 NUMS"◢
If RanInt#(0,1)
Then "WHAI IS THE 2ND"?➔N
Else "WHAT IS THE 1ST"?➔N
IfEnd
"IS THIS THE"
If N<G
Then "SMALLEST ONE?"
Else "BIGGEST ONE?"
IfEnd
"1=YES 0=NO"?➔R
R⇒Isz W
Isz T
A+N➔A
"WIN RATIO:"
W÷T◢
Goto 0

Tips: When you press the enter key, it means "↵" and it is equivalent to ":". Your original program will mislead the newbies.

 

Cheers,

CalcLoverHK



#4 Tritonio

Tritonio

    Casio Fan

  • Members
  • PipPip
  • 36 posts
  • Gender:Male

  • Calculators:
    FX-5800P, FX-991ES+, FX-991EX, HP Prime

Posted 15 September 2019 - 08:54 PM

I just don't like having "Then" in it's own line. I try to keep it like most programming languages where "Then" is in the same line as "If". I don't understand why Casio thought of making "Then" accept a command right after it. I would understand if it was supposed to be a single line "If something then dosomething" but that's not the case, you always have to use EndIf. And at the same time "For" takes a single line and doesn't need a final word for the opening line of the loop, there is no equivalent "Then" for "For". So they could have done the same for If, and not require "Then" at all.


Edited by Tritonio, 15 September 2019 - 09:01 PM.






Also tagged with one or more of these keywords: fx-5800P

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users