Post Reply 
(C Series?) Guessing Game 1-4
04-27-2018, 07:34 PM (This post was last modified: 04-27-2018 07:44 PM by Dieter.)
Post: #2
RE: (C Series?) Guessing Game 1-4
(04-27-2018 06:49 PM)SamE Wrote:  I made this a while back as a test of my skills. It's probably incredibly sloppy, but it works.

Yes, there is plenty room for improvement. But since this is an old program of yours ("a while back") I assume your skills will have improved by now. So how would you code this today?

(04-27-2018 06:49 PM)SamE Wrote:  I'm not sure what devices this works on exactly as I only have an 11C.

It should work on most HPs with a RAN# function. If you insert your own random number generator this should even include most programmable calculators. Maybe after renaming the labels A and B and/or use line addressing, and replacing X=Y? with X=0? after X and Y have been subtracted. The X<0? may take some care on calculators that do not have such a test, but it can be done.

Regarding the program: may I ask two questions?

The program is supposed to generate a number between 1 and 4. But in fact the number can be between 0 and 4. ?!?

The program first calculates a random integer between 0 and 9. Then it checks if it is ≤ 4. If not, it is discarded and a new number is calculated. But... why doesn't the program simply directly calculate a number between 0 or 1 and 4 ?

Sorry if I didn't understand something here, but I just want to ask.

Dieter
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
(C Series?) Guessing Game 1-4 - SamE - 04-27-2018, 06:49 PM
RE: (C Series?) Guessing Game 1-4 - Dieter - 04-27-2018 07:34 PM
RE: (C Series?) Guessing Game 1-4 - SamE - 04-27-2018, 08:49 PM
RE: (C Series?) Guessing Game 1-4 - Dieter - 04-27-2018, 09:48 PM



User(s) browsing this thread: 1 Guest(s)