FANDOM

484 Pages

Imagine: You get a Calculator from somebody, and you are making some equations on it. However, the Calculator seems to be broken, since it doesn't gives back the correct answer. This is a very funny program to use on somebody you lend your calculator to.

```:While 1
:Input "",A
:
:Disp A+1
:End
```

Version 2: Using Random Numbers Edit

The program above always gives a number back that is one higher than the answer that would be correct. However, it is kind of easy to tell what is wrong with this calculator. Therefore, a better idea would be:

```:While 1
:Input "",A
:
:Disp A+RandInt(-2,2
:End
```

Now the answer is randomly two less, one less, one more, two more and sometimes the correct anwer. Of course you can change the -2 and the 2 for any value you want.

Version 3: procedurally Edit

However, when the user enters the same calculation twice, they will get a different answer. This kind of gives the trick away. An better idea would be to not randomly generate the answer, but procedurally generate(a random looking value, but every time the same one for the same input) the answer. What is this? You will see...

```:
:While 1
:Input "",A
:
:fPart(√(A))→C
:iPart((C*10)-4.5))→D
:A+C->B
:Disp B
:End
```

Ouch! That looks kind of difficult now. Don't worry, in fact it is quite easy to understand.

```:fPart(√(A))→C
:iPart((C*10)-4.5))→D
```

The new part does this: The Root of A is taken, and only the part after that (that is what fPart does) is saved into C.

Afterwards, C is multiplied by 10, and then 4,5 is substracted. Why? This again creates a random-looking part. It creates some number between -4,5 and 4,5.

If you don't get it, here's an example:

1. √(5) is 2.236067977.
2. The fPart of that is 0.236067977.
3. Multiplied by ten, this is 2.36067977,
4. Minus 4.5 is -2.1394
5. Taken the iPart of this, the number is -2.

Version 4: Negative Roots Fix Edit

The program still has one drawback: you can't use square roots on negative values. However, abs( will return the same positive number for any input, so can be used to ensure square roots always work.

```:While 1
:Input "",A
:fPart(√(abs(A)))→C
:iPart((C*10)-4.5)→D
:A+C→B
:Disp B
:End
```

Of course, you can upgrade this program even further: by assigning a random value to a variable before the while loop, you can for that run of the program create unique numbers. Also, it is possible to end the program silently when entering a hidden password number or something. But that is something you can find out yourself.