Re: How to calculate/process this one?
Re: How to calculate/process this one?
- Subject: Re: How to calculate/process this one?
- From: Malcolm Fitzgerald <email@hidden>
- Date: Sun, 28 Apr 2002 18:00:11 +1000
He's adding every single (overlapping) adjacent pair.
1 + 1 = 2 -- digits 1 and 2
1 + 0 = 1 -- digits 2 and 3
0 + 5 = 5
5 + 0 = 5
The only reason he number of digits is reduced is because of all those 0 and
1 digits keeps the individual sums less than 10.
There are a lot more numbers which will get bigger than will get
smaller and some enter loops, such as 999. But that misses one of the
fundamental elements of this game: no mathematical solution is
necessary.
repeat 3 times
try
display dialog "Type any seven numbers" default answer ""
set s to text returned of result
try
set s to s * 1
if s > 1 and s < 9999999 then
display dialog "Your secret number is
" & number_play(s) buttons {"OK"} default button 1 with icon 1
exit repeat
else
beep
end if
on error
beep
display dialog "That's not a number" buttons
{"OK"} default button 1 with icon 2
end try
on error number -128
exit repeat -- user cancelled
end try
end repeat
on number_play(nbr)
-- all problems in this game are created and resolved by
teasing and cheating
delay 2 -- give the impression that a difficult numerical
procedure is underway
if some character of "0123456789" is 9 then
set s to some item of {"too long to print.","666.
Report to the Devil immediately.", "safe. I will not tell a soul." ,
"XXX. You don't know what you're missing!", "being destroyed now.
It's better for all of us."}
return s
else
return some item of "123456789" & some item of "123456789"
end if
end number_play
--
--
Malcolm Fitzgerald email@hidden
Database Manager
http://www.asauthors.org
The Australian Society of Authors ph: 02 93180877 fax: 02 93180530
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.