Jump to content



Photo
- - - - -

Guesser [fx-5800P]

fx-5800P

  • Please log in to reply
3 replies to this topic

#1 Tritonio

Tritonio

    Casio Addict

  • Members
  • PipPipPip
  • 77 posts
  • Gender:Male

  • Calculators:
    fx-5800P, fx-991ES+, fx-991EX, HP Prime, fx-9750GIII, fx-3650P II

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 Addict

  • Members
  • PipPipPip
  • 77 posts
  • Gender:Male

  • Calculators:
    fx-5800P, fx-991ES+, fx-991EX, HP Prime, fx-9750GIII, fx-3650P II

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
  • 256 posts
  • Gender:Male
  • Location:Hong Kong
  • Interests:Games (Minecraft, Krunker.io, CS2), programming in C.Basic

  • Calculators:
    fx-50FHII (2019/1/30)
    fx-991ESPLUS-2 (2023/12/22)
    fx-3650PII (2022/1/15)
    fx-9750GIII (2020/6/13)
    fx-9860G Slim (2024/2/27)
    fx-9860GIISD (2023/3/27)
    fx-9860GIISD-2 (2024/2/5)
    fx-CG20CN (2023/2/12)
    fx-CG50 (2023/10/23)

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 Addict

  • Members
  • PipPipPip
  • 77 posts
  • Gender:Male

  • Calculators:
    fx-5800P, fx-991ES+, fx-991EX, HP Prime, fx-9750GIII, fx-3650P II

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