[Tutor] "complete number" algorithm

Sean 'Shaleh' Perry shalehperry@attbi.com
Sat, 22 Jun 2002 13:39:21 -0700 (PDT)


On 22-Jun-2002 Andrei Kulakov wrote:
> Hello tutor crowd,
> 
> I'm working on a small algorithm that determines if a digit can be
> added at the end of one number and it could still be equal to or less
> than another number. This is for an on-screen list where you have to
> pick an item, each of them is numbered like this:
> 

why not mark each item as the user types and let them choose?

1
2
3
4
5
6
6
8
9
10
11
12
...
...
...
122

if the user types '1' then 1 gets hilighted.  if the user then presses '2' the
hilight moves to 12.  If they then press '1' it ends up on 121.  You can have
the "mark an item" function check the delay between keypresses and if the delay
is longer than a chosen time assume they started over.

This would work like emacs' search (C-s).