1. THINK OF A NUMBER BETWEEN 1 TO 63.
2. CPU SHOWS SOME TABLES WHERE U NEED TO TELL WHEATHER UR NUMBER IS THERE OR NOT.
3. FINALLY CPU IDENTIFIES UR NUMBER.
Agree with D'Errico comments. But well thought algorithm.
04 Sep 2006
Diary Off
01 Sep 2006
John D'Errico
A cute variation on bisective search.
First, some minor flaws that can be repaired by better programming practice:
- When the computer finally guesses your result, it leaves you hanging, with no button for a new game. You must close the figure and restart it yourself.
- If you close the window before the computer is done, an error results.
- Since you are always presented with EXACTLY 32 numbers in the sample, why are there always 36 slots provided, with 4 of the numbers as zero?
- Why is the mouse pointer set to crosshairs? (Silly answer: becuase this code uses ginput, for no valid reason.) There is no need to use ginput, just to get button clicks.
A more serious flaw is this code is a script, that starts out by CLEARING your matlab workspace, then leaves behind a lot of trash in the variables it has used. This is just poor programming practice. It alone is usually enough for me to give a code a poor(1) rating. I wanted to rate this code as a Good(4) before I noticed that all of my work had been deleted.