Loading

Codegolf & Golfscript の勉強その1

Factorial (by Nabb) - 9 chars


~,1\{)*}/

$ echo -n 1 | golfscript factorial.gs 
1

$ echo -n 4 | golfscript factorial.gs 
24

$ echo -n 6 | golfscript factorial.gs 
720

$ echo -n 10 | golfscript factorial.gs 
3628800

palindrome checker - 11 chars (by Nabb)


~2base.-1%=

$ echo 1 | golfscript codegolf-711-718.gs 
1

$ echo 2 | golfscript codegolf-711-718.gs 
0

$ echo 3 | golfscript codegolf-711-718.gs 
1

$ echo 4 | golfscript codegolf-711-718.gs 
0

$ echo 5 | golfscript codegolf-711-718.gs 
1

$ echo 6 | golfscript codegolf-711-718.gs 
0

completing the symmetrical quarter - 44 chars (mine)


n%{.-1%'/'/{'\\'/'/'*}%'\\'*+}%.-1%{-1%}%+n*

$ cat in
+---
|./.
|/..

$ cat in | golfscript codegolf-761.gs
+------+
|./..\.|
|/....\|
|\..../|
|.\../.|
+------+

# If you interest making your code golfed or want to golf, come and join our new http://codegolf.stackexchange.com

No comments:

က်ေနာ္ဖတ္ေသာ အျခား ဘေလာ့ / ဆိုဒ္မ်ား