![]() |
|
|
#1761 |
|
"Forget I exist"
Jul 2009
Dumbassville
26·131 Posts |
here's one that works both for the thread and has something else in common with Mersenne forums:
http://rosettacode.org/wiki/Towers_of_Hanoi |
|
|
|
|
|
#1762 |
|
Aug 2006
135338 Posts |
Yes, but the task is supposed to work with an arbitrary function. First, yours doesn't; second, it should really avoid such 'magic numbers'. What if, for example, the function took an hour to complete each run?
|
|
|
|
|
|
#1763 | |
|
Aug 2006
597910 Posts |
Quote:
|
|
|
|
|
|
|
#1764 |
|
"Forget I exist"
Jul 2009
Dumbassville
20C016 Posts |
|
|
|
|
|
|
#1765 |
|
"Forget I exist"
Jul 2009
Dumbassville
100000110000002 Posts |
Code:
longmultiply(a,b)= a=eval(a);b=eval(b);c=Vec(a);d=Vec(b);carry=0;answer=[];forstep(x=#d,1,[-1],if(d[x]==Vec("2"),print(yes)))
|
|
|
|
|
|
#1766 |
|
"Forget I exist"
Jul 2009
Dumbassville
20C016 Posts |
why is this not complete lol, it only took ME less than 10 minutes to work out lol.
Code:
guess_the_number(N=10)= a=random(N);print("guess the number between 0 and "N);for(x=1,N,if(x>1,print("guess again"));b=input();if(b==a,break()));print("You gueesed it correctly")
Last fiddled with by science_man_88 on 2010-11-29 at 00:08 |
|
|
|
|
|
#1767 |
|
Aug 2006
597910 Posts |
|
|
|
|
|
|
#1768 | |
|
Aug 2006
175B16 Posts |
Quote:
I certainly wouldn't use eval() unless I absolutely had to. |
|
|
|
|
|
|
#1769 |
|
"Forget I exist"
Jul 2009
Dumbassville
26·131 Posts |
|
|
|
|
|
|
#1770 | |
|
Aug 2006
3×1,993 Posts |
Quote:
You should break it onto multiple lines if possible first; that way it will look nice. |
|
|
|
|
|
|
#1771 |
|
"Forget I exist"
Jul 2009
Dumbassville
26·131 Posts |
the site isn't updating I added the guessing script, and the rate counter lol.
Last fiddled with by science_man_88 on 2010-11-29 at 00:32 |
|
|
|
![]() |
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Why do I sometimes see all the <> formatting commands when I quote or edit? | cheesehead | Forum Feedback | 3 | 2013-05-25 12:56 |
| Passing commands to PARI on Windows | James Heinrich | Software | 2 | 2012-05-13 19:19 |
| Ubiquity commands | Mini-Geek | Aliquot Sequences | 1 | 2009-09-22 19:33 |
| 64-bit Pari? | CRGreathouse | Software | 2 | 2009-03-13 04:22 |
| Are these commands correct? | jasong | Linux | 2 | 2007-10-18 23:40 |