![]() |
|
|
#1915 |
|
"Forget I exist"
Jul 2009
Dumbassville
26·131 Posts |
Been thinking of this one for a while now. I see the concept hard part is implementing what I know enough lol.
never mind lol I didn't fully get the concept, However I semi get it now. Last fiddled with by science_man_88 on 2010-12-02 at 02:48 |
|
|
|
|
|
#1916 |
|
"Forget I exist"
Jul 2009
Dumbassville
26·131 Posts |
order 6 Sierpinski triangle ?
|
|
|
|
|
|
#1917 |
|
"Forget I exist"
Jul 2009
Dumbassville
203008 Posts |
http://rosettacode.org/wiki/Repeat_a_string
http://rosettacode.org/wiki/Keyboard..._or_N_response http://rosettacode.org/wiki/Reverse_a_string http://rosettacode.org/wiki/Read_entire_file Since when are these not doable in PARI!. Just by looking I know 3 of them and if read(file) does read the full file it covers the last one lol. never mind lol: unenlightening theres a reason. Last fiddled with by science_man_88 on 2010-12-02 at 16:53 |
|
|
|
|
|
#1918 |
|
"Forget I exist"
Jul 2009
Dumbassville
838410 Posts |
Code:
(b)-> {
my(c=0,d=b,a=0);
for(x=1,b,a=random(b);
for(y=1,b,
if(a<=c||a>=d,
a=random(b),
break()
)
);
print("I guess "a" am I h,l,or e ?");
e=Str(input());
if(e=="h",
d=a,
if(e=="l",
c=a,
if(e=="e",
break()
)
)
)
);
}
Code:
if(e=="e",break()) Last fiddled with by science_man_88 on 2010-12-02 at 17:43 |
|
|
|
|
|
#1919 |
|
"Forget I exist"
Jul 2009
Dumbassville
26·131 Posts |
Code:
(b)-> {
my(c=0,d=b,a=0);
for(x=1,b,
a=random(b);
for(y=1,b,
if(a<c||a==c||a==d||a>d,
a=random(b),
break()
)
);
print("I guess "a" am I h,l,or e ?");
g=input();
if(g==h,
d=a,
if(g==l,
c=a,
if(g==e,
break()
)
)
)
);
}
http://rosettacode.org/wiki/Guess_th...edback_(player) The dark orange is a line that can be taken out. Last fiddled with by science_man_88 on 2010-12-02 at 18:07 |
|
|
|
|
|
#1920 |
|
"Forget I exist"
Jul 2009
Dumbassville
26×131 Posts |
http://rosettacode.org/wiki/Conditional_structures
this one is a long list lol; addhelp alias allocatemem apply break default error extern for fordiv forell forprime forstep forsubgroup forvec getheap getrand getstack gettime global if input install kill local my next print print1 printp printp1 printtex quit read readvec return select setrand system trap type until whatnow while write write1 writebin writetex |
|
|
|
|
|
#1921 |
|
"Forget I exist"
Jul 2009
Dumbassville
838410 Posts |
Code:
repeat(string,x)=for(y=1,x,print1(string)) |
|
|
|
|
|
#1922 | |
|
Aug 2006
3×1,993 Posts |
Quote:
Read entire file: Not possible* in GP. It can't distinguish between a file containing 1+1 and a file containing 2, for example. Reverse a string: Unenlightening, as you guessed. But you may very well want to do this one, even though I didn't want to. Get Y/N: Impossible* in GP, since the task requires that only Y or N, not Enter, be pressed. Repeat a string: Unenlightening. Again, feel free to do this anyway. * Not possible without using extern() or system(), as far as I know. |
|
|
|
|
|
|
#1923 | |
|
"Forget I exist"
Jul 2009
Dumbassville
838410 Posts |
Quote:
Code:
reverse(string)=my(v=Vec(Str(string)),c="");forstep(y=#v,1,-1,c=concat(c,v[y]));c |
|
|
|
|
|
|
#1924 |
|
Aug 2006
3·1,993 Posts |
|
|
|
|
|
|
#1925 | |
|
Aug 2006
3×1,993 Posts |
Quote:
You may also want to register on RC so that your contributions show up under your name (or rather your chosen pseudonym) instead of under your IP address. |
|
|
|
|
![]() |
| Thread Tools | |
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 |