From 86c034bb8b31d5bc7b7a0fe8e655e76f80ffa2d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ingy=20d=C3=B6t=20Net?= Date: Wed, 10 Apr 2013 12:38:42 -0700 Subject: [PATCH] new files --- Lang/0815/0DESCRIPTION | 9 + Lang/0815/99-Bottles-of-Beer | 1 + Lang/360-Assembly/0DESCRIPTION | 2 + Lang/360-Assembly/Comments | 1 + Lang/A+/0DESCRIPTION | 8 + Lang/ABAP/0DESCRIPTION | 2 + Lang/ABAP/99-Bottles-of-Beer | 1 + Lang/ABAP/Ackermann-function | 1 + Lang/ABAP/Anagrams | 1 + Lang/ABAP/Detect-division-by-zero | 1 + Lang/ABAP/Quine | 1 + Lang/ACL2/0DESCRIPTION | 10 + Lang/ACL2/99-Bottles-of-Beer | 1 + Lang/ACL2/Arrays | 1 + Lang/ACL2/Binary-search | 1 + Lang/ACL2/Comments | 1 + Lang/ACL2/FizzBuzz | 1 + Lang/ACL2/Knuth-shuffle | 1 + Lang/ACL2/Quine | 1 + Lang/ACL2/Search-a-list | 1 + Lang/AWK/99-Bottles-of-Beer | 1 + Lang/AWK/Ackermann-function | 1 + Lang/AWK/Balanced-brackets | 1 + Lang/AWK/Best-shuffle | 1 + Lang/AWK/Binary-search | 1 + Lang/AWK/Caesar-cipher | 1 + Lang/AWK/Delete-a-file | 1 + Lang/AWK/Determine-if-a-string-is-numeric | 1 + Lang/AWK/Knuth-shuffle | 1 + Lang/AWK/Ordered-words | 1 + Lang/AWK/Search-a-list | 1 + Lang/ActionScript/99-Bottles-of-Beer | 1 + Lang/ActionScript/Ackermann-function | 1 + .../Determine-if-a-string-is-numeric | 1 + Lang/ActionScript/Search-a-list | 1 + Lang/Ada/0DESCRIPTION | 20 ++ Lang/Ada/99-Bottles-of-Beer | 1 + Lang/Ada/Ackermann-function | 1 + Lang/Ada/Anagrams | 1 + Lang/Ada/Arrays | 1 + Lang/Ada/Assertions | 1 + Lang/Ada/Balanced-brackets | 1 + Lang/Ada/Balanced-ternary | 1 + Lang/Ada/Best-shuffle | 1 + Lang/Ada/Binary-search | 1 + Lang/Ada/Binary-strings | 1 + Lang/Ada/Bulls-and-cows | 1 + Lang/Ada/Caesar-cipher | 1 + Lang/Ada/Calendar | 1 + Lang/Ada/Check-that-file-exists | 1 + Lang/Ada/Checkpoint-synchronization | 1 + Lang/Ada/Classes | 1 + Lang/Ada/Closest-pair-problem | 1 + Lang/Ada/Collections | 1 + Lang/Ada/Comments | 1 + Lang/Ada/Define-a-primitive-data-type | 1 + Lang/Ada/Delegates | 1 + Lang/Ada/Delete-a-file | 1 + Lang/Ada/Detect-division-by-zero | 1 + Lang/Ada/Determine-if-a-string-is-numeric | 1 + Lang/Ada/Entropy | 1 + Lang/Ada/FizzBuzz | 1 + Lang/Ada/Forest-fire | 1 + Lang/Ada/Infinity | 1 + Lang/Ada/JSON | 1 + Lang/Ada/Knuth-shuffle | 1 + Lang/Ada/Narcissist | 1 + Lang/Ada/Ordered-words | 1 + Lang/Ada/Pi | 1 + Lang/Ada/Quine | 1 + Lang/Ada/Search-a-list | 1 + Lang/BASIC/99-Bottles-of-Beer | 1 + Lang/BASIC/Ackermann-function | 1 + Lang/BASIC/Balanced-brackets | 1 + Lang/BASIC/Binary-search | 1 + Lang/BASIC/Binary-strings | 1 + Lang/BASIC/Bulls-and-cows | 1 + Lang/BASIC/Check-that-file-exists | 1 + Lang/BASIC/Color-of-a-screen-pixel | 1 + Lang/BASIC/Delete-a-file | 1 + Lang/BASIC/Determine-if-a-string-is-numeric | 1 + Lang/BASIC/Knuth-shuffle | 1 + Lang/BASIC/Search-a-list | 1 + Lang/Babel/99-Bottles-of-Beer | 1 + Lang/Babel/Ackermann-function | 1 + Lang/Befunge/99-Bottles-of-Beer | 1 + Lang/Befunge/Ackermann-function | 1 + Lang/Befunge/Balanced-brackets | 1 + Lang/C/99-Bottles-of-Beer | 1 + Lang/C/Ackermann-function | 1 + Lang/C/Balanced-brackets | 1 + Lang/C/Best-shuffle | 1 + Lang/C/Binary-search | 1 + Lang/C/Binary-strings | 1 + Lang/C/Bulls-and-cows | 1 + Lang/C/Caesar-cipher | 1 + Lang/C/Check-that-file-exists | 1 + Lang/C/Checkpoint-synchronization | 1 + Lang/C/Color-of-a-screen-pixel | 1 + Lang/C/Death-Star | 1 + Lang/C/Delete-a-file | 1 + Lang/C/Detect-division-by-zero | 1 + Lang/C/Determine-if-a-string-is-numeric | 1 + Lang/C/Forest-fire | 1 + Lang/C/Knuth-shuffle | 1 + Lang/C/Ordered-words | 1 + Lang/C/Search-a-list | 1 + Lang/Clojure/99-Bottles-of-Beer | 1 + Lang/Clojure/Ackermann-function | 1 + Lang/Clojure/Balanced-brackets | 1 + Lang/Clojure/Best-shuffle | 1 + Lang/Clojure/Binary-search | 1 + Lang/Clojure/Bulls-and-cows | 1 + Lang/Clojure/Caesar-cipher | 1 + Lang/Clojure/Check-that-file-exists | 1 + Lang/Clojure/Closest-pair-problem | 1 + Lang/Clojure/Color-of-a-screen-pixel | 1 + Lang/Clojure/Delete-a-file | 1 + Lang/Clojure/Detect-division-by-zero | 1 + Lang/Clojure/Determine-if-a-string-is-numeric | 1 + Lang/Clojure/Forest-fire | 1 + Lang/Clojure/Knuth-shuffle | 1 + Lang/Clojure/Search-a-list | 1 + Lang/CoffeeScript/99-Bottles-of-Beer | 1 + Lang/CoffeeScript/Ackermann-function | 1 + Lang/CoffeeScript/Balanced-brackets | 1 + Lang/CoffeeScript/Binary-search | 1 + Lang/CoffeeScript/Caesar-cipher | 1 + .../Determine-if-a-string-is-numeric | 1 + Lang/CoffeeScript/Knuth-shuffle | 1 + Lang/CoffeeScript/Ordered-words | 1 + Lang/Dylan/99-Bottles-of-Beer | 1 + Lang/Dylan/Ackermann-function | 1 + Lang/Eiffel/Ackermann-function | 1 + Lang/Eiffel/Detect-division-by-zero | 1 + Lang/Erlang/99-Bottles-of-Beer | 1 + Lang/Erlang/Ackermann-function | 1 + Lang/Erlang/Balanced-ternary | 1 + Lang/Erlang/Binary-search | 1 + Lang/Erlang/Bulls-and-cows | 1 + Lang/Erlang/Caesar-cipher | 1 + Lang/Erlang/Check-that-file-exists | 1 + Lang/Erlang/Delete-a-file | 1 + Lang/Erlang/Detect-division-by-zero | 1 + Lang/Erlang/Determine-if-a-string-is-numeric | 1 + Lang/Erlang/Search-a-list | 1 + Lang/Forth/99-Bottles-of-Beer | 1 + Lang/Forth/Ackermann-function | 1 + Lang/Forth/Balanced-brackets | 1 + Lang/Forth/Binary-search | 1 + Lang/Forth/Binary-strings | 1 + Lang/Forth/Bulls-and-cows | 1 + Lang/Forth/Caesar-cipher | 1 + Lang/Forth/Check-that-file-exists | 1 + Lang/Forth/Delete-a-file | 1 + Lang/Forth/Detect-division-by-zero | 1 + Lang/Forth/Determine-if-a-string-is-numeric | 1 + Lang/Forth/Knuth-shuffle | 1 + Lang/Forth/Ordered-words | 1 + Lang/Forth/Search-a-list | 1 + Lang/Fortran/99-Bottles-of-Beer | 1 + Lang/Fortran/Ackermann-function | 1 + Lang/Fortran/Binary-search | 1 + Lang/Fortran/Bulls-and-cows | 1 + Lang/Fortran/Caesar-cipher | 1 + Lang/Fortran/Check-that-file-exists | 1 + Lang/Fortran/Define-a-primitive-data-type | 1 + Lang/Fortran/Delete-a-file | 1 + Lang/Fortran/Determine-if-a-string-is-numeric | 1 + Lang/Fortran/Forest-fire | 1 + Lang/Fortran/Knuth-shuffle | 1 + Lang/Fortran/Ordered-words | 1 + Lang/Fortran/Search-a-list | 1 + Lang/Go/99-Bottles-of-Beer | 1 + Lang/Go/Ackermann-function | 1 + Lang/Go/Balanced-brackets | 1 + Lang/Go/Balanced-ternary | 1 + Lang/Go/Best-shuffle | 1 + Lang/Go/Binary-search | 1 + Lang/Go/Binary-strings | 1 + Lang/Go/Bulls-and-cows | 1 + Lang/Go/Caesar-cipher | 1 + Lang/Go/Check-that-file-exists | 1 + Lang/Go/Checkpoint-synchronization | 1 + Lang/Go/Closest-pair-problem | 1 + Lang/Go/Death-Star | 1 + Lang/Go/Delete-a-file | 1 + Lang/Go/Detect-division-by-zero | 1 + Lang/Go/Determine-if-a-string-is-numeric | 1 + Lang/Go/Forest-fire | 1 + Lang/Go/Knuth-shuffle | 1 + Lang/Go/Ordered-words | 1 + Lang/Go/Search-a-list | 1 + Lang/Haskell/99-Bottles-of-Beer | 1 + Lang/Haskell/Ackermann-function | 1 + Lang/Haskell/Balanced-brackets | 1 + Lang/Haskell/Balanced-ternary | 1 + Lang/Haskell/Best-shuffle | 1 + Lang/Haskell/Binary-search | 1 + Lang/Haskell/Binary-strings | 1 + Lang/Haskell/Bulls-and-cows | 1 + Lang/Haskell/Caesar-cipher | 1 + Lang/Haskell/Check-that-file-exists | 1 + Lang/Haskell/Checkpoint-synchronization | 1 + Lang/Haskell/Closest-pair-problem | 1 + Lang/Haskell/Define-a-primitive-data-type | 1 + Lang/Haskell/Delete-a-file | 1 + Lang/Haskell/Detect-division-by-zero | 1 + Lang/Haskell/Determine-if-a-string-is-numeric | 1 + Lang/Haskell/Forest-fire | 1 + Lang/Haskell/Knuth-shuffle | 1 + Lang/Haskell/Ordered-words | 1 + Lang/Haskell/Search-a-list | 1 + Lang/Java/99-Bottles-of-Beer | 1 + Lang/Java/Ackermann-function | 1 + Lang/Java/Balanced-brackets | 1 + Lang/Java/Best-shuffle | 1 + Lang/Java/Binary-search | 1 + Lang/Java/Bulls-and-cows | 1 + Lang/Java/Caesar-cipher | 1 + Lang/Java/Check-that-file-exists | 1 + Lang/Java/Checkpoint-synchronization | 1 + Lang/Java/Closest-pair-problem | 1 + Lang/Java/Color-of-a-screen-pixel | 1 + Lang/Java/Define-a-primitive-data-type | 1 + Lang/Java/Delete-a-file | 1 + Lang/Java/Detect-division-by-zero | 1 + Lang/Java/Determine-if-a-string-is-numeric | 1 + Lang/Java/Forest-fire | 1 + Lang/Java/Knuth-shuffle | 1 + Lang/Java/Ordered-words | 1 + Lang/Java/Search-a-list | 1 + Lang/JavaScript/99-Bottles-of-Beer | 1 + Lang/JavaScript/Ackermann-function | 1 + Lang/JavaScript/Balanced-brackets | 1 + Lang/JavaScript/Best-shuffle | 1 + Lang/JavaScript/Binary-search | 1 + Lang/JavaScript/Bulls-and-cows | 1 + Lang/JavaScript/Caesar-cipher | 1 + Lang/JavaScript/Check-that-file-exists | 1 + Lang/JavaScript/Closest-pair-problem | 1 + Lang/JavaScript/Define-a-primitive-data-type | 1 + Lang/JavaScript/Delete-a-file | 1 + Lang/JavaScript/Detect-division-by-zero | 1 + .../Determine-if-a-string-is-numeric | 1 + Lang/JavaScript/Forest-fire | 1 + Lang/JavaScript/Knuth-shuffle | 1 + Lang/JavaScript/Ordered-words | 1 + Lang/JavaScript/Search-a-list | 1 + Lang/LaTeX/99-Bottles-of-Beer | 1 + Lang/Lua/99-Bottles-of-Beer | 1 + Lang/Lua/Ackermann-function | 1 + Lang/Lua/Balanced-brackets | 1 + Lang/Lua/Binary-search | 1 + Lang/Lua/Binary-strings | 1 + Lang/Lua/Bulls-and-cows | 1 + Lang/Lua/Caesar-cipher | 1 + Lang/Lua/Check-that-file-exists | 1 + Lang/Lua/Delete-a-file | 1 + Lang/Lua/Detect-division-by-zero | 1 + Lang/Lua/Determine-if-a-string-is-numeric | 1 + Lang/Lua/Knuth-shuffle | 1 + Lang/Lua/Ordered-words | 1 + Lang/Lua/Search-a-list | 1 + Lang/PHP/99-Bottles-of-Beer | 1 + Lang/PHP/Ackermann-function | 1 + Lang/PHP/Best-shuffle | 1 + Lang/PHP/Binary-search | 1 + Lang/PHP/Bulls-and-cows | 1 + Lang/PHP/Caesar-cipher | 1 + Lang/PHP/Check-that-file-exists | 1 + Lang/PHP/Color-of-a-screen-pixel | 1 + Lang/PHP/Delete-a-file | 1 + Lang/PHP/Detect-division-by-zero | 1 + Lang/PHP/Determine-if-a-string-is-numeric | 1 + Lang/PHP/Knuth-shuffle | 1 + Lang/PHP/Search-a-list | 1 + Lang/PIR/99-Bottles-of-Beer | 1 + Lang/Perl/99-Bottles-of-Beer | 1 + Lang/Perl/Ackermann-function | 1 + Lang/Perl/Balanced-brackets | 1 + Lang/Perl/Best-shuffle | 1 + Lang/Perl/Binary-search | 1 + Lang/Perl/Bulls-and-cows | 1 + Lang/Perl/Caesar-cipher | 1 + Lang/Perl/Check-that-file-exists | 1 + Lang/Perl/Checkpoint-synchronization | 1 + Lang/Perl/Closest-pair-problem | 1 + Lang/Perl/Death-Star | 1 + Lang/Perl/Define-a-primitive-data-type | 1 + Lang/Perl/Delete-a-file | 1 + Lang/Perl/Detect-division-by-zero | 1 + Lang/Perl/Determine-if-a-string-is-numeric | 1 + Lang/Perl/Forest-fire | 1 + Lang/Perl/Knuth-shuffle | 1 + Lang/Perl/Ordered-words | 1 + Lang/Perl/Search-a-list | 1 + Lang/PicoLisp/99-Bottles-of-Beer | 1 + Lang/PicoLisp/Ackermann-function | 1 + Lang/PicoLisp/Balanced-brackets | 1 + Lang/PicoLisp/Best-shuffle | 1 + Lang/PicoLisp/Binary-search | 1 + Lang/PicoLisp/Binary-strings | 1 + Lang/PicoLisp/Bulls-and-cows | 1 + Lang/PicoLisp/Caesar-cipher | 1 + Lang/PicoLisp/Check-that-file-exists | 1 + Lang/PicoLisp/Checkpoint-synchronization | 1 + Lang/PicoLisp/Closest-pair-problem | 1 + Lang/PicoLisp/Color-of-a-screen-pixel | 1 + Lang/PicoLisp/Define-a-primitive-data-type | 1 + Lang/PicoLisp/Delete-a-file | 1 + Lang/PicoLisp/Detect-division-by-zero | 1 + .../PicoLisp/Determine-if-a-string-is-numeric | 1 + Lang/PicoLisp/Forest-fire | 1 + Lang/PicoLisp/Knuth-shuffle | 1 + Lang/PicoLisp/Ordered-words | 1 + Lang/PicoLisp/Search-a-list | 1 + Lang/Prolog/99-Bottles-of-Beer | 1 + Lang/Prolog/Ackermann-function | 1 + Lang/Prolog/Balanced-brackets | 1 + Lang/Prolog/Balanced-ternary | 1 + Lang/Prolog/Best-shuffle | 1 + Lang/Prolog/Bulls-and-cows | 1 + Lang/Prolog/Caesar-cipher | 1 + Lang/Prolog/Ordered-words | 1 + Lang/Prolog/Search-a-list | 1 + Lang/Python/99-Bottles-of-Beer | 1 + Lang/Python/Ackermann-function | 1 + Lang/Python/Balanced-brackets | 1 + Lang/Python/Balanced-ternary | 1 + Lang/Python/Best-shuffle | 1 + Lang/Python/Binary-search | 1 + Lang/Python/Binary-strings | 1 + Lang/Python/Bulls-and-cows | 1 + Lang/Python/Caesar-cipher | 1 + Lang/Python/Check-that-file-exists | 1 + Lang/Python/Closest-pair-problem | 1 + Lang/Python/Color-of-a-screen-pixel | 1 + Lang/Python/Death-Star | 1 + Lang/Python/Define-a-primitive-data-type | 1 + Lang/Python/Delete-a-file | 1 + Lang/Python/Detect-division-by-zero | 1 + Lang/Python/Determine-if-a-string-is-numeric | 1 + Lang/Python/Forest-fire | 1 + Lang/Python/Knuth-shuffle | 1 + Lang/Python/Ordered-words | 1 + Lang/Python/Search-a-list | 1 + Lang/R/99-Bottles-of-Beer | 1 + Lang/R/Ackermann-function | 1 + Lang/R/Balanced-brackets | 1 + Lang/R/Binary-search | 1 + Lang/R/Bulls-and-cows | 1 + Lang/R/Check-that-file-exists | 1 + Lang/R/Closest-pair-problem | 1 + Lang/R/Delete-a-file | 1 + Lang/R/Detect-division-by-zero | 1 + Lang/R/Determine-if-a-string-is-numeric | 1 + Lang/R/Knuth-shuffle | 1 + Lang/R/Search-a-list | 1 + Lang/REXX/99-Bottles-of-Beer | 1 + Lang/REXX/Ackermann-function | 1 + Lang/REXX/Balanced-brackets | 1 + Lang/REXX/Balanced-ternary | 1 + Lang/REXX/Best-shuffle | 1 + Lang/REXX/Binary-search | 1 + Lang/REXX/Binary-strings | 1 + Lang/REXX/Bulls-and-cows | 1 + Lang/REXX/Caesar-cipher | 1 + Lang/REXX/Closest-pair-problem | 1 + Lang/REXX/Death-Star | 1 + Lang/REXX/Detect-division-by-zero | 1 + Lang/REXX/Determine-if-a-string-is-numeric | 1 + Lang/REXX/Forest-fire | 1 + Lang/REXX/Knuth-shuffle | 1 + Lang/REXX/Ordered-words | 1 + Lang/REXX/Search-a-list | 1 + Lang/Racket/99-Bottles-of-Beer | 1 + Lang/Racket/Ackermann-function | 1 + Lang/Racket/Balanced-brackets | 1 + Lang/Racket/Best-shuffle | 1 + Lang/Racket/Binary-search | 1 + Lang/Racket/Binary-strings | 1 + Lang/Racket/Caesar-cipher | 1 + Lang/Racket/Define-a-primitive-data-type | 1 + Lang/Racket/Detect-division-by-zero | 1 + Lang/Racket/Determine-if-a-string-is-numeric | 1 + Lang/Racket/Forest-fire | 1 + Lang/Racket/Search-a-list | 1 + Lang/Ruby/99-Bottles-of-Beer | 1 + Lang/Ruby/Ackermann-function | 1 + Lang/Ruby/Balanced-brackets | 1 + Lang/Ruby/Balanced-ternary | 1 + Lang/Ruby/Binary-search | 1 + Lang/Ruby/Binary-strings | 1 + Lang/Ruby/Bulls-and-cows | 1 + Lang/Ruby/Caesar-cipher | 1 + Lang/Ruby/Check-that-file-exists | 1 + Lang/Ruby/Checkpoint-synchronization | 1 + Lang/Ruby/Closest-pair-problem | 1 + Lang/Ruby/Define-a-primitive-data-type | 1 + Lang/Ruby/Delete-a-file | 1 + Lang/Ruby/Detect-division-by-zero | 1 + Lang/Ruby/Determine-if-a-string-is-numeric | 1 + Lang/Ruby/Forest-fire | 1 + Lang/Ruby/Knuth-shuffle | 1 + Lang/Ruby/Ordered-words | 1 + Lang/Ruby/Search-a-list | 1 + Lang/SNUSP/99-Bottles-of-Beer | 1 + Lang/SNUSP/Ackermann-function | 1 + Lang/Sather/99-Bottles-of-Beer | 1 + Lang/Sather/Ackermann-function | 1 + Lang/Sather/Forest-fire | 1 + Lang/Sather/Search-a-list | 1 + Lang/Scala/Ackermann-function | 1 + Lang/Scala/Balanced-brackets | 1 + Lang/Scala/Binary-search | 1 + Lang/Scala/Bulls-and-cows | 1 + Lang/Scala/Caesar-cipher | 1 + Lang/Scala/Closest-pair-problem | 1 + Lang/Scala/Detect-division-by-zero | 1 + Lang/Scala/Determine-if-a-string-is-numeric | 1 + Lang/Scala/Forest-fire | 1 + Lang/Scala/Knuth-shuffle | 1 + Lang/Scala/Search-a-list | 1 + Lang/Scheme/99-Bottles-of-Beer | 1 + Lang/Scheme/Ackermann-function | 1 + Lang/Scheme/Balanced-brackets | 1 + Lang/Scheme/Best-shuffle | 1 + Lang/Scheme/Binary-search | 1 + Lang/Scheme/Bulls-and-cows | 1 + Lang/Scheme/Check-that-file-exists | 1 + Lang/Scheme/Delete-a-file | 1 + Lang/Scheme/Determine-if-a-string-is-numeric | 1 + Lang/Scheme/Knuth-shuffle | 1 + Lang/Scheme/Ordered-words | 1 + Lang/Scheme/Search-a-list | 1 + Lang/Smalltalk/99-Bottles-of-Beer | 1 + Lang/Smalltalk/Ackermann-function | 1 + Lang/Smalltalk/Bulls-and-cows | 1 + Lang/Smalltalk/Caesar-cipher | 1 + Lang/Smalltalk/Check-that-file-exists | 1 + Lang/Smalltalk/Delete-a-file | 1 + Lang/Smalltalk/Detect-division-by-zero | 1 + .../Determine-if-a-string-is-numeric | 1 + Lang/Smalltalk/Knuth-shuffle | 1 + Lang/Smalltalk/Ordered-words | 1 + Lang/Smalltalk/Search-a-list | 1 + Lang/Tcl/99-Bottles-of-Beer | 1 + Lang/Tcl/Ackermann-function | 1 + Lang/Tcl/Balanced-brackets | 1 + Lang/Tcl/Balanced-ternary | 1 + Lang/Tcl/Best-shuffle | 1 + Lang/Tcl/Binary-search | 1 + Lang/Tcl/Binary-strings | 1 + Lang/Tcl/Bulls-and-cows | 1 + Lang/Tcl/Caesar-cipher | 1 + Lang/Tcl/Check-that-file-exists | 1 + Lang/Tcl/Checkpoint-synchronization | 1 + Lang/Tcl/Closest-pair-problem | 1 + Lang/Tcl/Color-of-a-screen-pixel | 1 + Lang/Tcl/Death-Star | 1 + Lang/Tcl/Define-a-primitive-data-type | 1 + Lang/Tcl/Delete-a-file | 1 + Lang/Tcl/Detect-division-by-zero | 1 + Lang/Tcl/Determine-if-a-string-is-numeric | 1 + Lang/Tcl/Forest-fire | 1 + Lang/Tcl/Knuth-shuffle | 1 + Lang/Tcl/Ordered-words | 1 + Lang/Tcl/Search-a-list | 1 + Meta/00Langs.yaml | 221 ++++++++++++++++ Meta/00Tasks.yaml | 153 +++++++++++ .../0815/99-bottles-of-beer.0815 | 25 ++ Task/99-Bottles-of-Beer/0DESCRIPTION | 13 + .../ABAP/99-bottles-of-beer.abap | 18 ++ .../ACL2/99-bottles-of-beer.acl2 | 14 + .../AWK/99-bottles-of-beer.awk | 7 + .../ActionScript/99-bottles-of-beer.as | 7 + .../Ada/99-bottles-of-beer-1.ada | 12 + .../Ada/99-bottles-of-beer-2.ada | 39 +++ .../BASIC/99-bottles-of-beer-1.bas | 12 + .../BASIC/99-bottles-of-beer-2.bas | 7 + .../Babel/99-bottles-of-beer.pb | 17 ++ .../Befunge/99-bottles-of-beer.bf | 11 + .../C/99-bottles-of-beer-1.c | 15 ++ .../C/99-bottles-of-beer-2.c | 5 + .../C/99-bottles-of-beer-3.c | 30 +++ .../C/99-bottles-of-beer-4.c | 35 +++ .../Clojure/99-bottles-of-beer.clj | 14 + .../CoffeeScript/99-bottles-of-beer-1.coffee | 9 + .../CoffeeScript/99-bottles-of-beer-2.coffee | 4 + .../CoffeeScript/99-bottles-of-beer-3.coffee | 1 + .../CoffeeScript/99-bottles-of-beer-4.coffee | 1 + .../Dylan/99-bottles-of-beer.dylan | 10 + .../Erlang/99-bottles-of-beer.erl | 39 +++ .../Forth/99-bottles-of-beer.fth | 14 + .../Fortran/99-bottles-of-beer.f | 24 ++ .../Go/99-bottles-of-beer.go | 18 ++ .../Haskell/99-bottles-of-beer-1.hs | 7 + .../Haskell/99-bottles-of-beer-2.hs | 16 ++ .../Haskell/99-bottles-of-beer-3.hs | 28 ++ .../Java/99-bottles-of-beer-1.java | 20 ++ .../Java/99-bottles-of-beer-2.java | 16 ++ .../Java/99-bottles-of-beer-3.java | 40 +++ .../JavaScript/99-bottles-of-beer-1.js | 10 + .../JavaScript/99-bottles-of-beer-2.js | 2 + .../JavaScript/99-bottles-of-beer-3.js | 21 ++ .../JavaScript/99-bottles-of-beer-4.js | 18 ++ .../LaTeX/99-bottles-of-beer-1.tex | 20 ++ .../LaTeX/99-bottles-of-beer-2.tex | 23 ++ .../Lua/99-bottles-of-beer.lua | 11 + .../PHP/99-bottles-of-beer-1.php | 15 ++ .../PHP/99-bottles-of-beer-2.php | 13 + .../PHP/99-bottles-of-beer-3.php | 18 ++ .../PHP/99-bottles-of-beer-4.php | 7 + .../PIR/99-bottles-of-beer.pir | 31 +++ .../Perl/99-bottles-of-beer-1.pl | 18 ++ .../Perl/99-bottles-of-beer-2.pl | 6 + .../Perl/99-bottles-of-beer-3.pl | 14 + .../Perl/99-bottles-of-beer-4.pl | 16 ++ .../PicoLisp/99-bottles-of-beer.l | 12 + .../Prolog/99-bottles-of-beer-1.pro | 10 + .../Prolog/99-bottles-of-beer-2.pro | 19 ++ .../Python/99-bottles-of-beer-1.py | 14 + .../Python/99-bottles-of-beer-2.py | 9 + .../Python/99-bottles-of-beer-3.py | 9 + .../Python/99-bottles-of-beer-4.py | 2 + .../Python/99-bottles-of-beer-5.py | 2 + .../Python/99-bottles-of-beer-6.py | 14 + .../Python/99-bottles-of-beer-7.py | 39 +++ .../Python/99-bottles-of-beer-8.py | 7 + .../R/99-bottles-of-beer-1.r | 16 ++ .../R/99-bottles-of-beer-2.r | 5 + .../REXX/99-bottles-of-beer.rexx | 19 ++ .../Racket/99-bottles-of-beer.rkt | 11 + .../Ruby/99-bottles-of-beer-1.rb | 13 + .../Ruby/99-bottles-of-beer-2.rb | 12 + .../Ruby/99-bottles-of-beer-3.rb | 15 ++ .../Ruby/99-bottles-of-beer-4.rb | 14 + .../SNUSP/99-bottles-of-beer.snusp | 19 ++ .../Sather/99-bottles-of-beer.sa | 14 + .../Scheme/99-bottles-of-beer.ss | 7 + .../Smalltalk/99-bottles-of-beer.st | 15 ++ .../Tcl/99-bottles-of-beer-1.tcl | 10 + .../Tcl/99-bottles-of-beer-2.tcl | 28 ++ Task/Ackermann-function/0DESCRIPTION | 12 + Task/Ackermann-function/1META.yaml | 5 + .../ABAP/ackermann-function.abap | 45 ++++ .../AWK/ackermann-function.awk | 18 ++ .../ActionScript/ackermann-function.as | 13 + .../Ada/ackermann-function.ada | 21 ++ .../BASIC/ackermann-function.bas | 12 + .../Babel/ackermann-function.pb | 53 ++++ .../Befunge/ackermann-function.bf | 8 + .../C/ackermann-function-1.c | 18 ++ .../C/ackermann-function-2.c | 41 +++ .../Clojure/ackermann-function.clj | 4 + .../CoffeeScript/ackermann-function.coffee | 4 + .../Dylan/ackermann-function.dylan | 6 + .../Eiffel/ackermann-function.e | 41 +++ .../Erlang/ackermann-function.erl | 11 + .../Forth/ackermann-function-1.fth | 5 + .../Forth/ackermann-function-2.fth | 14 + .../Fortran/ackermann-function.f | 27 ++ .../Go/ackermann-function-1.go | 9 + .../Go/ackermann-function-2.go | 15 ++ .../Go/ackermann-function-3.go | 53 ++++ .../Haskell/ackermann-function-1.hs | 3 + .../Haskell/ackermann-function-2.hs | 9 + .../Java/ackermann-function.java | 8 + .../JavaScript/ackermann-function.js | 4 + .../Lua/ackermann-function.lua | 5 + .../PHP/ackermann-function.php | 15 ++ .../Perl/ackermann-function-1.pl | 13 + .../Perl/ackermann-function-2.pl | 6 + .../Perl/ackermann-function-3.pl | 6 + .../PicoLisp/ackermann-function.l | 5 + .../Prolog/ackermann-function.pro | 3 + .../Python/ackermann-function-1.py | 3 + .../Python/ackermann-function-2.py | 7 + .../Python/ackermann-function-3.py | 10 + .../Python/ackermann-function-4.py | 6 + .../R/ackermann-function-1.r | 9 + .../R/ackermann-function-2.r | 3 + .../REXX/ackermann-function-1.rexx | 25 ++ .../REXX/ackermann-function-2.rexx | 21 ++ .../REXX/ackermann-function-3.rexx | 36 +++ .../Racket/ackermann-function.rkt | 7 + .../Ruby/ackermann-function-1.rb | 9 + .../Ruby/ackermann-function-2.rb | 4 + .../SNUSP/ackermann-function.snusp | 12 + .../Sather/ackermann-function-1.sa | 19 ++ .../Sather/ackermann-function-2.sa | 19 ++ .../Scala/ackermann-function-1.scala | 5 + .../Scala/ackermann-function-2.scala | 2 + .../Scala/ackermann-function-3.scala | 40 +++ .../Scala/ackermann-function-4.scala | 5 + .../Scheme/ackermann-function.ss | 5 + .../Smalltalk/ackermann-function.st | 15 ++ .../Tcl/ackermann-function-1.tcl | 9 + .../Tcl/ackermann-function-2.tcl | 9 + .../Tcl/ackermann-function-3.tcl | 55 ++++ Task/Anagrams/ABAP/anagrams.abap | 102 +++++++ Task/Anagrams/Ada/anagrams.ada | 69 +++++ Task/Anagrams/C/anagrams-1.c | 160 +++++++++++ Task/Anagrams/CoffeeScript/anagrams-1.coffee | 31 +++ Task/Anagrams/Go/anagrams-1.go | 39 +++ Task/Anagrams/Perl/anagrams-1.pl | 15 ++ Task/Anagrams/PicoLisp/anagrams-1.l | 4 + Task/Anagrams/Python/anagrams-1.py | 12 + Task/Anagrams/Racket/anagrams-1.rkt | 21 ++ Task/Anagrams/Ruby/anagrams-1.rb | 17 ++ Task/Anagrams/Scala/anagrams-1.scala | 4 + Task/Anagrams/Smalltalk/anagrams-1.st | 7 + Task/Arrays/ACL2/arrays.acl2 | 15 ++ Task/Arrays/Ada/arrays.ada | 43 +++ Task/Arrays/BASIC/arrays-1.bas | 2 + Task/Arrays/C/arrays-1.c | 2 + Task/Arrays/CoffeeScript/arrays-1.coffee | 8 + Task/Arrays/Forth/arrays-1.fth | 7 + Task/Arrays/Fortran/arrays-1.f | 1 + Task/Arrays/Java/arrays-1.java | 3 + Task/Arrays/PHP/arrays-1.php | 2 + Task/Arrays/PicoLisp/arrays-1.l | 2 + Task/Arrays/Prolog/arrays-1.pro | 9 + Task/Arrays/Python/arrays-1.py | 8 + Task/Arrays/REXX/arrays-1.rexx | 9 + Task/Arrays/Scala/arrays-1.scala | 11 + Task/Arrays/Smalltalk/arrays-1.st | 1 + Task/Arrays/Tcl/arrays-1.tcl | 8 + Task/Assertions/Ada/assertions-1.ada | 1 + Task/Assertions/Ada/assertions-2.ada | 3 + Task/Assertions/C/assertions-1.c | 9 + Task/Assertions/Eiffel/assertions-1.e | 12 + Task/Assertions/Perl/assertions-1.pl | 1 + Task/Assertions/PicoLisp/assertions-1.l | 3 + Task/Assertions/Racket/assertions-1.rkt | 13 + Task/Assertions/Scala/assertions-1.scala | 4 + Task/Assertions/Smalltalk/assertions-1.st | 3 + Task/Balanced-brackets/0DESCRIPTION | 10 + .../AWK/balanced-brackets.awk | 21 ++ .../Ada/balanced-brackets.ada | 57 ++++ .../BASIC/balanced-brackets.bas | 57 ++++ .../Befunge/balanced-brackets.bf | 7 + .../Balanced-brackets/C/balanced-brackets-1.c | 43 +++ .../Balanced-brackets/C/balanced-brackets-2.c | 9 + .../Clojure/balanced-brackets.clj | 28 ++ .../CoffeeScript/balanced-brackets-1.coffee | 15 ++ .../CoffeeScript/balanced-brackets-2.coffee | 17 ++ .../Forth/balanced-brackets.fth | 23 ++ .../Balanced-brackets/Go/balanced-brackets.go | 55 ++++ .../Haskell/balanced-brackets-1.hs | 29 ++ .../Haskell/balanced-brackets-2.hs | 20 ++ .../Java/balanced-brackets.java | 50 ++++ .../JavaScript/balanced-brackets-1.js | 43 +++ .../JavaScript/balanced-brackets-2.js | 29 ++ .../Lua/balanced-brackets.lua | 20 ++ .../Perl/balanced-brackets-1.pl | 13 + .../Perl/balanced-brackets-2.pl | 10 + .../PicoLisp/balanced-brackets.l | 17 ++ .../Prolog/balanced-brackets.pro | 52 ++++ .../Python/balanced-brackets.py | 27 ++ .../Balanced-brackets/R/balanced-brackets-1.r | 5 + .../Balanced-brackets/R/balanced-brackets-2.r | 3 + .../Balanced-brackets/R/balanced-brackets-3.r | 6 + .../Balanced-brackets/R/balanced-brackets-4.r | 11 + .../REXX/balanced-brackets-1.rexx | 40 +++ .../REXX/balanced-brackets-2.rexx | 67 +++++ .../REXX/balanced-brackets-3.rexx | 58 ++++ .../Racket/balanced-brackets.rkt | 17 ++ .../Ruby/balanced-brackets.rb | 24 ++ .../Scala/balanced-brackets.scala | 36 +++ .../Scheme/balanced-brackets.ss | 23 ++ .../Tcl/balanced-brackets-1.tcl | 28 ++ .../Tcl/balanced-brackets-2.tcl | 8 + Task/Balanced-ternary/0DESCRIPTION | 16 ++ .../Ada/balanced-ternary-1.ada | 47 ++++ .../Ada/balanced-ternary-2.ada | 181 +++++++++++++ .../Ada/balanced-ternary-3.ada | 19 ++ .../Erlang/balanced-ternary-1.erl | 89 +++++++ .../Erlang/balanced-ternary-2.erl | 6 + Task/Balanced-ternary/Go/balanced-ternary.go | 224 ++++++++++++++++ .../Haskell/balanced-ternary.hs | 62 +++++ .../Prolog/balanced-ternary-1.pro | 67 +++++ .../Prolog/balanced-ternary-2.pro | 123 +++++++++ .../Prolog/balanced-ternary-3.pro | 170 ++++++++++++ .../Python/balanced-ternary.py | 95 +++++++ .../REXX/balanced-ternary.rexx | 55 ++++ .../Balanced-ternary/Ruby/balanced-ternary.rb | 128 +++++++++ .../Tcl/balanced-ternary-1.tcl | 57 ++++ .../Tcl/balanced-ternary-2.tcl | 10 + Task/Best-shuffle/0DESCRIPTION | 11 + Task/Best-shuffle/AWK/best-shuffle-1.awk | 40 +++ Task/Best-shuffle/AWK/best-shuffle-2.awk | 79 ++++++ Task/Best-shuffle/AWK/best-shuffle-3.awk | 7 + Task/Best-shuffle/Ada/best-shuffle.ada | 42 +++ Task/Best-shuffle/C/best-shuffle-1.c | 111 ++++++++ Task/Best-shuffle/C/best-shuffle-2.c | 106 ++++++++ Task/Best-shuffle/C/best-shuffle-3.c | 5 + Task/Best-shuffle/C/best-shuffle-4.c | 36 +++ Task/Best-shuffle/Clojure/best-shuffle.clj | 54 ++++ Task/Best-shuffle/Go/best-shuffle.go | 37 +++ Task/Best-shuffle/Haskell/best-shuffle-1.hs | 33 +++ Task/Best-shuffle/Haskell/best-shuffle-2.hs | 2 + Task/Best-shuffle/Java/best-shuffle.java | 36 +++ .../Best-shuffle/JavaScript/best-shuffle-1.js | 47 ++++ .../Best-shuffle/JavaScript/best-shuffle-2.js | 7 + .../Best-shuffle/JavaScript/best-shuffle-3.js | 6 + Task/Best-shuffle/PHP/best-shuffle.php | 25 ++ Task/Best-shuffle/Perl/best-shuffle.pl | 38 +++ Task/Best-shuffle/PicoLisp/best-shuffle.l | 14 + Task/Best-shuffle/Prolog/best-shuffle.pro | 74 ++++++ Task/Best-shuffle/Python/best-shuffle-1.py | 28 ++ Task/Best-shuffle/Python/best-shuffle-2.py | 50 ++++ Task/Best-shuffle/REXX/best-shuffle-1.rexx | 42 +++ Task/Best-shuffle/REXX/best-shuffle-2.rexx | 37 +++ Task/Best-shuffle/REXX/best-shuffle-3.rexx | 25 ++ Task/Best-shuffle/Racket/best-shuffle.rkt | 20 ++ Task/Best-shuffle/Scheme/best-shuffle.ss | 65 +++++ Task/Best-shuffle/Tcl/best-shuffle-1.tcl | 21 ++ Task/Best-shuffle/Tcl/best-shuffle-2.tcl | 3 + Task/Binary-search/0DESCRIPTION | 140 ++++++++++ Task/Binary-search/1META.yaml | 4 + Task/Binary-search/ACL2/binary-search.acl2 | 61 +++++ Task/Binary-search/AWK/binary-search-1.awk | 8 + Task/Binary-search/AWK/binary-search-2.awk | 9 + Task/Binary-search/Ada/binary-search-1.ada | 54 ++++ Task/Binary-search/Ada/binary-search-2.ada | 56 ++++ Task/Binary-search/BASIC/binary-search-1.bas | 17 ++ Task/Binary-search/BASIC/binary-search-2.bas | 17 ++ Task/Binary-search/BASIC/binary-search-3.bas | 23 ++ Task/Binary-search/C/binary-search-1.c | 36 +++ Task/Binary-search/C/binary-search-2.c | 38 +++ Task/Binary-search/C/binary-search-3.c | 21 ++ Task/Binary-search/Clojure/binary-search.clj | 16 ++ .../CoffeeScript/binary-search.coffee | 16 ++ Task/Binary-search/Erlang/binary-search.erl | 27 ++ Task/Binary-search/Forth/binary-search.fth | 31 +++ Task/Binary-search/Fortran/binary-search-1.f | 18 ++ Task/Binary-search/Fortran/binary-search-2.f | 23 ++ Task/Binary-search/Go/binary-search-1.go | 12 + Task/Binary-search/Go/binary-search-2.go | 15 ++ Task/Binary-search/Go/binary-search-3.go | 5 + Task/Binary-search/Haskell/binary-search-1.hs | 9 + Task/Binary-search/Haskell/binary-search-2.hs | 5 + Task/Binary-search/Java/binary-search-1.java | 27 ++ Task/Binary-search/Java/binary-search-2.java | 21 ++ Task/Binary-search/Java/binary-search-3.java | 8 + Task/Binary-search/Java/binary-search-4.java | 4 + .../JavaScript/binary-search-1.js | 11 + .../JavaScript/binary-search-2.js | 14 + Task/Binary-search/Lua/binary-search-1.lua | 14 + Task/Binary-search/Lua/binary-search-2.lua | 9 + Task/Binary-search/PHP/binary-search-1.php | 19 ++ Task/Binary-search/PHP/binary-search-2.php | 15 ++ Task/Binary-search/Perl/binary-search-1.pl | 15 ++ Task/Binary-search/Perl/binary-search-2.pl | 15 ++ Task/Binary-search/PicoLisp/binary-search-1.l | 8 + Task/Binary-search/PicoLisp/binary-search-2.l | 11 + Task/Binary-search/Python/binary-search-1.py | 9 + Task/Binary-search/Python/binary-search-2.py | 10 + Task/Binary-search/Python/binary-search-3.py | 8 + Task/Binary-search/R/binary-search-1.r | 13 + Task/Binary-search/R/binary-search-2.r | 15 ++ Task/Binary-search/R/binary-search-3.r | 4 + Task/Binary-search/REXX/binary-search-1.rexx | 34 +++ Task/Binary-search/REXX/binary-search-2.rexx | 31 +++ Task/Binary-search/Racket/binary-search.rkt | 13 + Task/Binary-search/Ruby/binary-search-1.rb | 24 ++ Task/Binary-search/Ruby/binary-search-2.rb | 18 ++ Task/Binary-search/Scala/binary-search.scala | 9 + Task/Binary-search/Scheme/binary-search.ss | 11 + Task/Binary-search/Tcl/binary-search-1.tcl | 25 ++ Task/Binary-search/Tcl/binary-search-2.tcl | 8 + Task/Binary-strings/0DESCRIPTION | 14 + Task/Binary-strings/1META.yaml | 2 + Task/Binary-strings/Ada/binary-strings-1.ada | 17 ++ Task/Binary-strings/Ada/binary-strings-2.ada | 3 + Task/Binary-strings/Ada/binary-strings-3.ada | 4 + Task/Binary-strings/BASIC/binary-strings.bas | 13 + Task/Binary-strings/C/binary-strings.c | 138 ++++++++++ .../Binary-strings/Forth/binary-strings-1.fth | 8 + .../Binary-strings/Forth/binary-strings-2.fth | 6 + Task/Binary-strings/Go/binary-strings.go | 85 ++++++ .../Haskell/binary-strings-1.hs | 9 + .../Haskell/binary-strings-2.hs | 8 + .../Haskell/binary-strings-3.hs | 8 + .../Haskell/binary-strings-4.hs | 8 + .../Haskell/binary-strings-5.hs | 4 + .../Haskell/binary-strings-6.hs | 4 + .../Haskell/binary-strings-7.hs | 5 + Task/Binary-strings/Lua/binary-strings.lua | 31 +++ .../PicoLisp/binary-strings-1.l | 2 + .../PicoLisp/binary-strings-2.l | 6 + .../PicoLisp/binary-strings-3.l | 5 + .../PicoLisp/binary-strings-4.l | 2 + .../Binary-strings/Python/binary-strings-1.py | 5 + .../Python/binary-strings-10.py | 5 + .../Python/binary-strings-11.py | 5 + .../Python/binary-strings-12.py | 5 + .../Python/binary-strings-13.py | 2 + .../Python/binary-strings-14.py | 3 + .../Binary-strings/Python/binary-strings-2.py | 3 + .../Binary-strings/Python/binary-strings-3.py | 4 + .../Binary-strings/Python/binary-strings-4.py | 2 + .../Binary-strings/Python/binary-strings-5.py | 3 + .../Binary-strings/Python/binary-strings-6.py | 6 + .../Binary-strings/Python/binary-strings-7.py | 3 + .../Binary-strings/Python/binary-strings-8.py | 3 + .../Binary-strings/Python/binary-strings-9.py | 3 + Task/Binary-strings/REXX/binary-strings.rexx | 31 +++ Task/Binary-strings/Racket/binary-strings.rkt | 47 ++++ Task/Binary-strings/Ruby/binary-strings.rb | 45 ++++ Task/Binary-strings/Tcl/binary-strings.tcl | 36 +++ Task/Bulls-and-cows/0DESCRIPTION | 14 + Task/Bulls-and-cows/1META.yaml | 2 + Task/Bulls-and-cows/Ada/bulls-and-cows.ada | 53 ++++ Task/Bulls-and-cows/BASIC/bulls-and-cows.bas | 41 +++ Task/Bulls-and-cows/C/bulls-and-cows-1.c | 60 +++++ Task/Bulls-and-cows/C/bulls-and-cows-2.c | 85 ++++++ .../Bulls-and-cows/Clojure/bulls-and-cows.clj | 38 +++ .../Erlang/bulls-and-cows-1.erl | 45 ++++ .../Erlang/bulls-and-cows-2.erl | 3 + Task/Bulls-and-cows/Forth/bulls-and-cows.fth | 37 +++ Task/Bulls-and-cows/Fortran/bulls-and-cows.f | 84 ++++++ Task/Bulls-and-cows/Go/bulls-and-cows-1.go | 68 +++++ Task/Bulls-and-cows/Go/bulls-and-cows-2.go | 117 +++++++++ Task/Bulls-and-cows/Haskell/bulls-and-cows.hs | 50 ++++ Task/Bulls-and-cows/Java/bulls-and-cows.java | 52 ++++ .../JavaScript/bulls-and-cows.js | 88 +++++++ Task/Bulls-and-cows/Lua/bulls-and-cows.lua | 101 +++++++ Task/Bulls-and-cows/PHP/bulls-and-cows.php | 40 +++ Task/Bulls-and-cows/Perl/bulls-and-cows.pl | 39 +++ Task/Bulls-and-cows/PicoLisp/bulls-and-cows.l | 20 ++ Task/Bulls-and-cows/Prolog/bulls-and-cows.pro | 56 ++++ Task/Bulls-and-cows/Python/bulls-and-cows.py | 33 +++ Task/Bulls-and-cows/R/bulls-and-cows.r | 19 ++ .../Bulls-and-cows/REXX/bulls-and-cows-1.rexx | 43 +++ .../Bulls-and-cows/REXX/bulls-and-cows-2.rexx | 101 +++++++ Task/Bulls-and-cows/Ruby/bulls-and-cows.rb | 44 ++++ .../Bulls-and-cows/Scala/bulls-and-cows.scala | 42 +++ Task/Bulls-and-cows/Scheme/bulls-and-cows.ss | 65 +++++ .../Smalltalk/bulls-and-cows.st | 58 ++++ Task/Bulls-and-cows/Tcl/bulls-and-cows.tcl | 85 ++++++ Task/Caesar-cipher/0DESCRIPTION | 3 + Task/Caesar-cipher/1META.yaml | 2 + Task/Caesar-cipher/AWK/caesar-cipher.awk | 42 +++ Task/Caesar-cipher/Ada/caesar-cipher.ada | 45 ++++ Task/Caesar-cipher/C/caesar-cipher.c | 36 +++ Task/Caesar-cipher/Clojure/caesar-cipher.clj | 23 ++ .../CoffeeScript/caesar-cipher.coffee | 10 + Task/Caesar-cipher/Erlang/caesar-cipher-1.erl | 33 +++ Task/Caesar-cipher/Erlang/caesar-cipher-2.erl | 1 + Task/Caesar-cipher/Forth/caesar-cipher.fth | 19 ++ Task/Caesar-cipher/Fortran/caesar-cipher.f | 43 +++ Task/Caesar-cipher/Go/caesar-cipher-1.go | 59 +++++ Task/Caesar-cipher/Go/caesar-cipher-2.go | 57 ++++ Task/Caesar-cipher/Haskell/caesar-cipher.hs | 17 ++ Task/Caesar-cipher/Java/caesar-cipher.java | 26 ++ .../Caesar-cipher/JavaScript/caesar-cipher.js | 24 ++ Task/Caesar-cipher/Lua/caesar-cipher.lua | 30 +++ Task/Caesar-cipher/PHP/caesar-cipher.php | 19 ++ Task/Caesar-cipher/Perl/caesar-cipher.pl | 11 + Task/Caesar-cipher/PicoLisp/caesar-cipher.l | 6 + Task/Caesar-cipher/Prolog/caesar-cipher.pro | 33 +++ Task/Caesar-cipher/Python/caesar-cipher-1.py | 11 + Task/Caesar-cipher/Python/caesar-cipher-2.py | 15 ++ Task/Caesar-cipher/Python/caesar-cipher-3.py | 9 + Task/Caesar-cipher/REXX/caesar-cipher-1.rexx | 22 ++ Task/Caesar-cipher/REXX/caesar-cipher-2.rexx | 23 ++ Task/Caesar-cipher/Racket/caesar-cipher-1.rkt | 19 ++ Task/Caesar-cipher/Racket/caesar-cipher-2.rkt | 5 + Task/Caesar-cipher/Ruby/caesar-cipher.rb | 23 ++ .../Caesar-cipher/Scala/caesar-cipher-1.scala | 12 + .../Caesar-cipher/Scala/caesar-cipher-2.scala | 5 + .../Smalltalk/caesar-cipher-1.st | 1 + .../Smalltalk/caesar-cipher-2.st | 18 ++ Task/Caesar-cipher/Tcl/caesar-cipher-1.tcl | 23 ++ Task/Caesar-cipher/Tcl/caesar-cipher-2.tcl | 7 + Task/Calendar/Ada/calendar-1.ada | 48 ++++ Task/Calendar/Ada/calendar-2.ada | 176 +++++++++++++ Task/Calendar/Ada/calendar-3.ada | 11 + Task/Calendar/Tcl/calendar-1.tcl | 75 ++++++ Task/Check-that-file-exists/0DESCRIPTION | 1 + Task/Check-that-file-exists/1META.yaml | 2 + .../Ada/check-that-file-exists-1.ada | 17 ++ .../Ada/check-that-file-exists-2.ada | 20 ++ .../BASIC/check-that-file-exists-1.bas | 28 ++ .../BASIC/check-that-file-exists-2.bas | 14 + .../BASIC/check-that-file-exists-3.bas | 21 ++ .../C/check-that-file-exists.c | 28 ++ .../Clojure/check-that-file-exists.clj | 17 ++ .../Erlang/check-that-file-exists.erl | 23 ++ .../Forth/check-that-file-exists.fth | 5 + .../Fortran/check-that-file-exists-1.f | 4 + .../Fortran/check-that-file-exists-2.f | 9 + .../Go/check-that-file-exists.go | 24 ++ .../Haskell/check-that-file-exists.hs | 13 + .../Java/check-that-file-exists-1.java | 18 ++ .../Java/check-that-file-exists-2.java | 20 ++ .../JavaScript/check-that-file-exists.js | 6 + .../Lua/check-that-file-exists-1.lua | 12 + .../Lua/check-that-file-exists-2.lua | 9 + .../PHP/check-that-file-exists.php | 4 + .../Perl/check-that-file-exists.pl | 7 + .../PicoLisp/check-that-file-exists.l | 3 + .../Python/check-that-file-exists.py | 6 + .../R/check-that-file-exists.r | 7 + .../Ruby/check-that-file-exists-1.rb | 4 + .../Ruby/check-that-file-exists-2.rb | 4 + .../Scheme/check-that-file-exists.ss | 1 + .../Smalltalk/check-that-file-exists-1.st | 2 + .../Smalltalk/check-that-file-exists-2.st | 4 + .../Tcl/check-that-file-exists.tcl | 15 ++ Task/Checkpoint-synchronization/0DESCRIPTION | 11 + Task/Checkpoint-synchronization/1META.yaml | 6 + .../Ada/checkpoint-synchronization.ada | 101 +++++++ .../C/checkpoint-synchronization.c | 31 +++ .../Go/checkpoint-synchronization.go | 68 +++++ .../Haskell/checkpoint-synchronization-1.hs | 82 ++++++ .../Haskell/checkpoint-synchronization-2.hs | 112 ++++++++ .../Java/checkpoint-synchronization-1.java | 89 +++++++ .../Java/checkpoint-synchronization-2.java | 48 ++++ .../Perl/checkpoint-synchronization.pl | 69 +++++ .../PicoLisp/checkpoint-synchronization.l | 19 ++ .../Ruby/checkpoint-synchronization.rb | 158 +++++++++++ .../Tcl/checkpoint-synchronization-1.tcl | 97 +++++++ .../Tcl/checkpoint-synchronization-2.tcl | 30 +++ Task/Classes/Ada/classes-1.ada | 9 + Task/Classes/Ada/classes-2.ada | 13 + Task/Classes/Ada/classes-3.ada | 8 + Task/Classes/Forth/classes-1.fth | 14 + Task/Classes/Go/classes-1.go | 50 ++++ Task/Classes/Haskell/classes-1.hs | 33 +++ Task/Classes/Perl/classes-1.pl | 19 ++ Task/Classes/Python/classes-1.py | 38 +++ Task/Classes/R/classes-1.r | 13 + Task/Classes/Sather/classes-1.sa | 21 ++ Task/Closest-pair-problem/0DESCRIPTION | 63 +++++ Task/Closest-pair-problem/1META.yaml | 2 + .../Ada/closest-pair-problem.ada | 67 +++++ .../Clojure/closest-pair-problem.clj | 36 +++ .../Go/closest-pair-problem-1.go | 46 ++++ .../Go/closest-pair-problem-2.go | 117 +++++++++ .../Haskell/closest-pair-problem-1.hs | 16 ++ .../Haskell/closest-pair-problem-2.hs | 3 + .../Java/closest-pair-problem.java | 186 +++++++++++++ .../JavaScript/closest-pair-problem.js | 27 ++ .../Perl/closest-pair-problem.pl | 107 ++++++++ .../PicoLisp/closest-pair-problem.l | 14 + .../Python/closest-pair-problem.py | 87 ++++++ .../R/closest-pair-problem-1.r | 30 +++ .../R/closest-pair-problem-2.r | 20 ++ .../R/closest-pair-problem-3.r | 18 ++ .../R/closest-pair-problem-4.r | 36 +++ .../R/closest-pair-problem-5.r | 88 +++++++ .../REXX/closest-pair-problem.rexx | 37 +++ .../Ruby/closest-pair-problem.rb | 68 +++++ .../Scala/closest-pair-problem.scala | 24 ++ .../Tcl/closest-pair-problem.tcl | 90 +++++++ Task/Collections/AWK/collections-1.awk | 1 + Task/Collections/Ada/collections-1.ada | 11 + Task/Collections/Ada/collections-2.ada | 12 + Task/Collections/Ada/collections-3.ada | 13 + Task/Collections/Ada/collections-4.ada | 17 ++ Task/Collections/Ada/collections-5.ada | 17 ++ Task/Collections/C/collections-1.c | 11 + Task/Collections/Clojure/collections-1.clj | 4 + Task/Collections/Forth/collections-1.fth | 7 + Task/Collections/Haskell/collections-1.hs | 1 + Task/Collections/Java/collections-1.java | 14 + Task/Collections/JavaScript/collections-1.js | 5 + Task/Collections/R/collections-1.r | 3 + Task/Collections/REXX/collections-1.rexx | 36 +++ Task/Collections/Ruby/collections-1.rb | 8 + Task/Collections/Scheme/collections-1.ss | 1 + Task/Collections/Tcl/collections-1.tcl | 12 + Task/Color-of-a-screen-pixel/0DESCRIPTION | 1 + Task/Color-of-a-screen-pixel/1META.yaml | 4 + .../BASIC/color-of-a-screen-pixel.bas | 1 + .../C/color-of-a-screen-pixel-1.c | 15 ++ .../C/color-of-a-screen-pixel-2.c | 26 ++ .../Clojure/color-of-a-screen-pixel.clj | 2 + .../Java/color-of-a-screen-pixel.java | 3 + .../PHP/color-of-a-screen-pixel.php | 3 + .../PicoLisp/color-of-a-screen-pixel.l | 2 + .../Python/color-of-a-screen-pixel-1.py | 9 + .../Python/color-of-a-screen-pixel-2.py | 5 + .../Python/color-of-a-screen-pixel-3.py | 11 + .../Python/color-of-a-screen-pixel-4.py | 7 + .../Python/color-of-a-screen-pixel-5.py | 9 + .../Tcl/color-of-a-screen-pixel.tcl | 22 ++ Task/Comments/360-Assembly/comments.360 | 5 + Task/Comments/ACL2/comments.acl2 | 3 + Task/Comments/Ada/comments.ada | 1 + Task/Comments/Befunge/comments-1.bf | 2 + Task/Comments/C/comments-1.c | 4 + Task/Comments/Clojure/comments-1.clj | 3 + Task/Comments/Forth/comments-1.fth | 2 + Task/Comments/Fortran/comments-1.f | 2 + Task/Comments/Java/comments-1.java | 1 + Task/Comments/LaTeX/comments-1.tex | 1 + Task/Comments/Lua/comments-1.lua | 4 + Task/Comments/PHP/comments-1.php | 2 + Task/Comments/Perl/comments-1.pl | 1 + Task/Comments/Prolog/comments-1.pro | 1 + Task/Comments/Python/comments-1.py | 9 + Task/Comments/REXX/comments-1.rexx | 42 +++ Task/Comments/Tcl/comments-1.tcl | 3 + Task/Death-Star/0DESCRIPTION | 3 + Task/Death-Star/1META.yaml | 6 + Task/Death-Star/C/death-star.c | 112 ++++++++ Task/Death-Star/Go/death-star.go | 103 ++++++++ Task/Death-Star/Perl/death-star.pl | 75 ++++++ Task/Death-Star/Python/death-star.py | 67 +++++ Task/Death-Star/REXX/death-star.rexx | 75 ++++++ Task/Death-Star/Tcl/death-star-1.tcl | 115 ++++++++ Task/Death-Star/Tcl/death-star-2.tcl | 18 ++ .../Define-a-primitive-data-type/0DESCRIPTION | 3 + Task/Define-a-primitive-data-type/1META.yaml | 2 + .../Ada/define-a-primitive-data-type-1.ada | 1 + .../Ada/define-a-primitive-data-type-2.ada | 2 + .../Fortran/define-a-primitive-data-type-1.f | 102 +++++++ .../Fortran/define-a-primitive-data-type-2.f | 25 ++ .../Haskell/define-a-primitive-data-type-1.hs | 44 ++++ .../Haskell/define-a-primitive-data-type-2.hs | 5 + .../Haskell/define-a-primitive-data-type-3.hs | 5 + .../Java/define-a-primitive-data-type.java | 71 +++++ .../define-a-primitive-data-type.js | 22 ++ .../Perl/define-a-primitive-data-type.pl | 20 ++ .../PicoLisp/define-a-primitive-data-type.l | 32 +++ .../Python/define-a-primitive-data-type.py | 22 ++ .../Racket/define-a-primitive-data-type-1.rkt | 7 + .../Racket/define-a-primitive-data-type-2.rkt | 11 + .../Ruby/define-a-primitive-data-type.rb | 86 ++++++ .../Tcl/define-a-primitive-data-type.tcl | 37 +++ Task/Delegates/Ada/delegates.ada | 48 ++++ .../Delegates/CoffeeScript/delegates-1.coffee | 24 ++ Task/Delegates/Perl/delegates-1.pl | 38 +++ Task/Delegates/Ruby/delegates-1.rb | 31 +++ Task/Delegates/Tcl/delegates-1.tcl | 53 ++++ Task/Delete-a-file/0DESCRIPTION | 1 + Task/Delete-a-file/1META.yaml | 2 + Task/Delete-a-file/AWK/delete-a-file.awk | 4 + Task/Delete-a-file/Ada/delete-a-file-1.ada | 1 + Task/Delete-a-file/Ada/delete-a-file-2.ada | 4 + Task/Delete-a-file/BASIC/delete-a-file-1.bas | 4 + Task/Delete-a-file/BASIC/delete-a-file-2.bas | 1 + Task/Delete-a-file/C/delete-a-file-1.c | 9 + Task/Delete-a-file/C/delete-a-file-2.c | 9 + Task/Delete-a-file/Clojure/delete-a-file.clj | 6 + Task/Delete-a-file/Erlang/delete-a-file.erl | 1 + Task/Delete-a-file/Forth/delete-a-file.fth | 2 + Task/Delete-a-file/Fortran/delete-a-file.f | 4 + Task/Delete-a-file/Go/delete-a-file.go | 12 + Task/Delete-a-file/Haskell/delete-a-file.hs | 8 + Task/Delete-a-file/Java/delete-a-file.java | 18 ++ .../JavaScript/delete-a-file-1.js | 7 + .../JavaScript/delete-a-file-2.js | 10 + Task/Delete-a-file/Lua/delete-a-file.lua | 4 + Task/Delete-a-file/PHP/delete-a-file.php | 6 + Task/Delete-a-file/Perl/delete-a-file.pl | 7 + Task/Delete-a-file/PicoLisp/delete-a-file.l | 4 + Task/Delete-a-file/Python/delete-a-file-1.py | 7 + Task/Delete-a-file/Python/delete-a-file-2.py | 2 + Task/Delete-a-file/R/delete-a-file.r | 12 + Task/Delete-a-file/Ruby/delete-a-file.rb | 3 + Task/Delete-a-file/Scheme/delete-a-file.ss | 1 + Task/Delete-a-file/Smalltalk/delete-a-file.st | 4 + Task/Delete-a-file/Tcl/delete-a-file.tcl | 7 + Task/Detect-division-by-zero/0DESCRIPTION | 1 + .../ABAP/detect-division-by-zero.abap | 7 + .../Ada/detect-division-by-zero.ada | 32 +++ .../C/detect-division-by-zero.c | 100 +++++++ .../Clojure/detect-division-by-zero.clj | 7 + .../Eiffel/detect-division-by-zero.e | 21 ++ .../Erlang/detect-division-by-zero.erl | 5 + .../Forth/detect-division-by-zero.fth | 2 + .../Go/detect-division-by-zero.go | 16 ++ .../Haskell/detect-division-by-zero.hs | 3 + .../Java/detect-division-by-zero-1.java | 3 + .../Java/detect-division-by-zero-2.java | 6 + .../JavaScript/detect-division-by-zero.js | 7 + .../Lua/detect-division-by-zero.lua | 5 + .../PHP/detect-division-by-zero-1.php | 6 + .../PHP/detect-division-by-zero-2.php | 3 + .../Perl/detect-division-by-zero.pl | 4 + .../PicoLisp/detect-division-by-zero.l | 1 + .../Python/detect-division-by-zero.py | 7 + .../R/detect-division-by-zero.r | 4 + .../REXX/detect-division-by-zero.rexx | 22 ++ .../Racket/detect-division-by-zero.rkt | 5 + .../Ruby/detect-division-by-zero-1.rb | 9 + .../Ruby/detect-division-by-zero-2.rb | 4 + .../Ruby/detect-division-by-zero-3.rb | 9 + .../Ruby/detect-division-by-zero-4.rb | 4 + .../Scala/detect-division-by-zero.scala | 17 ++ .../Smalltalk/detect-division-by-zero.st | 7 + .../Tcl/detect-division-by-zero-1.tcl | 15 ++ .../Tcl/detect-division-by-zero-2.tcl | 15 ++ .../0DESCRIPTION | 1 + .../1META.yaml | 2 + .../AWK/determine-if-a-string-is-numeric.awk | 2 + .../determine-if-a-string-is-numeric.as | 4 + .../determine-if-a-string-is-numeric-1.ada | 3 + .../determine-if-a-string-is-numeric-2.ada | 11 + .../determine-if-a-string-is-numeric-3.ada | 12 + .../determine-if-a-string-is-numeric.bas | 6 + .../C/determine-if-a-string-is-numeric.c | 10 + .../determine-if-a-string-is-numeric-1.clj | 7 + .../determine-if-a-string-is-numeric-2.clj | 1 + .../determine-if-a-string-is-numeric.coffee | 2 + .../determine-if-a-string-is-numeric.erl | 4 + .../determine-if-a-string-is-numeric.fth | 22 ++ .../determine-if-a-string-is-numeric.f | 9 + .../Go/determine-if-a-string-is-numeric.go | 6 + .../determine-if-a-string-is-numeric-1.hs | 10 + .../determine-if-a-string-is-numeric-2.hs | 4 + .../determine-if-a-string-is-numeric-1.java | 10 + .../determine-if-a-string-is-numeric-2.java | 10 + .../determine-if-a-string-is-numeric-3.java | 3 + .../determine-if-a-string-is-numeric-4.java | 6 + .../determine-if-a-string-is-numeric-5.java | 4 + .../determine-if-a-string-is-numeric.js | 6 + .../Lua/determine-if-a-string-is-numeric.lua | 3 + .../PHP/determine-if-a-string-is-numeric.php | 5 + .../determine-if-a-string-is-numeric-1.pl | 2 + .../determine-if-a-string-is-numeric-2.pl | 8 + .../determine-if-a-string-is-numeric-3.pl | 15 ++ .../determine-if-a-string-is-numeric.l | 8 + .../determine-if-a-string-is-numeric-1.py | 5 + .../determine-if-a-string-is-numeric-2.py | 3 + .../determine-if-a-string-is-numeric-3.py | 28 ++ .../determine-if-a-string-is-numeric-4.py | 16 ++ .../R/determine-if-a-string-is-numeric.r | 3 + .../determine-if-a-string-is-numeric.rexx | 46 ++++ .../determine-if-a-string-is-numeric.rkt | 1 + .../determine-if-a-string-is-numeric-1.rb | 9 + .../determine-if-a-string-is-numeric-2.rb | 3 + .../determine-if-a-string-is-numeric.scala | 1 + .../determine-if-a-string-is-numeric.ss | 1 + .../determine-if-a-string-is-numeric-1.st | 20 ++ .../determine-if-a-string-is-numeric-2.st | 1 + .../determine-if-a-string-is-numeric-3.st | 1 + .../Tcl/determine-if-a-string-is-numeric.tcl | 3 + Task/Entropy/Ada/entropy.ada | 28 ++ Task/Entropy/REXX/entropy-1.rexx | 84 ++++++ Task/Entropy/Ruby/entropy-1.rb | 9 + Task/Entropy/Tcl/entropy-1.tcl | 10 + Task/FizzBuzz/ACL2/fizzbuzz.acl2 | 12 + Task/FizzBuzz/AWK/fizzbuzz-1.awk | 11 + Task/FizzBuzz/Ada/fizzbuzz.ada | 16 ++ Task/FizzBuzz/BASIC/fizzbuzz-1.bas | 11 + Task/FizzBuzz/C/fizzbuzz-1.c | 20 ++ Task/FizzBuzz/Clojure/fizzbuzz-1.clj | 5 + Task/FizzBuzz/CoffeeScript/fizzbuzz-1.coffee | 9 + Task/FizzBuzz/Forth/fizzbuzz-1.fth | 11 + Task/FizzBuzz/Fortran/fizzbuzz-1.f | 11 + Task/FizzBuzz/Haskell/fizzbuzz-1.hs | 7 + Task/FizzBuzz/Java/fizzbuzz-1.java | 15 ++ Task/FizzBuzz/JavaScript/fizzbuzz-1.js | 32 +++ Task/FizzBuzz/Lua/fizzbuzz-1.lua | 11 + Task/FizzBuzz/PHP/fizzbuzz-1.php | 13 + Task/FizzBuzz/Perl/fizzbuzz-1.pl | 14 + Task/FizzBuzz/PicoLisp/fizzbuzz-1.l | 3 + Task/FizzBuzz/Prolog/fizzbuzz-1.pro | 13 + Task/FizzBuzz/Python/fizzbuzz-1.py | 9 + Task/FizzBuzz/R/fizzbuzz-1.r | 6 + Task/FizzBuzz/REXX/fizzbuzz-1.rexx | 9 + Task/FizzBuzz/Ruby/fizzbuzz-1.rb | 6 + Task/FizzBuzz/Scala/fizzbuzz-1.scala | 6 + Task/FizzBuzz/Smalltalk/fizzbuzz-1.st | 9 + Task/FizzBuzz/Tcl/fizzbuzz-1.tcl | 9 + Task/Forest-fire/0DESCRIPTION | 17 ++ Task/Forest-fire/1META.yaml | 2 + Task/Forest-fire/Ada/forest-fire.ada | 69 +++++ Task/Forest-fire/C/forest-fire-1.c | 248 ++++++++++++++++++ Task/Forest-fire/C/forest-fire-2.c | 65 +++++ Task/Forest-fire/Clojure/forest-fire.clj | 77 ++++++ Task/Forest-fire/Fortran/forest-fire-1.f | 183 +++++++++++++ Task/Forest-fire/Fortran/forest-fire-2.f | 18 ++ Task/Forest-fire/Go/forest-fire.go | 84 ++++++ Task/Forest-fire/Haskell/forest-fire-1.hs | 47 ++++ Task/Forest-fire/Haskell/forest-fire-2.hs | 25 ++ Task/Forest-fire/Java/forest-fire.java | 137 ++++++++++ Task/Forest-fire/JavaScript/forest-fire-1.js | 63 +++++ Task/Forest-fire/JavaScript/forest-fire-2.js | 14 + Task/Forest-fire/Perl/forest-fire.pl | 63 +++++ Task/Forest-fire/PicoLisp/forest-fire.l | 43 +++ Task/Forest-fire/Python/forest-fire.py | 83 ++++++ Task/Forest-fire/REXX/forest-fire.rexx | 67 +++++ Task/Forest-fire/Racket/forest-fire.rkt | 60 +++++ Task/Forest-fire/Ruby/forest-fire.rb | 60 +++++ Task/Forest-fire/Sather/forest-fire.sa | 196 ++++++++++++++ Task/Forest-fire/Scala/forest-fire-1.scala | 28 ++ Task/Forest-fire/Scala/forest-fire-2.scala | 9 + Task/Forest-fire/Tcl/forest-fire.tcl | 78 ++++++ Task/Go-Fish/0DESCRIPTION | 13 + Task/Go-Fish/1META.yaml | 2 + Task/Infinity/Ada/infinity-1.ada | 24 ++ Task/Infinity/Ada/infinity-2.ada | 26 ++ Task/Infinity/Ada/infinity-3.ada | 1 + Task/Infinity/C/infinity-1.c | 11 + Task/Infinity/CoffeeScript/infinity-1.coffee | 1 + Task/Infinity/Fortran/infinity-1.f | 18 ++ Task/Infinity/Haskell/infinity-1.hs | 8 + Task/Infinity/Java/infinity-1.java | 2 + Task/Infinity/JavaScript/infinity-1.js | 1 + Task/Infinity/Perl/infinity-1.pl | 2 + Task/Infinity/Python/infinity-1.py | 2 + Task/Infinity/Ruby/infinity-1.rb | 10 + Task/Infinity/Smalltalk/infinity-1.st | 2 + Task/Infinity/Tcl/infinity-1.tcl | 6 + Task/JSON/Ada/json.ada | 41 +++ Task/JSON/Go/json-1.go | 25 ++ Task/JSON/JavaScript/json-1.js | 4 + Task/JSON/Python/json-1.py | 10 + Task/JSON/R/json-1.r | 3 + Task/JSON/Tcl/json-1.tcl | 5 + Task/Knuth-shuffle/0DESCRIPTION | 1 + Task/Knuth-shuffle/1META.yaml | 2 + Task/Knuth-shuffle/ACL2/knuth-shuffle.acl2 | 24 ++ Task/Knuth-shuffle/AWK/knuth-shuffle.awk | 21 ++ Task/Knuth-shuffle/Ada/knuth-shuffle-1.ada | 5 + Task/Knuth-shuffle/Ada/knuth-shuffle-2.ada | 17 ++ Task/Knuth-shuffle/Ada/knuth-shuffle-3.ada | 22 ++ Task/Knuth-shuffle/BASIC/knuth-shuffle.bas | 21 ++ Task/Knuth-shuffle/C/knuth-shuffle-1.c | 21 ++ Task/Knuth-shuffle/C/knuth-shuffle-2.c | 52 ++++ Task/Knuth-shuffle/Clojure/knuth-shuffle.clj | 4 + .../CoffeeScript/knuth-shuffle.coffee | 21 ++ Task/Knuth-shuffle/Forth/knuth-shuffle.fth | 15 ++ Task/Knuth-shuffle/Fortran/knuth-shuffle.f | 33 +++ Task/Knuth-shuffle/Go/knuth-shuffle-1.go | 22 ++ Task/Knuth-shuffle/Go/knuth-shuffle-2.go | 48 ++++ Task/Knuth-shuffle/Haskell/knuth-shuffle-1.hs | 17 ++ Task/Knuth-shuffle/Haskell/knuth-shuffle-2.hs | 3 + Task/Knuth-shuffle/Haskell/knuth-shuffle-3.hs | 21 ++ Task/Knuth-shuffle/Java/knuth-shuffle.java | 24 ++ .../Knuth-shuffle/JavaScript/knuth-shuffle.js | 28 ++ Task/Knuth-shuffle/Lua/knuth-shuffle.lua | 14 + Task/Knuth-shuffle/PHP/knuth-shuffle.php | 18 ++ Task/Knuth-shuffle/Perl/knuth-shuffle.pl | 8 + Task/Knuth-shuffle/PicoLisp/knuth-shuffle.l | 7 + Task/Knuth-shuffle/Python/knuth-shuffle.py | 10 + Task/Knuth-shuffle/R/knuth-shuffle-1.r | 12 + Task/Knuth-shuffle/R/knuth-shuffle-2.r | 21 ++ Task/Knuth-shuffle/REXX/knuth-shuffle.rexx | 37 +++ Task/Knuth-shuffle/Ruby/knuth-shuffle-1.rb | 21 ++ Task/Knuth-shuffle/Ruby/knuth-shuffle-2.rb | 9 + Task/Knuth-shuffle/Scala/knuth-shuffle.scala | 9 + Task/Knuth-shuffle/Scheme/knuth-shuffle.ss | 10 + .../Smalltalk/knuth-shuffle-1.st | 22 ++ .../Smalltalk/knuth-shuffle-2.st | 6 + Task/Knuth-shuffle/Tcl/knuth-shuffle-1.tcl | 17 ++ Task/Knuth-shuffle/Tcl/knuth-shuffle-2.tcl | 11 + Task/Narcissist/Ada/narcissist.ada | 1 + Task/Narcissist/Go/narcissist-1.go | 1 + Task/Narcissist/Perl/narcissist-1.pl | 2 + Task/Narcissist/REXX/narcissist-1.rexx | 1 + Task/Narcissist/Tcl/narcissist-1.tcl | 1 + Task/Ordered-words/0DESCRIPTION | 3 + Task/Ordered-words/1META.yaml | 2 + Task/Ordered-words/AWK/ordered-words.awk | 36 +++ Task/Ordered-words/Ada/ordered-words.ada | 48 ++++ Task/Ordered-words/C/ordered-words-1.c | 83 ++++++ Task/Ordered-words/C/ordered-words-2.c | 87 ++++++ Task/Ordered-words/C/ordered-words-3.c | 54 ++++ .../CoffeeScript/ordered-words-1.coffee | 21 ++ .../CoffeeScript/ordered-words-2.coffee | 18 ++ Task/Ordered-words/Forth/ordered-words.fth | 44 ++++ Task/Ordered-words/Fortran/ordered-words.f | 113 ++++++++ Task/Ordered-words/Go/ordered-words.go | 57 ++++ Task/Ordered-words/Haskell/ordered-words-1.hs | 21 ++ Task/Ordered-words/Haskell/ordered-words-2.hs | 16 ++ Task/Ordered-words/Haskell/ordered-words-3.hs | 11 + Task/Ordered-words/Java/ordered-words.java | 43 +++ .../JavaScript/ordered-words-1.js | 11 + .../JavaScript/ordered-words-2.js | 26 ++ Task/Ordered-words/Lua/ordered-words.lua | 29 ++ Task/Ordered-words/Perl/ordered-words.pl | 12 + Task/Ordered-words/PicoLisp/ordered-words.l | 6 + Task/Ordered-words/Prolog/ordered-words.pro | 44 ++++ Task/Ordered-words/Python/ordered-words-1.py | 8 + Task/Ordered-words/Python/ordered-words-2.py | 11 + Task/Ordered-words/Python/ordered-words-3.py | 3 + Task/Ordered-words/REXX/ordered-words.rexx | 28 ++ Task/Ordered-words/Ruby/ordered-words.rb | 8 + Task/Ordered-words/Scheme/ordered-words.ss | 20 ++ Task/Ordered-words/Smalltalk/ordered-words.st | 17 ++ Task/Ordered-words/Tcl/ordered-words.tcl | 25 ++ Task/Pi/Ada/pi.ada | 112 ++++++++ Task/Pi/Ruby/pi-1.rb | 20 ++ Task/Pi/Tcl/pi-1.tcl | 31 +++ Task/Quine/ABAP/quine-1.abap | 35 +++ Task/Quine/ABAP/quine-2.abap | 7 + Task/Quine/ABAP/quine-3.abap | 31 +++ Task/Quine/ABAP/quine-4.abap | 25 ++ Task/Quine/ACL2/quine-1.acl2 | 6 + Task/Quine/ACL2/quine-2.acl2 | 1 + Task/Quine/Ada/quine.ada | 1 + Task/Quine/BASIC/quine-1.bas | 1 + Task/Quine/Haskell/quine-1.hs | 1 + Task/Quine/Java/quine-1.java | 1 + Task/Quine/JavaScript/quine-1.js | 1 + Task/Quine/Perl/quine-1.pl | 2 + Task/Quine/PicoLisp/quine-1.l | 1 + Task/Quine/Python/quine-1.py | 2 + Task/Quine/REXX/quine-1.rexx | 1 + Task/Quine/Ruby/quine-1.rb | 1 + Task/Quine/Scala/quine-1.scala | 6 + Task/Quine/Scheme/quine-1.ss | 1 + Task/Quine/Smalltalk/quine-1.st | 1 + Task/Quine/Tcl/quine-1.tcl | 2 + Task/Search-a-list/0DESCRIPTION | 4 + Task/Search-a-list/1META.yaml | 2 + Task/Search-a-list/ACL2/search-a-list.acl2 | 7 + Task/Search-a-list/AWK/search-a-list.awk | 21 ++ .../ActionScript/search-a-list-1.as | 16 ++ .../ActionScript/search-a-list-2.as | 7 + .../ActionScript/search-a-list-3.as | 17 ++ Task/Search-a-list/Ada/search-a-list.ada | 42 +++ Task/Search-a-list/BASIC/search-a-list.bas | 29 ++ Task/Search-a-list/C/search-a-list.c | 40 +++ Task/Search-a-list/Clojure/search-a-list.clj | 5 + Task/Search-a-list/Erlang/search-a-list.erl | 15 ++ Task/Search-a-list/Forth/search-a-list.fth | 11 + Task/Search-a-list/Fortran/search-a-list.f | 35 +++ Task/Search-a-list/Go/search-a-list.go | 79 ++++++ Task/Search-a-list/Haskell/search-a-list-1.hs | 4 + Task/Search-a-list/Haskell/search-a-list-2.hs | 2 + Task/Search-a-list/Haskell/search-a-list-3.hs | 2 + Task/Search-a-list/Haskell/search-a-list-4.hs | 5 + Task/Search-a-list/Java/search-a-list-1.java | 12 + Task/Search-a-list/Java/search-a-list-2.java | 11 + .../JavaScript/search-a-list-1.js | 16 ++ .../JavaScript/search-a-list-2.js | 18 ++ Task/Search-a-list/Lua/search-a-list.lua | 7 + Task/Search-a-list/PHP/search-a-list.php | 9 + Task/Search-a-list/Perl/search-a-list-1.pl | 13 + Task/Search-a-list/Perl/search-a-list-2.pl | 13 + Task/Search-a-list/Perl/search-a-list-3.pl | 13 + Task/Search-a-list/PicoLisp/search-a-list.l | 10 + Task/Search-a-list/Prolog/search-a-list.pro | 23 ++ Task/Search-a-list/Python/search-a-list-1.py | 7 + Task/Search-a-list/Python/search-a-list-2.py | 9 + Task/Search-a-list/Python/search-a-list-3.py | 13 + Task/Search-a-list/R/search-a-list-1.r | 6 + Task/Search-a-list/R/search-a-list-2.r | 8 + Task/Search-a-list/REXX/search-a-list-1.rexx | 30 +++ Task/Search-a-list/REXX/search-a-list-2.rexx | 44 ++++ Task/Search-a-list/REXX/search-a-list-3.rexx | 29 ++ Task/Search-a-list/REXX/search-a-list-4.rexx | 24 ++ Task/Search-a-list/Racket/search-a-list-1.rkt | 4 + Task/Search-a-list/Racket/search-a-list-2.rkt | 4 + Task/Search-a-list/Racket/search-a-list-3.rkt | 7 + Task/Search-a-list/Ruby/search-a-list-1.rb | 9 + Task/Search-a-list/Ruby/search-a-list-2.rb | 7 + Task/Search-a-list/Ruby/search-a-list-3.rb | 3 + Task/Search-a-list/Sather/search-a-list.sa | 14 + Task/Search-a-list/Scala/search-a-list.scala | 3 + Task/Search-a-list/Scheme/search-a-list.ss | 16 ++ Task/Search-a-list/Smalltalk/search-a-list.st | 14 + Task/Search-a-list/Tcl/search-a-list-1.tcl | 8 + Task/Search-a-list/Tcl/search-a-list-2.tcl | 9 + 1364 files changed, 21352 insertions(+) create mode 100644 Lang/0815/0DESCRIPTION create mode 120000 Lang/0815/99-Bottles-of-Beer create mode 100644 Lang/360-Assembly/0DESCRIPTION create mode 120000 Lang/360-Assembly/Comments create mode 100644 Lang/A+/0DESCRIPTION create mode 100644 Lang/ABAP/0DESCRIPTION create mode 120000 Lang/ABAP/99-Bottles-of-Beer create mode 120000 Lang/ABAP/Ackermann-function create mode 120000 Lang/ABAP/Anagrams create mode 120000 Lang/ABAP/Detect-division-by-zero create mode 120000 Lang/ABAP/Quine create mode 100644 Lang/ACL2/0DESCRIPTION create mode 120000 Lang/ACL2/99-Bottles-of-Beer create mode 120000 Lang/ACL2/Arrays create mode 120000 Lang/ACL2/Binary-search create mode 120000 Lang/ACL2/Comments create mode 120000 Lang/ACL2/FizzBuzz create mode 120000 Lang/ACL2/Knuth-shuffle create mode 120000 Lang/ACL2/Quine create mode 120000 Lang/ACL2/Search-a-list create mode 120000 Lang/AWK/99-Bottles-of-Beer create mode 120000 Lang/AWK/Ackermann-function create mode 120000 Lang/AWK/Balanced-brackets create mode 120000 Lang/AWK/Best-shuffle create mode 120000 Lang/AWK/Binary-search create mode 120000 Lang/AWK/Caesar-cipher create mode 120000 Lang/AWK/Delete-a-file create mode 120000 Lang/AWK/Determine-if-a-string-is-numeric create mode 120000 Lang/AWK/Knuth-shuffle create mode 120000 Lang/AWK/Ordered-words create mode 120000 Lang/AWK/Search-a-list create mode 120000 Lang/ActionScript/99-Bottles-of-Beer create mode 120000 Lang/ActionScript/Ackermann-function create mode 120000 Lang/ActionScript/Determine-if-a-string-is-numeric create mode 120000 Lang/ActionScript/Search-a-list create mode 100644 Lang/Ada/0DESCRIPTION create mode 120000 Lang/Ada/99-Bottles-of-Beer create mode 120000 Lang/Ada/Ackermann-function create mode 120000 Lang/Ada/Anagrams create mode 120000 Lang/Ada/Arrays create mode 120000 Lang/Ada/Assertions create mode 120000 Lang/Ada/Balanced-brackets create mode 120000 Lang/Ada/Balanced-ternary create mode 120000 Lang/Ada/Best-shuffle create mode 120000 Lang/Ada/Binary-search create mode 120000 Lang/Ada/Binary-strings create mode 120000 Lang/Ada/Bulls-and-cows create mode 120000 Lang/Ada/Caesar-cipher create mode 120000 Lang/Ada/Calendar create mode 120000 Lang/Ada/Check-that-file-exists create mode 120000 Lang/Ada/Checkpoint-synchronization create mode 120000 Lang/Ada/Classes create mode 120000 Lang/Ada/Closest-pair-problem create mode 120000 Lang/Ada/Collections create mode 120000 Lang/Ada/Comments create mode 120000 Lang/Ada/Define-a-primitive-data-type create mode 120000 Lang/Ada/Delegates create mode 120000 Lang/Ada/Delete-a-file create mode 120000 Lang/Ada/Detect-division-by-zero create mode 120000 Lang/Ada/Determine-if-a-string-is-numeric create mode 120000 Lang/Ada/Entropy create mode 120000 Lang/Ada/FizzBuzz create mode 120000 Lang/Ada/Forest-fire create mode 120000 Lang/Ada/Infinity create mode 120000 Lang/Ada/JSON create mode 120000 Lang/Ada/Knuth-shuffle create mode 120000 Lang/Ada/Narcissist create mode 120000 Lang/Ada/Ordered-words create mode 120000 Lang/Ada/Pi create mode 120000 Lang/Ada/Quine create mode 120000 Lang/Ada/Search-a-list create mode 120000 Lang/BASIC/99-Bottles-of-Beer create mode 120000 Lang/BASIC/Ackermann-function create mode 120000 Lang/BASIC/Balanced-brackets create mode 120000 Lang/BASIC/Binary-search create mode 120000 Lang/BASIC/Binary-strings create mode 120000 Lang/BASIC/Bulls-and-cows create mode 120000 Lang/BASIC/Check-that-file-exists create mode 120000 Lang/BASIC/Color-of-a-screen-pixel create mode 120000 Lang/BASIC/Delete-a-file create mode 120000 Lang/BASIC/Determine-if-a-string-is-numeric create mode 120000 Lang/BASIC/Knuth-shuffle create mode 120000 Lang/BASIC/Search-a-list create mode 120000 Lang/Babel/99-Bottles-of-Beer create mode 120000 Lang/Babel/Ackermann-function create mode 120000 Lang/Befunge/99-Bottles-of-Beer create mode 120000 Lang/Befunge/Ackermann-function create mode 120000 Lang/Befunge/Balanced-brackets create mode 120000 Lang/C/99-Bottles-of-Beer create mode 120000 Lang/C/Ackermann-function create mode 120000 Lang/C/Balanced-brackets create mode 120000 Lang/C/Best-shuffle create mode 120000 Lang/C/Binary-search create mode 120000 Lang/C/Binary-strings create mode 120000 Lang/C/Bulls-and-cows create mode 120000 Lang/C/Caesar-cipher create mode 120000 Lang/C/Check-that-file-exists create mode 120000 Lang/C/Checkpoint-synchronization create mode 120000 Lang/C/Color-of-a-screen-pixel create mode 120000 Lang/C/Death-Star create mode 120000 Lang/C/Delete-a-file create mode 120000 Lang/C/Detect-division-by-zero create mode 120000 Lang/C/Determine-if-a-string-is-numeric create mode 120000 Lang/C/Forest-fire create mode 120000 Lang/C/Knuth-shuffle create mode 120000 Lang/C/Ordered-words create mode 120000 Lang/C/Search-a-list create mode 120000 Lang/Clojure/99-Bottles-of-Beer create mode 120000 Lang/Clojure/Ackermann-function create mode 120000 Lang/Clojure/Balanced-brackets create mode 120000 Lang/Clojure/Best-shuffle create mode 120000 Lang/Clojure/Binary-search create mode 120000 Lang/Clojure/Bulls-and-cows create mode 120000 Lang/Clojure/Caesar-cipher create mode 120000 Lang/Clojure/Check-that-file-exists create mode 120000 Lang/Clojure/Closest-pair-problem create mode 120000 Lang/Clojure/Color-of-a-screen-pixel create mode 120000 Lang/Clojure/Delete-a-file create mode 120000 Lang/Clojure/Detect-division-by-zero create mode 120000 Lang/Clojure/Determine-if-a-string-is-numeric create mode 120000 Lang/Clojure/Forest-fire create mode 120000 Lang/Clojure/Knuth-shuffle create mode 120000 Lang/Clojure/Search-a-list create mode 120000 Lang/CoffeeScript/99-Bottles-of-Beer create mode 120000 Lang/CoffeeScript/Ackermann-function create mode 120000 Lang/CoffeeScript/Balanced-brackets create mode 120000 Lang/CoffeeScript/Binary-search create mode 120000 Lang/CoffeeScript/Caesar-cipher create mode 120000 Lang/CoffeeScript/Determine-if-a-string-is-numeric create mode 120000 Lang/CoffeeScript/Knuth-shuffle create mode 120000 Lang/CoffeeScript/Ordered-words create mode 120000 Lang/Dylan/99-Bottles-of-Beer create mode 120000 Lang/Dylan/Ackermann-function create mode 120000 Lang/Eiffel/Ackermann-function create mode 120000 Lang/Eiffel/Detect-division-by-zero create mode 120000 Lang/Erlang/99-Bottles-of-Beer create mode 120000 Lang/Erlang/Ackermann-function create mode 120000 Lang/Erlang/Balanced-ternary create mode 120000 Lang/Erlang/Binary-search create mode 120000 Lang/Erlang/Bulls-and-cows create mode 120000 Lang/Erlang/Caesar-cipher create mode 120000 Lang/Erlang/Check-that-file-exists create mode 120000 Lang/Erlang/Delete-a-file create mode 120000 Lang/Erlang/Detect-division-by-zero create mode 120000 Lang/Erlang/Determine-if-a-string-is-numeric create mode 120000 Lang/Erlang/Search-a-list create mode 120000 Lang/Forth/99-Bottles-of-Beer create mode 120000 Lang/Forth/Ackermann-function create mode 120000 Lang/Forth/Balanced-brackets create mode 120000 Lang/Forth/Binary-search create mode 120000 Lang/Forth/Binary-strings create mode 120000 Lang/Forth/Bulls-and-cows create mode 120000 Lang/Forth/Caesar-cipher create mode 120000 Lang/Forth/Check-that-file-exists create mode 120000 Lang/Forth/Delete-a-file create mode 120000 Lang/Forth/Detect-division-by-zero create mode 120000 Lang/Forth/Determine-if-a-string-is-numeric create mode 120000 Lang/Forth/Knuth-shuffle create mode 120000 Lang/Forth/Ordered-words create mode 120000 Lang/Forth/Search-a-list create mode 120000 Lang/Fortran/99-Bottles-of-Beer create mode 120000 Lang/Fortran/Ackermann-function create mode 120000 Lang/Fortran/Binary-search create mode 120000 Lang/Fortran/Bulls-and-cows create mode 120000 Lang/Fortran/Caesar-cipher create mode 120000 Lang/Fortran/Check-that-file-exists create mode 120000 Lang/Fortran/Define-a-primitive-data-type create mode 120000 Lang/Fortran/Delete-a-file create mode 120000 Lang/Fortran/Determine-if-a-string-is-numeric create mode 120000 Lang/Fortran/Forest-fire create mode 120000 Lang/Fortran/Knuth-shuffle create mode 120000 Lang/Fortran/Ordered-words create mode 120000 Lang/Fortran/Search-a-list create mode 120000 Lang/Go/99-Bottles-of-Beer create mode 120000 Lang/Go/Ackermann-function create mode 120000 Lang/Go/Balanced-brackets create mode 120000 Lang/Go/Balanced-ternary create mode 120000 Lang/Go/Best-shuffle create mode 120000 Lang/Go/Binary-search create mode 120000 Lang/Go/Binary-strings create mode 120000 Lang/Go/Bulls-and-cows create mode 120000 Lang/Go/Caesar-cipher create mode 120000 Lang/Go/Check-that-file-exists create mode 120000 Lang/Go/Checkpoint-synchronization create mode 120000 Lang/Go/Closest-pair-problem create mode 120000 Lang/Go/Death-Star create mode 120000 Lang/Go/Delete-a-file create mode 120000 Lang/Go/Detect-division-by-zero create mode 120000 Lang/Go/Determine-if-a-string-is-numeric create mode 120000 Lang/Go/Forest-fire create mode 120000 Lang/Go/Knuth-shuffle create mode 120000 Lang/Go/Ordered-words create mode 120000 Lang/Go/Search-a-list create mode 120000 Lang/Haskell/99-Bottles-of-Beer create mode 120000 Lang/Haskell/Ackermann-function create mode 120000 Lang/Haskell/Balanced-brackets create mode 120000 Lang/Haskell/Balanced-ternary create mode 120000 Lang/Haskell/Best-shuffle create mode 120000 Lang/Haskell/Binary-search create mode 120000 Lang/Haskell/Binary-strings create mode 120000 Lang/Haskell/Bulls-and-cows create mode 120000 Lang/Haskell/Caesar-cipher create mode 120000 Lang/Haskell/Check-that-file-exists create mode 120000 Lang/Haskell/Checkpoint-synchronization create mode 120000 Lang/Haskell/Closest-pair-problem create mode 120000 Lang/Haskell/Define-a-primitive-data-type create mode 120000 Lang/Haskell/Delete-a-file create mode 120000 Lang/Haskell/Detect-division-by-zero create mode 120000 Lang/Haskell/Determine-if-a-string-is-numeric create mode 120000 Lang/Haskell/Forest-fire create mode 120000 Lang/Haskell/Knuth-shuffle create mode 120000 Lang/Haskell/Ordered-words create mode 120000 Lang/Haskell/Search-a-list create mode 120000 Lang/Java/99-Bottles-of-Beer create mode 120000 Lang/Java/Ackermann-function create mode 120000 Lang/Java/Balanced-brackets create mode 120000 Lang/Java/Best-shuffle create mode 120000 Lang/Java/Binary-search create mode 120000 Lang/Java/Bulls-and-cows create mode 120000 Lang/Java/Caesar-cipher create mode 120000 Lang/Java/Check-that-file-exists create mode 120000 Lang/Java/Checkpoint-synchronization create mode 120000 Lang/Java/Closest-pair-problem create mode 120000 Lang/Java/Color-of-a-screen-pixel create mode 120000 Lang/Java/Define-a-primitive-data-type create mode 120000 Lang/Java/Delete-a-file create mode 120000 Lang/Java/Detect-division-by-zero create mode 120000 Lang/Java/Determine-if-a-string-is-numeric create mode 120000 Lang/Java/Forest-fire create mode 120000 Lang/Java/Knuth-shuffle create mode 120000 Lang/Java/Ordered-words create mode 120000 Lang/Java/Search-a-list create mode 120000 Lang/JavaScript/99-Bottles-of-Beer create mode 120000 Lang/JavaScript/Ackermann-function create mode 120000 Lang/JavaScript/Balanced-brackets create mode 120000 Lang/JavaScript/Best-shuffle create mode 120000 Lang/JavaScript/Binary-search create mode 120000 Lang/JavaScript/Bulls-and-cows create mode 120000 Lang/JavaScript/Caesar-cipher create mode 120000 Lang/JavaScript/Check-that-file-exists create mode 120000 Lang/JavaScript/Closest-pair-problem create mode 120000 Lang/JavaScript/Define-a-primitive-data-type create mode 120000 Lang/JavaScript/Delete-a-file create mode 120000 Lang/JavaScript/Detect-division-by-zero create mode 120000 Lang/JavaScript/Determine-if-a-string-is-numeric create mode 120000 Lang/JavaScript/Forest-fire create mode 120000 Lang/JavaScript/Knuth-shuffle create mode 120000 Lang/JavaScript/Ordered-words create mode 120000 Lang/JavaScript/Search-a-list create mode 120000 Lang/LaTeX/99-Bottles-of-Beer create mode 120000 Lang/Lua/99-Bottles-of-Beer create mode 120000 Lang/Lua/Ackermann-function create mode 120000 Lang/Lua/Balanced-brackets create mode 120000 Lang/Lua/Binary-search create mode 120000 Lang/Lua/Binary-strings create mode 120000 Lang/Lua/Bulls-and-cows create mode 120000 Lang/Lua/Caesar-cipher create mode 120000 Lang/Lua/Check-that-file-exists create mode 120000 Lang/Lua/Delete-a-file create mode 120000 Lang/Lua/Detect-division-by-zero create mode 120000 Lang/Lua/Determine-if-a-string-is-numeric create mode 120000 Lang/Lua/Knuth-shuffle create mode 120000 Lang/Lua/Ordered-words create mode 120000 Lang/Lua/Search-a-list create mode 120000 Lang/PHP/99-Bottles-of-Beer create mode 120000 Lang/PHP/Ackermann-function create mode 120000 Lang/PHP/Best-shuffle create mode 120000 Lang/PHP/Binary-search create mode 120000 Lang/PHP/Bulls-and-cows create mode 120000 Lang/PHP/Caesar-cipher create mode 120000 Lang/PHP/Check-that-file-exists create mode 120000 Lang/PHP/Color-of-a-screen-pixel create mode 120000 Lang/PHP/Delete-a-file create mode 120000 Lang/PHP/Detect-division-by-zero create mode 120000 Lang/PHP/Determine-if-a-string-is-numeric create mode 120000 Lang/PHP/Knuth-shuffle create mode 120000 Lang/PHP/Search-a-list create mode 120000 Lang/PIR/99-Bottles-of-Beer create mode 120000 Lang/Perl/99-Bottles-of-Beer create mode 120000 Lang/Perl/Ackermann-function create mode 120000 Lang/Perl/Balanced-brackets create mode 120000 Lang/Perl/Best-shuffle create mode 120000 Lang/Perl/Binary-search create mode 120000 Lang/Perl/Bulls-and-cows create mode 120000 Lang/Perl/Caesar-cipher create mode 120000 Lang/Perl/Check-that-file-exists create mode 120000 Lang/Perl/Checkpoint-synchronization create mode 120000 Lang/Perl/Closest-pair-problem create mode 120000 Lang/Perl/Death-Star create mode 120000 Lang/Perl/Define-a-primitive-data-type create mode 120000 Lang/Perl/Delete-a-file create mode 120000 Lang/Perl/Detect-division-by-zero create mode 120000 Lang/Perl/Determine-if-a-string-is-numeric create mode 120000 Lang/Perl/Forest-fire create mode 120000 Lang/Perl/Knuth-shuffle create mode 120000 Lang/Perl/Ordered-words create mode 120000 Lang/Perl/Search-a-list create mode 120000 Lang/PicoLisp/99-Bottles-of-Beer create mode 120000 Lang/PicoLisp/Ackermann-function create mode 120000 Lang/PicoLisp/Balanced-brackets create mode 120000 Lang/PicoLisp/Best-shuffle create mode 120000 Lang/PicoLisp/Binary-search create mode 120000 Lang/PicoLisp/Binary-strings create mode 120000 Lang/PicoLisp/Bulls-and-cows create mode 120000 Lang/PicoLisp/Caesar-cipher create mode 120000 Lang/PicoLisp/Check-that-file-exists create mode 120000 Lang/PicoLisp/Checkpoint-synchronization create mode 120000 Lang/PicoLisp/Closest-pair-problem create mode 120000 Lang/PicoLisp/Color-of-a-screen-pixel create mode 120000 Lang/PicoLisp/Define-a-primitive-data-type create mode 120000 Lang/PicoLisp/Delete-a-file create mode 120000 Lang/PicoLisp/Detect-division-by-zero create mode 120000 Lang/PicoLisp/Determine-if-a-string-is-numeric create mode 120000 Lang/PicoLisp/Forest-fire create mode 120000 Lang/PicoLisp/Knuth-shuffle create mode 120000 Lang/PicoLisp/Ordered-words create mode 120000 Lang/PicoLisp/Search-a-list create mode 120000 Lang/Prolog/99-Bottles-of-Beer create mode 120000 Lang/Prolog/Ackermann-function create mode 120000 Lang/Prolog/Balanced-brackets create mode 120000 Lang/Prolog/Balanced-ternary create mode 120000 Lang/Prolog/Best-shuffle create mode 120000 Lang/Prolog/Bulls-and-cows create mode 120000 Lang/Prolog/Caesar-cipher create mode 120000 Lang/Prolog/Ordered-words create mode 120000 Lang/Prolog/Search-a-list create mode 120000 Lang/Python/99-Bottles-of-Beer create mode 120000 Lang/Python/Ackermann-function create mode 120000 Lang/Python/Balanced-brackets create mode 120000 Lang/Python/Balanced-ternary create mode 120000 Lang/Python/Best-shuffle create mode 120000 Lang/Python/Binary-search create mode 120000 Lang/Python/Binary-strings create mode 120000 Lang/Python/Bulls-and-cows create mode 120000 Lang/Python/Caesar-cipher create mode 120000 Lang/Python/Check-that-file-exists create mode 120000 Lang/Python/Closest-pair-problem create mode 120000 Lang/Python/Color-of-a-screen-pixel create mode 120000 Lang/Python/Death-Star create mode 120000 Lang/Python/Define-a-primitive-data-type create mode 120000 Lang/Python/Delete-a-file create mode 120000 Lang/Python/Detect-division-by-zero create mode 120000 Lang/Python/Determine-if-a-string-is-numeric create mode 120000 Lang/Python/Forest-fire create mode 120000 Lang/Python/Knuth-shuffle create mode 120000 Lang/Python/Ordered-words create mode 120000 Lang/Python/Search-a-list create mode 120000 Lang/R/99-Bottles-of-Beer create mode 120000 Lang/R/Ackermann-function create mode 120000 Lang/R/Balanced-brackets create mode 120000 Lang/R/Binary-search create mode 120000 Lang/R/Bulls-and-cows create mode 120000 Lang/R/Check-that-file-exists create mode 120000 Lang/R/Closest-pair-problem create mode 120000 Lang/R/Delete-a-file create mode 120000 Lang/R/Detect-division-by-zero create mode 120000 Lang/R/Determine-if-a-string-is-numeric create mode 120000 Lang/R/Knuth-shuffle create mode 120000 Lang/R/Search-a-list create mode 120000 Lang/REXX/99-Bottles-of-Beer create mode 120000 Lang/REXX/Ackermann-function create mode 120000 Lang/REXX/Balanced-brackets create mode 120000 Lang/REXX/Balanced-ternary create mode 120000 Lang/REXX/Best-shuffle create mode 120000 Lang/REXX/Binary-search create mode 120000 Lang/REXX/Binary-strings create mode 120000 Lang/REXX/Bulls-and-cows create mode 120000 Lang/REXX/Caesar-cipher create mode 120000 Lang/REXX/Closest-pair-problem create mode 120000 Lang/REXX/Death-Star create mode 120000 Lang/REXX/Detect-division-by-zero create mode 120000 Lang/REXX/Determine-if-a-string-is-numeric create mode 120000 Lang/REXX/Forest-fire create mode 120000 Lang/REXX/Knuth-shuffle create mode 120000 Lang/REXX/Ordered-words create mode 120000 Lang/REXX/Search-a-list create mode 120000 Lang/Racket/99-Bottles-of-Beer create mode 120000 Lang/Racket/Ackermann-function create mode 120000 Lang/Racket/Balanced-brackets create mode 120000 Lang/Racket/Best-shuffle create mode 120000 Lang/Racket/Binary-search create mode 120000 Lang/Racket/Binary-strings create mode 120000 Lang/Racket/Caesar-cipher create mode 120000 Lang/Racket/Define-a-primitive-data-type create mode 120000 Lang/Racket/Detect-division-by-zero create mode 120000 Lang/Racket/Determine-if-a-string-is-numeric create mode 120000 Lang/Racket/Forest-fire create mode 120000 Lang/Racket/Search-a-list create mode 120000 Lang/Ruby/99-Bottles-of-Beer create mode 120000 Lang/Ruby/Ackermann-function create mode 120000 Lang/Ruby/Balanced-brackets create mode 120000 Lang/Ruby/Balanced-ternary create mode 120000 Lang/Ruby/Binary-search create mode 120000 Lang/Ruby/Binary-strings create mode 120000 Lang/Ruby/Bulls-and-cows create mode 120000 Lang/Ruby/Caesar-cipher create mode 120000 Lang/Ruby/Check-that-file-exists create mode 120000 Lang/Ruby/Checkpoint-synchronization create mode 120000 Lang/Ruby/Closest-pair-problem create mode 120000 Lang/Ruby/Define-a-primitive-data-type create mode 120000 Lang/Ruby/Delete-a-file create mode 120000 Lang/Ruby/Detect-division-by-zero create mode 120000 Lang/Ruby/Determine-if-a-string-is-numeric create mode 120000 Lang/Ruby/Forest-fire create mode 120000 Lang/Ruby/Knuth-shuffle create mode 120000 Lang/Ruby/Ordered-words create mode 120000 Lang/Ruby/Search-a-list create mode 120000 Lang/SNUSP/99-Bottles-of-Beer create mode 120000 Lang/SNUSP/Ackermann-function create mode 120000 Lang/Sather/99-Bottles-of-Beer create mode 120000 Lang/Sather/Ackermann-function create mode 120000 Lang/Sather/Forest-fire create mode 120000 Lang/Sather/Search-a-list create mode 120000 Lang/Scala/Ackermann-function create mode 120000 Lang/Scala/Balanced-brackets create mode 120000 Lang/Scala/Binary-search create mode 120000 Lang/Scala/Bulls-and-cows create mode 120000 Lang/Scala/Caesar-cipher create mode 120000 Lang/Scala/Closest-pair-problem create mode 120000 Lang/Scala/Detect-division-by-zero create mode 120000 Lang/Scala/Determine-if-a-string-is-numeric create mode 120000 Lang/Scala/Forest-fire create mode 120000 Lang/Scala/Knuth-shuffle create mode 120000 Lang/Scala/Search-a-list create mode 120000 Lang/Scheme/99-Bottles-of-Beer create mode 120000 Lang/Scheme/Ackermann-function create mode 120000 Lang/Scheme/Balanced-brackets create mode 120000 Lang/Scheme/Best-shuffle create mode 120000 Lang/Scheme/Binary-search create mode 120000 Lang/Scheme/Bulls-and-cows create mode 120000 Lang/Scheme/Check-that-file-exists create mode 120000 Lang/Scheme/Delete-a-file create mode 120000 Lang/Scheme/Determine-if-a-string-is-numeric create mode 120000 Lang/Scheme/Knuth-shuffle create mode 120000 Lang/Scheme/Ordered-words create mode 120000 Lang/Scheme/Search-a-list create mode 120000 Lang/Smalltalk/99-Bottles-of-Beer create mode 120000 Lang/Smalltalk/Ackermann-function create mode 120000 Lang/Smalltalk/Bulls-and-cows create mode 120000 Lang/Smalltalk/Caesar-cipher create mode 120000 Lang/Smalltalk/Check-that-file-exists create mode 120000 Lang/Smalltalk/Delete-a-file create mode 120000 Lang/Smalltalk/Detect-division-by-zero create mode 120000 Lang/Smalltalk/Determine-if-a-string-is-numeric create mode 120000 Lang/Smalltalk/Knuth-shuffle create mode 120000 Lang/Smalltalk/Ordered-words create mode 120000 Lang/Smalltalk/Search-a-list create mode 120000 Lang/Tcl/99-Bottles-of-Beer create mode 120000 Lang/Tcl/Ackermann-function create mode 120000 Lang/Tcl/Balanced-brackets create mode 120000 Lang/Tcl/Balanced-ternary create mode 120000 Lang/Tcl/Best-shuffle create mode 120000 Lang/Tcl/Binary-search create mode 120000 Lang/Tcl/Binary-strings create mode 120000 Lang/Tcl/Bulls-and-cows create mode 120000 Lang/Tcl/Caesar-cipher create mode 120000 Lang/Tcl/Check-that-file-exists create mode 120000 Lang/Tcl/Checkpoint-synchronization create mode 120000 Lang/Tcl/Closest-pair-problem create mode 120000 Lang/Tcl/Color-of-a-screen-pixel create mode 120000 Lang/Tcl/Death-Star create mode 120000 Lang/Tcl/Define-a-primitive-data-type create mode 120000 Lang/Tcl/Delete-a-file create mode 120000 Lang/Tcl/Detect-division-by-zero create mode 120000 Lang/Tcl/Determine-if-a-string-is-numeric create mode 120000 Lang/Tcl/Forest-fire create mode 120000 Lang/Tcl/Knuth-shuffle create mode 120000 Lang/Tcl/Ordered-words create mode 120000 Lang/Tcl/Search-a-list create mode 100644 Meta/00Langs.yaml create mode 100644 Meta/00Tasks.yaml create mode 100644 Task/99-Bottles-of-Beer/0815/99-bottles-of-beer.0815 create mode 100644 Task/99-Bottles-of-Beer/0DESCRIPTION create mode 100644 Task/99-Bottles-of-Beer/ABAP/99-bottles-of-beer.abap create mode 100644 Task/99-Bottles-of-Beer/ACL2/99-bottles-of-beer.acl2 create mode 100644 Task/99-Bottles-of-Beer/AWK/99-bottles-of-beer.awk create mode 100644 Task/99-Bottles-of-Beer/ActionScript/99-bottles-of-beer.as create mode 100644 Task/99-Bottles-of-Beer/Ada/99-bottles-of-beer-1.ada create mode 100644 Task/99-Bottles-of-Beer/Ada/99-bottles-of-beer-2.ada create mode 100644 Task/99-Bottles-of-Beer/BASIC/99-bottles-of-beer-1.bas create mode 100644 Task/99-Bottles-of-Beer/BASIC/99-bottles-of-beer-2.bas create mode 100644 Task/99-Bottles-of-Beer/Babel/99-bottles-of-beer.pb create mode 100644 Task/99-Bottles-of-Beer/Befunge/99-bottles-of-beer.bf create mode 100644 Task/99-Bottles-of-Beer/C/99-bottles-of-beer-1.c create mode 100644 Task/99-Bottles-of-Beer/C/99-bottles-of-beer-2.c create mode 100644 Task/99-Bottles-of-Beer/C/99-bottles-of-beer-3.c create mode 100644 Task/99-Bottles-of-Beer/C/99-bottles-of-beer-4.c create mode 100644 Task/99-Bottles-of-Beer/Clojure/99-bottles-of-beer.clj create mode 100644 Task/99-Bottles-of-Beer/CoffeeScript/99-bottles-of-beer-1.coffee create mode 100644 Task/99-Bottles-of-Beer/CoffeeScript/99-bottles-of-beer-2.coffee create mode 100644 Task/99-Bottles-of-Beer/CoffeeScript/99-bottles-of-beer-3.coffee create mode 100644 Task/99-Bottles-of-Beer/CoffeeScript/99-bottles-of-beer-4.coffee create mode 100644 Task/99-Bottles-of-Beer/Dylan/99-bottles-of-beer.dylan create mode 100644 Task/99-Bottles-of-Beer/Erlang/99-bottles-of-beer.erl create mode 100644 Task/99-Bottles-of-Beer/Forth/99-bottles-of-beer.fth create mode 100644 Task/99-Bottles-of-Beer/Fortran/99-bottles-of-beer.f create mode 100644 Task/99-Bottles-of-Beer/Go/99-bottles-of-beer.go create mode 100644 Task/99-Bottles-of-Beer/Haskell/99-bottles-of-beer-1.hs create mode 100644 Task/99-Bottles-of-Beer/Haskell/99-bottles-of-beer-2.hs create mode 100644 Task/99-Bottles-of-Beer/Haskell/99-bottles-of-beer-3.hs create mode 100644 Task/99-Bottles-of-Beer/Java/99-bottles-of-beer-1.java create mode 100644 Task/99-Bottles-of-Beer/Java/99-bottles-of-beer-2.java create mode 100644 Task/99-Bottles-of-Beer/Java/99-bottles-of-beer-3.java create mode 100644 Task/99-Bottles-of-Beer/JavaScript/99-bottles-of-beer-1.js create mode 100644 Task/99-Bottles-of-Beer/JavaScript/99-bottles-of-beer-2.js create mode 100644 Task/99-Bottles-of-Beer/JavaScript/99-bottles-of-beer-3.js create mode 100644 Task/99-Bottles-of-Beer/JavaScript/99-bottles-of-beer-4.js create mode 100644 Task/99-Bottles-of-Beer/LaTeX/99-bottles-of-beer-1.tex create mode 100644 Task/99-Bottles-of-Beer/LaTeX/99-bottles-of-beer-2.tex create mode 100644 Task/99-Bottles-of-Beer/Lua/99-bottles-of-beer.lua create mode 100644 Task/99-Bottles-of-Beer/PHP/99-bottles-of-beer-1.php create mode 100644 Task/99-Bottles-of-Beer/PHP/99-bottles-of-beer-2.php create mode 100644 Task/99-Bottles-of-Beer/PHP/99-bottles-of-beer-3.php create mode 100644 Task/99-Bottles-of-Beer/PHP/99-bottles-of-beer-4.php create mode 100644 Task/99-Bottles-of-Beer/PIR/99-bottles-of-beer.pir create mode 100644 Task/99-Bottles-of-Beer/Perl/99-bottles-of-beer-1.pl create mode 100644 Task/99-Bottles-of-Beer/Perl/99-bottles-of-beer-2.pl create mode 100644 Task/99-Bottles-of-Beer/Perl/99-bottles-of-beer-3.pl create mode 100644 Task/99-Bottles-of-Beer/Perl/99-bottles-of-beer-4.pl create mode 100644 Task/99-Bottles-of-Beer/PicoLisp/99-bottles-of-beer.l create mode 100644 Task/99-Bottles-of-Beer/Prolog/99-bottles-of-beer-1.pro create mode 100644 Task/99-Bottles-of-Beer/Prolog/99-bottles-of-beer-2.pro create mode 100644 Task/99-Bottles-of-Beer/Python/99-bottles-of-beer-1.py create mode 100644 Task/99-Bottles-of-Beer/Python/99-bottles-of-beer-2.py create mode 100644 Task/99-Bottles-of-Beer/Python/99-bottles-of-beer-3.py create mode 100644 Task/99-Bottles-of-Beer/Python/99-bottles-of-beer-4.py create mode 100644 Task/99-Bottles-of-Beer/Python/99-bottles-of-beer-5.py create mode 100644 Task/99-Bottles-of-Beer/Python/99-bottles-of-beer-6.py create mode 100644 Task/99-Bottles-of-Beer/Python/99-bottles-of-beer-7.py create mode 100644 Task/99-Bottles-of-Beer/Python/99-bottles-of-beer-8.py create mode 100644 Task/99-Bottles-of-Beer/R/99-bottles-of-beer-1.r create mode 100644 Task/99-Bottles-of-Beer/R/99-bottles-of-beer-2.r create mode 100644 Task/99-Bottles-of-Beer/REXX/99-bottles-of-beer.rexx create mode 100644 Task/99-Bottles-of-Beer/Racket/99-bottles-of-beer.rkt create mode 100644 Task/99-Bottles-of-Beer/Ruby/99-bottles-of-beer-1.rb create mode 100644 Task/99-Bottles-of-Beer/Ruby/99-bottles-of-beer-2.rb create mode 100644 Task/99-Bottles-of-Beer/Ruby/99-bottles-of-beer-3.rb create mode 100644 Task/99-Bottles-of-Beer/Ruby/99-bottles-of-beer-4.rb create mode 100644 Task/99-Bottles-of-Beer/SNUSP/99-bottles-of-beer.snusp create mode 100644 Task/99-Bottles-of-Beer/Sather/99-bottles-of-beer.sa create mode 100644 Task/99-Bottles-of-Beer/Scheme/99-bottles-of-beer.ss create mode 100644 Task/99-Bottles-of-Beer/Smalltalk/99-bottles-of-beer.st create mode 100644 Task/99-Bottles-of-Beer/Tcl/99-bottles-of-beer-1.tcl create mode 100644 Task/99-Bottles-of-Beer/Tcl/99-bottles-of-beer-2.tcl create mode 100644 Task/Ackermann-function/0DESCRIPTION create mode 100644 Task/Ackermann-function/1META.yaml create mode 100644 Task/Ackermann-function/ABAP/ackermann-function.abap create mode 100644 Task/Ackermann-function/AWK/ackermann-function.awk create mode 100644 Task/Ackermann-function/ActionScript/ackermann-function.as create mode 100644 Task/Ackermann-function/Ada/ackermann-function.ada create mode 100644 Task/Ackermann-function/BASIC/ackermann-function.bas create mode 100644 Task/Ackermann-function/Babel/ackermann-function.pb create mode 100644 Task/Ackermann-function/Befunge/ackermann-function.bf create mode 100644 Task/Ackermann-function/C/ackermann-function-1.c create mode 100644 Task/Ackermann-function/C/ackermann-function-2.c create mode 100644 Task/Ackermann-function/Clojure/ackermann-function.clj create mode 100644 Task/Ackermann-function/CoffeeScript/ackermann-function.coffee create mode 100644 Task/Ackermann-function/Dylan/ackermann-function.dylan create mode 100644 Task/Ackermann-function/Eiffel/ackermann-function.e create mode 100644 Task/Ackermann-function/Erlang/ackermann-function.erl create mode 100644 Task/Ackermann-function/Forth/ackermann-function-1.fth create mode 100644 Task/Ackermann-function/Forth/ackermann-function-2.fth create mode 100644 Task/Ackermann-function/Fortran/ackermann-function.f create mode 100644 Task/Ackermann-function/Go/ackermann-function-1.go create mode 100644 Task/Ackermann-function/Go/ackermann-function-2.go create mode 100644 Task/Ackermann-function/Go/ackermann-function-3.go create mode 100644 Task/Ackermann-function/Haskell/ackermann-function-1.hs create mode 100644 Task/Ackermann-function/Haskell/ackermann-function-2.hs create mode 100644 Task/Ackermann-function/Java/ackermann-function.java create mode 100644 Task/Ackermann-function/JavaScript/ackermann-function.js create mode 100644 Task/Ackermann-function/Lua/ackermann-function.lua create mode 100644 Task/Ackermann-function/PHP/ackermann-function.php create mode 100644 Task/Ackermann-function/Perl/ackermann-function-1.pl create mode 100644 Task/Ackermann-function/Perl/ackermann-function-2.pl create mode 100644 Task/Ackermann-function/Perl/ackermann-function-3.pl create mode 100644 Task/Ackermann-function/PicoLisp/ackermann-function.l create mode 100644 Task/Ackermann-function/Prolog/ackermann-function.pro create mode 100644 Task/Ackermann-function/Python/ackermann-function-1.py create mode 100644 Task/Ackermann-function/Python/ackermann-function-2.py create mode 100644 Task/Ackermann-function/Python/ackermann-function-3.py create mode 100644 Task/Ackermann-function/Python/ackermann-function-4.py create mode 100644 Task/Ackermann-function/R/ackermann-function-1.r create mode 100644 Task/Ackermann-function/R/ackermann-function-2.r create mode 100644 Task/Ackermann-function/REXX/ackermann-function-1.rexx create mode 100644 Task/Ackermann-function/REXX/ackermann-function-2.rexx create mode 100644 Task/Ackermann-function/REXX/ackermann-function-3.rexx create mode 100644 Task/Ackermann-function/Racket/ackermann-function.rkt create mode 100644 Task/Ackermann-function/Ruby/ackermann-function-1.rb create mode 100644 Task/Ackermann-function/Ruby/ackermann-function-2.rb create mode 100644 Task/Ackermann-function/SNUSP/ackermann-function.snusp create mode 100644 Task/Ackermann-function/Sather/ackermann-function-1.sa create mode 100644 Task/Ackermann-function/Sather/ackermann-function-2.sa create mode 100644 Task/Ackermann-function/Scala/ackermann-function-1.scala create mode 100644 Task/Ackermann-function/Scala/ackermann-function-2.scala create mode 100644 Task/Ackermann-function/Scala/ackermann-function-3.scala create mode 100644 Task/Ackermann-function/Scala/ackermann-function-4.scala create mode 100644 Task/Ackermann-function/Scheme/ackermann-function.ss create mode 100644 Task/Ackermann-function/Smalltalk/ackermann-function.st create mode 100644 Task/Ackermann-function/Tcl/ackermann-function-1.tcl create mode 100644 Task/Ackermann-function/Tcl/ackermann-function-2.tcl create mode 100644 Task/Ackermann-function/Tcl/ackermann-function-3.tcl create mode 100644 Task/Anagrams/ABAP/anagrams.abap create mode 100644 Task/Anagrams/Ada/anagrams.ada create mode 100644 Task/Anagrams/C/anagrams-1.c create mode 100644 Task/Anagrams/CoffeeScript/anagrams-1.coffee create mode 100644 Task/Anagrams/Go/anagrams-1.go create mode 100644 Task/Anagrams/Perl/anagrams-1.pl create mode 100644 Task/Anagrams/PicoLisp/anagrams-1.l create mode 100644 Task/Anagrams/Python/anagrams-1.py create mode 100644 Task/Anagrams/Racket/anagrams-1.rkt create mode 100644 Task/Anagrams/Ruby/anagrams-1.rb create mode 100644 Task/Anagrams/Scala/anagrams-1.scala create mode 100644 Task/Anagrams/Smalltalk/anagrams-1.st create mode 100644 Task/Arrays/ACL2/arrays.acl2 create mode 100644 Task/Arrays/Ada/arrays.ada create mode 100644 Task/Arrays/BASIC/arrays-1.bas create mode 100644 Task/Arrays/C/arrays-1.c create mode 100644 Task/Arrays/CoffeeScript/arrays-1.coffee create mode 100644 Task/Arrays/Forth/arrays-1.fth create mode 100644 Task/Arrays/Fortran/arrays-1.f create mode 100644 Task/Arrays/Java/arrays-1.java create mode 100644 Task/Arrays/PHP/arrays-1.php create mode 100644 Task/Arrays/PicoLisp/arrays-1.l create mode 100644 Task/Arrays/Prolog/arrays-1.pro create mode 100644 Task/Arrays/Python/arrays-1.py create mode 100644 Task/Arrays/REXX/arrays-1.rexx create mode 100644 Task/Arrays/Scala/arrays-1.scala create mode 100644 Task/Arrays/Smalltalk/arrays-1.st create mode 100644 Task/Arrays/Tcl/arrays-1.tcl create mode 100644 Task/Assertions/Ada/assertions-1.ada create mode 100644 Task/Assertions/Ada/assertions-2.ada create mode 100644 Task/Assertions/C/assertions-1.c create mode 100644 Task/Assertions/Eiffel/assertions-1.e create mode 100644 Task/Assertions/Perl/assertions-1.pl create mode 100644 Task/Assertions/PicoLisp/assertions-1.l create mode 100644 Task/Assertions/Racket/assertions-1.rkt create mode 100644 Task/Assertions/Scala/assertions-1.scala create mode 100644 Task/Assertions/Smalltalk/assertions-1.st create mode 100644 Task/Balanced-brackets/0DESCRIPTION create mode 100644 Task/Balanced-brackets/AWK/balanced-brackets.awk create mode 100644 Task/Balanced-brackets/Ada/balanced-brackets.ada create mode 100644 Task/Balanced-brackets/BASIC/balanced-brackets.bas create mode 100644 Task/Balanced-brackets/Befunge/balanced-brackets.bf create mode 100644 Task/Balanced-brackets/C/balanced-brackets-1.c create mode 100644 Task/Balanced-brackets/C/balanced-brackets-2.c create mode 100644 Task/Balanced-brackets/Clojure/balanced-brackets.clj create mode 100644 Task/Balanced-brackets/CoffeeScript/balanced-brackets-1.coffee create mode 100644 Task/Balanced-brackets/CoffeeScript/balanced-brackets-2.coffee create mode 100644 Task/Balanced-brackets/Forth/balanced-brackets.fth create mode 100644 Task/Balanced-brackets/Go/balanced-brackets.go create mode 100644 Task/Balanced-brackets/Haskell/balanced-brackets-1.hs create mode 100644 Task/Balanced-brackets/Haskell/balanced-brackets-2.hs create mode 100644 Task/Balanced-brackets/Java/balanced-brackets.java create mode 100644 Task/Balanced-brackets/JavaScript/balanced-brackets-1.js create mode 100644 Task/Balanced-brackets/JavaScript/balanced-brackets-2.js create mode 100644 Task/Balanced-brackets/Lua/balanced-brackets.lua create mode 100644 Task/Balanced-brackets/Perl/balanced-brackets-1.pl create mode 100644 Task/Balanced-brackets/Perl/balanced-brackets-2.pl create mode 100644 Task/Balanced-brackets/PicoLisp/balanced-brackets.l create mode 100644 Task/Balanced-brackets/Prolog/balanced-brackets.pro create mode 100644 Task/Balanced-brackets/Python/balanced-brackets.py create mode 100644 Task/Balanced-brackets/R/balanced-brackets-1.r create mode 100644 Task/Balanced-brackets/R/balanced-brackets-2.r create mode 100644 Task/Balanced-brackets/R/balanced-brackets-3.r create mode 100644 Task/Balanced-brackets/R/balanced-brackets-4.r create mode 100644 Task/Balanced-brackets/REXX/balanced-brackets-1.rexx create mode 100644 Task/Balanced-brackets/REXX/balanced-brackets-2.rexx create mode 100644 Task/Balanced-brackets/REXX/balanced-brackets-3.rexx create mode 100644 Task/Balanced-brackets/Racket/balanced-brackets.rkt create mode 100644 Task/Balanced-brackets/Ruby/balanced-brackets.rb create mode 100644 Task/Balanced-brackets/Scala/balanced-brackets.scala create mode 100644 Task/Balanced-brackets/Scheme/balanced-brackets.ss create mode 100644 Task/Balanced-brackets/Tcl/balanced-brackets-1.tcl create mode 100644 Task/Balanced-brackets/Tcl/balanced-brackets-2.tcl create mode 100644 Task/Balanced-ternary/0DESCRIPTION create mode 100644 Task/Balanced-ternary/Ada/balanced-ternary-1.ada create mode 100644 Task/Balanced-ternary/Ada/balanced-ternary-2.ada create mode 100644 Task/Balanced-ternary/Ada/balanced-ternary-3.ada create mode 100644 Task/Balanced-ternary/Erlang/balanced-ternary-1.erl create mode 100644 Task/Balanced-ternary/Erlang/balanced-ternary-2.erl create mode 100644 Task/Balanced-ternary/Go/balanced-ternary.go create mode 100644 Task/Balanced-ternary/Haskell/balanced-ternary.hs create mode 100644 Task/Balanced-ternary/Prolog/balanced-ternary-1.pro create mode 100644 Task/Balanced-ternary/Prolog/balanced-ternary-2.pro create mode 100644 Task/Balanced-ternary/Prolog/balanced-ternary-3.pro create mode 100644 Task/Balanced-ternary/Python/balanced-ternary.py create mode 100644 Task/Balanced-ternary/REXX/balanced-ternary.rexx create mode 100644 Task/Balanced-ternary/Ruby/balanced-ternary.rb create mode 100644 Task/Balanced-ternary/Tcl/balanced-ternary-1.tcl create mode 100644 Task/Balanced-ternary/Tcl/balanced-ternary-2.tcl create mode 100644 Task/Best-shuffle/0DESCRIPTION create mode 100644 Task/Best-shuffle/AWK/best-shuffle-1.awk create mode 100644 Task/Best-shuffle/AWK/best-shuffle-2.awk create mode 100644 Task/Best-shuffle/AWK/best-shuffle-3.awk create mode 100644 Task/Best-shuffle/Ada/best-shuffle.ada create mode 100644 Task/Best-shuffle/C/best-shuffle-1.c create mode 100644 Task/Best-shuffle/C/best-shuffle-2.c create mode 100644 Task/Best-shuffle/C/best-shuffle-3.c create mode 100644 Task/Best-shuffle/C/best-shuffle-4.c create mode 100644 Task/Best-shuffle/Clojure/best-shuffle.clj create mode 100644 Task/Best-shuffle/Go/best-shuffle.go create mode 100644 Task/Best-shuffle/Haskell/best-shuffle-1.hs create mode 100644 Task/Best-shuffle/Haskell/best-shuffle-2.hs create mode 100644 Task/Best-shuffle/Java/best-shuffle.java create mode 100644 Task/Best-shuffle/JavaScript/best-shuffle-1.js create mode 100644 Task/Best-shuffle/JavaScript/best-shuffle-2.js create mode 100644 Task/Best-shuffle/JavaScript/best-shuffle-3.js create mode 100644 Task/Best-shuffle/PHP/best-shuffle.php create mode 100644 Task/Best-shuffle/Perl/best-shuffle.pl create mode 100644 Task/Best-shuffle/PicoLisp/best-shuffle.l create mode 100644 Task/Best-shuffle/Prolog/best-shuffle.pro create mode 100644 Task/Best-shuffle/Python/best-shuffle-1.py create mode 100644 Task/Best-shuffle/Python/best-shuffle-2.py create mode 100644 Task/Best-shuffle/REXX/best-shuffle-1.rexx create mode 100644 Task/Best-shuffle/REXX/best-shuffle-2.rexx create mode 100644 Task/Best-shuffle/REXX/best-shuffle-3.rexx create mode 100644 Task/Best-shuffle/Racket/best-shuffle.rkt create mode 100644 Task/Best-shuffle/Scheme/best-shuffle.ss create mode 100644 Task/Best-shuffle/Tcl/best-shuffle-1.tcl create mode 100644 Task/Best-shuffle/Tcl/best-shuffle-2.tcl create mode 100644 Task/Binary-search/0DESCRIPTION create mode 100644 Task/Binary-search/1META.yaml create mode 100644 Task/Binary-search/ACL2/binary-search.acl2 create mode 100644 Task/Binary-search/AWK/binary-search-1.awk create mode 100644 Task/Binary-search/AWK/binary-search-2.awk create mode 100644 Task/Binary-search/Ada/binary-search-1.ada create mode 100644 Task/Binary-search/Ada/binary-search-2.ada create mode 100644 Task/Binary-search/BASIC/binary-search-1.bas create mode 100644 Task/Binary-search/BASIC/binary-search-2.bas create mode 100644 Task/Binary-search/BASIC/binary-search-3.bas create mode 100644 Task/Binary-search/C/binary-search-1.c create mode 100644 Task/Binary-search/C/binary-search-2.c create mode 100644 Task/Binary-search/C/binary-search-3.c create mode 100644 Task/Binary-search/Clojure/binary-search.clj create mode 100644 Task/Binary-search/CoffeeScript/binary-search.coffee create mode 100644 Task/Binary-search/Erlang/binary-search.erl create mode 100644 Task/Binary-search/Forth/binary-search.fth create mode 100644 Task/Binary-search/Fortran/binary-search-1.f create mode 100644 Task/Binary-search/Fortran/binary-search-2.f create mode 100644 Task/Binary-search/Go/binary-search-1.go create mode 100644 Task/Binary-search/Go/binary-search-2.go create mode 100644 Task/Binary-search/Go/binary-search-3.go create mode 100644 Task/Binary-search/Haskell/binary-search-1.hs create mode 100644 Task/Binary-search/Haskell/binary-search-2.hs create mode 100644 Task/Binary-search/Java/binary-search-1.java create mode 100644 Task/Binary-search/Java/binary-search-2.java create mode 100644 Task/Binary-search/Java/binary-search-3.java create mode 100644 Task/Binary-search/Java/binary-search-4.java create mode 100644 Task/Binary-search/JavaScript/binary-search-1.js create mode 100644 Task/Binary-search/JavaScript/binary-search-2.js create mode 100644 Task/Binary-search/Lua/binary-search-1.lua create mode 100644 Task/Binary-search/Lua/binary-search-2.lua create mode 100644 Task/Binary-search/PHP/binary-search-1.php create mode 100644 Task/Binary-search/PHP/binary-search-2.php create mode 100644 Task/Binary-search/Perl/binary-search-1.pl create mode 100644 Task/Binary-search/Perl/binary-search-2.pl create mode 100644 Task/Binary-search/PicoLisp/binary-search-1.l create mode 100644 Task/Binary-search/PicoLisp/binary-search-2.l create mode 100644 Task/Binary-search/Python/binary-search-1.py create mode 100644 Task/Binary-search/Python/binary-search-2.py create mode 100644 Task/Binary-search/Python/binary-search-3.py create mode 100644 Task/Binary-search/R/binary-search-1.r create mode 100644 Task/Binary-search/R/binary-search-2.r create mode 100644 Task/Binary-search/R/binary-search-3.r create mode 100644 Task/Binary-search/REXX/binary-search-1.rexx create mode 100644 Task/Binary-search/REXX/binary-search-2.rexx create mode 100644 Task/Binary-search/Racket/binary-search.rkt create mode 100644 Task/Binary-search/Ruby/binary-search-1.rb create mode 100644 Task/Binary-search/Ruby/binary-search-2.rb create mode 100644 Task/Binary-search/Scala/binary-search.scala create mode 100644 Task/Binary-search/Scheme/binary-search.ss create mode 100644 Task/Binary-search/Tcl/binary-search-1.tcl create mode 100644 Task/Binary-search/Tcl/binary-search-2.tcl create mode 100644 Task/Binary-strings/0DESCRIPTION create mode 100644 Task/Binary-strings/1META.yaml create mode 100644 Task/Binary-strings/Ada/binary-strings-1.ada create mode 100644 Task/Binary-strings/Ada/binary-strings-2.ada create mode 100644 Task/Binary-strings/Ada/binary-strings-3.ada create mode 100644 Task/Binary-strings/BASIC/binary-strings.bas create mode 100644 Task/Binary-strings/C/binary-strings.c create mode 100644 Task/Binary-strings/Forth/binary-strings-1.fth create mode 100644 Task/Binary-strings/Forth/binary-strings-2.fth create mode 100644 Task/Binary-strings/Go/binary-strings.go create mode 100644 Task/Binary-strings/Haskell/binary-strings-1.hs create mode 100644 Task/Binary-strings/Haskell/binary-strings-2.hs create mode 100644 Task/Binary-strings/Haskell/binary-strings-3.hs create mode 100644 Task/Binary-strings/Haskell/binary-strings-4.hs create mode 100644 Task/Binary-strings/Haskell/binary-strings-5.hs create mode 100644 Task/Binary-strings/Haskell/binary-strings-6.hs create mode 100644 Task/Binary-strings/Haskell/binary-strings-7.hs create mode 100644 Task/Binary-strings/Lua/binary-strings.lua create mode 100644 Task/Binary-strings/PicoLisp/binary-strings-1.l create mode 100644 Task/Binary-strings/PicoLisp/binary-strings-2.l create mode 100644 Task/Binary-strings/PicoLisp/binary-strings-3.l create mode 100644 Task/Binary-strings/PicoLisp/binary-strings-4.l create mode 100644 Task/Binary-strings/Python/binary-strings-1.py create mode 100644 Task/Binary-strings/Python/binary-strings-10.py create mode 100644 Task/Binary-strings/Python/binary-strings-11.py create mode 100644 Task/Binary-strings/Python/binary-strings-12.py create mode 100644 Task/Binary-strings/Python/binary-strings-13.py create mode 100644 Task/Binary-strings/Python/binary-strings-14.py create mode 100644 Task/Binary-strings/Python/binary-strings-2.py create mode 100644 Task/Binary-strings/Python/binary-strings-3.py create mode 100644 Task/Binary-strings/Python/binary-strings-4.py create mode 100644 Task/Binary-strings/Python/binary-strings-5.py create mode 100644 Task/Binary-strings/Python/binary-strings-6.py create mode 100644 Task/Binary-strings/Python/binary-strings-7.py create mode 100644 Task/Binary-strings/Python/binary-strings-8.py create mode 100644 Task/Binary-strings/Python/binary-strings-9.py create mode 100644 Task/Binary-strings/REXX/binary-strings.rexx create mode 100644 Task/Binary-strings/Racket/binary-strings.rkt create mode 100644 Task/Binary-strings/Ruby/binary-strings.rb create mode 100644 Task/Binary-strings/Tcl/binary-strings.tcl create mode 100644 Task/Bulls-and-cows/0DESCRIPTION create mode 100644 Task/Bulls-and-cows/1META.yaml create mode 100644 Task/Bulls-and-cows/Ada/bulls-and-cows.ada create mode 100644 Task/Bulls-and-cows/BASIC/bulls-and-cows.bas create mode 100644 Task/Bulls-and-cows/C/bulls-and-cows-1.c create mode 100644 Task/Bulls-and-cows/C/bulls-and-cows-2.c create mode 100644 Task/Bulls-and-cows/Clojure/bulls-and-cows.clj create mode 100644 Task/Bulls-and-cows/Erlang/bulls-and-cows-1.erl create mode 100644 Task/Bulls-and-cows/Erlang/bulls-and-cows-2.erl create mode 100644 Task/Bulls-and-cows/Forth/bulls-and-cows.fth create mode 100644 Task/Bulls-and-cows/Fortran/bulls-and-cows.f create mode 100644 Task/Bulls-and-cows/Go/bulls-and-cows-1.go create mode 100644 Task/Bulls-and-cows/Go/bulls-and-cows-2.go create mode 100644 Task/Bulls-and-cows/Haskell/bulls-and-cows.hs create mode 100644 Task/Bulls-and-cows/Java/bulls-and-cows.java create mode 100644 Task/Bulls-and-cows/JavaScript/bulls-and-cows.js create mode 100644 Task/Bulls-and-cows/Lua/bulls-and-cows.lua create mode 100644 Task/Bulls-and-cows/PHP/bulls-and-cows.php create mode 100644 Task/Bulls-and-cows/Perl/bulls-and-cows.pl create mode 100644 Task/Bulls-and-cows/PicoLisp/bulls-and-cows.l create mode 100644 Task/Bulls-and-cows/Prolog/bulls-and-cows.pro create mode 100644 Task/Bulls-and-cows/Python/bulls-and-cows.py create mode 100644 Task/Bulls-and-cows/R/bulls-and-cows.r create mode 100644 Task/Bulls-and-cows/REXX/bulls-and-cows-1.rexx create mode 100644 Task/Bulls-and-cows/REXX/bulls-and-cows-2.rexx create mode 100644 Task/Bulls-and-cows/Ruby/bulls-and-cows.rb create mode 100644 Task/Bulls-and-cows/Scala/bulls-and-cows.scala create mode 100644 Task/Bulls-and-cows/Scheme/bulls-and-cows.ss create mode 100644 Task/Bulls-and-cows/Smalltalk/bulls-and-cows.st create mode 100644 Task/Bulls-and-cows/Tcl/bulls-and-cows.tcl create mode 100644 Task/Caesar-cipher/0DESCRIPTION create mode 100644 Task/Caesar-cipher/1META.yaml create mode 100644 Task/Caesar-cipher/AWK/caesar-cipher.awk create mode 100644 Task/Caesar-cipher/Ada/caesar-cipher.ada create mode 100644 Task/Caesar-cipher/C/caesar-cipher.c create mode 100644 Task/Caesar-cipher/Clojure/caesar-cipher.clj create mode 100644 Task/Caesar-cipher/CoffeeScript/caesar-cipher.coffee create mode 100644 Task/Caesar-cipher/Erlang/caesar-cipher-1.erl create mode 100644 Task/Caesar-cipher/Erlang/caesar-cipher-2.erl create mode 100644 Task/Caesar-cipher/Forth/caesar-cipher.fth create mode 100644 Task/Caesar-cipher/Fortran/caesar-cipher.f create mode 100644 Task/Caesar-cipher/Go/caesar-cipher-1.go create mode 100644 Task/Caesar-cipher/Go/caesar-cipher-2.go create mode 100644 Task/Caesar-cipher/Haskell/caesar-cipher.hs create mode 100644 Task/Caesar-cipher/Java/caesar-cipher.java create mode 100644 Task/Caesar-cipher/JavaScript/caesar-cipher.js create mode 100644 Task/Caesar-cipher/Lua/caesar-cipher.lua create mode 100644 Task/Caesar-cipher/PHP/caesar-cipher.php create mode 100644 Task/Caesar-cipher/Perl/caesar-cipher.pl create mode 100644 Task/Caesar-cipher/PicoLisp/caesar-cipher.l create mode 100644 Task/Caesar-cipher/Prolog/caesar-cipher.pro create mode 100644 Task/Caesar-cipher/Python/caesar-cipher-1.py create mode 100644 Task/Caesar-cipher/Python/caesar-cipher-2.py create mode 100644 Task/Caesar-cipher/Python/caesar-cipher-3.py create mode 100644 Task/Caesar-cipher/REXX/caesar-cipher-1.rexx create mode 100644 Task/Caesar-cipher/REXX/caesar-cipher-2.rexx create mode 100644 Task/Caesar-cipher/Racket/caesar-cipher-1.rkt create mode 100644 Task/Caesar-cipher/Racket/caesar-cipher-2.rkt create mode 100644 Task/Caesar-cipher/Ruby/caesar-cipher.rb create mode 100644 Task/Caesar-cipher/Scala/caesar-cipher-1.scala create mode 100644 Task/Caesar-cipher/Scala/caesar-cipher-2.scala create mode 100644 Task/Caesar-cipher/Smalltalk/caesar-cipher-1.st create mode 100644 Task/Caesar-cipher/Smalltalk/caesar-cipher-2.st create mode 100644 Task/Caesar-cipher/Tcl/caesar-cipher-1.tcl create mode 100644 Task/Caesar-cipher/Tcl/caesar-cipher-2.tcl create mode 100644 Task/Calendar/Ada/calendar-1.ada create mode 100644 Task/Calendar/Ada/calendar-2.ada create mode 100644 Task/Calendar/Ada/calendar-3.ada create mode 100644 Task/Calendar/Tcl/calendar-1.tcl create mode 100644 Task/Check-that-file-exists/0DESCRIPTION create mode 100644 Task/Check-that-file-exists/1META.yaml create mode 100644 Task/Check-that-file-exists/Ada/check-that-file-exists-1.ada create mode 100644 Task/Check-that-file-exists/Ada/check-that-file-exists-2.ada create mode 100644 Task/Check-that-file-exists/BASIC/check-that-file-exists-1.bas create mode 100644 Task/Check-that-file-exists/BASIC/check-that-file-exists-2.bas create mode 100644 Task/Check-that-file-exists/BASIC/check-that-file-exists-3.bas create mode 100644 Task/Check-that-file-exists/C/check-that-file-exists.c create mode 100644 Task/Check-that-file-exists/Clojure/check-that-file-exists.clj create mode 100644 Task/Check-that-file-exists/Erlang/check-that-file-exists.erl create mode 100644 Task/Check-that-file-exists/Forth/check-that-file-exists.fth create mode 100644 Task/Check-that-file-exists/Fortran/check-that-file-exists-1.f create mode 100644 Task/Check-that-file-exists/Fortran/check-that-file-exists-2.f create mode 100644 Task/Check-that-file-exists/Go/check-that-file-exists.go create mode 100644 Task/Check-that-file-exists/Haskell/check-that-file-exists.hs create mode 100644 Task/Check-that-file-exists/Java/check-that-file-exists-1.java create mode 100644 Task/Check-that-file-exists/Java/check-that-file-exists-2.java create mode 100644 Task/Check-that-file-exists/JavaScript/check-that-file-exists.js create mode 100644 Task/Check-that-file-exists/Lua/check-that-file-exists-1.lua create mode 100644 Task/Check-that-file-exists/Lua/check-that-file-exists-2.lua create mode 100644 Task/Check-that-file-exists/PHP/check-that-file-exists.php create mode 100644 Task/Check-that-file-exists/Perl/check-that-file-exists.pl create mode 100644 Task/Check-that-file-exists/PicoLisp/check-that-file-exists.l create mode 100644 Task/Check-that-file-exists/Python/check-that-file-exists.py create mode 100644 Task/Check-that-file-exists/R/check-that-file-exists.r create mode 100644 Task/Check-that-file-exists/Ruby/check-that-file-exists-1.rb create mode 100644 Task/Check-that-file-exists/Ruby/check-that-file-exists-2.rb create mode 100644 Task/Check-that-file-exists/Scheme/check-that-file-exists.ss create mode 100644 Task/Check-that-file-exists/Smalltalk/check-that-file-exists-1.st create mode 100644 Task/Check-that-file-exists/Smalltalk/check-that-file-exists-2.st create mode 100644 Task/Check-that-file-exists/Tcl/check-that-file-exists.tcl create mode 100644 Task/Checkpoint-synchronization/0DESCRIPTION create mode 100644 Task/Checkpoint-synchronization/1META.yaml create mode 100644 Task/Checkpoint-synchronization/Ada/checkpoint-synchronization.ada create mode 100644 Task/Checkpoint-synchronization/C/checkpoint-synchronization.c create mode 100644 Task/Checkpoint-synchronization/Go/checkpoint-synchronization.go create mode 100644 Task/Checkpoint-synchronization/Haskell/checkpoint-synchronization-1.hs create mode 100644 Task/Checkpoint-synchronization/Haskell/checkpoint-synchronization-2.hs create mode 100644 Task/Checkpoint-synchronization/Java/checkpoint-synchronization-1.java create mode 100644 Task/Checkpoint-synchronization/Java/checkpoint-synchronization-2.java create mode 100644 Task/Checkpoint-synchronization/Perl/checkpoint-synchronization.pl create mode 100644 Task/Checkpoint-synchronization/PicoLisp/checkpoint-synchronization.l create mode 100644 Task/Checkpoint-synchronization/Ruby/checkpoint-synchronization.rb create mode 100644 Task/Checkpoint-synchronization/Tcl/checkpoint-synchronization-1.tcl create mode 100644 Task/Checkpoint-synchronization/Tcl/checkpoint-synchronization-2.tcl create mode 100644 Task/Classes/Ada/classes-1.ada create mode 100644 Task/Classes/Ada/classes-2.ada create mode 100644 Task/Classes/Ada/classes-3.ada create mode 100644 Task/Classes/Forth/classes-1.fth create mode 100644 Task/Classes/Go/classes-1.go create mode 100644 Task/Classes/Haskell/classes-1.hs create mode 100644 Task/Classes/Perl/classes-1.pl create mode 100644 Task/Classes/Python/classes-1.py create mode 100644 Task/Classes/R/classes-1.r create mode 100644 Task/Classes/Sather/classes-1.sa create mode 100644 Task/Closest-pair-problem/0DESCRIPTION create mode 100644 Task/Closest-pair-problem/1META.yaml create mode 100644 Task/Closest-pair-problem/Ada/closest-pair-problem.ada create mode 100644 Task/Closest-pair-problem/Clojure/closest-pair-problem.clj create mode 100644 Task/Closest-pair-problem/Go/closest-pair-problem-1.go create mode 100644 Task/Closest-pair-problem/Go/closest-pair-problem-2.go create mode 100644 Task/Closest-pair-problem/Haskell/closest-pair-problem-1.hs create mode 100644 Task/Closest-pair-problem/Haskell/closest-pair-problem-2.hs create mode 100644 Task/Closest-pair-problem/Java/closest-pair-problem.java create mode 100644 Task/Closest-pair-problem/JavaScript/closest-pair-problem.js create mode 100644 Task/Closest-pair-problem/Perl/closest-pair-problem.pl create mode 100644 Task/Closest-pair-problem/PicoLisp/closest-pair-problem.l create mode 100644 Task/Closest-pair-problem/Python/closest-pair-problem.py create mode 100644 Task/Closest-pair-problem/R/closest-pair-problem-1.r create mode 100644 Task/Closest-pair-problem/R/closest-pair-problem-2.r create mode 100644 Task/Closest-pair-problem/R/closest-pair-problem-3.r create mode 100644 Task/Closest-pair-problem/R/closest-pair-problem-4.r create mode 100644 Task/Closest-pair-problem/R/closest-pair-problem-5.r create mode 100644 Task/Closest-pair-problem/REXX/closest-pair-problem.rexx create mode 100644 Task/Closest-pair-problem/Ruby/closest-pair-problem.rb create mode 100644 Task/Closest-pair-problem/Scala/closest-pair-problem.scala create mode 100644 Task/Closest-pair-problem/Tcl/closest-pair-problem.tcl create mode 100644 Task/Collections/AWK/collections-1.awk create mode 100644 Task/Collections/Ada/collections-1.ada create mode 100644 Task/Collections/Ada/collections-2.ada create mode 100644 Task/Collections/Ada/collections-3.ada create mode 100644 Task/Collections/Ada/collections-4.ada create mode 100644 Task/Collections/Ada/collections-5.ada create mode 100644 Task/Collections/C/collections-1.c create mode 100644 Task/Collections/Clojure/collections-1.clj create mode 100644 Task/Collections/Forth/collections-1.fth create mode 100644 Task/Collections/Haskell/collections-1.hs create mode 100644 Task/Collections/Java/collections-1.java create mode 100644 Task/Collections/JavaScript/collections-1.js create mode 100644 Task/Collections/R/collections-1.r create mode 100644 Task/Collections/REXX/collections-1.rexx create mode 100644 Task/Collections/Ruby/collections-1.rb create mode 100644 Task/Collections/Scheme/collections-1.ss create mode 100644 Task/Collections/Tcl/collections-1.tcl create mode 100644 Task/Color-of-a-screen-pixel/0DESCRIPTION create mode 100644 Task/Color-of-a-screen-pixel/1META.yaml create mode 100644 Task/Color-of-a-screen-pixel/BASIC/color-of-a-screen-pixel.bas create mode 100644 Task/Color-of-a-screen-pixel/C/color-of-a-screen-pixel-1.c create mode 100644 Task/Color-of-a-screen-pixel/C/color-of-a-screen-pixel-2.c create mode 100644 Task/Color-of-a-screen-pixel/Clojure/color-of-a-screen-pixel.clj create mode 100644 Task/Color-of-a-screen-pixel/Java/color-of-a-screen-pixel.java create mode 100644 Task/Color-of-a-screen-pixel/PHP/color-of-a-screen-pixel.php create mode 100644 Task/Color-of-a-screen-pixel/PicoLisp/color-of-a-screen-pixel.l create mode 100644 Task/Color-of-a-screen-pixel/Python/color-of-a-screen-pixel-1.py create mode 100644 Task/Color-of-a-screen-pixel/Python/color-of-a-screen-pixel-2.py create mode 100644 Task/Color-of-a-screen-pixel/Python/color-of-a-screen-pixel-3.py create mode 100644 Task/Color-of-a-screen-pixel/Python/color-of-a-screen-pixel-4.py create mode 100644 Task/Color-of-a-screen-pixel/Python/color-of-a-screen-pixel-5.py create mode 100644 Task/Color-of-a-screen-pixel/Tcl/color-of-a-screen-pixel.tcl create mode 100644 Task/Comments/360-Assembly/comments.360 create mode 100644 Task/Comments/ACL2/comments.acl2 create mode 100644 Task/Comments/Ada/comments.ada create mode 100644 Task/Comments/Befunge/comments-1.bf create mode 100644 Task/Comments/C/comments-1.c create mode 100644 Task/Comments/Clojure/comments-1.clj create mode 100644 Task/Comments/Forth/comments-1.fth create mode 100644 Task/Comments/Fortran/comments-1.f create mode 100644 Task/Comments/Java/comments-1.java create mode 100644 Task/Comments/LaTeX/comments-1.tex create mode 100644 Task/Comments/Lua/comments-1.lua create mode 100644 Task/Comments/PHP/comments-1.php create mode 100644 Task/Comments/Perl/comments-1.pl create mode 100644 Task/Comments/Prolog/comments-1.pro create mode 100644 Task/Comments/Python/comments-1.py create mode 100644 Task/Comments/REXX/comments-1.rexx create mode 100644 Task/Comments/Tcl/comments-1.tcl create mode 100644 Task/Death-Star/0DESCRIPTION create mode 100644 Task/Death-Star/1META.yaml create mode 100644 Task/Death-Star/C/death-star.c create mode 100644 Task/Death-Star/Go/death-star.go create mode 100644 Task/Death-Star/Perl/death-star.pl create mode 100644 Task/Death-Star/Python/death-star.py create mode 100644 Task/Death-Star/REXX/death-star.rexx create mode 100644 Task/Death-Star/Tcl/death-star-1.tcl create mode 100644 Task/Death-Star/Tcl/death-star-2.tcl create mode 100644 Task/Define-a-primitive-data-type/0DESCRIPTION create mode 100644 Task/Define-a-primitive-data-type/1META.yaml create mode 100644 Task/Define-a-primitive-data-type/Ada/define-a-primitive-data-type-1.ada create mode 100644 Task/Define-a-primitive-data-type/Ada/define-a-primitive-data-type-2.ada create mode 100644 Task/Define-a-primitive-data-type/Fortran/define-a-primitive-data-type-1.f create mode 100644 Task/Define-a-primitive-data-type/Fortran/define-a-primitive-data-type-2.f create mode 100644 Task/Define-a-primitive-data-type/Haskell/define-a-primitive-data-type-1.hs create mode 100644 Task/Define-a-primitive-data-type/Haskell/define-a-primitive-data-type-2.hs create mode 100644 Task/Define-a-primitive-data-type/Haskell/define-a-primitive-data-type-3.hs create mode 100644 Task/Define-a-primitive-data-type/Java/define-a-primitive-data-type.java create mode 100644 Task/Define-a-primitive-data-type/JavaScript/define-a-primitive-data-type.js create mode 100644 Task/Define-a-primitive-data-type/Perl/define-a-primitive-data-type.pl create mode 100644 Task/Define-a-primitive-data-type/PicoLisp/define-a-primitive-data-type.l create mode 100644 Task/Define-a-primitive-data-type/Python/define-a-primitive-data-type.py create mode 100644 Task/Define-a-primitive-data-type/Racket/define-a-primitive-data-type-1.rkt create mode 100644 Task/Define-a-primitive-data-type/Racket/define-a-primitive-data-type-2.rkt create mode 100644 Task/Define-a-primitive-data-type/Ruby/define-a-primitive-data-type.rb create mode 100644 Task/Define-a-primitive-data-type/Tcl/define-a-primitive-data-type.tcl create mode 100644 Task/Delegates/Ada/delegates.ada create mode 100644 Task/Delegates/CoffeeScript/delegates-1.coffee create mode 100644 Task/Delegates/Perl/delegates-1.pl create mode 100644 Task/Delegates/Ruby/delegates-1.rb create mode 100644 Task/Delegates/Tcl/delegates-1.tcl create mode 100644 Task/Delete-a-file/0DESCRIPTION create mode 100644 Task/Delete-a-file/1META.yaml create mode 100644 Task/Delete-a-file/AWK/delete-a-file.awk create mode 100644 Task/Delete-a-file/Ada/delete-a-file-1.ada create mode 100644 Task/Delete-a-file/Ada/delete-a-file-2.ada create mode 100644 Task/Delete-a-file/BASIC/delete-a-file-1.bas create mode 100644 Task/Delete-a-file/BASIC/delete-a-file-2.bas create mode 100644 Task/Delete-a-file/C/delete-a-file-1.c create mode 100644 Task/Delete-a-file/C/delete-a-file-2.c create mode 100644 Task/Delete-a-file/Clojure/delete-a-file.clj create mode 100644 Task/Delete-a-file/Erlang/delete-a-file.erl create mode 100644 Task/Delete-a-file/Forth/delete-a-file.fth create mode 100644 Task/Delete-a-file/Fortran/delete-a-file.f create mode 100644 Task/Delete-a-file/Go/delete-a-file.go create mode 100644 Task/Delete-a-file/Haskell/delete-a-file.hs create mode 100644 Task/Delete-a-file/Java/delete-a-file.java create mode 100644 Task/Delete-a-file/JavaScript/delete-a-file-1.js create mode 100644 Task/Delete-a-file/JavaScript/delete-a-file-2.js create mode 100644 Task/Delete-a-file/Lua/delete-a-file.lua create mode 100644 Task/Delete-a-file/PHP/delete-a-file.php create mode 100644 Task/Delete-a-file/Perl/delete-a-file.pl create mode 100644 Task/Delete-a-file/PicoLisp/delete-a-file.l create mode 100644 Task/Delete-a-file/Python/delete-a-file-1.py create mode 100644 Task/Delete-a-file/Python/delete-a-file-2.py create mode 100644 Task/Delete-a-file/R/delete-a-file.r create mode 100644 Task/Delete-a-file/Ruby/delete-a-file.rb create mode 100644 Task/Delete-a-file/Scheme/delete-a-file.ss create mode 100644 Task/Delete-a-file/Smalltalk/delete-a-file.st create mode 100644 Task/Delete-a-file/Tcl/delete-a-file.tcl create mode 100644 Task/Detect-division-by-zero/0DESCRIPTION create mode 100644 Task/Detect-division-by-zero/ABAP/detect-division-by-zero.abap create mode 100644 Task/Detect-division-by-zero/Ada/detect-division-by-zero.ada create mode 100644 Task/Detect-division-by-zero/C/detect-division-by-zero.c create mode 100644 Task/Detect-division-by-zero/Clojure/detect-division-by-zero.clj create mode 100644 Task/Detect-division-by-zero/Eiffel/detect-division-by-zero.e create mode 100644 Task/Detect-division-by-zero/Erlang/detect-division-by-zero.erl create mode 100644 Task/Detect-division-by-zero/Forth/detect-division-by-zero.fth create mode 100644 Task/Detect-division-by-zero/Go/detect-division-by-zero.go create mode 100644 Task/Detect-division-by-zero/Haskell/detect-division-by-zero.hs create mode 100644 Task/Detect-division-by-zero/Java/detect-division-by-zero-1.java create mode 100644 Task/Detect-division-by-zero/Java/detect-division-by-zero-2.java create mode 100644 Task/Detect-division-by-zero/JavaScript/detect-division-by-zero.js create mode 100644 Task/Detect-division-by-zero/Lua/detect-division-by-zero.lua create mode 100644 Task/Detect-division-by-zero/PHP/detect-division-by-zero-1.php create mode 100644 Task/Detect-division-by-zero/PHP/detect-division-by-zero-2.php create mode 100644 Task/Detect-division-by-zero/Perl/detect-division-by-zero.pl create mode 100644 Task/Detect-division-by-zero/PicoLisp/detect-division-by-zero.l create mode 100644 Task/Detect-division-by-zero/Python/detect-division-by-zero.py create mode 100644 Task/Detect-division-by-zero/R/detect-division-by-zero.r create mode 100644 Task/Detect-division-by-zero/REXX/detect-division-by-zero.rexx create mode 100644 Task/Detect-division-by-zero/Racket/detect-division-by-zero.rkt create mode 100644 Task/Detect-division-by-zero/Ruby/detect-division-by-zero-1.rb create mode 100644 Task/Detect-division-by-zero/Ruby/detect-division-by-zero-2.rb create mode 100644 Task/Detect-division-by-zero/Ruby/detect-division-by-zero-3.rb create mode 100644 Task/Detect-division-by-zero/Ruby/detect-division-by-zero-4.rb create mode 100644 Task/Detect-division-by-zero/Scala/detect-division-by-zero.scala create mode 100644 Task/Detect-division-by-zero/Smalltalk/detect-division-by-zero.st create mode 100644 Task/Detect-division-by-zero/Tcl/detect-division-by-zero-1.tcl create mode 100644 Task/Detect-division-by-zero/Tcl/detect-division-by-zero-2.tcl create mode 100644 Task/Determine-if-a-string-is-numeric/0DESCRIPTION create mode 100644 Task/Determine-if-a-string-is-numeric/1META.yaml create mode 100644 Task/Determine-if-a-string-is-numeric/AWK/determine-if-a-string-is-numeric.awk create mode 100644 Task/Determine-if-a-string-is-numeric/ActionScript/determine-if-a-string-is-numeric.as create mode 100644 Task/Determine-if-a-string-is-numeric/Ada/determine-if-a-string-is-numeric-1.ada create mode 100644 Task/Determine-if-a-string-is-numeric/Ada/determine-if-a-string-is-numeric-2.ada create mode 100644 Task/Determine-if-a-string-is-numeric/Ada/determine-if-a-string-is-numeric-3.ada create mode 100644 Task/Determine-if-a-string-is-numeric/BASIC/determine-if-a-string-is-numeric.bas create mode 100644 Task/Determine-if-a-string-is-numeric/C/determine-if-a-string-is-numeric.c create mode 100644 Task/Determine-if-a-string-is-numeric/Clojure/determine-if-a-string-is-numeric-1.clj create mode 100644 Task/Determine-if-a-string-is-numeric/Clojure/determine-if-a-string-is-numeric-2.clj create mode 100644 Task/Determine-if-a-string-is-numeric/CoffeeScript/determine-if-a-string-is-numeric.coffee create mode 100644 Task/Determine-if-a-string-is-numeric/Erlang/determine-if-a-string-is-numeric.erl create mode 100644 Task/Determine-if-a-string-is-numeric/Forth/determine-if-a-string-is-numeric.fth create mode 100644 Task/Determine-if-a-string-is-numeric/Fortran/determine-if-a-string-is-numeric.f create mode 100644 Task/Determine-if-a-string-is-numeric/Go/determine-if-a-string-is-numeric.go create mode 100644 Task/Determine-if-a-string-is-numeric/Haskell/determine-if-a-string-is-numeric-1.hs create mode 100644 Task/Determine-if-a-string-is-numeric/Haskell/determine-if-a-string-is-numeric-2.hs create mode 100644 Task/Determine-if-a-string-is-numeric/Java/determine-if-a-string-is-numeric-1.java create mode 100644 Task/Determine-if-a-string-is-numeric/Java/determine-if-a-string-is-numeric-2.java create mode 100644 Task/Determine-if-a-string-is-numeric/Java/determine-if-a-string-is-numeric-3.java create mode 100644 Task/Determine-if-a-string-is-numeric/Java/determine-if-a-string-is-numeric-4.java create mode 100644 Task/Determine-if-a-string-is-numeric/Java/determine-if-a-string-is-numeric-5.java create mode 100644 Task/Determine-if-a-string-is-numeric/JavaScript/determine-if-a-string-is-numeric.js create mode 100644 Task/Determine-if-a-string-is-numeric/Lua/determine-if-a-string-is-numeric.lua create mode 100644 Task/Determine-if-a-string-is-numeric/PHP/determine-if-a-string-is-numeric.php create mode 100644 Task/Determine-if-a-string-is-numeric/Perl/determine-if-a-string-is-numeric-1.pl create mode 100644 Task/Determine-if-a-string-is-numeric/Perl/determine-if-a-string-is-numeric-2.pl create mode 100644 Task/Determine-if-a-string-is-numeric/Perl/determine-if-a-string-is-numeric-3.pl create mode 100644 Task/Determine-if-a-string-is-numeric/PicoLisp/determine-if-a-string-is-numeric.l create mode 100644 Task/Determine-if-a-string-is-numeric/Python/determine-if-a-string-is-numeric-1.py create mode 100644 Task/Determine-if-a-string-is-numeric/Python/determine-if-a-string-is-numeric-2.py create mode 100644 Task/Determine-if-a-string-is-numeric/Python/determine-if-a-string-is-numeric-3.py create mode 100644 Task/Determine-if-a-string-is-numeric/Python/determine-if-a-string-is-numeric-4.py create mode 100644 Task/Determine-if-a-string-is-numeric/R/determine-if-a-string-is-numeric.r create mode 100644 Task/Determine-if-a-string-is-numeric/REXX/determine-if-a-string-is-numeric.rexx create mode 100644 Task/Determine-if-a-string-is-numeric/Racket/determine-if-a-string-is-numeric.rkt create mode 100644 Task/Determine-if-a-string-is-numeric/Ruby/determine-if-a-string-is-numeric-1.rb create mode 100644 Task/Determine-if-a-string-is-numeric/Ruby/determine-if-a-string-is-numeric-2.rb create mode 100644 Task/Determine-if-a-string-is-numeric/Scala/determine-if-a-string-is-numeric.scala create mode 100644 Task/Determine-if-a-string-is-numeric/Scheme/determine-if-a-string-is-numeric.ss create mode 100644 Task/Determine-if-a-string-is-numeric/Smalltalk/determine-if-a-string-is-numeric-1.st create mode 100644 Task/Determine-if-a-string-is-numeric/Smalltalk/determine-if-a-string-is-numeric-2.st create mode 100644 Task/Determine-if-a-string-is-numeric/Smalltalk/determine-if-a-string-is-numeric-3.st create mode 100644 Task/Determine-if-a-string-is-numeric/Tcl/determine-if-a-string-is-numeric.tcl create mode 100644 Task/Entropy/Ada/entropy.ada create mode 100644 Task/Entropy/REXX/entropy-1.rexx create mode 100644 Task/Entropy/Ruby/entropy-1.rb create mode 100644 Task/Entropy/Tcl/entropy-1.tcl create mode 100644 Task/FizzBuzz/ACL2/fizzbuzz.acl2 create mode 100644 Task/FizzBuzz/AWK/fizzbuzz-1.awk create mode 100644 Task/FizzBuzz/Ada/fizzbuzz.ada create mode 100644 Task/FizzBuzz/BASIC/fizzbuzz-1.bas create mode 100644 Task/FizzBuzz/C/fizzbuzz-1.c create mode 100644 Task/FizzBuzz/Clojure/fizzbuzz-1.clj create mode 100644 Task/FizzBuzz/CoffeeScript/fizzbuzz-1.coffee create mode 100644 Task/FizzBuzz/Forth/fizzbuzz-1.fth create mode 100644 Task/FizzBuzz/Fortran/fizzbuzz-1.f create mode 100644 Task/FizzBuzz/Haskell/fizzbuzz-1.hs create mode 100644 Task/FizzBuzz/Java/fizzbuzz-1.java create mode 100644 Task/FizzBuzz/JavaScript/fizzbuzz-1.js create mode 100644 Task/FizzBuzz/Lua/fizzbuzz-1.lua create mode 100644 Task/FizzBuzz/PHP/fizzbuzz-1.php create mode 100644 Task/FizzBuzz/Perl/fizzbuzz-1.pl create mode 100644 Task/FizzBuzz/PicoLisp/fizzbuzz-1.l create mode 100644 Task/FizzBuzz/Prolog/fizzbuzz-1.pro create mode 100644 Task/FizzBuzz/Python/fizzbuzz-1.py create mode 100644 Task/FizzBuzz/R/fizzbuzz-1.r create mode 100644 Task/FizzBuzz/REXX/fizzbuzz-1.rexx create mode 100644 Task/FizzBuzz/Ruby/fizzbuzz-1.rb create mode 100644 Task/FizzBuzz/Scala/fizzbuzz-1.scala create mode 100644 Task/FizzBuzz/Smalltalk/fizzbuzz-1.st create mode 100644 Task/FizzBuzz/Tcl/fizzbuzz-1.tcl create mode 100644 Task/Forest-fire/0DESCRIPTION create mode 100644 Task/Forest-fire/1META.yaml create mode 100644 Task/Forest-fire/Ada/forest-fire.ada create mode 100644 Task/Forest-fire/C/forest-fire-1.c create mode 100644 Task/Forest-fire/C/forest-fire-2.c create mode 100644 Task/Forest-fire/Clojure/forest-fire.clj create mode 100644 Task/Forest-fire/Fortran/forest-fire-1.f create mode 100644 Task/Forest-fire/Fortran/forest-fire-2.f create mode 100644 Task/Forest-fire/Go/forest-fire.go create mode 100644 Task/Forest-fire/Haskell/forest-fire-1.hs create mode 100644 Task/Forest-fire/Haskell/forest-fire-2.hs create mode 100644 Task/Forest-fire/Java/forest-fire.java create mode 100644 Task/Forest-fire/JavaScript/forest-fire-1.js create mode 100644 Task/Forest-fire/JavaScript/forest-fire-2.js create mode 100644 Task/Forest-fire/Perl/forest-fire.pl create mode 100644 Task/Forest-fire/PicoLisp/forest-fire.l create mode 100644 Task/Forest-fire/Python/forest-fire.py create mode 100644 Task/Forest-fire/REXX/forest-fire.rexx create mode 100644 Task/Forest-fire/Racket/forest-fire.rkt create mode 100644 Task/Forest-fire/Ruby/forest-fire.rb create mode 100644 Task/Forest-fire/Sather/forest-fire.sa create mode 100644 Task/Forest-fire/Scala/forest-fire-1.scala create mode 100644 Task/Forest-fire/Scala/forest-fire-2.scala create mode 100644 Task/Forest-fire/Tcl/forest-fire.tcl create mode 100644 Task/Go-Fish/0DESCRIPTION create mode 100644 Task/Go-Fish/1META.yaml create mode 100644 Task/Infinity/Ada/infinity-1.ada create mode 100644 Task/Infinity/Ada/infinity-2.ada create mode 100644 Task/Infinity/Ada/infinity-3.ada create mode 100644 Task/Infinity/C/infinity-1.c create mode 100644 Task/Infinity/CoffeeScript/infinity-1.coffee create mode 100644 Task/Infinity/Fortran/infinity-1.f create mode 100644 Task/Infinity/Haskell/infinity-1.hs create mode 100644 Task/Infinity/Java/infinity-1.java create mode 100644 Task/Infinity/JavaScript/infinity-1.js create mode 100644 Task/Infinity/Perl/infinity-1.pl create mode 100644 Task/Infinity/Python/infinity-1.py create mode 100644 Task/Infinity/Ruby/infinity-1.rb create mode 100644 Task/Infinity/Smalltalk/infinity-1.st create mode 100644 Task/Infinity/Tcl/infinity-1.tcl create mode 100644 Task/JSON/Ada/json.ada create mode 100644 Task/JSON/Go/json-1.go create mode 100644 Task/JSON/JavaScript/json-1.js create mode 100644 Task/JSON/Python/json-1.py create mode 100644 Task/JSON/R/json-1.r create mode 100644 Task/JSON/Tcl/json-1.tcl create mode 100644 Task/Knuth-shuffle/0DESCRIPTION create mode 100644 Task/Knuth-shuffle/1META.yaml create mode 100644 Task/Knuth-shuffle/ACL2/knuth-shuffle.acl2 create mode 100644 Task/Knuth-shuffle/AWK/knuth-shuffle.awk create mode 100644 Task/Knuth-shuffle/Ada/knuth-shuffle-1.ada create mode 100644 Task/Knuth-shuffle/Ada/knuth-shuffle-2.ada create mode 100644 Task/Knuth-shuffle/Ada/knuth-shuffle-3.ada create mode 100644 Task/Knuth-shuffle/BASIC/knuth-shuffle.bas create mode 100644 Task/Knuth-shuffle/C/knuth-shuffle-1.c create mode 100644 Task/Knuth-shuffle/C/knuth-shuffle-2.c create mode 100644 Task/Knuth-shuffle/Clojure/knuth-shuffle.clj create mode 100644 Task/Knuth-shuffle/CoffeeScript/knuth-shuffle.coffee create mode 100644 Task/Knuth-shuffle/Forth/knuth-shuffle.fth create mode 100644 Task/Knuth-shuffle/Fortran/knuth-shuffle.f create mode 100644 Task/Knuth-shuffle/Go/knuth-shuffle-1.go create mode 100644 Task/Knuth-shuffle/Go/knuth-shuffle-2.go create mode 100644 Task/Knuth-shuffle/Haskell/knuth-shuffle-1.hs create mode 100644 Task/Knuth-shuffle/Haskell/knuth-shuffle-2.hs create mode 100644 Task/Knuth-shuffle/Haskell/knuth-shuffle-3.hs create mode 100644 Task/Knuth-shuffle/Java/knuth-shuffle.java create mode 100644 Task/Knuth-shuffle/JavaScript/knuth-shuffle.js create mode 100644 Task/Knuth-shuffle/Lua/knuth-shuffle.lua create mode 100644 Task/Knuth-shuffle/PHP/knuth-shuffle.php create mode 100644 Task/Knuth-shuffle/Perl/knuth-shuffle.pl create mode 100644 Task/Knuth-shuffle/PicoLisp/knuth-shuffle.l create mode 100644 Task/Knuth-shuffle/Python/knuth-shuffle.py create mode 100644 Task/Knuth-shuffle/R/knuth-shuffle-1.r create mode 100644 Task/Knuth-shuffle/R/knuth-shuffle-2.r create mode 100644 Task/Knuth-shuffle/REXX/knuth-shuffle.rexx create mode 100644 Task/Knuth-shuffle/Ruby/knuth-shuffle-1.rb create mode 100644 Task/Knuth-shuffle/Ruby/knuth-shuffle-2.rb create mode 100644 Task/Knuth-shuffle/Scala/knuth-shuffle.scala create mode 100644 Task/Knuth-shuffle/Scheme/knuth-shuffle.ss create mode 100644 Task/Knuth-shuffle/Smalltalk/knuth-shuffle-1.st create mode 100644 Task/Knuth-shuffle/Smalltalk/knuth-shuffle-2.st create mode 100644 Task/Knuth-shuffle/Tcl/knuth-shuffle-1.tcl create mode 100644 Task/Knuth-shuffle/Tcl/knuth-shuffle-2.tcl create mode 100644 Task/Narcissist/Ada/narcissist.ada create mode 100644 Task/Narcissist/Go/narcissist-1.go create mode 100644 Task/Narcissist/Perl/narcissist-1.pl create mode 100644 Task/Narcissist/REXX/narcissist-1.rexx create mode 100644 Task/Narcissist/Tcl/narcissist-1.tcl create mode 100644 Task/Ordered-words/0DESCRIPTION create mode 100644 Task/Ordered-words/1META.yaml create mode 100644 Task/Ordered-words/AWK/ordered-words.awk create mode 100644 Task/Ordered-words/Ada/ordered-words.ada create mode 100644 Task/Ordered-words/C/ordered-words-1.c create mode 100644 Task/Ordered-words/C/ordered-words-2.c create mode 100644 Task/Ordered-words/C/ordered-words-3.c create mode 100644 Task/Ordered-words/CoffeeScript/ordered-words-1.coffee create mode 100644 Task/Ordered-words/CoffeeScript/ordered-words-2.coffee create mode 100644 Task/Ordered-words/Forth/ordered-words.fth create mode 100644 Task/Ordered-words/Fortran/ordered-words.f create mode 100644 Task/Ordered-words/Go/ordered-words.go create mode 100644 Task/Ordered-words/Haskell/ordered-words-1.hs create mode 100644 Task/Ordered-words/Haskell/ordered-words-2.hs create mode 100644 Task/Ordered-words/Haskell/ordered-words-3.hs create mode 100644 Task/Ordered-words/Java/ordered-words.java create mode 100644 Task/Ordered-words/JavaScript/ordered-words-1.js create mode 100644 Task/Ordered-words/JavaScript/ordered-words-2.js create mode 100644 Task/Ordered-words/Lua/ordered-words.lua create mode 100644 Task/Ordered-words/Perl/ordered-words.pl create mode 100644 Task/Ordered-words/PicoLisp/ordered-words.l create mode 100644 Task/Ordered-words/Prolog/ordered-words.pro create mode 100644 Task/Ordered-words/Python/ordered-words-1.py create mode 100644 Task/Ordered-words/Python/ordered-words-2.py create mode 100644 Task/Ordered-words/Python/ordered-words-3.py create mode 100644 Task/Ordered-words/REXX/ordered-words.rexx create mode 100644 Task/Ordered-words/Ruby/ordered-words.rb create mode 100644 Task/Ordered-words/Scheme/ordered-words.ss create mode 100644 Task/Ordered-words/Smalltalk/ordered-words.st create mode 100644 Task/Ordered-words/Tcl/ordered-words.tcl create mode 100644 Task/Pi/Ada/pi.ada create mode 100644 Task/Pi/Ruby/pi-1.rb create mode 100644 Task/Pi/Tcl/pi-1.tcl create mode 100644 Task/Quine/ABAP/quine-1.abap create mode 100644 Task/Quine/ABAP/quine-2.abap create mode 100644 Task/Quine/ABAP/quine-3.abap create mode 100644 Task/Quine/ABAP/quine-4.abap create mode 100644 Task/Quine/ACL2/quine-1.acl2 create mode 100644 Task/Quine/ACL2/quine-2.acl2 create mode 100644 Task/Quine/Ada/quine.ada create mode 100644 Task/Quine/BASIC/quine-1.bas create mode 100644 Task/Quine/Haskell/quine-1.hs create mode 100644 Task/Quine/Java/quine-1.java create mode 100644 Task/Quine/JavaScript/quine-1.js create mode 100644 Task/Quine/Perl/quine-1.pl create mode 100644 Task/Quine/PicoLisp/quine-1.l create mode 100644 Task/Quine/Python/quine-1.py create mode 100644 Task/Quine/REXX/quine-1.rexx create mode 100644 Task/Quine/Ruby/quine-1.rb create mode 100644 Task/Quine/Scala/quine-1.scala create mode 100644 Task/Quine/Scheme/quine-1.ss create mode 100644 Task/Quine/Smalltalk/quine-1.st create mode 100644 Task/Quine/Tcl/quine-1.tcl create mode 100644 Task/Search-a-list/0DESCRIPTION create mode 100644 Task/Search-a-list/1META.yaml create mode 100644 Task/Search-a-list/ACL2/search-a-list.acl2 create mode 100644 Task/Search-a-list/AWK/search-a-list.awk create mode 100644 Task/Search-a-list/ActionScript/search-a-list-1.as create mode 100644 Task/Search-a-list/ActionScript/search-a-list-2.as create mode 100644 Task/Search-a-list/ActionScript/search-a-list-3.as create mode 100644 Task/Search-a-list/Ada/search-a-list.ada create mode 100644 Task/Search-a-list/BASIC/search-a-list.bas create mode 100644 Task/Search-a-list/C/search-a-list.c create mode 100644 Task/Search-a-list/Clojure/search-a-list.clj create mode 100644 Task/Search-a-list/Erlang/search-a-list.erl create mode 100644 Task/Search-a-list/Forth/search-a-list.fth create mode 100644 Task/Search-a-list/Fortran/search-a-list.f create mode 100644 Task/Search-a-list/Go/search-a-list.go create mode 100644 Task/Search-a-list/Haskell/search-a-list-1.hs create mode 100644 Task/Search-a-list/Haskell/search-a-list-2.hs create mode 100644 Task/Search-a-list/Haskell/search-a-list-3.hs create mode 100644 Task/Search-a-list/Haskell/search-a-list-4.hs create mode 100644 Task/Search-a-list/Java/search-a-list-1.java create mode 100644 Task/Search-a-list/Java/search-a-list-2.java create mode 100644 Task/Search-a-list/JavaScript/search-a-list-1.js create mode 100644 Task/Search-a-list/JavaScript/search-a-list-2.js create mode 100644 Task/Search-a-list/Lua/search-a-list.lua create mode 100644 Task/Search-a-list/PHP/search-a-list.php create mode 100644 Task/Search-a-list/Perl/search-a-list-1.pl create mode 100644 Task/Search-a-list/Perl/search-a-list-2.pl create mode 100644 Task/Search-a-list/Perl/search-a-list-3.pl create mode 100644 Task/Search-a-list/PicoLisp/search-a-list.l create mode 100644 Task/Search-a-list/Prolog/search-a-list.pro create mode 100644 Task/Search-a-list/Python/search-a-list-1.py create mode 100644 Task/Search-a-list/Python/search-a-list-2.py create mode 100644 Task/Search-a-list/Python/search-a-list-3.py create mode 100644 Task/Search-a-list/R/search-a-list-1.r create mode 100644 Task/Search-a-list/R/search-a-list-2.r create mode 100644 Task/Search-a-list/REXX/search-a-list-1.rexx create mode 100644 Task/Search-a-list/REXX/search-a-list-2.rexx create mode 100644 Task/Search-a-list/REXX/search-a-list-3.rexx create mode 100644 Task/Search-a-list/REXX/search-a-list-4.rexx create mode 100644 Task/Search-a-list/Racket/search-a-list-1.rkt create mode 100644 Task/Search-a-list/Racket/search-a-list-2.rkt create mode 100644 Task/Search-a-list/Racket/search-a-list-3.rkt create mode 100644 Task/Search-a-list/Ruby/search-a-list-1.rb create mode 100644 Task/Search-a-list/Ruby/search-a-list-2.rb create mode 100644 Task/Search-a-list/Ruby/search-a-list-3.rb create mode 100644 Task/Search-a-list/Sather/search-a-list.sa create mode 100644 Task/Search-a-list/Scala/search-a-list.scala create mode 100644 Task/Search-a-list/Scheme/search-a-list.ss create mode 100644 Task/Search-a-list/Smalltalk/search-a-list.st create mode 100644 Task/Search-a-list/Tcl/search-a-list-1.tcl create mode 100644 Task/Search-a-list/Tcl/search-a-list-2.tcl diff --git a/Lang/0815/0DESCRIPTION b/Lang/0815/0DESCRIPTION new file mode 100644 index 0000000000..836363472e --- /dev/null +++ b/Lang/0815/0DESCRIPTION @@ -0,0 +1,9 @@ +{{language|0815}} +'''0815''' is an esoteric programming language designed and implemented between December 2012 and January 2013 by [[Paulo Jorente]] + + +==See also== +* [http://esolangs.org/wiki/0815 0815 Esolangs] – 0815 on Esolangs +* [http://pjorente.pj.funpic.de/poncho/esolang/ 0815 page] – features specs, programs and an interpreter. + +[[Category:Esoteric_Languages]] \ No newline at end of file diff --git a/Lang/0815/99-Bottles-of-Beer b/Lang/0815/99-Bottles-of-Beer new file mode 120000 index 0000000000..a429d71bfe --- /dev/null +++ b/Lang/0815/99-Bottles-of-Beer @@ -0,0 +1 @@ +../../Task/99-Bottles-of-Beer/0815 \ No newline at end of file diff --git a/Lang/360-Assembly/0DESCRIPTION b/Lang/360-Assembly/0DESCRIPTION new file mode 100644 index 0000000000..a56af4e8bc --- /dev/null +++ b/Lang/360-Assembly/0DESCRIPTION @@ -0,0 +1,2 @@ +{{stub}}{{language}} +[[Category:Assembly]] \ No newline at end of file diff --git a/Lang/360-Assembly/Comments b/Lang/360-Assembly/Comments new file mode 120000 index 0000000000..f2736ed864 --- /dev/null +++ b/Lang/360-Assembly/Comments @@ -0,0 +1 @@ +../../Task/Comments/360-Assembly \ No newline at end of file diff --git a/Lang/A+/0DESCRIPTION b/Lang/A+/0DESCRIPTION new file mode 100644 index 0000000000..fe07e23140 --- /dev/null +++ b/Lang/A+/0DESCRIPTION @@ -0,0 +1,8 @@ +{{language|A+ +|site=http://www.aplusdev.org/ +}} + +A+ is an array programming language, which is derived from the programming language [[derived from::A]], a dialect of [[APL]] with aggressive extensions. Arthur Whitney developed the "A" portion of A+, while other developers at Morgan Stanley extended it, adding a graphical user interface and other language features. A+ was designed for numerically intensive applications, especially those found in financial applications. A+ runs on many Unix variants, including Linux. A+ is a high-level, interactive, interpreted language.[[#Citation|[1]]] + +==Citations== +#[[wp:A%2B_(programming_language)|Wikipedia A+]] \ No newline at end of file diff --git a/Lang/ABAP/0DESCRIPTION b/Lang/ABAP/0DESCRIPTION new file mode 100644 index 0000000000..446b44c265 --- /dev/null +++ b/Lang/ABAP/0DESCRIPTION @@ -0,0 +1,2 @@ +{{stub}}{{language|site=http://www.sdn.sap.com/irj/sdn/abap}} +ABAP (Advanced Business Application Programming) is a programming language developed by the german software vendor SAP. It is mainly used to build high performance business applications. \ No newline at end of file diff --git a/Lang/ABAP/99-Bottles-of-Beer b/Lang/ABAP/99-Bottles-of-Beer new file mode 120000 index 0000000000..b7768e4e51 --- /dev/null +++ b/Lang/ABAP/99-Bottles-of-Beer @@ -0,0 +1 @@ +../../Task/99-Bottles-of-Beer/ABAP \ No newline at end of file diff --git a/Lang/ABAP/Ackermann-function b/Lang/ABAP/Ackermann-function new file mode 120000 index 0000000000..f3b46fe804 --- /dev/null +++ b/Lang/ABAP/Ackermann-function @@ -0,0 +1 @@ +../../Task/Ackermann-function/ABAP \ No newline at end of file diff --git a/Lang/ABAP/Anagrams b/Lang/ABAP/Anagrams new file mode 120000 index 0000000000..9e3ec3a3bf --- /dev/null +++ b/Lang/ABAP/Anagrams @@ -0,0 +1 @@ +../../Task/Anagrams/ABAP \ No newline at end of file diff --git a/Lang/ABAP/Detect-division-by-zero b/Lang/ABAP/Detect-division-by-zero new file mode 120000 index 0000000000..79070dff66 --- /dev/null +++ b/Lang/ABAP/Detect-division-by-zero @@ -0,0 +1 @@ +../../Task/Detect-division-by-zero/ABAP \ No newline at end of file diff --git a/Lang/ABAP/Quine b/Lang/ABAP/Quine new file mode 120000 index 0000000000..89f3e3fe4e --- /dev/null +++ b/Lang/ABAP/Quine @@ -0,0 +1 @@ +../../Task/Quine/ABAP \ No newline at end of file diff --git a/Lang/ACL2/0DESCRIPTION b/Lang/ACL2/0DESCRIPTION new file mode 100644 index 0000000000..a40f260132 --- /dev/null +++ b/Lang/ACL2/0DESCRIPTION @@ -0,0 +1,10 @@ +{{stub}} +{{language +|site=http://userweb.cs.utexas.edu/users/moore/acl2/ +|strength=strong +|safety=unsafe +|checking=dynamic +|gc=yes +|LCT=yes}} +{{language programming paradigm|Functional}} +ACL2 is both a programming language in which you can model computer systems and a tool to help you prove properties of those models. \ No newline at end of file diff --git a/Lang/ACL2/99-Bottles-of-Beer b/Lang/ACL2/99-Bottles-of-Beer new file mode 120000 index 0000000000..c798847c1a --- /dev/null +++ b/Lang/ACL2/99-Bottles-of-Beer @@ -0,0 +1 @@ +../../Task/99-Bottles-of-Beer/ACL2 \ No newline at end of file diff --git a/Lang/ACL2/Arrays b/Lang/ACL2/Arrays new file mode 120000 index 0000000000..9f51f3e22a --- /dev/null +++ b/Lang/ACL2/Arrays @@ -0,0 +1 @@ +../../Task/Arrays/ACL2 \ No newline at end of file diff --git a/Lang/ACL2/Binary-search b/Lang/ACL2/Binary-search new file mode 120000 index 0000000000..df213d603e --- /dev/null +++ b/Lang/ACL2/Binary-search @@ -0,0 +1 @@ +../../Task/Binary-search/ACL2 \ No newline at end of file diff --git a/Lang/ACL2/Comments b/Lang/ACL2/Comments new file mode 120000 index 0000000000..768b236432 --- /dev/null +++ b/Lang/ACL2/Comments @@ -0,0 +1 @@ +../../Task/Comments/ACL2 \ No newline at end of file diff --git a/Lang/ACL2/FizzBuzz b/Lang/ACL2/FizzBuzz new file mode 120000 index 0000000000..9f0893e7f6 --- /dev/null +++ b/Lang/ACL2/FizzBuzz @@ -0,0 +1 @@ +../../Task/FizzBuzz/ACL2 \ No newline at end of file diff --git a/Lang/ACL2/Knuth-shuffle b/Lang/ACL2/Knuth-shuffle new file mode 120000 index 0000000000..bb7a9bd9e1 --- /dev/null +++ b/Lang/ACL2/Knuth-shuffle @@ -0,0 +1 @@ +../../Task/Knuth-shuffle/ACL2 \ No newline at end of file diff --git a/Lang/ACL2/Quine b/Lang/ACL2/Quine new file mode 120000 index 0000000000..6eb0bca588 --- /dev/null +++ b/Lang/ACL2/Quine @@ -0,0 +1 @@ +../../Task/Quine/ACL2 \ No newline at end of file diff --git a/Lang/ACL2/Search-a-list b/Lang/ACL2/Search-a-list new file mode 120000 index 0000000000..edbdabf0f7 --- /dev/null +++ b/Lang/ACL2/Search-a-list @@ -0,0 +1 @@ +../../Task/Search-a-list/ACL2 \ No newline at end of file diff --git a/Lang/AWK/99-Bottles-of-Beer b/Lang/AWK/99-Bottles-of-Beer new file mode 120000 index 0000000000..da5b663609 --- /dev/null +++ b/Lang/AWK/99-Bottles-of-Beer @@ -0,0 +1 @@ +../../Task/99-Bottles-of-Beer/AWK \ No newline at end of file diff --git a/Lang/AWK/Ackermann-function b/Lang/AWK/Ackermann-function new file mode 120000 index 0000000000..e8987e6ad9 --- /dev/null +++ b/Lang/AWK/Ackermann-function @@ -0,0 +1 @@ +../../Task/Ackermann-function/AWK \ No newline at end of file diff --git a/Lang/AWK/Balanced-brackets b/Lang/AWK/Balanced-brackets new file mode 120000 index 0000000000..a6ccec6abe --- /dev/null +++ b/Lang/AWK/Balanced-brackets @@ -0,0 +1 @@ +../../Task/Balanced-brackets/AWK \ No newline at end of file diff --git a/Lang/AWK/Best-shuffle b/Lang/AWK/Best-shuffle new file mode 120000 index 0000000000..1e4c04b601 --- /dev/null +++ b/Lang/AWK/Best-shuffle @@ -0,0 +1 @@ +../../Task/Best-shuffle/AWK \ No newline at end of file diff --git a/Lang/AWK/Binary-search b/Lang/AWK/Binary-search new file mode 120000 index 0000000000..063d60427c --- /dev/null +++ b/Lang/AWK/Binary-search @@ -0,0 +1 @@ +../../Task/Binary-search/AWK \ No newline at end of file diff --git a/Lang/AWK/Caesar-cipher b/Lang/AWK/Caesar-cipher new file mode 120000 index 0000000000..190b6c9776 --- /dev/null +++ b/Lang/AWK/Caesar-cipher @@ -0,0 +1 @@ +../../Task/Caesar-cipher/AWK \ No newline at end of file diff --git a/Lang/AWK/Delete-a-file b/Lang/AWK/Delete-a-file new file mode 120000 index 0000000000..86a7985a99 --- /dev/null +++ b/Lang/AWK/Delete-a-file @@ -0,0 +1 @@ +../../Task/Delete-a-file/AWK \ No newline at end of file diff --git a/Lang/AWK/Determine-if-a-string-is-numeric b/Lang/AWK/Determine-if-a-string-is-numeric new file mode 120000 index 0000000000..bd2fa035df --- /dev/null +++ b/Lang/AWK/Determine-if-a-string-is-numeric @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-is-numeric/AWK \ No newline at end of file diff --git a/Lang/AWK/Knuth-shuffle b/Lang/AWK/Knuth-shuffle new file mode 120000 index 0000000000..72ff3137cd --- /dev/null +++ b/Lang/AWK/Knuth-shuffle @@ -0,0 +1 @@ +../../Task/Knuth-shuffle/AWK \ No newline at end of file diff --git a/Lang/AWK/Ordered-words b/Lang/AWK/Ordered-words new file mode 120000 index 0000000000..78c237822a --- /dev/null +++ b/Lang/AWK/Ordered-words @@ -0,0 +1 @@ +../../Task/Ordered-words/AWK \ No newline at end of file diff --git a/Lang/AWK/Search-a-list b/Lang/AWK/Search-a-list new file mode 120000 index 0000000000..3f67534d5b --- /dev/null +++ b/Lang/AWK/Search-a-list @@ -0,0 +1 @@ +../../Task/Search-a-list/AWK \ No newline at end of file diff --git a/Lang/ActionScript/99-Bottles-of-Beer b/Lang/ActionScript/99-Bottles-of-Beer new file mode 120000 index 0000000000..ee2f6597d9 --- /dev/null +++ b/Lang/ActionScript/99-Bottles-of-Beer @@ -0,0 +1 @@ +../../Task/99-Bottles-of-Beer/ActionScript \ No newline at end of file diff --git a/Lang/ActionScript/Ackermann-function b/Lang/ActionScript/Ackermann-function new file mode 120000 index 0000000000..b9ffffe409 --- /dev/null +++ b/Lang/ActionScript/Ackermann-function @@ -0,0 +1 @@ +../../Task/Ackermann-function/ActionScript \ No newline at end of file diff --git a/Lang/ActionScript/Determine-if-a-string-is-numeric b/Lang/ActionScript/Determine-if-a-string-is-numeric new file mode 120000 index 0000000000..e63c407c62 --- /dev/null +++ b/Lang/ActionScript/Determine-if-a-string-is-numeric @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-is-numeric/ActionScript \ No newline at end of file diff --git a/Lang/ActionScript/Search-a-list b/Lang/ActionScript/Search-a-list new file mode 120000 index 0000000000..1c12eeddec --- /dev/null +++ b/Lang/ActionScript/Search-a-list @@ -0,0 +1 @@ +../../Task/Search-a-list/ActionScript \ No newline at end of file diff --git a/Lang/Ada/0DESCRIPTION b/Lang/Ada/0DESCRIPTION new file mode 100644 index 0000000000..85a16e96c0 --- /dev/null +++ b/Lang/Ada/0DESCRIPTION @@ -0,0 +1,20 @@ +{{language|Ada +|exec=machine +|gc=allowed +|parampass=both +|checking=static +|compat=nominative +|express=explicit +|strength=strong +|safety=safe +|LCT=yes +|bnf=http://www.adaic.org/standards/1zrm/html/RM-P.html}}'''Ada''' is a structured, statically typed [[imperative programming|imperative]] computer programming language. Ada was initially standardized by [[ANSI]] in 1983 and by [[ISO]] in 1987. This version of the language is commonly known as [[Ada 83]]. The next version was standardized by ISO in 1995 (ISO/IEC 8652:1995) and is commonly known as [[Ada 95]]. Following that ISO published ISO/IEC 8652:1995/Amd 1:2007 in 2007, which is commonly known as [[Ada 2005]]. Most recently ISO published [http://www.ada-auth.org/standards/12rm/html/RM-TTL.html ISO/IEC 8652:2012(E)], commonly known as [[Ada 2012]]. Formally only the most recent version of the language is known as '''Ada'''. + +The language is named after [[wp:Ada_Lovelace|Augusta Ada King, Countess of Lovelace]] thought to be the first ever programmer. Initially it was designed for [http://www.defense.gov U.S. Department of Defense]. The language is used for large and mission-critical systems. See [[wp:Ada_(programming_language)|also]]. +==Grammar== +* [[wp:Van Wijngaarden grammar|W-Grammar]] Description for Ada. Air Force Inst. of Tech., Wright-Patterson [http://www.ntis.gov/search/product.aspx?ABBR=ADA177802 - Master's thesis] +{{Language programming paradigm|Concurrent}} +{{Language programming paradigm|Distributed}} +{{Language programming paradigm|Generic}} +{{Language programming paradigm|Imperative}} +{{Language programming paradigm|Object-oriented}} \ No newline at end of file diff --git a/Lang/Ada/99-Bottles-of-Beer b/Lang/Ada/99-Bottles-of-Beer new file mode 120000 index 0000000000..9af46257fd --- /dev/null +++ b/Lang/Ada/99-Bottles-of-Beer @@ -0,0 +1 @@ +../../Task/99-Bottles-of-Beer/Ada \ No newline at end of file diff --git a/Lang/Ada/Ackermann-function b/Lang/Ada/Ackermann-function new file mode 120000 index 0000000000..e993fe2e15 --- /dev/null +++ b/Lang/Ada/Ackermann-function @@ -0,0 +1 @@ +../../Task/Ackermann-function/Ada \ No newline at end of file diff --git a/Lang/Ada/Anagrams b/Lang/Ada/Anagrams new file mode 120000 index 0000000000..0e6d77ba0a --- /dev/null +++ b/Lang/Ada/Anagrams @@ -0,0 +1 @@ +../../Task/Anagrams/Ada \ No newline at end of file diff --git a/Lang/Ada/Arrays b/Lang/Ada/Arrays new file mode 120000 index 0000000000..b6c4cbcb37 --- /dev/null +++ b/Lang/Ada/Arrays @@ -0,0 +1 @@ +../../Task/Arrays/Ada \ No newline at end of file diff --git a/Lang/Ada/Assertions b/Lang/Ada/Assertions new file mode 120000 index 0000000000..9fb6694805 --- /dev/null +++ b/Lang/Ada/Assertions @@ -0,0 +1 @@ +../../Task/Assertions/Ada \ No newline at end of file diff --git a/Lang/Ada/Balanced-brackets b/Lang/Ada/Balanced-brackets new file mode 120000 index 0000000000..8a599add2f --- /dev/null +++ b/Lang/Ada/Balanced-brackets @@ -0,0 +1 @@ +../../Task/Balanced-brackets/Ada \ No newline at end of file diff --git a/Lang/Ada/Balanced-ternary b/Lang/Ada/Balanced-ternary new file mode 120000 index 0000000000..adaef44956 --- /dev/null +++ b/Lang/Ada/Balanced-ternary @@ -0,0 +1 @@ +../../Task/Balanced-ternary/Ada \ No newline at end of file diff --git a/Lang/Ada/Best-shuffle b/Lang/Ada/Best-shuffle new file mode 120000 index 0000000000..f5ec6e40c6 --- /dev/null +++ b/Lang/Ada/Best-shuffle @@ -0,0 +1 @@ +../../Task/Best-shuffle/Ada \ No newline at end of file diff --git a/Lang/Ada/Binary-search b/Lang/Ada/Binary-search new file mode 120000 index 0000000000..888f6ee03b --- /dev/null +++ b/Lang/Ada/Binary-search @@ -0,0 +1 @@ +../../Task/Binary-search/Ada \ No newline at end of file diff --git a/Lang/Ada/Binary-strings b/Lang/Ada/Binary-strings new file mode 120000 index 0000000000..ae8729c88c --- /dev/null +++ b/Lang/Ada/Binary-strings @@ -0,0 +1 @@ +../../Task/Binary-strings/Ada \ No newline at end of file diff --git a/Lang/Ada/Bulls-and-cows b/Lang/Ada/Bulls-and-cows new file mode 120000 index 0000000000..6c51224ebf --- /dev/null +++ b/Lang/Ada/Bulls-and-cows @@ -0,0 +1 @@ +../../Task/Bulls-and-cows/Ada \ No newline at end of file diff --git a/Lang/Ada/Caesar-cipher b/Lang/Ada/Caesar-cipher new file mode 120000 index 0000000000..61e75e0ca5 --- /dev/null +++ b/Lang/Ada/Caesar-cipher @@ -0,0 +1 @@ +../../Task/Caesar-cipher/Ada \ No newline at end of file diff --git a/Lang/Ada/Calendar b/Lang/Ada/Calendar new file mode 120000 index 0000000000..53fa48fb6d --- /dev/null +++ b/Lang/Ada/Calendar @@ -0,0 +1 @@ +../../Task/Calendar/Ada \ No newline at end of file diff --git a/Lang/Ada/Check-that-file-exists b/Lang/Ada/Check-that-file-exists new file mode 120000 index 0000000000..52444452cf --- /dev/null +++ b/Lang/Ada/Check-that-file-exists @@ -0,0 +1 @@ +../../Task/Check-that-file-exists/Ada \ No newline at end of file diff --git a/Lang/Ada/Checkpoint-synchronization b/Lang/Ada/Checkpoint-synchronization new file mode 120000 index 0000000000..858da5f7af --- /dev/null +++ b/Lang/Ada/Checkpoint-synchronization @@ -0,0 +1 @@ +../../Task/Checkpoint-synchronization/Ada \ No newline at end of file diff --git a/Lang/Ada/Classes b/Lang/Ada/Classes new file mode 120000 index 0000000000..1505b65bd8 --- /dev/null +++ b/Lang/Ada/Classes @@ -0,0 +1 @@ +../../Task/Classes/Ada \ No newline at end of file diff --git a/Lang/Ada/Closest-pair-problem b/Lang/Ada/Closest-pair-problem new file mode 120000 index 0000000000..741c3cee20 --- /dev/null +++ b/Lang/Ada/Closest-pair-problem @@ -0,0 +1 @@ +../../Task/Closest-pair-problem/Ada \ No newline at end of file diff --git a/Lang/Ada/Collections b/Lang/Ada/Collections new file mode 120000 index 0000000000..1f2005ede1 --- /dev/null +++ b/Lang/Ada/Collections @@ -0,0 +1 @@ +../../Task/Collections/Ada \ No newline at end of file diff --git a/Lang/Ada/Comments b/Lang/Ada/Comments new file mode 120000 index 0000000000..af24179e2c --- /dev/null +++ b/Lang/Ada/Comments @@ -0,0 +1 @@ +../../Task/Comments/Ada \ No newline at end of file diff --git a/Lang/Ada/Define-a-primitive-data-type b/Lang/Ada/Define-a-primitive-data-type new file mode 120000 index 0000000000..3bb1b3abce --- /dev/null +++ b/Lang/Ada/Define-a-primitive-data-type @@ -0,0 +1 @@ +../../Task/Define-a-primitive-data-type/Ada \ No newline at end of file diff --git a/Lang/Ada/Delegates b/Lang/Ada/Delegates new file mode 120000 index 0000000000..38e9f5e5af --- /dev/null +++ b/Lang/Ada/Delegates @@ -0,0 +1 @@ +../../Task/Delegates/Ada \ No newline at end of file diff --git a/Lang/Ada/Delete-a-file b/Lang/Ada/Delete-a-file new file mode 120000 index 0000000000..a04338796c --- /dev/null +++ b/Lang/Ada/Delete-a-file @@ -0,0 +1 @@ +../../Task/Delete-a-file/Ada \ No newline at end of file diff --git a/Lang/Ada/Detect-division-by-zero b/Lang/Ada/Detect-division-by-zero new file mode 120000 index 0000000000..2692da3200 --- /dev/null +++ b/Lang/Ada/Detect-division-by-zero @@ -0,0 +1 @@ +../../Task/Detect-division-by-zero/Ada \ No newline at end of file diff --git a/Lang/Ada/Determine-if-a-string-is-numeric b/Lang/Ada/Determine-if-a-string-is-numeric new file mode 120000 index 0000000000..3eaa1ea93f --- /dev/null +++ b/Lang/Ada/Determine-if-a-string-is-numeric @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-is-numeric/Ada \ No newline at end of file diff --git a/Lang/Ada/Entropy b/Lang/Ada/Entropy new file mode 120000 index 0000000000..7c9d5002df --- /dev/null +++ b/Lang/Ada/Entropy @@ -0,0 +1 @@ +../../Task/Entropy/Ada \ No newline at end of file diff --git a/Lang/Ada/FizzBuzz b/Lang/Ada/FizzBuzz new file mode 120000 index 0000000000..045e82b89f --- /dev/null +++ b/Lang/Ada/FizzBuzz @@ -0,0 +1 @@ +../../Task/FizzBuzz/Ada \ No newline at end of file diff --git a/Lang/Ada/Forest-fire b/Lang/Ada/Forest-fire new file mode 120000 index 0000000000..aea409673d --- /dev/null +++ b/Lang/Ada/Forest-fire @@ -0,0 +1 @@ +../../Task/Forest-fire/Ada \ No newline at end of file diff --git a/Lang/Ada/Infinity b/Lang/Ada/Infinity new file mode 120000 index 0000000000..9d8ea002a1 --- /dev/null +++ b/Lang/Ada/Infinity @@ -0,0 +1 @@ +../../Task/Infinity/Ada \ No newline at end of file diff --git a/Lang/Ada/JSON b/Lang/Ada/JSON new file mode 120000 index 0000000000..b9b9d88696 --- /dev/null +++ b/Lang/Ada/JSON @@ -0,0 +1 @@ +../../Task/JSON/Ada \ No newline at end of file diff --git a/Lang/Ada/Knuth-shuffle b/Lang/Ada/Knuth-shuffle new file mode 120000 index 0000000000..5a725b03f1 --- /dev/null +++ b/Lang/Ada/Knuth-shuffle @@ -0,0 +1 @@ +../../Task/Knuth-shuffle/Ada \ No newline at end of file diff --git a/Lang/Ada/Narcissist b/Lang/Ada/Narcissist new file mode 120000 index 0000000000..573c3c76dd --- /dev/null +++ b/Lang/Ada/Narcissist @@ -0,0 +1 @@ +../../Task/Narcissist/Ada \ No newline at end of file diff --git a/Lang/Ada/Ordered-words b/Lang/Ada/Ordered-words new file mode 120000 index 0000000000..0198a82c63 --- /dev/null +++ b/Lang/Ada/Ordered-words @@ -0,0 +1 @@ +../../Task/Ordered-words/Ada \ No newline at end of file diff --git a/Lang/Ada/Pi b/Lang/Ada/Pi new file mode 120000 index 0000000000..1aa0739875 --- /dev/null +++ b/Lang/Ada/Pi @@ -0,0 +1 @@ +../../Task/Pi/Ada \ No newline at end of file diff --git a/Lang/Ada/Quine b/Lang/Ada/Quine new file mode 120000 index 0000000000..35d18a8cbc --- /dev/null +++ b/Lang/Ada/Quine @@ -0,0 +1 @@ +../../Task/Quine/Ada \ No newline at end of file diff --git a/Lang/Ada/Search-a-list b/Lang/Ada/Search-a-list new file mode 120000 index 0000000000..9e67ed2c31 --- /dev/null +++ b/Lang/Ada/Search-a-list @@ -0,0 +1 @@ +../../Task/Search-a-list/Ada \ No newline at end of file diff --git a/Lang/BASIC/99-Bottles-of-Beer b/Lang/BASIC/99-Bottles-of-Beer new file mode 120000 index 0000000000..b2e57f0408 --- /dev/null +++ b/Lang/BASIC/99-Bottles-of-Beer @@ -0,0 +1 @@ +../../Task/99-Bottles-of-Beer/BASIC \ No newline at end of file diff --git a/Lang/BASIC/Ackermann-function b/Lang/BASIC/Ackermann-function new file mode 120000 index 0000000000..b1163a4ab4 --- /dev/null +++ b/Lang/BASIC/Ackermann-function @@ -0,0 +1 @@ +../../Task/Ackermann-function/BASIC \ No newline at end of file diff --git a/Lang/BASIC/Balanced-brackets b/Lang/BASIC/Balanced-brackets new file mode 120000 index 0000000000..7bdc0952eb --- /dev/null +++ b/Lang/BASIC/Balanced-brackets @@ -0,0 +1 @@ +../../Task/Balanced-brackets/BASIC \ No newline at end of file diff --git a/Lang/BASIC/Binary-search b/Lang/BASIC/Binary-search new file mode 120000 index 0000000000..0b2b3882e1 --- /dev/null +++ b/Lang/BASIC/Binary-search @@ -0,0 +1 @@ +../../Task/Binary-search/BASIC \ No newline at end of file diff --git a/Lang/BASIC/Binary-strings b/Lang/BASIC/Binary-strings new file mode 120000 index 0000000000..10c2f2d522 --- /dev/null +++ b/Lang/BASIC/Binary-strings @@ -0,0 +1 @@ +../../Task/Binary-strings/BASIC \ No newline at end of file diff --git a/Lang/BASIC/Bulls-and-cows b/Lang/BASIC/Bulls-and-cows new file mode 120000 index 0000000000..ebf19eefb2 --- /dev/null +++ b/Lang/BASIC/Bulls-and-cows @@ -0,0 +1 @@ +../../Task/Bulls-and-cows/BASIC \ No newline at end of file diff --git a/Lang/BASIC/Check-that-file-exists b/Lang/BASIC/Check-that-file-exists new file mode 120000 index 0000000000..33955b6a30 --- /dev/null +++ b/Lang/BASIC/Check-that-file-exists @@ -0,0 +1 @@ +../../Task/Check-that-file-exists/BASIC \ No newline at end of file diff --git a/Lang/BASIC/Color-of-a-screen-pixel b/Lang/BASIC/Color-of-a-screen-pixel new file mode 120000 index 0000000000..7e712985ac --- /dev/null +++ b/Lang/BASIC/Color-of-a-screen-pixel @@ -0,0 +1 @@ +../../Task/Color-of-a-screen-pixel/BASIC \ No newline at end of file diff --git a/Lang/BASIC/Delete-a-file b/Lang/BASIC/Delete-a-file new file mode 120000 index 0000000000..82309c5c4c --- /dev/null +++ b/Lang/BASIC/Delete-a-file @@ -0,0 +1 @@ +../../Task/Delete-a-file/BASIC \ No newline at end of file diff --git a/Lang/BASIC/Determine-if-a-string-is-numeric b/Lang/BASIC/Determine-if-a-string-is-numeric new file mode 120000 index 0000000000..066222675d --- /dev/null +++ b/Lang/BASIC/Determine-if-a-string-is-numeric @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-is-numeric/BASIC \ No newline at end of file diff --git a/Lang/BASIC/Knuth-shuffle b/Lang/BASIC/Knuth-shuffle new file mode 120000 index 0000000000..7aeb5bf309 --- /dev/null +++ b/Lang/BASIC/Knuth-shuffle @@ -0,0 +1 @@ +../../Task/Knuth-shuffle/BASIC \ No newline at end of file diff --git a/Lang/BASIC/Search-a-list b/Lang/BASIC/Search-a-list new file mode 120000 index 0000000000..3b30ff8451 --- /dev/null +++ b/Lang/BASIC/Search-a-list @@ -0,0 +1 @@ +../../Task/Search-a-list/BASIC \ No newline at end of file diff --git a/Lang/Babel/99-Bottles-of-Beer b/Lang/Babel/99-Bottles-of-Beer new file mode 120000 index 0000000000..b3da87a622 --- /dev/null +++ b/Lang/Babel/99-Bottles-of-Beer @@ -0,0 +1 @@ +../../Task/99-Bottles-of-Beer/Babel \ No newline at end of file diff --git a/Lang/Babel/Ackermann-function b/Lang/Babel/Ackermann-function new file mode 120000 index 0000000000..0c969eda18 --- /dev/null +++ b/Lang/Babel/Ackermann-function @@ -0,0 +1 @@ +../../Task/Ackermann-function/Babel \ No newline at end of file diff --git a/Lang/Befunge/99-Bottles-of-Beer b/Lang/Befunge/99-Bottles-of-Beer new file mode 120000 index 0000000000..e9cdb8cbe4 --- /dev/null +++ b/Lang/Befunge/99-Bottles-of-Beer @@ -0,0 +1 @@ +../../Task/99-Bottles-of-Beer/Befunge \ No newline at end of file diff --git a/Lang/Befunge/Ackermann-function b/Lang/Befunge/Ackermann-function new file mode 120000 index 0000000000..de000f401e --- /dev/null +++ b/Lang/Befunge/Ackermann-function @@ -0,0 +1 @@ +../../Task/Ackermann-function/Befunge \ No newline at end of file diff --git a/Lang/Befunge/Balanced-brackets b/Lang/Befunge/Balanced-brackets new file mode 120000 index 0000000000..cd097b515c --- /dev/null +++ b/Lang/Befunge/Balanced-brackets @@ -0,0 +1 @@ +../../Task/Balanced-brackets/Befunge \ No newline at end of file diff --git a/Lang/C/99-Bottles-of-Beer b/Lang/C/99-Bottles-of-Beer new file mode 120000 index 0000000000..025e25ddd2 --- /dev/null +++ b/Lang/C/99-Bottles-of-Beer @@ -0,0 +1 @@ +../../Task/99-Bottles-of-Beer/C \ No newline at end of file diff --git a/Lang/C/Ackermann-function b/Lang/C/Ackermann-function new file mode 120000 index 0000000000..6a7e823cb5 --- /dev/null +++ b/Lang/C/Ackermann-function @@ -0,0 +1 @@ +../../Task/Ackermann-function/C \ No newline at end of file diff --git a/Lang/C/Balanced-brackets b/Lang/C/Balanced-brackets new file mode 120000 index 0000000000..10e2d87a4d --- /dev/null +++ b/Lang/C/Balanced-brackets @@ -0,0 +1 @@ +../../Task/Balanced-brackets/C \ No newline at end of file diff --git a/Lang/C/Best-shuffle b/Lang/C/Best-shuffle new file mode 120000 index 0000000000..ecc5b8020d --- /dev/null +++ b/Lang/C/Best-shuffle @@ -0,0 +1 @@ +../../Task/Best-shuffle/C \ No newline at end of file diff --git a/Lang/C/Binary-search b/Lang/C/Binary-search new file mode 120000 index 0000000000..04867a3352 --- /dev/null +++ b/Lang/C/Binary-search @@ -0,0 +1 @@ +../../Task/Binary-search/C \ No newline at end of file diff --git a/Lang/C/Binary-strings b/Lang/C/Binary-strings new file mode 120000 index 0000000000..fab58abc73 --- /dev/null +++ b/Lang/C/Binary-strings @@ -0,0 +1 @@ +../../Task/Binary-strings/C \ No newline at end of file diff --git a/Lang/C/Bulls-and-cows b/Lang/C/Bulls-and-cows new file mode 120000 index 0000000000..aa6f5032be --- /dev/null +++ b/Lang/C/Bulls-and-cows @@ -0,0 +1 @@ +../../Task/Bulls-and-cows/C \ No newline at end of file diff --git a/Lang/C/Caesar-cipher b/Lang/C/Caesar-cipher new file mode 120000 index 0000000000..6f7221041d --- /dev/null +++ b/Lang/C/Caesar-cipher @@ -0,0 +1 @@ +../../Task/Caesar-cipher/C \ No newline at end of file diff --git a/Lang/C/Check-that-file-exists b/Lang/C/Check-that-file-exists new file mode 120000 index 0000000000..9075cf6ca8 --- /dev/null +++ b/Lang/C/Check-that-file-exists @@ -0,0 +1 @@ +../../Task/Check-that-file-exists/C \ No newline at end of file diff --git a/Lang/C/Checkpoint-synchronization b/Lang/C/Checkpoint-synchronization new file mode 120000 index 0000000000..6c355e3270 --- /dev/null +++ b/Lang/C/Checkpoint-synchronization @@ -0,0 +1 @@ +../../Task/Checkpoint-synchronization/C \ No newline at end of file diff --git a/Lang/C/Color-of-a-screen-pixel b/Lang/C/Color-of-a-screen-pixel new file mode 120000 index 0000000000..6fcf379d79 --- /dev/null +++ b/Lang/C/Color-of-a-screen-pixel @@ -0,0 +1 @@ +../../Task/Color-of-a-screen-pixel/C \ No newline at end of file diff --git a/Lang/C/Death-Star b/Lang/C/Death-Star new file mode 120000 index 0000000000..4e5539b035 --- /dev/null +++ b/Lang/C/Death-Star @@ -0,0 +1 @@ +../../Task/Death-Star/C \ No newline at end of file diff --git a/Lang/C/Delete-a-file b/Lang/C/Delete-a-file new file mode 120000 index 0000000000..ae25699209 --- /dev/null +++ b/Lang/C/Delete-a-file @@ -0,0 +1 @@ +../../Task/Delete-a-file/C \ No newline at end of file diff --git a/Lang/C/Detect-division-by-zero b/Lang/C/Detect-division-by-zero new file mode 120000 index 0000000000..6174373688 --- /dev/null +++ b/Lang/C/Detect-division-by-zero @@ -0,0 +1 @@ +../../Task/Detect-division-by-zero/C \ No newline at end of file diff --git a/Lang/C/Determine-if-a-string-is-numeric b/Lang/C/Determine-if-a-string-is-numeric new file mode 120000 index 0000000000..bddd742081 --- /dev/null +++ b/Lang/C/Determine-if-a-string-is-numeric @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-is-numeric/C \ No newline at end of file diff --git a/Lang/C/Forest-fire b/Lang/C/Forest-fire new file mode 120000 index 0000000000..3375d74c44 --- /dev/null +++ b/Lang/C/Forest-fire @@ -0,0 +1 @@ +../../Task/Forest-fire/C \ No newline at end of file diff --git a/Lang/C/Knuth-shuffle b/Lang/C/Knuth-shuffle new file mode 120000 index 0000000000..74930cd042 --- /dev/null +++ b/Lang/C/Knuth-shuffle @@ -0,0 +1 @@ +../../Task/Knuth-shuffle/C \ No newline at end of file diff --git a/Lang/C/Ordered-words b/Lang/C/Ordered-words new file mode 120000 index 0000000000..d1229102ea --- /dev/null +++ b/Lang/C/Ordered-words @@ -0,0 +1 @@ +../../Task/Ordered-words/C \ No newline at end of file diff --git a/Lang/C/Search-a-list b/Lang/C/Search-a-list new file mode 120000 index 0000000000..f1325419b3 --- /dev/null +++ b/Lang/C/Search-a-list @@ -0,0 +1 @@ +../../Task/Search-a-list/C \ No newline at end of file diff --git a/Lang/Clojure/99-Bottles-of-Beer b/Lang/Clojure/99-Bottles-of-Beer new file mode 120000 index 0000000000..7ff3589c45 --- /dev/null +++ b/Lang/Clojure/99-Bottles-of-Beer @@ -0,0 +1 @@ +../../Task/99-Bottles-of-Beer/Clojure \ No newline at end of file diff --git a/Lang/Clojure/Ackermann-function b/Lang/Clojure/Ackermann-function new file mode 120000 index 0000000000..13a0b8fce3 --- /dev/null +++ b/Lang/Clojure/Ackermann-function @@ -0,0 +1 @@ +../../Task/Ackermann-function/Clojure \ No newline at end of file diff --git a/Lang/Clojure/Balanced-brackets b/Lang/Clojure/Balanced-brackets new file mode 120000 index 0000000000..b4eaefacbb --- /dev/null +++ b/Lang/Clojure/Balanced-brackets @@ -0,0 +1 @@ +../../Task/Balanced-brackets/Clojure \ No newline at end of file diff --git a/Lang/Clojure/Best-shuffle b/Lang/Clojure/Best-shuffle new file mode 120000 index 0000000000..91f1c321d4 --- /dev/null +++ b/Lang/Clojure/Best-shuffle @@ -0,0 +1 @@ +../../Task/Best-shuffle/Clojure \ No newline at end of file diff --git a/Lang/Clojure/Binary-search b/Lang/Clojure/Binary-search new file mode 120000 index 0000000000..73adf1ba57 --- /dev/null +++ b/Lang/Clojure/Binary-search @@ -0,0 +1 @@ +../../Task/Binary-search/Clojure \ No newline at end of file diff --git a/Lang/Clojure/Bulls-and-cows b/Lang/Clojure/Bulls-and-cows new file mode 120000 index 0000000000..abd87102da --- /dev/null +++ b/Lang/Clojure/Bulls-and-cows @@ -0,0 +1 @@ +../../Task/Bulls-and-cows/Clojure \ No newline at end of file diff --git a/Lang/Clojure/Caesar-cipher b/Lang/Clojure/Caesar-cipher new file mode 120000 index 0000000000..0993fbcb93 --- /dev/null +++ b/Lang/Clojure/Caesar-cipher @@ -0,0 +1 @@ +../../Task/Caesar-cipher/Clojure \ No newline at end of file diff --git a/Lang/Clojure/Check-that-file-exists b/Lang/Clojure/Check-that-file-exists new file mode 120000 index 0000000000..ed1ec8005a --- /dev/null +++ b/Lang/Clojure/Check-that-file-exists @@ -0,0 +1 @@ +../../Task/Check-that-file-exists/Clojure \ No newline at end of file diff --git a/Lang/Clojure/Closest-pair-problem b/Lang/Clojure/Closest-pair-problem new file mode 120000 index 0000000000..91ab824199 --- /dev/null +++ b/Lang/Clojure/Closest-pair-problem @@ -0,0 +1 @@ +../../Task/Closest-pair-problem/Clojure \ No newline at end of file diff --git a/Lang/Clojure/Color-of-a-screen-pixel b/Lang/Clojure/Color-of-a-screen-pixel new file mode 120000 index 0000000000..a90afee9af --- /dev/null +++ b/Lang/Clojure/Color-of-a-screen-pixel @@ -0,0 +1 @@ +../../Task/Color-of-a-screen-pixel/Clojure \ No newline at end of file diff --git a/Lang/Clojure/Delete-a-file b/Lang/Clojure/Delete-a-file new file mode 120000 index 0000000000..3cefcc0815 --- /dev/null +++ b/Lang/Clojure/Delete-a-file @@ -0,0 +1 @@ +../../Task/Delete-a-file/Clojure \ No newline at end of file diff --git a/Lang/Clojure/Detect-division-by-zero b/Lang/Clojure/Detect-division-by-zero new file mode 120000 index 0000000000..ca0358341f --- /dev/null +++ b/Lang/Clojure/Detect-division-by-zero @@ -0,0 +1 @@ +../../Task/Detect-division-by-zero/Clojure \ No newline at end of file diff --git a/Lang/Clojure/Determine-if-a-string-is-numeric b/Lang/Clojure/Determine-if-a-string-is-numeric new file mode 120000 index 0000000000..4b45df638d --- /dev/null +++ b/Lang/Clojure/Determine-if-a-string-is-numeric @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-is-numeric/Clojure \ No newline at end of file diff --git a/Lang/Clojure/Forest-fire b/Lang/Clojure/Forest-fire new file mode 120000 index 0000000000..c494d1f1e9 --- /dev/null +++ b/Lang/Clojure/Forest-fire @@ -0,0 +1 @@ +../../Task/Forest-fire/Clojure \ No newline at end of file diff --git a/Lang/Clojure/Knuth-shuffle b/Lang/Clojure/Knuth-shuffle new file mode 120000 index 0000000000..38b6f88eb5 --- /dev/null +++ b/Lang/Clojure/Knuth-shuffle @@ -0,0 +1 @@ +../../Task/Knuth-shuffle/Clojure \ No newline at end of file diff --git a/Lang/Clojure/Search-a-list b/Lang/Clojure/Search-a-list new file mode 120000 index 0000000000..30f67f0275 --- /dev/null +++ b/Lang/Clojure/Search-a-list @@ -0,0 +1 @@ +../../Task/Search-a-list/Clojure \ No newline at end of file diff --git a/Lang/CoffeeScript/99-Bottles-of-Beer b/Lang/CoffeeScript/99-Bottles-of-Beer new file mode 120000 index 0000000000..ab2d0eb225 --- /dev/null +++ b/Lang/CoffeeScript/99-Bottles-of-Beer @@ -0,0 +1 @@ +../../Task/99-Bottles-of-Beer/CoffeeScript \ No newline at end of file diff --git a/Lang/CoffeeScript/Ackermann-function b/Lang/CoffeeScript/Ackermann-function new file mode 120000 index 0000000000..285468fdb5 --- /dev/null +++ b/Lang/CoffeeScript/Ackermann-function @@ -0,0 +1 @@ +../../Task/Ackermann-function/CoffeeScript \ No newline at end of file diff --git a/Lang/CoffeeScript/Balanced-brackets b/Lang/CoffeeScript/Balanced-brackets new file mode 120000 index 0000000000..f6c03142c1 --- /dev/null +++ b/Lang/CoffeeScript/Balanced-brackets @@ -0,0 +1 @@ +../../Task/Balanced-brackets/CoffeeScript \ No newline at end of file diff --git a/Lang/CoffeeScript/Binary-search b/Lang/CoffeeScript/Binary-search new file mode 120000 index 0000000000..ce90e88789 --- /dev/null +++ b/Lang/CoffeeScript/Binary-search @@ -0,0 +1 @@ +../../Task/Binary-search/CoffeeScript \ No newline at end of file diff --git a/Lang/CoffeeScript/Caesar-cipher b/Lang/CoffeeScript/Caesar-cipher new file mode 120000 index 0000000000..ba959415c8 --- /dev/null +++ b/Lang/CoffeeScript/Caesar-cipher @@ -0,0 +1 @@ +../../Task/Caesar-cipher/CoffeeScript \ No newline at end of file diff --git a/Lang/CoffeeScript/Determine-if-a-string-is-numeric b/Lang/CoffeeScript/Determine-if-a-string-is-numeric new file mode 120000 index 0000000000..5f37af0313 --- /dev/null +++ b/Lang/CoffeeScript/Determine-if-a-string-is-numeric @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-is-numeric/CoffeeScript \ No newline at end of file diff --git a/Lang/CoffeeScript/Knuth-shuffle b/Lang/CoffeeScript/Knuth-shuffle new file mode 120000 index 0000000000..c94d685548 --- /dev/null +++ b/Lang/CoffeeScript/Knuth-shuffle @@ -0,0 +1 @@ +../../Task/Knuth-shuffle/CoffeeScript \ No newline at end of file diff --git a/Lang/CoffeeScript/Ordered-words b/Lang/CoffeeScript/Ordered-words new file mode 120000 index 0000000000..ebaab246cb --- /dev/null +++ b/Lang/CoffeeScript/Ordered-words @@ -0,0 +1 @@ +../../Task/Ordered-words/CoffeeScript \ No newline at end of file diff --git a/Lang/Dylan/99-Bottles-of-Beer b/Lang/Dylan/99-Bottles-of-Beer new file mode 120000 index 0000000000..177e29613c --- /dev/null +++ b/Lang/Dylan/99-Bottles-of-Beer @@ -0,0 +1 @@ +../../Task/99-Bottles-of-Beer/Dylan \ No newline at end of file diff --git a/Lang/Dylan/Ackermann-function b/Lang/Dylan/Ackermann-function new file mode 120000 index 0000000000..f31dad6aeb --- /dev/null +++ b/Lang/Dylan/Ackermann-function @@ -0,0 +1 @@ +../../Task/Ackermann-function/Dylan \ No newline at end of file diff --git a/Lang/Eiffel/Ackermann-function b/Lang/Eiffel/Ackermann-function new file mode 120000 index 0000000000..198f647206 --- /dev/null +++ b/Lang/Eiffel/Ackermann-function @@ -0,0 +1 @@ +../../Task/Ackermann-function/Eiffel \ No newline at end of file diff --git a/Lang/Eiffel/Detect-division-by-zero b/Lang/Eiffel/Detect-division-by-zero new file mode 120000 index 0000000000..3440b62bcd --- /dev/null +++ b/Lang/Eiffel/Detect-division-by-zero @@ -0,0 +1 @@ +../../Task/Detect-division-by-zero/Eiffel \ No newline at end of file diff --git a/Lang/Erlang/99-Bottles-of-Beer b/Lang/Erlang/99-Bottles-of-Beer new file mode 120000 index 0000000000..e5a398160d --- /dev/null +++ b/Lang/Erlang/99-Bottles-of-Beer @@ -0,0 +1 @@ +../../Task/99-Bottles-of-Beer/Erlang \ No newline at end of file diff --git a/Lang/Erlang/Ackermann-function b/Lang/Erlang/Ackermann-function new file mode 120000 index 0000000000..bf9c85e896 --- /dev/null +++ b/Lang/Erlang/Ackermann-function @@ -0,0 +1 @@ +../../Task/Ackermann-function/Erlang \ No newline at end of file diff --git a/Lang/Erlang/Balanced-ternary b/Lang/Erlang/Balanced-ternary new file mode 120000 index 0000000000..c7a73ee5ed --- /dev/null +++ b/Lang/Erlang/Balanced-ternary @@ -0,0 +1 @@ +../../Task/Balanced-ternary/Erlang \ No newline at end of file diff --git a/Lang/Erlang/Binary-search b/Lang/Erlang/Binary-search new file mode 120000 index 0000000000..7873d5cdb7 --- /dev/null +++ b/Lang/Erlang/Binary-search @@ -0,0 +1 @@ +../../Task/Binary-search/Erlang \ No newline at end of file diff --git a/Lang/Erlang/Bulls-and-cows b/Lang/Erlang/Bulls-and-cows new file mode 120000 index 0000000000..16d94b18c0 --- /dev/null +++ b/Lang/Erlang/Bulls-and-cows @@ -0,0 +1 @@ +../../Task/Bulls-and-cows/Erlang \ No newline at end of file diff --git a/Lang/Erlang/Caesar-cipher b/Lang/Erlang/Caesar-cipher new file mode 120000 index 0000000000..412b006345 --- /dev/null +++ b/Lang/Erlang/Caesar-cipher @@ -0,0 +1 @@ +../../Task/Caesar-cipher/Erlang \ No newline at end of file diff --git a/Lang/Erlang/Check-that-file-exists b/Lang/Erlang/Check-that-file-exists new file mode 120000 index 0000000000..7e10be3e45 --- /dev/null +++ b/Lang/Erlang/Check-that-file-exists @@ -0,0 +1 @@ +../../Task/Check-that-file-exists/Erlang \ No newline at end of file diff --git a/Lang/Erlang/Delete-a-file b/Lang/Erlang/Delete-a-file new file mode 120000 index 0000000000..10fbd8d595 --- /dev/null +++ b/Lang/Erlang/Delete-a-file @@ -0,0 +1 @@ +../../Task/Delete-a-file/Erlang \ No newline at end of file diff --git a/Lang/Erlang/Detect-division-by-zero b/Lang/Erlang/Detect-division-by-zero new file mode 120000 index 0000000000..117034edd3 --- /dev/null +++ b/Lang/Erlang/Detect-division-by-zero @@ -0,0 +1 @@ +../../Task/Detect-division-by-zero/Erlang \ No newline at end of file diff --git a/Lang/Erlang/Determine-if-a-string-is-numeric b/Lang/Erlang/Determine-if-a-string-is-numeric new file mode 120000 index 0000000000..4b7bd5fd38 --- /dev/null +++ b/Lang/Erlang/Determine-if-a-string-is-numeric @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-is-numeric/Erlang \ No newline at end of file diff --git a/Lang/Erlang/Search-a-list b/Lang/Erlang/Search-a-list new file mode 120000 index 0000000000..2e3595eb98 --- /dev/null +++ b/Lang/Erlang/Search-a-list @@ -0,0 +1 @@ +../../Task/Search-a-list/Erlang \ No newline at end of file diff --git a/Lang/Forth/99-Bottles-of-Beer b/Lang/Forth/99-Bottles-of-Beer new file mode 120000 index 0000000000..c649b1341c --- /dev/null +++ b/Lang/Forth/99-Bottles-of-Beer @@ -0,0 +1 @@ +../../Task/99-Bottles-of-Beer/Forth \ No newline at end of file diff --git a/Lang/Forth/Ackermann-function b/Lang/Forth/Ackermann-function new file mode 120000 index 0000000000..949b79f95a --- /dev/null +++ b/Lang/Forth/Ackermann-function @@ -0,0 +1 @@ +../../Task/Ackermann-function/Forth \ No newline at end of file diff --git a/Lang/Forth/Balanced-brackets b/Lang/Forth/Balanced-brackets new file mode 120000 index 0000000000..1bf9c801da --- /dev/null +++ b/Lang/Forth/Balanced-brackets @@ -0,0 +1 @@ +../../Task/Balanced-brackets/Forth \ No newline at end of file diff --git a/Lang/Forth/Binary-search b/Lang/Forth/Binary-search new file mode 120000 index 0000000000..682a5f4340 --- /dev/null +++ b/Lang/Forth/Binary-search @@ -0,0 +1 @@ +../../Task/Binary-search/Forth \ No newline at end of file diff --git a/Lang/Forth/Binary-strings b/Lang/Forth/Binary-strings new file mode 120000 index 0000000000..3b52b2d714 --- /dev/null +++ b/Lang/Forth/Binary-strings @@ -0,0 +1 @@ +../../Task/Binary-strings/Forth \ No newline at end of file diff --git a/Lang/Forth/Bulls-and-cows b/Lang/Forth/Bulls-and-cows new file mode 120000 index 0000000000..70a4d9271e --- /dev/null +++ b/Lang/Forth/Bulls-and-cows @@ -0,0 +1 @@ +../../Task/Bulls-and-cows/Forth \ No newline at end of file diff --git a/Lang/Forth/Caesar-cipher b/Lang/Forth/Caesar-cipher new file mode 120000 index 0000000000..8372c17a6b --- /dev/null +++ b/Lang/Forth/Caesar-cipher @@ -0,0 +1 @@ +../../Task/Caesar-cipher/Forth \ No newline at end of file diff --git a/Lang/Forth/Check-that-file-exists b/Lang/Forth/Check-that-file-exists new file mode 120000 index 0000000000..5409610115 --- /dev/null +++ b/Lang/Forth/Check-that-file-exists @@ -0,0 +1 @@ +../../Task/Check-that-file-exists/Forth \ No newline at end of file diff --git a/Lang/Forth/Delete-a-file b/Lang/Forth/Delete-a-file new file mode 120000 index 0000000000..837db5057b --- /dev/null +++ b/Lang/Forth/Delete-a-file @@ -0,0 +1 @@ +../../Task/Delete-a-file/Forth \ No newline at end of file diff --git a/Lang/Forth/Detect-division-by-zero b/Lang/Forth/Detect-division-by-zero new file mode 120000 index 0000000000..bfe2f600ff --- /dev/null +++ b/Lang/Forth/Detect-division-by-zero @@ -0,0 +1 @@ +../../Task/Detect-division-by-zero/Forth \ No newline at end of file diff --git a/Lang/Forth/Determine-if-a-string-is-numeric b/Lang/Forth/Determine-if-a-string-is-numeric new file mode 120000 index 0000000000..aaa5ca3e33 --- /dev/null +++ b/Lang/Forth/Determine-if-a-string-is-numeric @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-is-numeric/Forth \ No newline at end of file diff --git a/Lang/Forth/Knuth-shuffle b/Lang/Forth/Knuth-shuffle new file mode 120000 index 0000000000..e030c668b2 --- /dev/null +++ b/Lang/Forth/Knuth-shuffle @@ -0,0 +1 @@ +../../Task/Knuth-shuffle/Forth \ No newline at end of file diff --git a/Lang/Forth/Ordered-words b/Lang/Forth/Ordered-words new file mode 120000 index 0000000000..617b55ad28 --- /dev/null +++ b/Lang/Forth/Ordered-words @@ -0,0 +1 @@ +../../Task/Ordered-words/Forth \ No newline at end of file diff --git a/Lang/Forth/Search-a-list b/Lang/Forth/Search-a-list new file mode 120000 index 0000000000..cf9a940615 --- /dev/null +++ b/Lang/Forth/Search-a-list @@ -0,0 +1 @@ +../../Task/Search-a-list/Forth \ No newline at end of file diff --git a/Lang/Fortran/99-Bottles-of-Beer b/Lang/Fortran/99-Bottles-of-Beer new file mode 120000 index 0000000000..36d43aa752 --- /dev/null +++ b/Lang/Fortran/99-Bottles-of-Beer @@ -0,0 +1 @@ +../../Task/99-Bottles-of-Beer/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Ackermann-function b/Lang/Fortran/Ackermann-function new file mode 120000 index 0000000000..88784a585a --- /dev/null +++ b/Lang/Fortran/Ackermann-function @@ -0,0 +1 @@ +../../Task/Ackermann-function/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Binary-search b/Lang/Fortran/Binary-search new file mode 120000 index 0000000000..f84bcf74f2 --- /dev/null +++ b/Lang/Fortran/Binary-search @@ -0,0 +1 @@ +../../Task/Binary-search/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Bulls-and-cows b/Lang/Fortran/Bulls-and-cows new file mode 120000 index 0000000000..32b4df3964 --- /dev/null +++ b/Lang/Fortran/Bulls-and-cows @@ -0,0 +1 @@ +../../Task/Bulls-and-cows/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Caesar-cipher b/Lang/Fortran/Caesar-cipher new file mode 120000 index 0000000000..0c5bad3fac --- /dev/null +++ b/Lang/Fortran/Caesar-cipher @@ -0,0 +1 @@ +../../Task/Caesar-cipher/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Check-that-file-exists b/Lang/Fortran/Check-that-file-exists new file mode 120000 index 0000000000..fba1aa23ef --- /dev/null +++ b/Lang/Fortran/Check-that-file-exists @@ -0,0 +1 @@ +../../Task/Check-that-file-exists/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Define-a-primitive-data-type b/Lang/Fortran/Define-a-primitive-data-type new file mode 120000 index 0000000000..26593f29aa --- /dev/null +++ b/Lang/Fortran/Define-a-primitive-data-type @@ -0,0 +1 @@ +../../Task/Define-a-primitive-data-type/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Delete-a-file b/Lang/Fortran/Delete-a-file new file mode 120000 index 0000000000..498d118fb3 --- /dev/null +++ b/Lang/Fortran/Delete-a-file @@ -0,0 +1 @@ +../../Task/Delete-a-file/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Determine-if-a-string-is-numeric b/Lang/Fortran/Determine-if-a-string-is-numeric new file mode 120000 index 0000000000..1f602aab23 --- /dev/null +++ b/Lang/Fortran/Determine-if-a-string-is-numeric @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-is-numeric/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Forest-fire b/Lang/Fortran/Forest-fire new file mode 120000 index 0000000000..ea6808ef44 --- /dev/null +++ b/Lang/Fortran/Forest-fire @@ -0,0 +1 @@ +../../Task/Forest-fire/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Knuth-shuffle b/Lang/Fortran/Knuth-shuffle new file mode 120000 index 0000000000..031846d1c9 --- /dev/null +++ b/Lang/Fortran/Knuth-shuffle @@ -0,0 +1 @@ +../../Task/Knuth-shuffle/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Ordered-words b/Lang/Fortran/Ordered-words new file mode 120000 index 0000000000..783ad97042 --- /dev/null +++ b/Lang/Fortran/Ordered-words @@ -0,0 +1 @@ +../../Task/Ordered-words/Fortran \ No newline at end of file diff --git a/Lang/Fortran/Search-a-list b/Lang/Fortran/Search-a-list new file mode 120000 index 0000000000..6531aadde0 --- /dev/null +++ b/Lang/Fortran/Search-a-list @@ -0,0 +1 @@ +../../Task/Search-a-list/Fortran \ No newline at end of file diff --git a/Lang/Go/99-Bottles-of-Beer b/Lang/Go/99-Bottles-of-Beer new file mode 120000 index 0000000000..89333d280e --- /dev/null +++ b/Lang/Go/99-Bottles-of-Beer @@ -0,0 +1 @@ +../../Task/99-Bottles-of-Beer/Go \ No newline at end of file diff --git a/Lang/Go/Ackermann-function b/Lang/Go/Ackermann-function new file mode 120000 index 0000000000..fd61748fc4 --- /dev/null +++ b/Lang/Go/Ackermann-function @@ -0,0 +1 @@ +../../Task/Ackermann-function/Go \ No newline at end of file diff --git a/Lang/Go/Balanced-brackets b/Lang/Go/Balanced-brackets new file mode 120000 index 0000000000..606146b7bf --- /dev/null +++ b/Lang/Go/Balanced-brackets @@ -0,0 +1 @@ +../../Task/Balanced-brackets/Go \ No newline at end of file diff --git a/Lang/Go/Balanced-ternary b/Lang/Go/Balanced-ternary new file mode 120000 index 0000000000..7a62632c50 --- /dev/null +++ b/Lang/Go/Balanced-ternary @@ -0,0 +1 @@ +../../Task/Balanced-ternary/Go \ No newline at end of file diff --git a/Lang/Go/Best-shuffle b/Lang/Go/Best-shuffle new file mode 120000 index 0000000000..e18a456027 --- /dev/null +++ b/Lang/Go/Best-shuffle @@ -0,0 +1 @@ +../../Task/Best-shuffle/Go \ No newline at end of file diff --git a/Lang/Go/Binary-search b/Lang/Go/Binary-search new file mode 120000 index 0000000000..5ca4018079 --- /dev/null +++ b/Lang/Go/Binary-search @@ -0,0 +1 @@ +../../Task/Binary-search/Go \ No newline at end of file diff --git a/Lang/Go/Binary-strings b/Lang/Go/Binary-strings new file mode 120000 index 0000000000..c0f8618941 --- /dev/null +++ b/Lang/Go/Binary-strings @@ -0,0 +1 @@ +../../Task/Binary-strings/Go \ No newline at end of file diff --git a/Lang/Go/Bulls-and-cows b/Lang/Go/Bulls-and-cows new file mode 120000 index 0000000000..a6472e8efc --- /dev/null +++ b/Lang/Go/Bulls-and-cows @@ -0,0 +1 @@ +../../Task/Bulls-and-cows/Go \ No newline at end of file diff --git a/Lang/Go/Caesar-cipher b/Lang/Go/Caesar-cipher new file mode 120000 index 0000000000..eaa55a7d4d --- /dev/null +++ b/Lang/Go/Caesar-cipher @@ -0,0 +1 @@ +../../Task/Caesar-cipher/Go \ No newline at end of file diff --git a/Lang/Go/Check-that-file-exists b/Lang/Go/Check-that-file-exists new file mode 120000 index 0000000000..f498a58e48 --- /dev/null +++ b/Lang/Go/Check-that-file-exists @@ -0,0 +1 @@ +../../Task/Check-that-file-exists/Go \ No newline at end of file diff --git a/Lang/Go/Checkpoint-synchronization b/Lang/Go/Checkpoint-synchronization new file mode 120000 index 0000000000..e40313a783 --- /dev/null +++ b/Lang/Go/Checkpoint-synchronization @@ -0,0 +1 @@ +../../Task/Checkpoint-synchronization/Go \ No newline at end of file diff --git a/Lang/Go/Closest-pair-problem b/Lang/Go/Closest-pair-problem new file mode 120000 index 0000000000..7ddac263f8 --- /dev/null +++ b/Lang/Go/Closest-pair-problem @@ -0,0 +1 @@ +../../Task/Closest-pair-problem/Go \ No newline at end of file diff --git a/Lang/Go/Death-Star b/Lang/Go/Death-Star new file mode 120000 index 0000000000..712bf5fc14 --- /dev/null +++ b/Lang/Go/Death-Star @@ -0,0 +1 @@ +../../Task/Death-Star/Go \ No newline at end of file diff --git a/Lang/Go/Delete-a-file b/Lang/Go/Delete-a-file new file mode 120000 index 0000000000..1925809784 --- /dev/null +++ b/Lang/Go/Delete-a-file @@ -0,0 +1 @@ +../../Task/Delete-a-file/Go \ No newline at end of file diff --git a/Lang/Go/Detect-division-by-zero b/Lang/Go/Detect-division-by-zero new file mode 120000 index 0000000000..5fe7c7109d --- /dev/null +++ b/Lang/Go/Detect-division-by-zero @@ -0,0 +1 @@ +../../Task/Detect-division-by-zero/Go \ No newline at end of file diff --git a/Lang/Go/Determine-if-a-string-is-numeric b/Lang/Go/Determine-if-a-string-is-numeric new file mode 120000 index 0000000000..ca766803f7 --- /dev/null +++ b/Lang/Go/Determine-if-a-string-is-numeric @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-is-numeric/Go \ No newline at end of file diff --git a/Lang/Go/Forest-fire b/Lang/Go/Forest-fire new file mode 120000 index 0000000000..93cd3ae890 --- /dev/null +++ b/Lang/Go/Forest-fire @@ -0,0 +1 @@ +../../Task/Forest-fire/Go \ No newline at end of file diff --git a/Lang/Go/Knuth-shuffle b/Lang/Go/Knuth-shuffle new file mode 120000 index 0000000000..abed6ace6c --- /dev/null +++ b/Lang/Go/Knuth-shuffle @@ -0,0 +1 @@ +../../Task/Knuth-shuffle/Go \ No newline at end of file diff --git a/Lang/Go/Ordered-words b/Lang/Go/Ordered-words new file mode 120000 index 0000000000..ec68260a4b --- /dev/null +++ b/Lang/Go/Ordered-words @@ -0,0 +1 @@ +../../Task/Ordered-words/Go \ No newline at end of file diff --git a/Lang/Go/Search-a-list b/Lang/Go/Search-a-list new file mode 120000 index 0000000000..af3c104de3 --- /dev/null +++ b/Lang/Go/Search-a-list @@ -0,0 +1 @@ +../../Task/Search-a-list/Go \ No newline at end of file diff --git a/Lang/Haskell/99-Bottles-of-Beer b/Lang/Haskell/99-Bottles-of-Beer new file mode 120000 index 0000000000..3c4b84e99f --- /dev/null +++ b/Lang/Haskell/99-Bottles-of-Beer @@ -0,0 +1 @@ +../../Task/99-Bottles-of-Beer/Haskell \ No newline at end of file diff --git a/Lang/Haskell/Ackermann-function b/Lang/Haskell/Ackermann-function new file mode 120000 index 0000000000..155ad8253d --- /dev/null +++ b/Lang/Haskell/Ackermann-function @@ -0,0 +1 @@ +../../Task/Ackermann-function/Haskell \ No newline at end of file diff --git a/Lang/Haskell/Balanced-brackets b/Lang/Haskell/Balanced-brackets new file mode 120000 index 0000000000..f5544bc313 --- /dev/null +++ b/Lang/Haskell/Balanced-brackets @@ -0,0 +1 @@ +../../Task/Balanced-brackets/Haskell \ No newline at end of file diff --git a/Lang/Haskell/Balanced-ternary b/Lang/Haskell/Balanced-ternary new file mode 120000 index 0000000000..61f662a1eb --- /dev/null +++ b/Lang/Haskell/Balanced-ternary @@ -0,0 +1 @@ +../../Task/Balanced-ternary/Haskell \ No newline at end of file diff --git a/Lang/Haskell/Best-shuffle b/Lang/Haskell/Best-shuffle new file mode 120000 index 0000000000..b571c62b5f --- /dev/null +++ b/Lang/Haskell/Best-shuffle @@ -0,0 +1 @@ +../../Task/Best-shuffle/Haskell \ No newline at end of file diff --git a/Lang/Haskell/Binary-search b/Lang/Haskell/Binary-search new file mode 120000 index 0000000000..5fcec07b35 --- /dev/null +++ b/Lang/Haskell/Binary-search @@ -0,0 +1 @@ +../../Task/Binary-search/Haskell \ No newline at end of file diff --git a/Lang/Haskell/Binary-strings b/Lang/Haskell/Binary-strings new file mode 120000 index 0000000000..a7fca88f62 --- /dev/null +++ b/Lang/Haskell/Binary-strings @@ -0,0 +1 @@ +../../Task/Binary-strings/Haskell \ No newline at end of file diff --git a/Lang/Haskell/Bulls-and-cows b/Lang/Haskell/Bulls-and-cows new file mode 120000 index 0000000000..e555bb35d5 --- /dev/null +++ b/Lang/Haskell/Bulls-and-cows @@ -0,0 +1 @@ +../../Task/Bulls-and-cows/Haskell \ No newline at end of file diff --git a/Lang/Haskell/Caesar-cipher b/Lang/Haskell/Caesar-cipher new file mode 120000 index 0000000000..e0b500c54c --- /dev/null +++ b/Lang/Haskell/Caesar-cipher @@ -0,0 +1 @@ +../../Task/Caesar-cipher/Haskell \ No newline at end of file diff --git a/Lang/Haskell/Check-that-file-exists b/Lang/Haskell/Check-that-file-exists new file mode 120000 index 0000000000..d939440dcc --- /dev/null +++ b/Lang/Haskell/Check-that-file-exists @@ -0,0 +1 @@ +../../Task/Check-that-file-exists/Haskell \ No newline at end of file diff --git a/Lang/Haskell/Checkpoint-synchronization b/Lang/Haskell/Checkpoint-synchronization new file mode 120000 index 0000000000..5530c679db --- /dev/null +++ b/Lang/Haskell/Checkpoint-synchronization @@ -0,0 +1 @@ +../../Task/Checkpoint-synchronization/Haskell \ No newline at end of file diff --git a/Lang/Haskell/Closest-pair-problem b/Lang/Haskell/Closest-pair-problem new file mode 120000 index 0000000000..28b9f81c30 --- /dev/null +++ b/Lang/Haskell/Closest-pair-problem @@ -0,0 +1 @@ +../../Task/Closest-pair-problem/Haskell \ No newline at end of file diff --git a/Lang/Haskell/Define-a-primitive-data-type b/Lang/Haskell/Define-a-primitive-data-type new file mode 120000 index 0000000000..c26f6fe822 --- /dev/null +++ b/Lang/Haskell/Define-a-primitive-data-type @@ -0,0 +1 @@ +../../Task/Define-a-primitive-data-type/Haskell \ No newline at end of file diff --git a/Lang/Haskell/Delete-a-file b/Lang/Haskell/Delete-a-file new file mode 120000 index 0000000000..65f7e6c1f9 --- /dev/null +++ b/Lang/Haskell/Delete-a-file @@ -0,0 +1 @@ +../../Task/Delete-a-file/Haskell \ No newline at end of file diff --git a/Lang/Haskell/Detect-division-by-zero b/Lang/Haskell/Detect-division-by-zero new file mode 120000 index 0000000000..3fc331cc99 --- /dev/null +++ b/Lang/Haskell/Detect-division-by-zero @@ -0,0 +1 @@ +../../Task/Detect-division-by-zero/Haskell \ No newline at end of file diff --git a/Lang/Haskell/Determine-if-a-string-is-numeric b/Lang/Haskell/Determine-if-a-string-is-numeric new file mode 120000 index 0000000000..1042ead030 --- /dev/null +++ b/Lang/Haskell/Determine-if-a-string-is-numeric @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-is-numeric/Haskell \ No newline at end of file diff --git a/Lang/Haskell/Forest-fire b/Lang/Haskell/Forest-fire new file mode 120000 index 0000000000..597005b8ce --- /dev/null +++ b/Lang/Haskell/Forest-fire @@ -0,0 +1 @@ +../../Task/Forest-fire/Haskell \ No newline at end of file diff --git a/Lang/Haskell/Knuth-shuffle b/Lang/Haskell/Knuth-shuffle new file mode 120000 index 0000000000..52424dc3e7 --- /dev/null +++ b/Lang/Haskell/Knuth-shuffle @@ -0,0 +1 @@ +../../Task/Knuth-shuffle/Haskell \ No newline at end of file diff --git a/Lang/Haskell/Ordered-words b/Lang/Haskell/Ordered-words new file mode 120000 index 0000000000..0ae908cbad --- /dev/null +++ b/Lang/Haskell/Ordered-words @@ -0,0 +1 @@ +../../Task/Ordered-words/Haskell \ No newline at end of file diff --git a/Lang/Haskell/Search-a-list b/Lang/Haskell/Search-a-list new file mode 120000 index 0000000000..c645d3878f --- /dev/null +++ b/Lang/Haskell/Search-a-list @@ -0,0 +1 @@ +../../Task/Search-a-list/Haskell \ No newline at end of file diff --git a/Lang/Java/99-Bottles-of-Beer b/Lang/Java/99-Bottles-of-Beer new file mode 120000 index 0000000000..abd96c8382 --- /dev/null +++ b/Lang/Java/99-Bottles-of-Beer @@ -0,0 +1 @@ +../../Task/99-Bottles-of-Beer/Java \ No newline at end of file diff --git a/Lang/Java/Ackermann-function b/Lang/Java/Ackermann-function new file mode 120000 index 0000000000..ab1e3bc071 --- /dev/null +++ b/Lang/Java/Ackermann-function @@ -0,0 +1 @@ +../../Task/Ackermann-function/Java \ No newline at end of file diff --git a/Lang/Java/Balanced-brackets b/Lang/Java/Balanced-brackets new file mode 120000 index 0000000000..290fea81e1 --- /dev/null +++ b/Lang/Java/Balanced-brackets @@ -0,0 +1 @@ +../../Task/Balanced-brackets/Java \ No newline at end of file diff --git a/Lang/Java/Best-shuffle b/Lang/Java/Best-shuffle new file mode 120000 index 0000000000..6031b314a3 --- /dev/null +++ b/Lang/Java/Best-shuffle @@ -0,0 +1 @@ +../../Task/Best-shuffle/Java \ No newline at end of file diff --git a/Lang/Java/Binary-search b/Lang/Java/Binary-search new file mode 120000 index 0000000000..41d16dfa2f --- /dev/null +++ b/Lang/Java/Binary-search @@ -0,0 +1 @@ +../../Task/Binary-search/Java \ No newline at end of file diff --git a/Lang/Java/Bulls-and-cows b/Lang/Java/Bulls-and-cows new file mode 120000 index 0000000000..4ca4cdeb35 --- /dev/null +++ b/Lang/Java/Bulls-and-cows @@ -0,0 +1 @@ +../../Task/Bulls-and-cows/Java \ No newline at end of file diff --git a/Lang/Java/Caesar-cipher b/Lang/Java/Caesar-cipher new file mode 120000 index 0000000000..0ce8341e58 --- /dev/null +++ b/Lang/Java/Caesar-cipher @@ -0,0 +1 @@ +../../Task/Caesar-cipher/Java \ No newline at end of file diff --git a/Lang/Java/Check-that-file-exists b/Lang/Java/Check-that-file-exists new file mode 120000 index 0000000000..5ef78e1854 --- /dev/null +++ b/Lang/Java/Check-that-file-exists @@ -0,0 +1 @@ +../../Task/Check-that-file-exists/Java \ No newline at end of file diff --git a/Lang/Java/Checkpoint-synchronization b/Lang/Java/Checkpoint-synchronization new file mode 120000 index 0000000000..1718cd98b3 --- /dev/null +++ b/Lang/Java/Checkpoint-synchronization @@ -0,0 +1 @@ +../../Task/Checkpoint-synchronization/Java \ No newline at end of file diff --git a/Lang/Java/Closest-pair-problem b/Lang/Java/Closest-pair-problem new file mode 120000 index 0000000000..9dc8c81782 --- /dev/null +++ b/Lang/Java/Closest-pair-problem @@ -0,0 +1 @@ +../../Task/Closest-pair-problem/Java \ No newline at end of file diff --git a/Lang/Java/Color-of-a-screen-pixel b/Lang/Java/Color-of-a-screen-pixel new file mode 120000 index 0000000000..69d7108cf4 --- /dev/null +++ b/Lang/Java/Color-of-a-screen-pixel @@ -0,0 +1 @@ +../../Task/Color-of-a-screen-pixel/Java \ No newline at end of file diff --git a/Lang/Java/Define-a-primitive-data-type b/Lang/Java/Define-a-primitive-data-type new file mode 120000 index 0000000000..57d1b5f083 --- /dev/null +++ b/Lang/Java/Define-a-primitive-data-type @@ -0,0 +1 @@ +../../Task/Define-a-primitive-data-type/Java \ No newline at end of file diff --git a/Lang/Java/Delete-a-file b/Lang/Java/Delete-a-file new file mode 120000 index 0000000000..d6717d2a6b --- /dev/null +++ b/Lang/Java/Delete-a-file @@ -0,0 +1 @@ +../../Task/Delete-a-file/Java \ No newline at end of file diff --git a/Lang/Java/Detect-division-by-zero b/Lang/Java/Detect-division-by-zero new file mode 120000 index 0000000000..3daa83d4a3 --- /dev/null +++ b/Lang/Java/Detect-division-by-zero @@ -0,0 +1 @@ +../../Task/Detect-division-by-zero/Java \ No newline at end of file diff --git a/Lang/Java/Determine-if-a-string-is-numeric b/Lang/Java/Determine-if-a-string-is-numeric new file mode 120000 index 0000000000..a27ff87c0d --- /dev/null +++ b/Lang/Java/Determine-if-a-string-is-numeric @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-is-numeric/Java \ No newline at end of file diff --git a/Lang/Java/Forest-fire b/Lang/Java/Forest-fire new file mode 120000 index 0000000000..d31f3c79fe --- /dev/null +++ b/Lang/Java/Forest-fire @@ -0,0 +1 @@ +../../Task/Forest-fire/Java \ No newline at end of file diff --git a/Lang/Java/Knuth-shuffle b/Lang/Java/Knuth-shuffle new file mode 120000 index 0000000000..2147c032ef --- /dev/null +++ b/Lang/Java/Knuth-shuffle @@ -0,0 +1 @@ +../../Task/Knuth-shuffle/Java \ No newline at end of file diff --git a/Lang/Java/Ordered-words b/Lang/Java/Ordered-words new file mode 120000 index 0000000000..eb91b9776d --- /dev/null +++ b/Lang/Java/Ordered-words @@ -0,0 +1 @@ +../../Task/Ordered-words/Java \ No newline at end of file diff --git a/Lang/Java/Search-a-list b/Lang/Java/Search-a-list new file mode 120000 index 0000000000..2f9d96b998 --- /dev/null +++ b/Lang/Java/Search-a-list @@ -0,0 +1 @@ +../../Task/Search-a-list/Java \ No newline at end of file diff --git a/Lang/JavaScript/99-Bottles-of-Beer b/Lang/JavaScript/99-Bottles-of-Beer new file mode 120000 index 0000000000..99088664ab --- /dev/null +++ b/Lang/JavaScript/99-Bottles-of-Beer @@ -0,0 +1 @@ +../../Task/99-Bottles-of-Beer/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Ackermann-function b/Lang/JavaScript/Ackermann-function new file mode 120000 index 0000000000..0537633e73 --- /dev/null +++ b/Lang/JavaScript/Ackermann-function @@ -0,0 +1 @@ +../../Task/Ackermann-function/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Balanced-brackets b/Lang/JavaScript/Balanced-brackets new file mode 120000 index 0000000000..5ac87a181a --- /dev/null +++ b/Lang/JavaScript/Balanced-brackets @@ -0,0 +1 @@ +../../Task/Balanced-brackets/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Best-shuffle b/Lang/JavaScript/Best-shuffle new file mode 120000 index 0000000000..119492778b --- /dev/null +++ b/Lang/JavaScript/Best-shuffle @@ -0,0 +1 @@ +../../Task/Best-shuffle/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Binary-search b/Lang/JavaScript/Binary-search new file mode 120000 index 0000000000..5bf68854dc --- /dev/null +++ b/Lang/JavaScript/Binary-search @@ -0,0 +1 @@ +../../Task/Binary-search/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Bulls-and-cows b/Lang/JavaScript/Bulls-and-cows new file mode 120000 index 0000000000..369bf9099c --- /dev/null +++ b/Lang/JavaScript/Bulls-and-cows @@ -0,0 +1 @@ +../../Task/Bulls-and-cows/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Caesar-cipher b/Lang/JavaScript/Caesar-cipher new file mode 120000 index 0000000000..11b0945b93 --- /dev/null +++ b/Lang/JavaScript/Caesar-cipher @@ -0,0 +1 @@ +../../Task/Caesar-cipher/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Check-that-file-exists b/Lang/JavaScript/Check-that-file-exists new file mode 120000 index 0000000000..d96ff24c83 --- /dev/null +++ b/Lang/JavaScript/Check-that-file-exists @@ -0,0 +1 @@ +../../Task/Check-that-file-exists/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Closest-pair-problem b/Lang/JavaScript/Closest-pair-problem new file mode 120000 index 0000000000..d010d6916a --- /dev/null +++ b/Lang/JavaScript/Closest-pair-problem @@ -0,0 +1 @@ +../../Task/Closest-pair-problem/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Define-a-primitive-data-type b/Lang/JavaScript/Define-a-primitive-data-type new file mode 120000 index 0000000000..40ca3c77e4 --- /dev/null +++ b/Lang/JavaScript/Define-a-primitive-data-type @@ -0,0 +1 @@ +../../Task/Define-a-primitive-data-type/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Delete-a-file b/Lang/JavaScript/Delete-a-file new file mode 120000 index 0000000000..c150d93193 --- /dev/null +++ b/Lang/JavaScript/Delete-a-file @@ -0,0 +1 @@ +../../Task/Delete-a-file/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Detect-division-by-zero b/Lang/JavaScript/Detect-division-by-zero new file mode 120000 index 0000000000..a6b6e52ce5 --- /dev/null +++ b/Lang/JavaScript/Detect-division-by-zero @@ -0,0 +1 @@ +../../Task/Detect-division-by-zero/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Determine-if-a-string-is-numeric b/Lang/JavaScript/Determine-if-a-string-is-numeric new file mode 120000 index 0000000000..67ea9313b0 --- /dev/null +++ b/Lang/JavaScript/Determine-if-a-string-is-numeric @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-is-numeric/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Forest-fire b/Lang/JavaScript/Forest-fire new file mode 120000 index 0000000000..26302d7563 --- /dev/null +++ b/Lang/JavaScript/Forest-fire @@ -0,0 +1 @@ +../../Task/Forest-fire/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Knuth-shuffle b/Lang/JavaScript/Knuth-shuffle new file mode 120000 index 0000000000..ffacf01912 --- /dev/null +++ b/Lang/JavaScript/Knuth-shuffle @@ -0,0 +1 @@ +../../Task/Knuth-shuffle/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Ordered-words b/Lang/JavaScript/Ordered-words new file mode 120000 index 0000000000..6d23a7a970 --- /dev/null +++ b/Lang/JavaScript/Ordered-words @@ -0,0 +1 @@ +../../Task/Ordered-words/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Search-a-list b/Lang/JavaScript/Search-a-list new file mode 120000 index 0000000000..b3b53f42ac --- /dev/null +++ b/Lang/JavaScript/Search-a-list @@ -0,0 +1 @@ +../../Task/Search-a-list/JavaScript \ No newline at end of file diff --git a/Lang/LaTeX/99-Bottles-of-Beer b/Lang/LaTeX/99-Bottles-of-Beer new file mode 120000 index 0000000000..ef22cefb7d --- /dev/null +++ b/Lang/LaTeX/99-Bottles-of-Beer @@ -0,0 +1 @@ +../../Task/99-Bottles-of-Beer/LaTeX \ No newline at end of file diff --git a/Lang/Lua/99-Bottles-of-Beer b/Lang/Lua/99-Bottles-of-Beer new file mode 120000 index 0000000000..6bdb7eb2cd --- /dev/null +++ b/Lang/Lua/99-Bottles-of-Beer @@ -0,0 +1 @@ +../../Task/99-Bottles-of-Beer/Lua \ No newline at end of file diff --git a/Lang/Lua/Ackermann-function b/Lang/Lua/Ackermann-function new file mode 120000 index 0000000000..76ea1e4ae3 --- /dev/null +++ b/Lang/Lua/Ackermann-function @@ -0,0 +1 @@ +../../Task/Ackermann-function/Lua \ No newline at end of file diff --git a/Lang/Lua/Balanced-brackets b/Lang/Lua/Balanced-brackets new file mode 120000 index 0000000000..63cb83fdbf --- /dev/null +++ b/Lang/Lua/Balanced-brackets @@ -0,0 +1 @@ +../../Task/Balanced-brackets/Lua \ No newline at end of file diff --git a/Lang/Lua/Binary-search b/Lang/Lua/Binary-search new file mode 120000 index 0000000000..71c9630372 --- /dev/null +++ b/Lang/Lua/Binary-search @@ -0,0 +1 @@ +../../Task/Binary-search/Lua \ No newline at end of file diff --git a/Lang/Lua/Binary-strings b/Lang/Lua/Binary-strings new file mode 120000 index 0000000000..2662bed788 --- /dev/null +++ b/Lang/Lua/Binary-strings @@ -0,0 +1 @@ +../../Task/Binary-strings/Lua \ No newline at end of file diff --git a/Lang/Lua/Bulls-and-cows b/Lang/Lua/Bulls-and-cows new file mode 120000 index 0000000000..c31badedc5 --- /dev/null +++ b/Lang/Lua/Bulls-and-cows @@ -0,0 +1 @@ +../../Task/Bulls-and-cows/Lua \ No newline at end of file diff --git a/Lang/Lua/Caesar-cipher b/Lang/Lua/Caesar-cipher new file mode 120000 index 0000000000..3534d253ce --- /dev/null +++ b/Lang/Lua/Caesar-cipher @@ -0,0 +1 @@ +../../Task/Caesar-cipher/Lua \ No newline at end of file diff --git a/Lang/Lua/Check-that-file-exists b/Lang/Lua/Check-that-file-exists new file mode 120000 index 0000000000..30e5ff7acb --- /dev/null +++ b/Lang/Lua/Check-that-file-exists @@ -0,0 +1 @@ +../../Task/Check-that-file-exists/Lua \ No newline at end of file diff --git a/Lang/Lua/Delete-a-file b/Lang/Lua/Delete-a-file new file mode 120000 index 0000000000..a0242a6aa5 --- /dev/null +++ b/Lang/Lua/Delete-a-file @@ -0,0 +1 @@ +../../Task/Delete-a-file/Lua \ No newline at end of file diff --git a/Lang/Lua/Detect-division-by-zero b/Lang/Lua/Detect-division-by-zero new file mode 120000 index 0000000000..fd39913250 --- /dev/null +++ b/Lang/Lua/Detect-division-by-zero @@ -0,0 +1 @@ +../../Task/Detect-division-by-zero/Lua \ No newline at end of file diff --git a/Lang/Lua/Determine-if-a-string-is-numeric b/Lang/Lua/Determine-if-a-string-is-numeric new file mode 120000 index 0000000000..0106c2d36d --- /dev/null +++ b/Lang/Lua/Determine-if-a-string-is-numeric @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-is-numeric/Lua \ No newline at end of file diff --git a/Lang/Lua/Knuth-shuffle b/Lang/Lua/Knuth-shuffle new file mode 120000 index 0000000000..40bd614400 --- /dev/null +++ b/Lang/Lua/Knuth-shuffle @@ -0,0 +1 @@ +../../Task/Knuth-shuffle/Lua \ No newline at end of file diff --git a/Lang/Lua/Ordered-words b/Lang/Lua/Ordered-words new file mode 120000 index 0000000000..87a4feb0a5 --- /dev/null +++ b/Lang/Lua/Ordered-words @@ -0,0 +1 @@ +../../Task/Ordered-words/Lua \ No newline at end of file diff --git a/Lang/Lua/Search-a-list b/Lang/Lua/Search-a-list new file mode 120000 index 0000000000..016b43e6ce --- /dev/null +++ b/Lang/Lua/Search-a-list @@ -0,0 +1 @@ +../../Task/Search-a-list/Lua \ No newline at end of file diff --git a/Lang/PHP/99-Bottles-of-Beer b/Lang/PHP/99-Bottles-of-Beer new file mode 120000 index 0000000000..d5ce353d6f --- /dev/null +++ b/Lang/PHP/99-Bottles-of-Beer @@ -0,0 +1 @@ +../../Task/99-Bottles-of-Beer/PHP \ No newline at end of file diff --git a/Lang/PHP/Ackermann-function b/Lang/PHP/Ackermann-function new file mode 120000 index 0000000000..382e552288 --- /dev/null +++ b/Lang/PHP/Ackermann-function @@ -0,0 +1 @@ +../../Task/Ackermann-function/PHP \ No newline at end of file diff --git a/Lang/PHP/Best-shuffle b/Lang/PHP/Best-shuffle new file mode 120000 index 0000000000..289a0d811c --- /dev/null +++ b/Lang/PHP/Best-shuffle @@ -0,0 +1 @@ +../../Task/Best-shuffle/PHP \ No newline at end of file diff --git a/Lang/PHP/Binary-search b/Lang/PHP/Binary-search new file mode 120000 index 0000000000..9b216edb6c --- /dev/null +++ b/Lang/PHP/Binary-search @@ -0,0 +1 @@ +../../Task/Binary-search/PHP \ No newline at end of file diff --git a/Lang/PHP/Bulls-and-cows b/Lang/PHP/Bulls-and-cows new file mode 120000 index 0000000000..90c0889688 --- /dev/null +++ b/Lang/PHP/Bulls-and-cows @@ -0,0 +1 @@ +../../Task/Bulls-and-cows/PHP \ No newline at end of file diff --git a/Lang/PHP/Caesar-cipher b/Lang/PHP/Caesar-cipher new file mode 120000 index 0000000000..97dbf9c503 --- /dev/null +++ b/Lang/PHP/Caesar-cipher @@ -0,0 +1 @@ +../../Task/Caesar-cipher/PHP \ No newline at end of file diff --git a/Lang/PHP/Check-that-file-exists b/Lang/PHP/Check-that-file-exists new file mode 120000 index 0000000000..0c11063bfe --- /dev/null +++ b/Lang/PHP/Check-that-file-exists @@ -0,0 +1 @@ +../../Task/Check-that-file-exists/PHP \ No newline at end of file diff --git a/Lang/PHP/Color-of-a-screen-pixel b/Lang/PHP/Color-of-a-screen-pixel new file mode 120000 index 0000000000..0515402788 --- /dev/null +++ b/Lang/PHP/Color-of-a-screen-pixel @@ -0,0 +1 @@ +../../Task/Color-of-a-screen-pixel/PHP \ No newline at end of file diff --git a/Lang/PHP/Delete-a-file b/Lang/PHP/Delete-a-file new file mode 120000 index 0000000000..57552980a5 --- /dev/null +++ b/Lang/PHP/Delete-a-file @@ -0,0 +1 @@ +../../Task/Delete-a-file/PHP \ No newline at end of file diff --git a/Lang/PHP/Detect-division-by-zero b/Lang/PHP/Detect-division-by-zero new file mode 120000 index 0000000000..803bcfeae8 --- /dev/null +++ b/Lang/PHP/Detect-division-by-zero @@ -0,0 +1 @@ +../../Task/Detect-division-by-zero/PHP \ No newline at end of file diff --git a/Lang/PHP/Determine-if-a-string-is-numeric b/Lang/PHP/Determine-if-a-string-is-numeric new file mode 120000 index 0000000000..558f7fe931 --- /dev/null +++ b/Lang/PHP/Determine-if-a-string-is-numeric @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-is-numeric/PHP \ No newline at end of file diff --git a/Lang/PHP/Knuth-shuffle b/Lang/PHP/Knuth-shuffle new file mode 120000 index 0000000000..acc38f9240 --- /dev/null +++ b/Lang/PHP/Knuth-shuffle @@ -0,0 +1 @@ +../../Task/Knuth-shuffle/PHP \ No newline at end of file diff --git a/Lang/PHP/Search-a-list b/Lang/PHP/Search-a-list new file mode 120000 index 0000000000..9b8dbec29b --- /dev/null +++ b/Lang/PHP/Search-a-list @@ -0,0 +1 @@ +../../Task/Search-a-list/PHP \ No newline at end of file diff --git a/Lang/PIR/99-Bottles-of-Beer b/Lang/PIR/99-Bottles-of-Beer new file mode 120000 index 0000000000..a85f01da92 --- /dev/null +++ b/Lang/PIR/99-Bottles-of-Beer @@ -0,0 +1 @@ +../../Task/99-Bottles-of-Beer/PIR \ No newline at end of file diff --git a/Lang/Perl/99-Bottles-of-Beer b/Lang/Perl/99-Bottles-of-Beer new file mode 120000 index 0000000000..08ebd37f8c --- /dev/null +++ b/Lang/Perl/99-Bottles-of-Beer @@ -0,0 +1 @@ +../../Task/99-Bottles-of-Beer/Perl \ No newline at end of file diff --git a/Lang/Perl/Ackermann-function b/Lang/Perl/Ackermann-function new file mode 120000 index 0000000000..c4d780cf19 --- /dev/null +++ b/Lang/Perl/Ackermann-function @@ -0,0 +1 @@ +../../Task/Ackermann-function/Perl \ No newline at end of file diff --git a/Lang/Perl/Balanced-brackets b/Lang/Perl/Balanced-brackets new file mode 120000 index 0000000000..13dfa62d3e --- /dev/null +++ b/Lang/Perl/Balanced-brackets @@ -0,0 +1 @@ +../../Task/Balanced-brackets/Perl \ No newline at end of file diff --git a/Lang/Perl/Best-shuffle b/Lang/Perl/Best-shuffle new file mode 120000 index 0000000000..9324bd6628 --- /dev/null +++ b/Lang/Perl/Best-shuffle @@ -0,0 +1 @@ +../../Task/Best-shuffle/Perl \ No newline at end of file diff --git a/Lang/Perl/Binary-search b/Lang/Perl/Binary-search new file mode 120000 index 0000000000..60485a896a --- /dev/null +++ b/Lang/Perl/Binary-search @@ -0,0 +1 @@ +../../Task/Binary-search/Perl \ No newline at end of file diff --git a/Lang/Perl/Bulls-and-cows b/Lang/Perl/Bulls-and-cows new file mode 120000 index 0000000000..790ee469ab --- /dev/null +++ b/Lang/Perl/Bulls-and-cows @@ -0,0 +1 @@ +../../Task/Bulls-and-cows/Perl \ No newline at end of file diff --git a/Lang/Perl/Caesar-cipher b/Lang/Perl/Caesar-cipher new file mode 120000 index 0000000000..8f35e087af --- /dev/null +++ b/Lang/Perl/Caesar-cipher @@ -0,0 +1 @@ +../../Task/Caesar-cipher/Perl \ No newline at end of file diff --git a/Lang/Perl/Check-that-file-exists b/Lang/Perl/Check-that-file-exists new file mode 120000 index 0000000000..d9548a1247 --- /dev/null +++ b/Lang/Perl/Check-that-file-exists @@ -0,0 +1 @@ +../../Task/Check-that-file-exists/Perl \ No newline at end of file diff --git a/Lang/Perl/Checkpoint-synchronization b/Lang/Perl/Checkpoint-synchronization new file mode 120000 index 0000000000..b0bb50ead8 --- /dev/null +++ b/Lang/Perl/Checkpoint-synchronization @@ -0,0 +1 @@ +../../Task/Checkpoint-synchronization/Perl \ No newline at end of file diff --git a/Lang/Perl/Closest-pair-problem b/Lang/Perl/Closest-pair-problem new file mode 120000 index 0000000000..eaf73f5083 --- /dev/null +++ b/Lang/Perl/Closest-pair-problem @@ -0,0 +1 @@ +../../Task/Closest-pair-problem/Perl \ No newline at end of file diff --git a/Lang/Perl/Death-Star b/Lang/Perl/Death-Star new file mode 120000 index 0000000000..bdbeefa7be --- /dev/null +++ b/Lang/Perl/Death-Star @@ -0,0 +1 @@ +../../Task/Death-Star/Perl \ No newline at end of file diff --git a/Lang/Perl/Define-a-primitive-data-type b/Lang/Perl/Define-a-primitive-data-type new file mode 120000 index 0000000000..34b600707e --- /dev/null +++ b/Lang/Perl/Define-a-primitive-data-type @@ -0,0 +1 @@ +../../Task/Define-a-primitive-data-type/Perl \ No newline at end of file diff --git a/Lang/Perl/Delete-a-file b/Lang/Perl/Delete-a-file new file mode 120000 index 0000000000..be233c3211 --- /dev/null +++ b/Lang/Perl/Delete-a-file @@ -0,0 +1 @@ +../../Task/Delete-a-file/Perl \ No newline at end of file diff --git a/Lang/Perl/Detect-division-by-zero b/Lang/Perl/Detect-division-by-zero new file mode 120000 index 0000000000..6f5698c867 --- /dev/null +++ b/Lang/Perl/Detect-division-by-zero @@ -0,0 +1 @@ +../../Task/Detect-division-by-zero/Perl \ No newline at end of file diff --git a/Lang/Perl/Determine-if-a-string-is-numeric b/Lang/Perl/Determine-if-a-string-is-numeric new file mode 120000 index 0000000000..93248188da --- /dev/null +++ b/Lang/Perl/Determine-if-a-string-is-numeric @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-is-numeric/Perl \ No newline at end of file diff --git a/Lang/Perl/Forest-fire b/Lang/Perl/Forest-fire new file mode 120000 index 0000000000..44047f6799 --- /dev/null +++ b/Lang/Perl/Forest-fire @@ -0,0 +1 @@ +../../Task/Forest-fire/Perl \ No newline at end of file diff --git a/Lang/Perl/Knuth-shuffle b/Lang/Perl/Knuth-shuffle new file mode 120000 index 0000000000..308902bd8f --- /dev/null +++ b/Lang/Perl/Knuth-shuffle @@ -0,0 +1 @@ +../../Task/Knuth-shuffle/Perl \ No newline at end of file diff --git a/Lang/Perl/Ordered-words b/Lang/Perl/Ordered-words new file mode 120000 index 0000000000..b7246f6975 --- /dev/null +++ b/Lang/Perl/Ordered-words @@ -0,0 +1 @@ +../../Task/Ordered-words/Perl \ No newline at end of file diff --git a/Lang/Perl/Search-a-list b/Lang/Perl/Search-a-list new file mode 120000 index 0000000000..5dd83089d6 --- /dev/null +++ b/Lang/Perl/Search-a-list @@ -0,0 +1 @@ +../../Task/Search-a-list/Perl \ No newline at end of file diff --git a/Lang/PicoLisp/99-Bottles-of-Beer b/Lang/PicoLisp/99-Bottles-of-Beer new file mode 120000 index 0000000000..7c5b47876e --- /dev/null +++ b/Lang/PicoLisp/99-Bottles-of-Beer @@ -0,0 +1 @@ +../../Task/99-Bottles-of-Beer/PicoLisp \ No newline at end of file diff --git a/Lang/PicoLisp/Ackermann-function b/Lang/PicoLisp/Ackermann-function new file mode 120000 index 0000000000..f1f22c9c07 --- /dev/null +++ b/Lang/PicoLisp/Ackermann-function @@ -0,0 +1 @@ +../../Task/Ackermann-function/PicoLisp \ No newline at end of file diff --git a/Lang/PicoLisp/Balanced-brackets b/Lang/PicoLisp/Balanced-brackets new file mode 120000 index 0000000000..cee8a297de --- /dev/null +++ b/Lang/PicoLisp/Balanced-brackets @@ -0,0 +1 @@ +../../Task/Balanced-brackets/PicoLisp \ No newline at end of file diff --git a/Lang/PicoLisp/Best-shuffle b/Lang/PicoLisp/Best-shuffle new file mode 120000 index 0000000000..692a490364 --- /dev/null +++ b/Lang/PicoLisp/Best-shuffle @@ -0,0 +1 @@ +../../Task/Best-shuffle/PicoLisp \ No newline at end of file diff --git a/Lang/PicoLisp/Binary-search b/Lang/PicoLisp/Binary-search new file mode 120000 index 0000000000..f5328438d8 --- /dev/null +++ b/Lang/PicoLisp/Binary-search @@ -0,0 +1 @@ +../../Task/Binary-search/PicoLisp \ No newline at end of file diff --git a/Lang/PicoLisp/Binary-strings b/Lang/PicoLisp/Binary-strings new file mode 120000 index 0000000000..8e4b9ed992 --- /dev/null +++ b/Lang/PicoLisp/Binary-strings @@ -0,0 +1 @@ +../../Task/Binary-strings/PicoLisp \ No newline at end of file diff --git a/Lang/PicoLisp/Bulls-and-cows b/Lang/PicoLisp/Bulls-and-cows new file mode 120000 index 0000000000..6502d87af9 --- /dev/null +++ b/Lang/PicoLisp/Bulls-and-cows @@ -0,0 +1 @@ +../../Task/Bulls-and-cows/PicoLisp \ No newline at end of file diff --git a/Lang/PicoLisp/Caesar-cipher b/Lang/PicoLisp/Caesar-cipher new file mode 120000 index 0000000000..b0e645b41b --- /dev/null +++ b/Lang/PicoLisp/Caesar-cipher @@ -0,0 +1 @@ +../../Task/Caesar-cipher/PicoLisp \ No newline at end of file diff --git a/Lang/PicoLisp/Check-that-file-exists b/Lang/PicoLisp/Check-that-file-exists new file mode 120000 index 0000000000..709cb338da --- /dev/null +++ b/Lang/PicoLisp/Check-that-file-exists @@ -0,0 +1 @@ +../../Task/Check-that-file-exists/PicoLisp \ No newline at end of file diff --git a/Lang/PicoLisp/Checkpoint-synchronization b/Lang/PicoLisp/Checkpoint-synchronization new file mode 120000 index 0000000000..e1e4fb8ba4 --- /dev/null +++ b/Lang/PicoLisp/Checkpoint-synchronization @@ -0,0 +1 @@ +../../Task/Checkpoint-synchronization/PicoLisp \ No newline at end of file diff --git a/Lang/PicoLisp/Closest-pair-problem b/Lang/PicoLisp/Closest-pair-problem new file mode 120000 index 0000000000..11a0fc2b6b --- /dev/null +++ b/Lang/PicoLisp/Closest-pair-problem @@ -0,0 +1 @@ +../../Task/Closest-pair-problem/PicoLisp \ No newline at end of file diff --git a/Lang/PicoLisp/Color-of-a-screen-pixel b/Lang/PicoLisp/Color-of-a-screen-pixel new file mode 120000 index 0000000000..b6a1413daa --- /dev/null +++ b/Lang/PicoLisp/Color-of-a-screen-pixel @@ -0,0 +1 @@ +../../Task/Color-of-a-screen-pixel/PicoLisp \ No newline at end of file diff --git a/Lang/PicoLisp/Define-a-primitive-data-type b/Lang/PicoLisp/Define-a-primitive-data-type new file mode 120000 index 0000000000..451b964868 --- /dev/null +++ b/Lang/PicoLisp/Define-a-primitive-data-type @@ -0,0 +1 @@ +../../Task/Define-a-primitive-data-type/PicoLisp \ No newline at end of file diff --git a/Lang/PicoLisp/Delete-a-file b/Lang/PicoLisp/Delete-a-file new file mode 120000 index 0000000000..f04a9e1e95 --- /dev/null +++ b/Lang/PicoLisp/Delete-a-file @@ -0,0 +1 @@ +../../Task/Delete-a-file/PicoLisp \ No newline at end of file diff --git a/Lang/PicoLisp/Detect-division-by-zero b/Lang/PicoLisp/Detect-division-by-zero new file mode 120000 index 0000000000..ea2a6dc792 --- /dev/null +++ b/Lang/PicoLisp/Detect-division-by-zero @@ -0,0 +1 @@ +../../Task/Detect-division-by-zero/PicoLisp \ No newline at end of file diff --git a/Lang/PicoLisp/Determine-if-a-string-is-numeric b/Lang/PicoLisp/Determine-if-a-string-is-numeric new file mode 120000 index 0000000000..2d2d6fce8c --- /dev/null +++ b/Lang/PicoLisp/Determine-if-a-string-is-numeric @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-is-numeric/PicoLisp \ No newline at end of file diff --git a/Lang/PicoLisp/Forest-fire b/Lang/PicoLisp/Forest-fire new file mode 120000 index 0000000000..923bb562bb --- /dev/null +++ b/Lang/PicoLisp/Forest-fire @@ -0,0 +1 @@ +../../Task/Forest-fire/PicoLisp \ No newline at end of file diff --git a/Lang/PicoLisp/Knuth-shuffle b/Lang/PicoLisp/Knuth-shuffle new file mode 120000 index 0000000000..cc8928e810 --- /dev/null +++ b/Lang/PicoLisp/Knuth-shuffle @@ -0,0 +1 @@ +../../Task/Knuth-shuffle/PicoLisp \ No newline at end of file diff --git a/Lang/PicoLisp/Ordered-words b/Lang/PicoLisp/Ordered-words new file mode 120000 index 0000000000..2ec8a5bdf8 --- /dev/null +++ b/Lang/PicoLisp/Ordered-words @@ -0,0 +1 @@ +../../Task/Ordered-words/PicoLisp \ No newline at end of file diff --git a/Lang/PicoLisp/Search-a-list b/Lang/PicoLisp/Search-a-list new file mode 120000 index 0000000000..23ef71a6f5 --- /dev/null +++ b/Lang/PicoLisp/Search-a-list @@ -0,0 +1 @@ +../../Task/Search-a-list/PicoLisp \ No newline at end of file diff --git a/Lang/Prolog/99-Bottles-of-Beer b/Lang/Prolog/99-Bottles-of-Beer new file mode 120000 index 0000000000..6fc27c5350 --- /dev/null +++ b/Lang/Prolog/99-Bottles-of-Beer @@ -0,0 +1 @@ +../../Task/99-Bottles-of-Beer/Prolog \ No newline at end of file diff --git a/Lang/Prolog/Ackermann-function b/Lang/Prolog/Ackermann-function new file mode 120000 index 0000000000..20ab4cd1b8 --- /dev/null +++ b/Lang/Prolog/Ackermann-function @@ -0,0 +1 @@ +../../Task/Ackermann-function/Prolog \ No newline at end of file diff --git a/Lang/Prolog/Balanced-brackets b/Lang/Prolog/Balanced-brackets new file mode 120000 index 0000000000..437fd2b18a --- /dev/null +++ b/Lang/Prolog/Balanced-brackets @@ -0,0 +1 @@ +../../Task/Balanced-brackets/Prolog \ No newline at end of file diff --git a/Lang/Prolog/Balanced-ternary b/Lang/Prolog/Balanced-ternary new file mode 120000 index 0000000000..e33896a277 --- /dev/null +++ b/Lang/Prolog/Balanced-ternary @@ -0,0 +1 @@ +../../Task/Balanced-ternary/Prolog \ No newline at end of file diff --git a/Lang/Prolog/Best-shuffle b/Lang/Prolog/Best-shuffle new file mode 120000 index 0000000000..c152b7a24d --- /dev/null +++ b/Lang/Prolog/Best-shuffle @@ -0,0 +1 @@ +../../Task/Best-shuffle/Prolog \ No newline at end of file diff --git a/Lang/Prolog/Bulls-and-cows b/Lang/Prolog/Bulls-and-cows new file mode 120000 index 0000000000..2478daeaba --- /dev/null +++ b/Lang/Prolog/Bulls-and-cows @@ -0,0 +1 @@ +../../Task/Bulls-and-cows/Prolog \ No newline at end of file diff --git a/Lang/Prolog/Caesar-cipher b/Lang/Prolog/Caesar-cipher new file mode 120000 index 0000000000..5be6918d34 --- /dev/null +++ b/Lang/Prolog/Caesar-cipher @@ -0,0 +1 @@ +../../Task/Caesar-cipher/Prolog \ No newline at end of file diff --git a/Lang/Prolog/Ordered-words b/Lang/Prolog/Ordered-words new file mode 120000 index 0000000000..a0c63dfffb --- /dev/null +++ b/Lang/Prolog/Ordered-words @@ -0,0 +1 @@ +../../Task/Ordered-words/Prolog \ No newline at end of file diff --git a/Lang/Prolog/Search-a-list b/Lang/Prolog/Search-a-list new file mode 120000 index 0000000000..1626b0b248 --- /dev/null +++ b/Lang/Prolog/Search-a-list @@ -0,0 +1 @@ +../../Task/Search-a-list/Prolog \ No newline at end of file diff --git a/Lang/Python/99-Bottles-of-Beer b/Lang/Python/99-Bottles-of-Beer new file mode 120000 index 0000000000..7f8b6fa2de --- /dev/null +++ b/Lang/Python/99-Bottles-of-Beer @@ -0,0 +1 @@ +../../Task/99-Bottles-of-Beer/Python \ No newline at end of file diff --git a/Lang/Python/Ackermann-function b/Lang/Python/Ackermann-function new file mode 120000 index 0000000000..3365bbd203 --- /dev/null +++ b/Lang/Python/Ackermann-function @@ -0,0 +1 @@ +../../Task/Ackermann-function/Python \ No newline at end of file diff --git a/Lang/Python/Balanced-brackets b/Lang/Python/Balanced-brackets new file mode 120000 index 0000000000..357da7e48a --- /dev/null +++ b/Lang/Python/Balanced-brackets @@ -0,0 +1 @@ +../../Task/Balanced-brackets/Python \ No newline at end of file diff --git a/Lang/Python/Balanced-ternary b/Lang/Python/Balanced-ternary new file mode 120000 index 0000000000..74555a8e74 --- /dev/null +++ b/Lang/Python/Balanced-ternary @@ -0,0 +1 @@ +../../Task/Balanced-ternary/Python \ No newline at end of file diff --git a/Lang/Python/Best-shuffle b/Lang/Python/Best-shuffle new file mode 120000 index 0000000000..d95127ff4e --- /dev/null +++ b/Lang/Python/Best-shuffle @@ -0,0 +1 @@ +../../Task/Best-shuffle/Python \ No newline at end of file diff --git a/Lang/Python/Binary-search b/Lang/Python/Binary-search new file mode 120000 index 0000000000..c17da4e6ae --- /dev/null +++ b/Lang/Python/Binary-search @@ -0,0 +1 @@ +../../Task/Binary-search/Python \ No newline at end of file diff --git a/Lang/Python/Binary-strings b/Lang/Python/Binary-strings new file mode 120000 index 0000000000..a0afbb79e5 --- /dev/null +++ b/Lang/Python/Binary-strings @@ -0,0 +1 @@ +../../Task/Binary-strings/Python \ No newline at end of file diff --git a/Lang/Python/Bulls-and-cows b/Lang/Python/Bulls-and-cows new file mode 120000 index 0000000000..03be4cd1fe --- /dev/null +++ b/Lang/Python/Bulls-and-cows @@ -0,0 +1 @@ +../../Task/Bulls-and-cows/Python \ No newline at end of file diff --git a/Lang/Python/Caesar-cipher b/Lang/Python/Caesar-cipher new file mode 120000 index 0000000000..fde00beff6 --- /dev/null +++ b/Lang/Python/Caesar-cipher @@ -0,0 +1 @@ +../../Task/Caesar-cipher/Python \ No newline at end of file diff --git a/Lang/Python/Check-that-file-exists b/Lang/Python/Check-that-file-exists new file mode 120000 index 0000000000..799c530639 --- /dev/null +++ b/Lang/Python/Check-that-file-exists @@ -0,0 +1 @@ +../../Task/Check-that-file-exists/Python \ No newline at end of file diff --git a/Lang/Python/Closest-pair-problem b/Lang/Python/Closest-pair-problem new file mode 120000 index 0000000000..433db0cec8 --- /dev/null +++ b/Lang/Python/Closest-pair-problem @@ -0,0 +1 @@ +../../Task/Closest-pair-problem/Python \ No newline at end of file diff --git a/Lang/Python/Color-of-a-screen-pixel b/Lang/Python/Color-of-a-screen-pixel new file mode 120000 index 0000000000..d430ee2e89 --- /dev/null +++ b/Lang/Python/Color-of-a-screen-pixel @@ -0,0 +1 @@ +../../Task/Color-of-a-screen-pixel/Python \ No newline at end of file diff --git a/Lang/Python/Death-Star b/Lang/Python/Death-Star new file mode 120000 index 0000000000..b9a8e1a474 --- /dev/null +++ b/Lang/Python/Death-Star @@ -0,0 +1 @@ +../../Task/Death-Star/Python \ No newline at end of file diff --git a/Lang/Python/Define-a-primitive-data-type b/Lang/Python/Define-a-primitive-data-type new file mode 120000 index 0000000000..dcccb4a1f2 --- /dev/null +++ b/Lang/Python/Define-a-primitive-data-type @@ -0,0 +1 @@ +../../Task/Define-a-primitive-data-type/Python \ No newline at end of file diff --git a/Lang/Python/Delete-a-file b/Lang/Python/Delete-a-file new file mode 120000 index 0000000000..f1333b883a --- /dev/null +++ b/Lang/Python/Delete-a-file @@ -0,0 +1 @@ +../../Task/Delete-a-file/Python \ No newline at end of file diff --git a/Lang/Python/Detect-division-by-zero b/Lang/Python/Detect-division-by-zero new file mode 120000 index 0000000000..c3d6a8942f --- /dev/null +++ b/Lang/Python/Detect-division-by-zero @@ -0,0 +1 @@ +../../Task/Detect-division-by-zero/Python \ No newline at end of file diff --git a/Lang/Python/Determine-if-a-string-is-numeric b/Lang/Python/Determine-if-a-string-is-numeric new file mode 120000 index 0000000000..a17b2c88a7 --- /dev/null +++ b/Lang/Python/Determine-if-a-string-is-numeric @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-is-numeric/Python \ No newline at end of file diff --git a/Lang/Python/Forest-fire b/Lang/Python/Forest-fire new file mode 120000 index 0000000000..e16d58a35e --- /dev/null +++ b/Lang/Python/Forest-fire @@ -0,0 +1 @@ +../../Task/Forest-fire/Python \ No newline at end of file diff --git a/Lang/Python/Knuth-shuffle b/Lang/Python/Knuth-shuffle new file mode 120000 index 0000000000..336341c620 --- /dev/null +++ b/Lang/Python/Knuth-shuffle @@ -0,0 +1 @@ +../../Task/Knuth-shuffle/Python \ No newline at end of file diff --git a/Lang/Python/Ordered-words b/Lang/Python/Ordered-words new file mode 120000 index 0000000000..e4dac107c2 --- /dev/null +++ b/Lang/Python/Ordered-words @@ -0,0 +1 @@ +../../Task/Ordered-words/Python \ No newline at end of file diff --git a/Lang/Python/Search-a-list b/Lang/Python/Search-a-list new file mode 120000 index 0000000000..a1aa1df244 --- /dev/null +++ b/Lang/Python/Search-a-list @@ -0,0 +1 @@ +../../Task/Search-a-list/Python \ No newline at end of file diff --git a/Lang/R/99-Bottles-of-Beer b/Lang/R/99-Bottles-of-Beer new file mode 120000 index 0000000000..f0428186e3 --- /dev/null +++ b/Lang/R/99-Bottles-of-Beer @@ -0,0 +1 @@ +../../Task/99-Bottles-of-Beer/R \ No newline at end of file diff --git a/Lang/R/Ackermann-function b/Lang/R/Ackermann-function new file mode 120000 index 0000000000..b5364b4cc1 --- /dev/null +++ b/Lang/R/Ackermann-function @@ -0,0 +1 @@ +../../Task/Ackermann-function/R \ No newline at end of file diff --git a/Lang/R/Balanced-brackets b/Lang/R/Balanced-brackets new file mode 120000 index 0000000000..8e57882fb5 --- /dev/null +++ b/Lang/R/Balanced-brackets @@ -0,0 +1 @@ +../../Task/Balanced-brackets/R \ No newline at end of file diff --git a/Lang/R/Binary-search b/Lang/R/Binary-search new file mode 120000 index 0000000000..de11e4a145 --- /dev/null +++ b/Lang/R/Binary-search @@ -0,0 +1 @@ +../../Task/Binary-search/R \ No newline at end of file diff --git a/Lang/R/Bulls-and-cows b/Lang/R/Bulls-and-cows new file mode 120000 index 0000000000..1b898acf04 --- /dev/null +++ b/Lang/R/Bulls-and-cows @@ -0,0 +1 @@ +../../Task/Bulls-and-cows/R \ No newline at end of file diff --git a/Lang/R/Check-that-file-exists b/Lang/R/Check-that-file-exists new file mode 120000 index 0000000000..9989dd6e62 --- /dev/null +++ b/Lang/R/Check-that-file-exists @@ -0,0 +1 @@ +../../Task/Check-that-file-exists/R \ No newline at end of file diff --git a/Lang/R/Closest-pair-problem b/Lang/R/Closest-pair-problem new file mode 120000 index 0000000000..720f4139b9 --- /dev/null +++ b/Lang/R/Closest-pair-problem @@ -0,0 +1 @@ +../../Task/Closest-pair-problem/R \ No newline at end of file diff --git a/Lang/R/Delete-a-file b/Lang/R/Delete-a-file new file mode 120000 index 0000000000..8fe0039e3f --- /dev/null +++ b/Lang/R/Delete-a-file @@ -0,0 +1 @@ +../../Task/Delete-a-file/R \ No newline at end of file diff --git a/Lang/R/Detect-division-by-zero b/Lang/R/Detect-division-by-zero new file mode 120000 index 0000000000..b6a7171f6d --- /dev/null +++ b/Lang/R/Detect-division-by-zero @@ -0,0 +1 @@ +../../Task/Detect-division-by-zero/R \ No newline at end of file diff --git a/Lang/R/Determine-if-a-string-is-numeric b/Lang/R/Determine-if-a-string-is-numeric new file mode 120000 index 0000000000..f2970fc841 --- /dev/null +++ b/Lang/R/Determine-if-a-string-is-numeric @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-is-numeric/R \ No newline at end of file diff --git a/Lang/R/Knuth-shuffle b/Lang/R/Knuth-shuffle new file mode 120000 index 0000000000..59983274d4 --- /dev/null +++ b/Lang/R/Knuth-shuffle @@ -0,0 +1 @@ +../../Task/Knuth-shuffle/R \ No newline at end of file diff --git a/Lang/R/Search-a-list b/Lang/R/Search-a-list new file mode 120000 index 0000000000..e7522acf77 --- /dev/null +++ b/Lang/R/Search-a-list @@ -0,0 +1 @@ +../../Task/Search-a-list/R \ No newline at end of file diff --git a/Lang/REXX/99-Bottles-of-Beer b/Lang/REXX/99-Bottles-of-Beer new file mode 120000 index 0000000000..e36186c828 --- /dev/null +++ b/Lang/REXX/99-Bottles-of-Beer @@ -0,0 +1 @@ +../../Task/99-Bottles-of-Beer/REXX \ No newline at end of file diff --git a/Lang/REXX/Ackermann-function b/Lang/REXX/Ackermann-function new file mode 120000 index 0000000000..0f40523833 --- /dev/null +++ b/Lang/REXX/Ackermann-function @@ -0,0 +1 @@ +../../Task/Ackermann-function/REXX \ No newline at end of file diff --git a/Lang/REXX/Balanced-brackets b/Lang/REXX/Balanced-brackets new file mode 120000 index 0000000000..2f501e9c2b --- /dev/null +++ b/Lang/REXX/Balanced-brackets @@ -0,0 +1 @@ +../../Task/Balanced-brackets/REXX \ No newline at end of file diff --git a/Lang/REXX/Balanced-ternary b/Lang/REXX/Balanced-ternary new file mode 120000 index 0000000000..409a75ff46 --- /dev/null +++ b/Lang/REXX/Balanced-ternary @@ -0,0 +1 @@ +../../Task/Balanced-ternary/REXX \ No newline at end of file diff --git a/Lang/REXX/Best-shuffle b/Lang/REXX/Best-shuffle new file mode 120000 index 0000000000..cf57be11db --- /dev/null +++ b/Lang/REXX/Best-shuffle @@ -0,0 +1 @@ +../../Task/Best-shuffle/REXX \ No newline at end of file diff --git a/Lang/REXX/Binary-search b/Lang/REXX/Binary-search new file mode 120000 index 0000000000..204bcb4842 --- /dev/null +++ b/Lang/REXX/Binary-search @@ -0,0 +1 @@ +../../Task/Binary-search/REXX \ No newline at end of file diff --git a/Lang/REXX/Binary-strings b/Lang/REXX/Binary-strings new file mode 120000 index 0000000000..b9a3d7fe0c --- /dev/null +++ b/Lang/REXX/Binary-strings @@ -0,0 +1 @@ +../../Task/Binary-strings/REXX \ No newline at end of file diff --git a/Lang/REXX/Bulls-and-cows b/Lang/REXX/Bulls-and-cows new file mode 120000 index 0000000000..a6c3d70b24 --- /dev/null +++ b/Lang/REXX/Bulls-and-cows @@ -0,0 +1 @@ +../../Task/Bulls-and-cows/REXX \ No newline at end of file diff --git a/Lang/REXX/Caesar-cipher b/Lang/REXX/Caesar-cipher new file mode 120000 index 0000000000..1aa5dbf934 --- /dev/null +++ b/Lang/REXX/Caesar-cipher @@ -0,0 +1 @@ +../../Task/Caesar-cipher/REXX \ No newline at end of file diff --git a/Lang/REXX/Closest-pair-problem b/Lang/REXX/Closest-pair-problem new file mode 120000 index 0000000000..f6ef024db7 --- /dev/null +++ b/Lang/REXX/Closest-pair-problem @@ -0,0 +1 @@ +../../Task/Closest-pair-problem/REXX \ No newline at end of file diff --git a/Lang/REXX/Death-Star b/Lang/REXX/Death-Star new file mode 120000 index 0000000000..5e4aac111f --- /dev/null +++ b/Lang/REXX/Death-Star @@ -0,0 +1 @@ +../../Task/Death-Star/REXX \ No newline at end of file diff --git a/Lang/REXX/Detect-division-by-zero b/Lang/REXX/Detect-division-by-zero new file mode 120000 index 0000000000..3acb21ee87 --- /dev/null +++ b/Lang/REXX/Detect-division-by-zero @@ -0,0 +1 @@ +../../Task/Detect-division-by-zero/REXX \ No newline at end of file diff --git a/Lang/REXX/Determine-if-a-string-is-numeric b/Lang/REXX/Determine-if-a-string-is-numeric new file mode 120000 index 0000000000..d6c0d1cf74 --- /dev/null +++ b/Lang/REXX/Determine-if-a-string-is-numeric @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-is-numeric/REXX \ No newline at end of file diff --git a/Lang/REXX/Forest-fire b/Lang/REXX/Forest-fire new file mode 120000 index 0000000000..150ef6a342 --- /dev/null +++ b/Lang/REXX/Forest-fire @@ -0,0 +1 @@ +../../Task/Forest-fire/REXX \ No newline at end of file diff --git a/Lang/REXX/Knuth-shuffle b/Lang/REXX/Knuth-shuffle new file mode 120000 index 0000000000..6d4751dae2 --- /dev/null +++ b/Lang/REXX/Knuth-shuffle @@ -0,0 +1 @@ +../../Task/Knuth-shuffle/REXX \ No newline at end of file diff --git a/Lang/REXX/Ordered-words b/Lang/REXX/Ordered-words new file mode 120000 index 0000000000..f23021e833 --- /dev/null +++ b/Lang/REXX/Ordered-words @@ -0,0 +1 @@ +../../Task/Ordered-words/REXX \ No newline at end of file diff --git a/Lang/REXX/Search-a-list b/Lang/REXX/Search-a-list new file mode 120000 index 0000000000..f7d56b70a6 --- /dev/null +++ b/Lang/REXX/Search-a-list @@ -0,0 +1 @@ +../../Task/Search-a-list/REXX \ No newline at end of file diff --git a/Lang/Racket/99-Bottles-of-Beer b/Lang/Racket/99-Bottles-of-Beer new file mode 120000 index 0000000000..1b0667152e --- /dev/null +++ b/Lang/Racket/99-Bottles-of-Beer @@ -0,0 +1 @@ +../../Task/99-Bottles-of-Beer/Racket \ No newline at end of file diff --git a/Lang/Racket/Ackermann-function b/Lang/Racket/Ackermann-function new file mode 120000 index 0000000000..365936ea75 --- /dev/null +++ b/Lang/Racket/Ackermann-function @@ -0,0 +1 @@ +../../Task/Ackermann-function/Racket \ No newline at end of file diff --git a/Lang/Racket/Balanced-brackets b/Lang/Racket/Balanced-brackets new file mode 120000 index 0000000000..69f15ba7b2 --- /dev/null +++ b/Lang/Racket/Balanced-brackets @@ -0,0 +1 @@ +../../Task/Balanced-brackets/Racket \ No newline at end of file diff --git a/Lang/Racket/Best-shuffle b/Lang/Racket/Best-shuffle new file mode 120000 index 0000000000..ccfe37c509 --- /dev/null +++ b/Lang/Racket/Best-shuffle @@ -0,0 +1 @@ +../../Task/Best-shuffle/Racket \ No newline at end of file diff --git a/Lang/Racket/Binary-search b/Lang/Racket/Binary-search new file mode 120000 index 0000000000..9fe0d06f74 --- /dev/null +++ b/Lang/Racket/Binary-search @@ -0,0 +1 @@ +../../Task/Binary-search/Racket \ No newline at end of file diff --git a/Lang/Racket/Binary-strings b/Lang/Racket/Binary-strings new file mode 120000 index 0000000000..207d0dc509 --- /dev/null +++ b/Lang/Racket/Binary-strings @@ -0,0 +1 @@ +../../Task/Binary-strings/Racket \ No newline at end of file diff --git a/Lang/Racket/Caesar-cipher b/Lang/Racket/Caesar-cipher new file mode 120000 index 0000000000..14c21f6cfd --- /dev/null +++ b/Lang/Racket/Caesar-cipher @@ -0,0 +1 @@ +../../Task/Caesar-cipher/Racket \ No newline at end of file diff --git a/Lang/Racket/Define-a-primitive-data-type b/Lang/Racket/Define-a-primitive-data-type new file mode 120000 index 0000000000..c52ffa2174 --- /dev/null +++ b/Lang/Racket/Define-a-primitive-data-type @@ -0,0 +1 @@ +../../Task/Define-a-primitive-data-type/Racket \ No newline at end of file diff --git a/Lang/Racket/Detect-division-by-zero b/Lang/Racket/Detect-division-by-zero new file mode 120000 index 0000000000..b25682fa3f --- /dev/null +++ b/Lang/Racket/Detect-division-by-zero @@ -0,0 +1 @@ +../../Task/Detect-division-by-zero/Racket \ No newline at end of file diff --git a/Lang/Racket/Determine-if-a-string-is-numeric b/Lang/Racket/Determine-if-a-string-is-numeric new file mode 120000 index 0000000000..d8692cb219 --- /dev/null +++ b/Lang/Racket/Determine-if-a-string-is-numeric @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-is-numeric/Racket \ No newline at end of file diff --git a/Lang/Racket/Forest-fire b/Lang/Racket/Forest-fire new file mode 120000 index 0000000000..0d3e12dbd8 --- /dev/null +++ b/Lang/Racket/Forest-fire @@ -0,0 +1 @@ +../../Task/Forest-fire/Racket \ No newline at end of file diff --git a/Lang/Racket/Search-a-list b/Lang/Racket/Search-a-list new file mode 120000 index 0000000000..ea9a304430 --- /dev/null +++ b/Lang/Racket/Search-a-list @@ -0,0 +1 @@ +../../Task/Search-a-list/Racket \ No newline at end of file diff --git a/Lang/Ruby/99-Bottles-of-Beer b/Lang/Ruby/99-Bottles-of-Beer new file mode 120000 index 0000000000..cfd321ce73 --- /dev/null +++ b/Lang/Ruby/99-Bottles-of-Beer @@ -0,0 +1 @@ +../../Task/99-Bottles-of-Beer/Ruby \ No newline at end of file diff --git a/Lang/Ruby/Ackermann-function b/Lang/Ruby/Ackermann-function new file mode 120000 index 0000000000..d7dd8fc515 --- /dev/null +++ b/Lang/Ruby/Ackermann-function @@ -0,0 +1 @@ +../../Task/Ackermann-function/Ruby \ No newline at end of file diff --git a/Lang/Ruby/Balanced-brackets b/Lang/Ruby/Balanced-brackets new file mode 120000 index 0000000000..5640f0e44c --- /dev/null +++ b/Lang/Ruby/Balanced-brackets @@ -0,0 +1 @@ +../../Task/Balanced-brackets/Ruby \ No newline at end of file diff --git a/Lang/Ruby/Balanced-ternary b/Lang/Ruby/Balanced-ternary new file mode 120000 index 0000000000..66ce95ae3f --- /dev/null +++ b/Lang/Ruby/Balanced-ternary @@ -0,0 +1 @@ +../../Task/Balanced-ternary/Ruby \ No newline at end of file diff --git a/Lang/Ruby/Binary-search b/Lang/Ruby/Binary-search new file mode 120000 index 0000000000..f092465caf --- /dev/null +++ b/Lang/Ruby/Binary-search @@ -0,0 +1 @@ +../../Task/Binary-search/Ruby \ No newline at end of file diff --git a/Lang/Ruby/Binary-strings b/Lang/Ruby/Binary-strings new file mode 120000 index 0000000000..6b76368624 --- /dev/null +++ b/Lang/Ruby/Binary-strings @@ -0,0 +1 @@ +../../Task/Binary-strings/Ruby \ No newline at end of file diff --git a/Lang/Ruby/Bulls-and-cows b/Lang/Ruby/Bulls-and-cows new file mode 120000 index 0000000000..833eda72bb --- /dev/null +++ b/Lang/Ruby/Bulls-and-cows @@ -0,0 +1 @@ +../../Task/Bulls-and-cows/Ruby \ No newline at end of file diff --git a/Lang/Ruby/Caesar-cipher b/Lang/Ruby/Caesar-cipher new file mode 120000 index 0000000000..088f939eda --- /dev/null +++ b/Lang/Ruby/Caesar-cipher @@ -0,0 +1 @@ +../../Task/Caesar-cipher/Ruby \ No newline at end of file diff --git a/Lang/Ruby/Check-that-file-exists b/Lang/Ruby/Check-that-file-exists new file mode 120000 index 0000000000..8db132cd9f --- /dev/null +++ b/Lang/Ruby/Check-that-file-exists @@ -0,0 +1 @@ +../../Task/Check-that-file-exists/Ruby \ No newline at end of file diff --git a/Lang/Ruby/Checkpoint-synchronization b/Lang/Ruby/Checkpoint-synchronization new file mode 120000 index 0000000000..3348dd7595 --- /dev/null +++ b/Lang/Ruby/Checkpoint-synchronization @@ -0,0 +1 @@ +../../Task/Checkpoint-synchronization/Ruby \ No newline at end of file diff --git a/Lang/Ruby/Closest-pair-problem b/Lang/Ruby/Closest-pair-problem new file mode 120000 index 0000000000..563a6a8c94 --- /dev/null +++ b/Lang/Ruby/Closest-pair-problem @@ -0,0 +1 @@ +../../Task/Closest-pair-problem/Ruby \ No newline at end of file diff --git a/Lang/Ruby/Define-a-primitive-data-type b/Lang/Ruby/Define-a-primitive-data-type new file mode 120000 index 0000000000..377d75cc28 --- /dev/null +++ b/Lang/Ruby/Define-a-primitive-data-type @@ -0,0 +1 @@ +../../Task/Define-a-primitive-data-type/Ruby \ No newline at end of file diff --git a/Lang/Ruby/Delete-a-file b/Lang/Ruby/Delete-a-file new file mode 120000 index 0000000000..2c1b3431b2 --- /dev/null +++ b/Lang/Ruby/Delete-a-file @@ -0,0 +1 @@ +../../Task/Delete-a-file/Ruby \ No newline at end of file diff --git a/Lang/Ruby/Detect-division-by-zero b/Lang/Ruby/Detect-division-by-zero new file mode 120000 index 0000000000..2f26b1630a --- /dev/null +++ b/Lang/Ruby/Detect-division-by-zero @@ -0,0 +1 @@ +../../Task/Detect-division-by-zero/Ruby \ No newline at end of file diff --git a/Lang/Ruby/Determine-if-a-string-is-numeric b/Lang/Ruby/Determine-if-a-string-is-numeric new file mode 120000 index 0000000000..13d7181af9 --- /dev/null +++ b/Lang/Ruby/Determine-if-a-string-is-numeric @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-is-numeric/Ruby \ No newline at end of file diff --git a/Lang/Ruby/Forest-fire b/Lang/Ruby/Forest-fire new file mode 120000 index 0000000000..c2c50e4852 --- /dev/null +++ b/Lang/Ruby/Forest-fire @@ -0,0 +1 @@ +../../Task/Forest-fire/Ruby \ No newline at end of file diff --git a/Lang/Ruby/Knuth-shuffle b/Lang/Ruby/Knuth-shuffle new file mode 120000 index 0000000000..c69d9166b4 --- /dev/null +++ b/Lang/Ruby/Knuth-shuffle @@ -0,0 +1 @@ +../../Task/Knuth-shuffle/Ruby \ No newline at end of file diff --git a/Lang/Ruby/Ordered-words b/Lang/Ruby/Ordered-words new file mode 120000 index 0000000000..fe24942790 --- /dev/null +++ b/Lang/Ruby/Ordered-words @@ -0,0 +1 @@ +../../Task/Ordered-words/Ruby \ No newline at end of file diff --git a/Lang/Ruby/Search-a-list b/Lang/Ruby/Search-a-list new file mode 120000 index 0000000000..2dcfac8902 --- /dev/null +++ b/Lang/Ruby/Search-a-list @@ -0,0 +1 @@ +../../Task/Search-a-list/Ruby \ No newline at end of file diff --git a/Lang/SNUSP/99-Bottles-of-Beer b/Lang/SNUSP/99-Bottles-of-Beer new file mode 120000 index 0000000000..6a9767c2f6 --- /dev/null +++ b/Lang/SNUSP/99-Bottles-of-Beer @@ -0,0 +1 @@ +../../Task/99-Bottles-of-Beer/SNUSP \ No newline at end of file diff --git a/Lang/SNUSP/Ackermann-function b/Lang/SNUSP/Ackermann-function new file mode 120000 index 0000000000..bee6a83104 --- /dev/null +++ b/Lang/SNUSP/Ackermann-function @@ -0,0 +1 @@ +../../Task/Ackermann-function/SNUSP \ No newline at end of file diff --git a/Lang/Sather/99-Bottles-of-Beer b/Lang/Sather/99-Bottles-of-Beer new file mode 120000 index 0000000000..01babcc398 --- /dev/null +++ b/Lang/Sather/99-Bottles-of-Beer @@ -0,0 +1 @@ +../../Task/99-Bottles-of-Beer/Sather \ No newline at end of file diff --git a/Lang/Sather/Ackermann-function b/Lang/Sather/Ackermann-function new file mode 120000 index 0000000000..1ea1bbaf96 --- /dev/null +++ b/Lang/Sather/Ackermann-function @@ -0,0 +1 @@ +../../Task/Ackermann-function/Sather \ No newline at end of file diff --git a/Lang/Sather/Forest-fire b/Lang/Sather/Forest-fire new file mode 120000 index 0000000000..256425a853 --- /dev/null +++ b/Lang/Sather/Forest-fire @@ -0,0 +1 @@ +../../Task/Forest-fire/Sather \ No newline at end of file diff --git a/Lang/Sather/Search-a-list b/Lang/Sather/Search-a-list new file mode 120000 index 0000000000..ea42f8aff0 --- /dev/null +++ b/Lang/Sather/Search-a-list @@ -0,0 +1 @@ +../../Task/Search-a-list/Sather \ No newline at end of file diff --git a/Lang/Scala/Ackermann-function b/Lang/Scala/Ackermann-function new file mode 120000 index 0000000000..d9b7206424 --- /dev/null +++ b/Lang/Scala/Ackermann-function @@ -0,0 +1 @@ +../../Task/Ackermann-function/Scala \ No newline at end of file diff --git a/Lang/Scala/Balanced-brackets b/Lang/Scala/Balanced-brackets new file mode 120000 index 0000000000..d30ace6336 --- /dev/null +++ b/Lang/Scala/Balanced-brackets @@ -0,0 +1 @@ +../../Task/Balanced-brackets/Scala \ No newline at end of file diff --git a/Lang/Scala/Binary-search b/Lang/Scala/Binary-search new file mode 120000 index 0000000000..eedb94f3a8 --- /dev/null +++ b/Lang/Scala/Binary-search @@ -0,0 +1 @@ +../../Task/Binary-search/Scala \ No newline at end of file diff --git a/Lang/Scala/Bulls-and-cows b/Lang/Scala/Bulls-and-cows new file mode 120000 index 0000000000..2d8c24e15d --- /dev/null +++ b/Lang/Scala/Bulls-and-cows @@ -0,0 +1 @@ +../../Task/Bulls-and-cows/Scala \ No newline at end of file diff --git a/Lang/Scala/Caesar-cipher b/Lang/Scala/Caesar-cipher new file mode 120000 index 0000000000..f05dea6d72 --- /dev/null +++ b/Lang/Scala/Caesar-cipher @@ -0,0 +1 @@ +../../Task/Caesar-cipher/Scala \ No newline at end of file diff --git a/Lang/Scala/Closest-pair-problem b/Lang/Scala/Closest-pair-problem new file mode 120000 index 0000000000..d939d55466 --- /dev/null +++ b/Lang/Scala/Closest-pair-problem @@ -0,0 +1 @@ +../../Task/Closest-pair-problem/Scala \ No newline at end of file diff --git a/Lang/Scala/Detect-division-by-zero b/Lang/Scala/Detect-division-by-zero new file mode 120000 index 0000000000..3ef8c0ad8c --- /dev/null +++ b/Lang/Scala/Detect-division-by-zero @@ -0,0 +1 @@ +../../Task/Detect-division-by-zero/Scala \ No newline at end of file diff --git a/Lang/Scala/Determine-if-a-string-is-numeric b/Lang/Scala/Determine-if-a-string-is-numeric new file mode 120000 index 0000000000..fd40f1f583 --- /dev/null +++ b/Lang/Scala/Determine-if-a-string-is-numeric @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-is-numeric/Scala \ No newline at end of file diff --git a/Lang/Scala/Forest-fire b/Lang/Scala/Forest-fire new file mode 120000 index 0000000000..3cc7a5a8b8 --- /dev/null +++ b/Lang/Scala/Forest-fire @@ -0,0 +1 @@ +../../Task/Forest-fire/Scala \ No newline at end of file diff --git a/Lang/Scala/Knuth-shuffle b/Lang/Scala/Knuth-shuffle new file mode 120000 index 0000000000..ce6bac3966 --- /dev/null +++ b/Lang/Scala/Knuth-shuffle @@ -0,0 +1 @@ +../../Task/Knuth-shuffle/Scala \ No newline at end of file diff --git a/Lang/Scala/Search-a-list b/Lang/Scala/Search-a-list new file mode 120000 index 0000000000..ac45fe25b4 --- /dev/null +++ b/Lang/Scala/Search-a-list @@ -0,0 +1 @@ +../../Task/Search-a-list/Scala \ No newline at end of file diff --git a/Lang/Scheme/99-Bottles-of-Beer b/Lang/Scheme/99-Bottles-of-Beer new file mode 120000 index 0000000000..49516c5924 --- /dev/null +++ b/Lang/Scheme/99-Bottles-of-Beer @@ -0,0 +1 @@ +../../Task/99-Bottles-of-Beer/Scheme \ No newline at end of file diff --git a/Lang/Scheme/Ackermann-function b/Lang/Scheme/Ackermann-function new file mode 120000 index 0000000000..9dfdb6533b --- /dev/null +++ b/Lang/Scheme/Ackermann-function @@ -0,0 +1 @@ +../../Task/Ackermann-function/Scheme \ No newline at end of file diff --git a/Lang/Scheme/Balanced-brackets b/Lang/Scheme/Balanced-brackets new file mode 120000 index 0000000000..727414d1af --- /dev/null +++ b/Lang/Scheme/Balanced-brackets @@ -0,0 +1 @@ +../../Task/Balanced-brackets/Scheme \ No newline at end of file diff --git a/Lang/Scheme/Best-shuffle b/Lang/Scheme/Best-shuffle new file mode 120000 index 0000000000..c608a8a8d5 --- /dev/null +++ b/Lang/Scheme/Best-shuffle @@ -0,0 +1 @@ +../../Task/Best-shuffle/Scheme \ No newline at end of file diff --git a/Lang/Scheme/Binary-search b/Lang/Scheme/Binary-search new file mode 120000 index 0000000000..7e60fae264 --- /dev/null +++ b/Lang/Scheme/Binary-search @@ -0,0 +1 @@ +../../Task/Binary-search/Scheme \ No newline at end of file diff --git a/Lang/Scheme/Bulls-and-cows b/Lang/Scheme/Bulls-and-cows new file mode 120000 index 0000000000..2de7817550 --- /dev/null +++ b/Lang/Scheme/Bulls-and-cows @@ -0,0 +1 @@ +../../Task/Bulls-and-cows/Scheme \ No newline at end of file diff --git a/Lang/Scheme/Check-that-file-exists b/Lang/Scheme/Check-that-file-exists new file mode 120000 index 0000000000..48070c3092 --- /dev/null +++ b/Lang/Scheme/Check-that-file-exists @@ -0,0 +1 @@ +../../Task/Check-that-file-exists/Scheme \ No newline at end of file diff --git a/Lang/Scheme/Delete-a-file b/Lang/Scheme/Delete-a-file new file mode 120000 index 0000000000..3d670701ac --- /dev/null +++ b/Lang/Scheme/Delete-a-file @@ -0,0 +1 @@ +../../Task/Delete-a-file/Scheme \ No newline at end of file diff --git a/Lang/Scheme/Determine-if-a-string-is-numeric b/Lang/Scheme/Determine-if-a-string-is-numeric new file mode 120000 index 0000000000..583cd373b9 --- /dev/null +++ b/Lang/Scheme/Determine-if-a-string-is-numeric @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-is-numeric/Scheme \ No newline at end of file diff --git a/Lang/Scheme/Knuth-shuffle b/Lang/Scheme/Knuth-shuffle new file mode 120000 index 0000000000..2d3ae18806 --- /dev/null +++ b/Lang/Scheme/Knuth-shuffle @@ -0,0 +1 @@ +../../Task/Knuth-shuffle/Scheme \ No newline at end of file diff --git a/Lang/Scheme/Ordered-words b/Lang/Scheme/Ordered-words new file mode 120000 index 0000000000..aaaa658980 --- /dev/null +++ b/Lang/Scheme/Ordered-words @@ -0,0 +1 @@ +../../Task/Ordered-words/Scheme \ No newline at end of file diff --git a/Lang/Scheme/Search-a-list b/Lang/Scheme/Search-a-list new file mode 120000 index 0000000000..b67d990b84 --- /dev/null +++ b/Lang/Scheme/Search-a-list @@ -0,0 +1 @@ +../../Task/Search-a-list/Scheme \ No newline at end of file diff --git a/Lang/Smalltalk/99-Bottles-of-Beer b/Lang/Smalltalk/99-Bottles-of-Beer new file mode 120000 index 0000000000..86617ad30a --- /dev/null +++ b/Lang/Smalltalk/99-Bottles-of-Beer @@ -0,0 +1 @@ +../../Task/99-Bottles-of-Beer/Smalltalk \ No newline at end of file diff --git a/Lang/Smalltalk/Ackermann-function b/Lang/Smalltalk/Ackermann-function new file mode 120000 index 0000000000..c75b75298c --- /dev/null +++ b/Lang/Smalltalk/Ackermann-function @@ -0,0 +1 @@ +../../Task/Ackermann-function/Smalltalk \ No newline at end of file diff --git a/Lang/Smalltalk/Bulls-and-cows b/Lang/Smalltalk/Bulls-and-cows new file mode 120000 index 0000000000..cc826b88f4 --- /dev/null +++ b/Lang/Smalltalk/Bulls-and-cows @@ -0,0 +1 @@ +../../Task/Bulls-and-cows/Smalltalk \ No newline at end of file diff --git a/Lang/Smalltalk/Caesar-cipher b/Lang/Smalltalk/Caesar-cipher new file mode 120000 index 0000000000..7c4453d191 --- /dev/null +++ b/Lang/Smalltalk/Caesar-cipher @@ -0,0 +1 @@ +../../Task/Caesar-cipher/Smalltalk \ No newline at end of file diff --git a/Lang/Smalltalk/Check-that-file-exists b/Lang/Smalltalk/Check-that-file-exists new file mode 120000 index 0000000000..3010eb3b18 --- /dev/null +++ b/Lang/Smalltalk/Check-that-file-exists @@ -0,0 +1 @@ +../../Task/Check-that-file-exists/Smalltalk \ No newline at end of file diff --git a/Lang/Smalltalk/Delete-a-file b/Lang/Smalltalk/Delete-a-file new file mode 120000 index 0000000000..50bc9c8891 --- /dev/null +++ b/Lang/Smalltalk/Delete-a-file @@ -0,0 +1 @@ +../../Task/Delete-a-file/Smalltalk \ No newline at end of file diff --git a/Lang/Smalltalk/Detect-division-by-zero b/Lang/Smalltalk/Detect-division-by-zero new file mode 120000 index 0000000000..5db617230f --- /dev/null +++ b/Lang/Smalltalk/Detect-division-by-zero @@ -0,0 +1 @@ +../../Task/Detect-division-by-zero/Smalltalk \ No newline at end of file diff --git a/Lang/Smalltalk/Determine-if-a-string-is-numeric b/Lang/Smalltalk/Determine-if-a-string-is-numeric new file mode 120000 index 0000000000..fb0d31979a --- /dev/null +++ b/Lang/Smalltalk/Determine-if-a-string-is-numeric @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-is-numeric/Smalltalk \ No newline at end of file diff --git a/Lang/Smalltalk/Knuth-shuffle b/Lang/Smalltalk/Knuth-shuffle new file mode 120000 index 0000000000..94dd56d5b0 --- /dev/null +++ b/Lang/Smalltalk/Knuth-shuffle @@ -0,0 +1 @@ +../../Task/Knuth-shuffle/Smalltalk \ No newline at end of file diff --git a/Lang/Smalltalk/Ordered-words b/Lang/Smalltalk/Ordered-words new file mode 120000 index 0000000000..85a8b2eab8 --- /dev/null +++ b/Lang/Smalltalk/Ordered-words @@ -0,0 +1 @@ +../../Task/Ordered-words/Smalltalk \ No newline at end of file diff --git a/Lang/Smalltalk/Search-a-list b/Lang/Smalltalk/Search-a-list new file mode 120000 index 0000000000..f4567508e5 --- /dev/null +++ b/Lang/Smalltalk/Search-a-list @@ -0,0 +1 @@ +../../Task/Search-a-list/Smalltalk \ No newline at end of file diff --git a/Lang/Tcl/99-Bottles-of-Beer b/Lang/Tcl/99-Bottles-of-Beer new file mode 120000 index 0000000000..e5219c564e --- /dev/null +++ b/Lang/Tcl/99-Bottles-of-Beer @@ -0,0 +1 @@ +../../Task/99-Bottles-of-Beer/Tcl \ No newline at end of file diff --git a/Lang/Tcl/Ackermann-function b/Lang/Tcl/Ackermann-function new file mode 120000 index 0000000000..b50506a0be --- /dev/null +++ b/Lang/Tcl/Ackermann-function @@ -0,0 +1 @@ +../../Task/Ackermann-function/Tcl \ No newline at end of file diff --git a/Lang/Tcl/Balanced-brackets b/Lang/Tcl/Balanced-brackets new file mode 120000 index 0000000000..f46e1cff4b --- /dev/null +++ b/Lang/Tcl/Balanced-brackets @@ -0,0 +1 @@ +../../Task/Balanced-brackets/Tcl \ No newline at end of file diff --git a/Lang/Tcl/Balanced-ternary b/Lang/Tcl/Balanced-ternary new file mode 120000 index 0000000000..d5ae245c99 --- /dev/null +++ b/Lang/Tcl/Balanced-ternary @@ -0,0 +1 @@ +../../Task/Balanced-ternary/Tcl \ No newline at end of file diff --git a/Lang/Tcl/Best-shuffle b/Lang/Tcl/Best-shuffle new file mode 120000 index 0000000000..1522b2b3c7 --- /dev/null +++ b/Lang/Tcl/Best-shuffle @@ -0,0 +1 @@ +../../Task/Best-shuffle/Tcl \ No newline at end of file diff --git a/Lang/Tcl/Binary-search b/Lang/Tcl/Binary-search new file mode 120000 index 0000000000..92f81cd15e --- /dev/null +++ b/Lang/Tcl/Binary-search @@ -0,0 +1 @@ +../../Task/Binary-search/Tcl \ No newline at end of file diff --git a/Lang/Tcl/Binary-strings b/Lang/Tcl/Binary-strings new file mode 120000 index 0000000000..ace408a289 --- /dev/null +++ b/Lang/Tcl/Binary-strings @@ -0,0 +1 @@ +../../Task/Binary-strings/Tcl \ No newline at end of file diff --git a/Lang/Tcl/Bulls-and-cows b/Lang/Tcl/Bulls-and-cows new file mode 120000 index 0000000000..ce7383c36b --- /dev/null +++ b/Lang/Tcl/Bulls-and-cows @@ -0,0 +1 @@ +../../Task/Bulls-and-cows/Tcl \ No newline at end of file diff --git a/Lang/Tcl/Caesar-cipher b/Lang/Tcl/Caesar-cipher new file mode 120000 index 0000000000..106b7c390b --- /dev/null +++ b/Lang/Tcl/Caesar-cipher @@ -0,0 +1 @@ +../../Task/Caesar-cipher/Tcl \ No newline at end of file diff --git a/Lang/Tcl/Check-that-file-exists b/Lang/Tcl/Check-that-file-exists new file mode 120000 index 0000000000..d4b559c078 --- /dev/null +++ b/Lang/Tcl/Check-that-file-exists @@ -0,0 +1 @@ +../../Task/Check-that-file-exists/Tcl \ No newline at end of file diff --git a/Lang/Tcl/Checkpoint-synchronization b/Lang/Tcl/Checkpoint-synchronization new file mode 120000 index 0000000000..7a7ccdc7c3 --- /dev/null +++ b/Lang/Tcl/Checkpoint-synchronization @@ -0,0 +1 @@ +../../Task/Checkpoint-synchronization/Tcl \ No newline at end of file diff --git a/Lang/Tcl/Closest-pair-problem b/Lang/Tcl/Closest-pair-problem new file mode 120000 index 0000000000..a771a8925e --- /dev/null +++ b/Lang/Tcl/Closest-pair-problem @@ -0,0 +1 @@ +../../Task/Closest-pair-problem/Tcl \ No newline at end of file diff --git a/Lang/Tcl/Color-of-a-screen-pixel b/Lang/Tcl/Color-of-a-screen-pixel new file mode 120000 index 0000000000..a896790fe9 --- /dev/null +++ b/Lang/Tcl/Color-of-a-screen-pixel @@ -0,0 +1 @@ +../../Task/Color-of-a-screen-pixel/Tcl \ No newline at end of file diff --git a/Lang/Tcl/Death-Star b/Lang/Tcl/Death-Star new file mode 120000 index 0000000000..d848e80646 --- /dev/null +++ b/Lang/Tcl/Death-Star @@ -0,0 +1 @@ +../../Task/Death-Star/Tcl \ No newline at end of file diff --git a/Lang/Tcl/Define-a-primitive-data-type b/Lang/Tcl/Define-a-primitive-data-type new file mode 120000 index 0000000000..6bf999e9b0 --- /dev/null +++ b/Lang/Tcl/Define-a-primitive-data-type @@ -0,0 +1 @@ +../../Task/Define-a-primitive-data-type/Tcl \ No newline at end of file diff --git a/Lang/Tcl/Delete-a-file b/Lang/Tcl/Delete-a-file new file mode 120000 index 0000000000..0b2fe90bd9 --- /dev/null +++ b/Lang/Tcl/Delete-a-file @@ -0,0 +1 @@ +../../Task/Delete-a-file/Tcl \ No newline at end of file diff --git a/Lang/Tcl/Detect-division-by-zero b/Lang/Tcl/Detect-division-by-zero new file mode 120000 index 0000000000..b48fe86fb1 --- /dev/null +++ b/Lang/Tcl/Detect-division-by-zero @@ -0,0 +1 @@ +../../Task/Detect-division-by-zero/Tcl \ No newline at end of file diff --git a/Lang/Tcl/Determine-if-a-string-is-numeric b/Lang/Tcl/Determine-if-a-string-is-numeric new file mode 120000 index 0000000000..2960e1c678 --- /dev/null +++ b/Lang/Tcl/Determine-if-a-string-is-numeric @@ -0,0 +1 @@ +../../Task/Determine-if-a-string-is-numeric/Tcl \ No newline at end of file diff --git a/Lang/Tcl/Forest-fire b/Lang/Tcl/Forest-fire new file mode 120000 index 0000000000..e615880c66 --- /dev/null +++ b/Lang/Tcl/Forest-fire @@ -0,0 +1 @@ +../../Task/Forest-fire/Tcl \ No newline at end of file diff --git a/Lang/Tcl/Knuth-shuffle b/Lang/Tcl/Knuth-shuffle new file mode 120000 index 0000000000..0f0ff59a07 --- /dev/null +++ b/Lang/Tcl/Knuth-shuffle @@ -0,0 +1 @@ +../../Task/Knuth-shuffle/Tcl \ No newline at end of file diff --git a/Lang/Tcl/Ordered-words b/Lang/Tcl/Ordered-words new file mode 120000 index 0000000000..51d723d0b6 --- /dev/null +++ b/Lang/Tcl/Ordered-words @@ -0,0 +1 @@ +../../Task/Ordered-words/Tcl \ No newline at end of file diff --git a/Lang/Tcl/Search-a-list b/Lang/Tcl/Search-a-list new file mode 120000 index 0000000000..2f5a8ffc06 --- /dev/null +++ b/Lang/Tcl/Search-a-list @@ -0,0 +1 @@ +../../Task/Search-a-list/Tcl \ No newline at end of file diff --git a/Meta/00Langs.yaml b/Meta/00Langs.yaml new file mode 100644 index 0000000000..5c7ab13e58 --- /dev/null +++ b/Meta/00Langs.yaml @@ -0,0 +1,221 @@ +--- +'0815': + ext: '0815' + name: '0815' + path: '0815' + url: '0815' +360 Assembly: + ext: '360' + name: 360 Assembly + path: 360-Assembly + url: 360_Assembly +4D: + ext: 4d + name: 4D + path: 4D + url: 4D +A+: + ext: a+ + name: A+ + path: A+ + url: A+ +ABAP: + ext: abap + name: ABAP + path: ABAP + url: ABAP +ACL2: + ext: acl2 + name: ACL2 + path: ACL2 + url: ACL2 +AWK: + ext: awk + name: AWK + path: AWK + url: AWK +ActionScript: + ext: as + name: ActionScript + path: ActionScript + url: ActionScript +Ada: + ext: ada + name: Ada + path: Ada + url: Ada +B: + ext: b + name: B + path: B + url: B +BASIC: + ext: bas + name: BASIC + path: BASIC + url: BASIC +Babel: + ext: pb + name: Babel + path: Babel + url: Babel +Befunge: + ext: bf + name: Befunge + path: Befunge + url: Befunge +C: + ext: c + name: C + path: C + url: C +Clojure: + ext: clj + name: Clojure + path: Clojure + url: Clojure +CoffeeScript: + ext: coffee + name: CoffeeScript + path: CoffeeScript + url: CoffeeScript +Dylan: + ext: dylan + name: Dylan + path: Dylan + url: Dylan +Eiffel: + ext: e + name: Eiffel + path: Eiffel + url: Eiffel +Erlang: + ext: erl + name: Erlang + path: Erlang + url: Erlang +Forth: + ext: fth + name: Forth + path: Forth + url: Forth +Fortran: + ext: f + name: Fortran + path: Fortran + url: Fortran +Go: + ext: go + name: Go + path: Go + url: Go +Haskell: + ext: hs + name: Haskell + path: Haskell + url: Haskell +Java: + ext: java + name: Java + path: Java + url: Java +JavaScript: + ext: js + name: JavaScript + path: JavaScript + url: JavaScript +LaTeX: + ext: tex + name: LaTeX + path: LaTeX + url: LaTeX +Lua: + ext: lua + name: Lua + path: Lua + url: Lua +PHP: + ext: php + name: PHP + path: PHP + url: PHP +PIR: + ext: pir + name: PIR + path: PIR + url: PIR +Perl: + ext: pl + name: Perl + path: Perl + url: Perl +PicoLisp: + ext: l + name: PicoLisp + path: PicoLisp + url: PicoLisp +Prolog: + ext: pro + name: Prolog + path: Prolog + url: Prolog +Python: + ext: py + name: Python + path: Python + url: Python +R: + ext: r + name: R + path: R + url: R +REXX: + ext: rexx + name: REXX + path: REXX + url: REXX +Racket: + ext: rkt + name: Racket + path: Racket + url: Racket +Ruby: + ext: rb + name: Ruby + path: Ruby + url: Ruby +SNUSP: + ext: snusp + name: SNUSP + path: SNUSP + url: SNUSP +Sather: + ext: sa + name: Sather + path: Sather + url: Sather +Scala: + ext: scala + name: Scala + path: Scala + url: Scala +Scheme: + ext: ss + name: Scheme + path: Scheme + url: Scheme +Smalltalk: + ext: st + name: Smalltalk + path: Smalltalk + url: Smalltalk +Tcl: + ext: tcl + name: Tcl + path: Tcl + url: Tcl +Turing: + ext: turing + name: Turing + path: Turing + url: Turing diff --git a/Meta/00Tasks.yaml b/Meta/00Tasks.yaml new file mode 100644 index 0000000000..8770be8cab --- /dev/null +++ b/Meta/00Tasks.yaml @@ -0,0 +1,153 @@ +--- +99 Bottles of Beer: + name: 99 Bottles of Beer + path: 99-Bottles-of-Beer + url: 99_Bottles_of_Beer +Ackermann function: + name: Ackermann function + path: Ackermann-function + url: Ackermann_function +Anagrams: + name: Anagrams + path: Anagrams + url: Anagrams +Arrays: + name: Arrays + path: Arrays + url: Arrays +Assertions: + name: Assertions + path: Assertions + url: Assertions +Balanced brackets: + name: Balanced brackets + path: Balanced-brackets + url: Balanced_brackets +Balanced ternary: + name: Balanced ternary + path: Balanced-ternary + url: Balanced_ternary +Best shuffle: + name: Best shuffle + path: Best-shuffle + url: Best_shuffle +Binary search: + name: Binary search + path: Binary-search + url: Binary_search +Binary strings: + name: Binary strings + path: Binary-strings + url: Binary_strings +Bulls and cows: + name: Bulls and cows + path: Bulls-and-cows + url: Bulls_and_cows +Caesar cipher: + name: Caesar cipher + path: Caesar-cipher + url: Caesar_cipher +Calendar: + name: Calendar + path: Calendar + url: Calendar +Check that file exists: + name: Check that file exists + path: Check-that-file-exists + url: Check_that_file_exists +Checkpoint synchronization: + name: Checkpoint synchronization + path: Checkpoint-synchronization + url: Checkpoint_synchronization +Classes: + name: Classes + path: Classes + url: Classes +Closest-pair problem: + name: Closest-pair problem + path: Closest-pair-problem + url: Closest-pair_problem +Collections: + name: Collections + path: Collections + url: Collections +Color of a screen pixel: + name: Color of a screen pixel + path: Color-of-a-screen-pixel + url: Color_of_a_screen_pixel +Comments: + name: Comments + path: Comments + url: Comments +Death Star: + name: Death Star + path: Death-Star + url: Death_Star +Define a primitive data type: + name: Define a primitive data type + path: Define-a-primitive-data-type + url: Define_a_primitive_data_type +Delegates: + name: Delegates + path: Delegates + url: Delegates +Delete a file: + name: Delete a file + path: Delete-a-file + url: Delete_a_file +Detect division by zero: + name: Detect division by zero + path: Detect-division-by-zero + url: Detect_division_by_zero +Determine if a string is numeric: + name: Determine if a string is numeric + path: Determine-if-a-string-is-numeric + url: Determine_if_a_string_is_numeric +Entropy: + name: Entropy + path: Entropy + url: Entropy +FizzBuzz: + name: FizzBuzz + path: FizzBuzz + url: FizzBuzz +Forest fire: + name: Forest fire + path: Forest-fire + url: Forest_fire +Go Fish: + name: Go Fish + path: Go-Fish + url: Go_Fish +'Infinity': + name: 'Infinity' + path: 'Infinity' + url: 'Infinity' +JSON: + name: JSON + path: JSON + url: JSON +Knuth shuffle: + name: Knuth shuffle + path: Knuth-shuffle + url: Knuth_shuffle +Narcissist: + name: Narcissist + path: Narcissist + url: Narcissist +Ordered words: + name: Ordered words + path: Ordered-words + url: Ordered_words +Pi: + name: Pi + path: Pi + url: Pi +Quine: + name: Quine + path: Quine + url: Quine +Search a list: + name: Search a list + path: Search-a-list + url: Search_a_list diff --git a/Task/99-Bottles-of-Beer/0815/99-bottles-of-beer.0815 b/Task/99-Bottles-of-Beer/0815/99-bottles-of-beer.0815 new file mode 100644 index 0000000000..350b8fdf26 --- /dev/null +++ b/Task/99-Bottles-of-Beer/0815/99-bottles-of-beer.0815 @@ -0,0 +1,25 @@ +<:63:x<:20:=<:62:>=>=><:6F:x<:74:=<:6C:>=>>=><:65:x<:73:=<:20:>=>=><:6F:x<:66:=<:20:>=>=> +<:62:x<:65:=<:72:>=>>=><:20:x<:6F:=<:6E:>=>=><:20:x<:74:=<:68:>=>=><:65:x<:20:=<:77:>=>=> +<:61:x<:6C:=>=>><:54:x<:61:=<:6B:>=>=><:65:x<:20:=<:6F:>=>=><:6E:x<:65:=<:20:>=>=><:64:x +<:6F:=<:77:>=>=><:6E:x<:20:=<:61:>=>=><:6E:x<:64:=<:20:>=>=><:70:x<:61:=<:73:>=>=>><:20:x +<:69:=<:74:>=>=><:20:x<:61:=<:72:>=>=><:6F:x<:75:=<:6E:>=>=><:64:~>}:_start:{~%><:1c:~ +}:_99:~{~$>=<:01:x-^:_99:<:0D:~$@:20:{~%><:10:~}:_98:~{~$>=<:01:x-^:_98:<:0D:~$@:c:<:20:~ +}:_97:~{~$>=<:01:x-^:_97:<:0D:~${x<:01:x->&==<:01:-#:_322:{~%><:1c:~}:_96:~{~$>=<:01:x- +^:_96:<:d:~$$@:20:{~>&^:_start:}:_90:?<:4E:x<:6F:=<:20:>=>=><:6D:x<:6F:=<:72:>=>=><:65:x +<:20:=<:62:>=>=><:6F:x<:74:=<:6C:>=>>=><:65:x<:73:=<:20:>=>=><:6F:x<:66:=<:20:>=>=><:62:x +<:65:=<:72:>=>>=><:20:x<:6F:=<:6E:>=>=><:20:x<:74:=<:68:>=>=><:65:x<:20:=<:77:>=>=><:61:x +<:6C:=>=>><:02:~}:_70:><:23:~}:_80:~{~$>=<:01:x-^:_80:{~<:01:=-#:_60:<:0D:~$$=^:_70:}:_60: +<:0D:~$<:17:~}:_81:~{~$=<:01:x-^:_81:<:0D:~$?<:47:x<:6F:=<:20:>=>=><:74:x<:6F:=<:20:>=>=> +<:74:x<:68:=<:65:>=>=><:20:x<:73:=<:74:>=>=><:6F:x<:72:=<:65:>=>=><:20:x<:61:=<:6E:>=>=> +<:64:x<:20:=<:62:>=>=><:75:x<:79:=<:20:>=>=><:73:x<:6F:=<:6D:>=>=><:65:x<:20:=<:6D:>=>=> +<:6F:x<:72:=<:65:>=>=><:21:~}:_18:~{~$=<:01:x-^:_18:<:0D:~$<:63:x<:20:=<:62:>=>=><:6F:x +<:74:=<:6C:>=>>=><:65:x<:73:=<:20:>=>=><:6F:x<:66:=<:20:>=>=><:62:x<:65:=<:72:>=>>=><:20: +x<:6F:=<:6E:>=>=><:20:x<:74:=<:68:>=>=><:65:x<:20:=<:77:>=>=><:61:x<:6C:=>=>>{~%<:1c:~ +}:_21:~{~$=<:01:x-^:_21:<:0D:~$^:end:}:_322:?<:01:x<:20:=<:62:>=>=><:6F:x<:74:=<:6C:>=>>= +><:65:x<:20:=<:6F:>=>=><:66:x<:20:=>=><:62:x<:65:=<:72:>=>>=><:20:x<:6F:=<:6E:>=>=><:20:x +<:74:=<:68:>=>=><:65:x<:20:=<:77:>=>=><:61:x<:6C:=>=>><:54:x<:61:=<:6B:>=>=><:65:x<:20:= +<:6F:>=>=><:6E:x<:65:=<:20:>=>=><:64:x<:6F:=<:77:>=>=><:6E:x<:20:=<:61:>=>=><:6E:x<:64:= +<:20:>=>=><:70:x<:61:=<:73:>=>=>><:20:x<:69:=<:74:>=>=><:20:x<:61:=<:72:>=>=><:6F:x<:75:= +<:6E:>=>=><:64:~>{~%><:1b:~}:_299:~{~$>=<:01:x-^:_299:<:0D:~$$@:20:{~%><:1b:~}:_298:~{~$> +=<:01:x-^:_298:<:0D:~$@:20:{~%<:f:~}:_297:~{~$>=<:01:x-^:_297:<:0D:~$@:c:<:20:~}:_296:~{~ +$>=<:01:x-^:_296:<:0D:~${x<:01:x->&==<:01:-^:_90: diff --git a/Task/99-Bottles-of-Beer/0DESCRIPTION b/Task/99-Bottles-of-Beer/0DESCRIPTION new file mode 100644 index 0000000000..a30be4d290 --- /dev/null +++ b/Task/99-Bottles-of-Beer/0DESCRIPTION @@ -0,0 +1,13 @@ +In this puzzle, write code to print out the entire "99 bottles of beer on the wall" song. For those who do not know the song, the lyrics follow this form: + X bottles of beer on the wall + X bottles of beer + Take one down, pass it around + X-1 bottles of beer on the wall + + X-1 bottles of beer on the wall + ... + Take one down, pass it around + 0 bottles of beer on the wall +Where X and X-1 are replaced by numbers of course. Grammatical support for "1 bottle of beer" is optional. As with any puzzle, try to do it in as creative/concise/comical a way as possible (simple, obvious solutions allowed, too). + +See also: http://99-bottles-of-beer.net/ diff --git a/Task/99-Bottles-of-Beer/ABAP/99-bottles-of-beer.abap b/Task/99-Bottles-of-Beer/ABAP/99-bottles-of-beer.abap new file mode 100644 index 0000000000..499ae3e2b0 --- /dev/null +++ b/Task/99-Bottles-of-Beer/ABAP/99-bottles-of-beer.abap @@ -0,0 +1,18 @@ +REPORT z99bottles. + +DATA lv_no_bottles(2) TYPE n VALUE 99. + +DO lv_no_bottles TIMES. + WRITE lv_no_bottles NO-ZERO. + WRITE ' bottles of beer on the wall'. + NEW-LINE. + WRITE lv_no_bottles NO-ZERO. + WRITE ' bottles of beer'. + NEW-LINE. + WRITE 'Take one down, pass it around'. + NEW-LINE. + SUBTRACT 1 FROM lv_no_bottles. + WRITE lv_no_bottles NO-ZERO. + WRITE ' bottles of beer on the wall'. + WRITE /. +ENDDO. diff --git a/Task/99-Bottles-of-Beer/ACL2/99-bottles-of-beer.acl2 b/Task/99-Bottles-of-Beer/ACL2/99-bottles-of-beer.acl2 new file mode 100644 index 0000000000..f5630f373d --- /dev/null +++ b/Task/99-Bottles-of-Beer/ACL2/99-bottles-of-beer.acl2 @@ -0,0 +1,14 @@ +(defun bottles-of-beer (n) + (if (zp n) + nil + (prog2$ (cw (concatenate 'string + "~%" + "~N0 bottle~#1~[~/s~] of beer on the wall,~%" + "~n0 bottle~#1~[~/s~] of beer.~%" + "Take one down, pass it around,~%" + "~n2 bottle~#3~[~/s~] of beer on the wall.~%") + n + (if (= n 1) 0 1) + (1- n) + (if (= n 2) 0 1)) + (bottles-of-beer (- n 1))))) diff --git a/Task/99-Bottles-of-Beer/AWK/99-bottles-of-beer.awk b/Task/99-Bottles-of-Beer/AWK/99-bottles-of-beer.awk new file mode 100644 index 0000000000..07b781bb05 --- /dev/null +++ b/Task/99-Bottles-of-Beer/AWK/99-bottles-of-beer.awk @@ -0,0 +1,7 @@ +{ i = 99 +while (i > 0) + {print i, " bottles of beer on the wall," + print i, " bottles of beer." + print "Take one down, pass it around," + i-- + print i, " bottles of beer on the wall\n"}} diff --git a/Task/99-Bottles-of-Beer/ActionScript/99-bottles-of-beer.as b/Task/99-Bottles-of-Beer/ActionScript/99-bottles-of-beer.as new file mode 100644 index 0000000000..38c9afc0f0 --- /dev/null +++ b/Task/99-Bottles-of-Beer/ActionScript/99-bottles-of-beer.as @@ -0,0 +1,7 @@ +for(var numBottles:uint = 99; numBottles > 0; numBottles--) +{ + trace(numBottles, " bottles of beer on the wall"); + trace(numBottles, " bottles of beer"); + trace("Take one down, pass it around"); + trace(numBottles - 1, " bottles of beer on the wall\n"); +} diff --git a/Task/99-Bottles-of-Beer/Ada/99-bottles-of-beer-1.ada b/Task/99-Bottles-of-Beer/Ada/99-bottles-of-beer-1.ada new file mode 100644 index 0000000000..6086882d32 --- /dev/null +++ b/Task/99-Bottles-of-Beer/Ada/99-bottles-of-beer-1.ada @@ -0,0 +1,12 @@ +with Ada.Text_Io; use Ada.Text_Io; + + procedure Bottles is + begin + for X in reverse 1..99 loop + Put_Line(Integer'Image(X) & " bottles of beer on the wall"); + Put_Line(Integer'Image(X) & " bottles of beer"); + Put_Line("Take one down, pass it around"); + Put_Line(Integer'Image(X - 1) & " bottles of beer on the wall"); + New_Line; + end loop; + end Bottles; diff --git a/Task/99-Bottles-of-Beer/Ada/99-bottles-of-beer-2.ada b/Task/99-Bottles-of-Beer/Ada/99-bottles-of-beer-2.ada new file mode 100644 index 0000000000..e93a47998b --- /dev/null +++ b/Task/99-Bottles-of-Beer/Ada/99-bottles-of-beer-2.ada @@ -0,0 +1,39 @@ +with Ada.Text_Io; use Ada.Text_Io; + +procedure Tasking_99_Bottles is + subtype Num_Bottles is Natural range 1..99; + task Print is + entry Set (Num_Bottles); + end Print; + task body Print is + Num : Natural; + begin + for I in reverse Num_Bottles'range loop + select + accept + Set(I) do -- Rendezvous with Counter task I + Num := I; + end Set; + Put_Line(Integer'Image(Num) & " bottles of beer on the wall"); + Put_Line(Integer'Image(Num) & " bottles of beer"); + Put_Line("Take one down, pass it around"); + Put_Line(Integer'Image(Num - 1) & " bottles of beer on the wall"); + New_Line; + or terminate; -- end when all Counter tasks have completed + end select; + end loop; + end Print; + task type Counter(I : Num_Bottles); + task body Counter is + begin + Print.Set(I); + end Counter; + type Task_Access is access Counter; + + Task_List : array(Num_Bottles) of Task_Access; + +begin + for I in Task_List'range loop -- Create 99 Counter tasks + Task_List(I) := new Counter(I); + end loop; +end Tasking_99_Bottles; diff --git a/Task/99-Bottles-of-Beer/BASIC/99-bottles-of-beer-1.bas b/Task/99-Bottles-of-Beer/BASIC/99-bottles-of-beer-1.bas new file mode 100644 index 0000000000..cefa889e54 --- /dev/null +++ b/Task/99-Bottles-of-Beer/BASIC/99-bottles-of-beer-1.bas @@ -0,0 +1,12 @@ +PLAY "<" +FOR x = 99 TO 0 STEP -1 + PRINT x; "bottles of beer on the wall" + PRINT x; "bottles of beer" + PRINT "Take one down, pass it around" + PRINT x-1; "bottles of beer on the wall" + PRINT + PLAY "e-8e-8e-8e-8e-8e-8e-4"'X bottles of beer on the wall + PLAY "f8f8f8c8c8c8f4"'X bottles of beer + PLAY "d4d8d8 N0 d8d8d8d4"'take one down, pass it around + PLAY "c8c8d8d+8d+8d+8d+4"'X-1 bottles of beer on the wall +NEXT x diff --git a/Task/99-Bottles-of-Beer/BASIC/99-bottles-of-beer-2.bas b/Task/99-Bottles-of-Beer/BASIC/99-bottles-of-beer-2.bas new file mode 100644 index 0000000000..3dd875c8d6 --- /dev/null +++ b/Task/99-Bottles-of-Beer/BASIC/99-bottles-of-beer-2.bas @@ -0,0 +1,7 @@ +FOR x = 99 TO 1 STEP -1 + PRINT x; "bottles of beer on the wall" + PRINT x; "bottles of beer" + PRINT "Take one down, pass it around" + PRINT x-1; "bottles of beer on the wall" + PRINT +NEXT x diff --git a/Task/99-Bottles-of-Beer/Babel/99-bottles-of-beer.pb b/Task/99-Bottles-of-Beer/Babel/99-bottles-of-beer.pb new file mode 100644 index 0000000000..2d61ab35e4 --- /dev/null +++ b/Task/99-Bottles-of-Beer/Babel/99-bottles-of-beer.pb @@ -0,0 +1,17 @@ +main: { 99 bottles } + +bottles!: + { x set + { bw + bx cr << + "Take one down, pass it around\n" << + 1 x -= + bw "\n" << } + x times } + +b : " bottles of beer" +bx!: { x %d << b } +w : " on the wall" +bw!: { bx w . cr << } + +x: [0] diff --git a/Task/99-Bottles-of-Beer/Befunge/99-bottles-of-beer.bf b/Task/99-Bottles-of-Beer/Befunge/99-bottles-of-beer.bf new file mode 100644 index 0000000000..9366f05bfa --- /dev/null +++ b/Task/99-Bottles-of-Beer/Befunge/99-bottles-of-beer.bf @@ -0,0 +1,11 @@ +:,| + :,| + :,| + >01g1-:01p v +v <.g10" bottles of beer on the wall"+*4310< +>:,| + >134*+0` | + @ diff --git a/Task/99-Bottles-of-Beer/C/99-bottles-of-beer-1.c b/Task/99-Bottles-of-Beer/C/99-bottles-of-beer-1.c new file mode 100644 index 0000000000..40042b3568 --- /dev/null +++ b/Task/99-Bottles-of-Beer/C/99-bottles-of-beer-1.c @@ -0,0 +1,15 @@ +#include +#include + +int main(void) +{ + unsigned int bottles = 99; + do + { + printf("%u bottles of beer on the wall\n", bottles); + printf("%u bottles of beer\n", bottles); + printf("Take one down, pass it around\n"); + printf("%u bottles of beer on the wall\n\n", --bottles); + } while(bottles > 0); + return EXIT_SUCCESS; +} diff --git a/Task/99-Bottles-of-Beer/C/99-bottles-of-beer-2.c b/Task/99-Bottles-of-Beer/C/99-bottles-of-beer-2.c new file mode 100644 index 0000000000..7cd63889af --- /dev/null +++ b/Task/99-Bottles-of-Beer/C/99-bottles-of-beer-2.c @@ -0,0 +1,5 @@ +#include +main(){_=100;while(--_)printf("%i bottle%s of beer in the wall,\n%i bottle%" +"s of beer.\nTake one down, pass it round,\n%s%s\n\n",_,_-1?"s":"",_,_-1?"s" +:"",_-1?(char[]){(_-1)/10?(_-1)/10+48:(_-1)%10+48,(_-1)/10?(_-1)%10+48:2+30, +(_-1)/10?32:0,0}:"",_-1?"bottles of beer in the wall":"No more beers");} diff --git a/Task/99-Bottles-of-Beer/C/99-bottles-of-beer-3.c b/Task/99-Bottles-of-Beer/C/99-bottles-of-beer-3.c new file mode 100644 index 0000000000..d484ea9641 --- /dev/null +++ b/Task/99-Bottles-of-Beer/C/99-bottles-of-beer-3.c @@ -0,0 +1,30 @@ +#include +#include + +#define BOTTLE(nstr) nstr " bottles of beer" + +#define WALL(nstr) BOTTLE(nstr) " on the wall" + +#define PART1(nstr) WALL(nstr) "\n" BOTTLE(nstr) \ + "\nTake one down, pass it around\n" + +#define PART2(nstr) WALL(nstr) "\n\n" + +#define MIDDLE(nstr) PART2(nstr) PART1(nstr) + +#define SONG PART1("100") CD2 PART2("0") + +#define CD2 CD3("9") CD3("8") CD3("7") CD3("6") CD3("5") \ + CD3("4") CD3("3") CD3("2") CD3("1") CD4("") + +#define CD3(pre) CD4(pre) MIDDLE(pre "0") + +#define CD4(pre) MIDDLE(pre "9") MIDDLE(pre "8") MIDDLE(pre "7") \ + MIDDLE(pre "6") MIDDLE(pre "5") MIDDLE(pre "4") MIDDLE(pre "3") \ + MIDDLE(pre "2") MIDDLE(pre "1") + +int main(void) +{ + (void) printf(SONG); + return EXIT_SUCCESS; +} diff --git a/Task/99-Bottles-of-Beer/C/99-bottles-of-beer-4.c b/Task/99-Bottles-of-Beer/C/99-bottles-of-beer-4.c new file mode 100644 index 0000000000..f4bde51887 --- /dev/null +++ b/Task/99-Bottles-of-Beer/C/99-bottles-of-beer-4.c @@ -0,0 +1,35 @@ + int b =99,u =1; + #include + char *d[16],y[] + = "#:ottle/ of" + ":eer_ a_Goy\x20some6" + "_Take8;down4p" + "a=1rou7_17 _<" + "h;_ m?_nd_ on" + "_085wal" "l_ " + "b_e _ t_ss it" + "_?4bu_ore_9, " + "\060.""@, 9$"; + # define x c ^= + #include + #define or(t,z) else\ + if(c==t && !(c = 0) &&\ + (c =! z)); int p(char *t) +{ char *s = t; int c; for ( +d[c = 0] = y; !t && (d[c +1 +]= strchr(s = d[c], '_'));* +(d[++c]++) = 0); for(t = s? +s:t;(c= *s++); c && putchar +(c)) { if (!((( x 48)& ~0xf +) && ( x 48)) ) p(d[c]), c= +0 ; or('$', p(b - 99?".\n": +"." ) && p(b - 99? t : "")) +or ('\x40', c && p( d[!!b-- ++ 2])) or('/', c && p( b^1? +"s": "")) or ('\043', b++ ? +p("So6" + --b):!printf("%d" +, b ? --b : (b += 99))) or( +'S',!(++u % 3) * 32+ 78) or +('.', puts("."))}return c;} + int main() {return p(0);} diff --git a/Task/99-Bottles-of-Beer/Clojure/99-bottles-of-beer.clj b/Task/99-Bottles-of-Beer/Clojure/99-bottles-of-beer.clj new file mode 100644 index 0000000000..15d05694a8 --- /dev/null +++ b/Task/99-Bottles-of-Beer/Clojure/99-bottles-of-beer.clj @@ -0,0 +1,14 @@ +(defn verse + [n] + (printf "%d bottles of beer on the wall, +%d bottles of beer, +Take one down, pass it around, +%d bottles of beer on the wall.\n\n" + n + n + (dec n))) + +(defn sing + [start] + (doseq [n (range start 0 -1)] + (verse n))) diff --git a/Task/99-Bottles-of-Beer/CoffeeScript/99-bottles-of-beer-1.coffee b/Task/99-Bottles-of-Beer/CoffeeScript/99-bottles-of-beer-1.coffee new file mode 100644 index 0000000000..d1b09dc2e9 --- /dev/null +++ b/Task/99-Bottles-of-Beer/CoffeeScript/99-bottles-of-beer-1.coffee @@ -0,0 +1,9 @@ +bottlesOfBeer = (n) -> + "#{n} bottle#{if n is 1 then '' else 's'} of beer" + +console.log """ + #{bottlesOfBeer n} on the wall + #{bottlesOfBeer n} + Take one down, pass it around + #{bottlesOfBeer n - 1} on the wall + \n""" for n in [99..1] diff --git a/Task/99-Bottles-of-Beer/CoffeeScript/99-bottles-of-beer-2.coffee b/Task/99-Bottles-of-Beer/CoffeeScript/99-bottles-of-beer-2.coffee new file mode 100644 index 0000000000..5d1cb3a77b --- /dev/null +++ b/Task/99-Bottles-of-Beer/CoffeeScript/99-bottles-of-beer-2.coffee @@ -0,0 +1,4 @@ +for j in [99..1] + x='' + x += [j,j-1,'\nTake one down, pass it around\n'," bottles of beer",' on the wall\n'][i] for i in [0,3,4,0,3,2,1,3,4] + console.log x.replace /(1.+)s/g, '$1' diff --git a/Task/99-Bottles-of-Beer/CoffeeScript/99-bottles-of-beer-3.coffee b/Task/99-Bottles-of-Beer/CoffeeScript/99-bottles-of-beer-3.coffee new file mode 100644 index 0000000000..e6f32d0481 --- /dev/null +++ b/Task/99-Bottles-of-Beer/CoffeeScript/99-bottles-of-beer-3.coffee @@ -0,0 +1 @@ +console.log( if (j+2)%4 then (x=Math.round j/4)+" bottle#{if x-1 then 's' else ''} of beer#{if (j+1)%4 then ' on the wall' else ''}" else "Take one down, pass it around" ) for j in [396..1] diff --git a/Task/99-Bottles-of-Beer/CoffeeScript/99-bottles-of-beer-4.coffee b/Task/99-Bottles-of-Beer/CoffeeScript/99-bottles-of-beer-4.coffee new file mode 100644 index 0000000000..0fbf558351 --- /dev/null +++ b/Task/99-Bottles-of-Beer/CoffeeScript/99-bottles-of-beer-4.coffee @@ -0,0 +1 @@ +((console.log if i is 2 then "Take one down, pass it around" else "#{b-!(i-1%4)} bottle#{if 4*b+i<10 and b-i then '' else 's'} of beer#{if i%3 then ' on the wall' else ''}") for i in [4..1]) for b in [99..1] diff --git a/Task/99-Bottles-of-Beer/Dylan/99-bottles-of-beer.dylan b/Task/99-Bottles-of-Beer/Dylan/99-bottles-of-beer.dylan new file mode 100644 index 0000000000..d27359219f --- /dev/null +++ b/Task/99-Bottles-of-Beer/Dylan/99-bottles-of-beer.dylan @@ -0,0 +1,10 @@ +Module: bottles +define method bottles (n :: ) + for (n from 99 to 1 by -1) + format-out("%d bottles of beer on the wall,\n" + "%d bottles of beer\n" + "Take one down, pass it around\n" + "%d bottles of beer on the wall\n", + n, n, n - 1); + end +end method diff --git a/Task/99-Bottles-of-Beer/Erlang/99-bottles-of-beer.erl b/Task/99-Bottles-of-Beer/Erlang/99-bottles-of-beer.erl new file mode 100644 index 0000000000..3331149e18 --- /dev/null +++ b/Task/99-Bottles-of-Beer/Erlang/99-bottles-of-beer.erl @@ -0,0 +1,39 @@ +-module(beersong). +-export([sing/0]). +-define(TEMPLATE_0, "~s of beer on the wall, ~s of beer.~nGo to the store and buy some more, 99 +bottles of beer on the wall.~n"). +-define(TEMPLATE_N, "~s of beer on the wall, ~s of beer.~nTake one down and pass it around, ~s of +beer on the wall.~n~n"). + +create_verse(0) -> {0, io_lib:format(?TEMPLATE_0, phrase(0))}; +create_verse(Bottle) -> {Bottle, io_lib:format(?TEMPLATE_N, phrase(Bottle))}. + +phrase(0) -> ["No more bottles", "no more bottles"]; +phrase(1) -> ["1 bottle", "1 bottle", "no more bottles"]; +phrase(2) -> ["2 bottles", "2 bottles", "1 bottle"]; +phrase(Bottle) -> lists:duplicate(2, integer_to_list(Bottle) ++ " bottles") ++ +[integer_to_list(Bottle-1) ++ " bottles"]. + +bottles() -> lists:reverse(lists:seq(0,99)). + +sing() -> + lists:foreach(fun spawn_singer/1, bottles()), + sing_verse(99). + +spawn_singer(Bottle) -> + Pid = self(), + spawn(fun() -> Pid ! create_verse(Bottle) end). + +sing_verse(Bottle) -> + receive + {_, Verse} when Bottle == 0 -> + io:format(Verse); + {N, Verse} when Bottle == N -> + io:format(Verse), + sing_verse(Bottle-1) + after + 3000 -> + io:format("Verse not received - re-starting singer~n"), + spawn_singer(Bottle), + sing_verse(Bottle) + end. diff --git a/Task/99-Bottles-of-Beer/Forth/99-bottles-of-beer.fth b/Task/99-Bottles-of-Beer/Forth/99-bottles-of-beer.fth new file mode 100644 index 0000000000..be6b3cc20f --- /dev/null +++ b/Task/99-Bottles-of-Beer/Forth/99-bottles-of-beer.fth @@ -0,0 +1,14 @@ +:noname dup . ." bottles" ; +:noname ." 1 bottle" ; +:noname ." no more bottles" ; +create bottles , , , + +: .bottles dup 2 min cells bottles + @ execute ; +: .beer .bottles ." of beer" ; +: .wall .beer ." on the wall" ; +: .take ." Take one down, pass it around" ; +: .verse .wall cr .beer cr + 1- .take cr .wall cr ; +: verses begin cr .verse ?dup 0= until ; + +99 verses diff --git a/Task/99-Bottles-of-Beer/Fortran/99-bottles-of-beer.f b/Task/99-Bottles-of-Beer/Fortran/99-bottles-of-beer.f new file mode 100644 index 0000000000..69ad0d2a9c --- /dev/null +++ b/Task/99-Bottles-of-Beer/Fortran/99-bottles-of-beer.f @@ -0,0 +1,24 @@ +program bottlestest + + implicit none + + integer :: i + + character(len=*), parameter :: bwall = " on the wall", & + bottles = "bottles of beer", & + bottle = "bottle of beer", & + take = "Take one down, pass it around", & + form = "(I0, ' ', A)" + + do i = 99,0,-1 + if ( i /= 1 ) then + write (*,form) i, bottles // bwall + if ( i > 0 ) write (*,form) i, bottles + else + write (*,form) i, bottle // bwall + write (*,form) i, bottle + end if + if ( i > 0 ) write (*,*) take + end do + +end program bottlestest diff --git a/Task/99-Bottles-of-Beer/Go/99-bottles-of-beer.go b/Task/99-Bottles-of-Beer/Go/99-bottles-of-beer.go new file mode 100644 index 0000000000..ac31ac13b1 --- /dev/null +++ b/Task/99-Bottles-of-Beer/Go/99-bottles-of-beer.go @@ -0,0 +1,18 @@ +package main + +import "fmt" + +func main() { + cardinality := func (i int) string { + if i!=1 { + return "s" + } + return "" + } + for i := 99; i > 0; i-- { + fmt.Printf("%d bottle%s of beer on the wall\n", i, cardinality(i)) + fmt.Printf("%d bottle%s of beer\n", i, cardinality(i)) + fmt.Printf("Take one down, pass it around\n") + fmt.Printf("%d bottle%s of beer on the wall\n", i-1, cardinality(i-1)) + } +} diff --git a/Task/99-Bottles-of-Beer/Haskell/99-bottles-of-beer-1.hs b/Task/99-Bottles-of-Beer/Haskell/99-bottles-of-beer-1.hs new file mode 100644 index 0000000000..b58d89c01e --- /dev/null +++ b/Task/99-Bottles-of-Beer/Haskell/99-bottles-of-beer-1.hs @@ -0,0 +1,7 @@ +main = mapM_ (putStrLn . beer) [99, 98 .. 0] +beer 1 = "1 bottle of beer on the wall\n1 bottle of beer\nTake one down, pass it around" +beer 0 = "better go to the store and buy some more." +beer v = show v ++ " bottles of beer on the wall\n" + ++ show v + ++" bottles of beer\nTake one down, pass it around\n" + ++ head (lines $ beer $ v-1) ++ "\n" diff --git a/Task/99-Bottles-of-Beer/Haskell/99-bottles-of-beer-2.hs b/Task/99-Bottles-of-Beer/Haskell/99-bottles-of-beer-2.hs new file mode 100644 index 0000000000..b72cbda87c --- /dev/null +++ b/Task/99-Bottles-of-Beer/Haskell/99-bottles-of-beer-2.hs @@ -0,0 +1,16 @@ +import qualified Char + +main = putStr $ concat + [up (bob n) ++ wall ++ ", " ++ bob n ++ ".\n" ++ + pass n ++ bob (n - 1) ++ wall ++ ".\n\n" | + n <- [99, 98 .. 0]] + where bob n = (num n) ++ " bottle" ++ (s n) ++ " of beer" + wall = " on the wall" + pass 0 = "Go to the store and buy some more, " + pass _ = "Take one down and pass it around, " + up (x : xs) = Char.toUpper x : xs + num (-1) = "99" + num 0 = "no more" + num n = show n + s 1 = "" + s _ = "s" diff --git a/Task/99-Bottles-of-Beer/Haskell/99-bottles-of-beer-3.hs b/Task/99-Bottles-of-Beer/Haskell/99-bottles-of-beer-3.hs new file mode 100644 index 0000000000..af6eb0ed23 --- /dev/null +++ b/Task/99-Bottles-of-Beer/Haskell/99-bottles-of-beer-3.hs @@ -0,0 +1,28 @@ +{-# LANGUAGE TemplateHaskell #-} +-- build with "ghc --make beer.hs" +module Main where +import Language.Haskell.TH +import Control.Monad.Writer + +-- This is calculated at compile time, and is equivalent to +-- songString = "99 bottles of beer on the wall\n99 bottles..." +songString = + $(let + sing = tell -- we can't sing very well... + + someBottles 1 = "1 bottle of beer " + someBottles n = show n ++ " bottles of beer " + + bottlesOfBeer n = (someBottles n ++) + + verse n = do + sing $ n `bottlesOfBeer` "on the wall\n" + sing $ n `bottlesOfBeer` "\n" + sing $ "Take one down, pass it around\n" + sing $ (n - 1) `bottlesOfBeer` "on the wall\n\n" + + song = execWriter $ mapM_ verse [99,98..1] + + in return $ LitE $ StringL $ song) + +main = putStr songString diff --git a/Task/99-Bottles-of-Beer/Java/99-bottles-of-beer-1.java b/Task/99-Bottles-of-Beer/Java/99-bottles-of-beer-1.java new file mode 100644 index 0000000000..805e0b3e6c --- /dev/null +++ b/Task/99-Bottles-of-Beer/Java/99-bottles-of-beer-1.java @@ -0,0 +1,20 @@ +import java.text.MessageFormat; +public class Beer +{ + static String bottles(final int n) + { + return MessageFormat.format("{0,choice,0#No more bottles|1#One bottle|2#{0} bottles} of beer", n); + } + public static void main(final String[] args) + { + String byob = bottles(99); + for (int x = 99; x > 0;) + { + System.out.println(byob + " on the wall"); + System.out.println(byob); + System.out.println("Take one down, pass it around"); + byob = bottles(--x); + System.out.println(byob + " on the wall\n"); + } + } +} diff --git a/Task/99-Bottles-of-Beer/Java/99-bottles-of-beer-2.java b/Task/99-Bottles-of-Beer/Java/99-bottles-of-beer-2.java new file mode 100644 index 0000000000..b89dcc149f --- /dev/null +++ b/Task/99-Bottles-of-Beer/Java/99-bottles-of-beer-2.java @@ -0,0 +1,16 @@ +public class Beer +{ + public static void main(final String[] args) + { + int beer = 99; + StringBuilder sb = new StringBuilder(); + String data[] = new String[] { " bottles of beer on the wall\n", + " bottles of beer.\nTake one down, pass it around,\n", + "Better go to the store and buy some more." }; + + while (beer > 0) + sb.append(beer).append(data[0]).append(beer).append(data[1]).append(--beer).append(data[0]).append("\n"); + + System.out.println(sb.append(data[2]).toString()); + } +} diff --git a/Task/99-Bottles-of-Beer/Java/99-bottles-of-beer-3.java b/Task/99-Bottles-of-Beer/Java/99-bottles-of-beer-3.java new file mode 100644 index 0000000000..ca5c43b61a --- /dev/null +++ b/Task/99-Bottles-of-Beer/Java/99-bottles-of-beer-3.java @@ -0,0 +1,40 @@ +import java.awt.BorderLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import javax.swing.JButton; +import javax.swing.JFrame; +import javax.swing.JOptionPane; +import javax.swing.JTextArea; +public class Beer extends JFrame implements ActionListener{ + private int x; + private JButton take; + private JTextArea text; + public static void main(String[] args){ + new Beer();//build and show the GUI + } + + public Beer(){ + x= 99; + take= new JButton("Take one down, pass it around"); + text= new JTextArea(4,30);//size the area to 4 lines, 30 chars each + text.setText(x + " bottles of beer on the wall\n" + x + " bottles of beer"); + text.setEditable(false);//so they can't change the text after it's displayed + take.addActionListener(this);//listen to the button + setLayout(new BorderLayout());//handle placement of components + add(text, BorderLayout.CENTER);//put the text area in the largest section + add(take, BorderLayout.SOUTH);//put the button underneath it + pack();//auto-size the window + setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);//exit on "X" (I hate System.exit...) + setVisible(true);//show it + } + + public void actionPerformed(ActionEvent arg0){ + if(arg0.getSource() == take){//if they clicked the button + JOptionPane.showMessageDialog(null, --x + " bottles of beer on the wall");//show a popup message + text.setText(x + " bottles of beer on the wall\n" + x + " bottles of beer");//change the text + } + if(x == 0){//if it's the end + dispose();//end + } + } +} diff --git a/Task/99-Bottles-of-Beer/JavaScript/99-bottles-of-beer-1.js b/Task/99-Bottles-of-Beer/JavaScript/99-bottles-of-beer-1.js new file mode 100644 index 0000000000..b877df7843 --- /dev/null +++ b/Task/99-Bottles-of-Beer/JavaScript/99-bottles-of-beer-1.js @@ -0,0 +1,10 @@ +// Line breaks are in HTML +var beer = 99; +while (beer > 0) +{ + document.write( beer + " bottles of beer on the wall
" ); + document.write( beer + " bottles of beer
" ); + document.write( "Take one down, pass it around
" ); + document.write( (beer - 1) + " bottles of beer on the wall
" ); + beer--; +} diff --git a/Task/99-Bottles-of-Beer/JavaScript/99-bottles-of-beer-2.js b/Task/99-Bottles-of-Beer/JavaScript/99-bottles-of-beer-2.js new file mode 100644 index 0000000000..8c8b4a2fca --- /dev/null +++ b/Task/99-Bottles-of-Beer/JavaScript/99-bottles-of-beer-2.js @@ -0,0 +1,2 @@ +// Line breaks are in HTML +var beer; while ((beer = typeof beer === "undefined" ? 99 : beer) > 0) document.write( beer + " bottle" + (beer != 1 ? "s" : "") + " of beer on the wall
" + beer + " bottle" + (beer != 1 ? "s" : "") + " of beer
Take one down, pass it around
" + (--beer) + " bottle" + (beer != 1 ? "s" : "") + " of beer on the wall
" ); diff --git a/Task/99-Bottles-of-Beer/JavaScript/99-bottles-of-beer-3.js b/Task/99-Bottles-of-Beer/JavaScript/99-bottles-of-beer-3.js new file mode 100644 index 0000000000..9b1ded8bdc --- /dev/null +++ b/Task/99-Bottles-of-Beer/JavaScript/99-bottles-of-beer-3.js @@ -0,0 +1,21 @@ +// Line breaks are in HTML +function Bottles(count){ + this.count = (!!count)?count:99; + this.knock = function(){ + var c = document.createElement('div'); + c.id="bottle-"+this.count; + c.innerHTML = "

"+this.count+" bottles of beer on the wall

" + +"

"+this.count+" bottles of beer!

" + +"

Take one down,
Pass it around

" + +"

"+(--this.count)+" bottles of beer on the wall


"; + document.body.appendChild(c); + } + this.sing = function(){ + while (this.count>0) { this.knock(); } + } +} + +(function(){ + var bar = new Bottles(99); + bar.sing(); +})(); diff --git a/Task/99-Bottles-of-Beer/JavaScript/99-bottles-of-beer-4.js b/Task/99-Bottles-of-Beer/JavaScript/99-bottles-of-beer-4.js new file mode 100644 index 0000000000..036d7f4de0 --- /dev/null +++ b/Task/99-Bottles-of-Beer/JavaScript/99-bottles-of-beer-4.js @@ -0,0 +1,18 @@ +function bottleSong(n) { + if (!isFinite(Number(n)) || n == 0) n = 100; + var a = '%% bottles of beer', + b = ' on the wall', + c = 'Take one down, pass it around', + r = '
' + p = document.createElement('p'), + s = [], + re = /%%/g; + + while(n) { + s.push((a+b+r+a+r+c+r).replace(re, n) + (a+b).replace(re, --n)); + } + p.innerHTML = s.join(r+r); + document.body.appendChild(p); +} + +window.onload = bottleSong; diff --git a/Task/99-Bottles-of-Beer/LaTeX/99-bottles-of-beer-1.tex b/Task/99-Bottles-of-Beer/LaTeX/99-bottles-of-beer-1.tex new file mode 100644 index 0000000000..edc0aacb18 --- /dev/null +++ b/Task/99-Bottles-of-Beer/LaTeX/99-bottles-of-beer-1.tex @@ -0,0 +1,20 @@ +\documentclass{article} + +\newcounter{beer} + +\newcommand{\verses}[1]{ + \setcounter{beer}{#1} + \par\noindent + \arabic{beer} bottles of beer on the wall,\\ + \arabic{beer} bottles of beer!\\ + Take one down, pass it around---\\ + \addtocounter{beer}{-1} + \arabic{beer} bottles of beer on the wall!\\ + \ifnum#1>0 + \verses{\value{beer}} + \fi +} + +\begin{document} +\verses{99} +\end{document} diff --git a/Task/99-Bottles-of-Beer/LaTeX/99-bottles-of-beer-2.tex b/Task/99-Bottles-of-Beer/LaTeX/99-bottles-of-beer-2.tex new file mode 100644 index 0000000000..661df6bc25 --- /dev/null +++ b/Task/99-Bottles-of-Beer/LaTeX/99-bottles-of-beer-2.tex @@ -0,0 +1,23 @@ +\documentclass{article} + +\newcounter{beer} +\newcounter{showC} + +\newcommand{\verses}[1]{ + \setcounter{beer}{#1} + \loop + \par\noindent + \Roman{beer} bottles of beer on the wall,\\ + \Roman{beer} bottles of beer!\\ + Take one down, pass it around---\\ + \addtocounter{beer}{-1} +% Romans didn't know how to write zero ;-) + \ifnum\value{beer}=0 ZERO \else\Roman{beer} \fi + bottles of beer on the wall!\\ + \ifnum\value{beer}>0 + \repeat +} + +\begin{document} +\verses{99} +\end{document} diff --git a/Task/99-Bottles-of-Beer/Lua/99-bottles-of-beer.lua b/Task/99-Bottles-of-Beer/Lua/99-bottles-of-beer.lua new file mode 100644 index 0000000000..8c355162de --- /dev/null +++ b/Task/99-Bottles-of-Beer/Lua/99-bottles-of-beer.lua @@ -0,0 +1,11 @@ +local bottles = 99 + +local function plural (bottles) if bottles == 1 then return '' end return 's' end +while bottles > 0 do + print (bottles..' bottle'..plural(bottles)..' of beer on the wall') + print (bottles..' bottle'..plural(bottles)..' of beer') + print ('Take one down, pass it around') + bottles = bottles - 1 + print (bottles..' bottle'..plural(bottles)..' of beer on the wall') + print () +end diff --git a/Task/99-Bottles-of-Beer/PHP/99-bottles-of-beer-1.php b/Task/99-Bottles-of-Beer/PHP/99-bottles-of-beer-1.php new file mode 100644 index 0000000000..4131be3fd0 --- /dev/null +++ b/Task/99-Bottles-of-Beer/PHP/99-bottles-of-beer-1.php @@ -0,0 +1,15 @@ + 1) + echo ($i - 1) . " bottle$plural of beer on the wall!\n\n"; + else + echo "No more bottles of beer on the wall!\n"; +} +?> diff --git a/Task/99-Bottles-of-Beer/PHP/99-bottles-of-beer-2.php b/Task/99-Bottles-of-Beer/PHP/99-bottles-of-beer-2.php new file mode 100644 index 0000000000..ef5231cd9e --- /dev/null +++ b/Task/99-Bottles-of-Beer/PHP/99-bottles-of-beer-2.php @@ -0,0 +1,13 @@ +1)?"s":""; + echo <<< EOV +$i bottle$p of beer on the wall +$i bottle$p of beer +Take one down, pass it around + + +EOV; +} +echo "No more Bottles of beer on the wall"; +?> diff --git a/Task/99-Bottles-of-Beer/PHP/99-bottles-of-beer-3.php b/Task/99-Bottles-of-Beer/PHP/99-bottles-of-beer-3.php new file mode 100644 index 0000000000..07e20f3c46 --- /dev/null +++ b/Task/99-Bottles-of-Beer/PHP/99-bottles-of-beer-3.php @@ -0,0 +1,18 @@ + diff --git a/Task/99-Bottles-of-Beer/PHP/99-bottles-of-beer-4.php b/Task/99-Bottles-of-Beer/PHP/99-bottles-of-beer-4.php new file mode 100644 index 0000000000..2154592a21 --- /dev/null +++ b/Task/99-Bottles-of-Beer/PHP/99-bottles-of-beer-4.php @@ -0,0 +1,7 @@ +0;$i--){ + $p2=$i." bottle".(($i>1)?"s":"")." of beer"; + $p1=$p2." on the wall\n"; + $p3="Take one down, pass it around\n"; + echo (($i<100)?$p1."\n":"").$p1.$p2."\n".$p3.(($i<2)?($i-1).substr($p1,1,28):""); + } diff --git a/Task/99-Bottles-of-Beer/PIR/99-bottles-of-beer.pir b/Task/99-Bottles-of-Beer/PIR/99-bottles-of-beer.pir new file mode 100644 index 0000000000..6d53050492 --- /dev/null +++ b/Task/99-Bottles-of-Beer/PIR/99-bottles-of-beer.pir @@ -0,0 +1,31 @@ +.sub sounding_smart_is_hard_after_drinking_this_many + .param int b + if b == 1 goto ONE + .return(" bottles ") +ONE: + .return(" bottle ") + end +.end + +.sub main :main + .local int bottles + .local string b + bottles = 99 +LUSH: + if bottles == 0 goto DRUNK + b = sounding_smart_is_hard_after_drinking_this_many( bottles ) + print bottles + print b + print "of beer on the wall\n" + print bottles + print b + print "of beer\nTake one down, pass it around\n" + dec bottles + b = sounding_smart_is_hard_after_drinking_this_many( bottles ) + print bottles + print b + print "of beer on the wall\n\n" + goto LUSH +DRUNK: + end +.end diff --git a/Task/99-Bottles-of-Beer/Perl/99-bottles-of-beer-1.pl b/Task/99-Bottles-of-Beer/Perl/99-bottles-of-beer-1.pl new file mode 100644 index 0000000000..92dcb0f34c --- /dev/null +++ b/Task/99-Bottles-of-Beer/Perl/99-bottles-of-beer-1.pl @@ -0,0 +1,18 @@ +#!/usr/bin/perl -w + +my $verse = <<"VERSE"; +100 bottles of beer on the wall, +100 bottles of beer! +Take one down, pass it around! +99 bottles of beer on the wall! + +VERSE + +{ + $verse =~ s/(\d+)/$1-1/ge; + $verse =~ s/\b1 bottles/1 bottle/g; + my $done = $verse =~ s/\b0 bottle/No bottles/g; # if we make this replacement, we're also done. + + print $verse; + redo unless $done; +} diff --git a/Task/99-Bottles-of-Beer/Perl/99-bottles-of-beer-2.pl b/Task/99-Bottles-of-Beer/Perl/99-bottles-of-beer-2.pl new file mode 100644 index 0000000000..2ac7e5045f --- /dev/null +++ b/Task/99-Bottles-of-Beer/Perl/99-bottles-of-beer-2.pl @@ -0,0 +1,6 @@ +for $n (reverse(0..99)) +{ + $bottles = sprintf("%s bottle%s of beer on the wall\n",(($n==0)?"No":$n), (($n==1)?"":"s")); + print( (($n==99)?"":"$bottles\n") . + (($n==0)?"":(substr(${bottles}x2,0,-12) . "\nTake one down, pass it around\n")) ); +} diff --git a/Task/99-Bottles-of-Beer/Perl/99-bottles-of-beer-3.pl b/Task/99-Bottles-of-Beer/Perl/99-bottles-of-beer-3.pl new file mode 100644 index 0000000000..b7e539c8d5 --- /dev/null +++ b/Task/99-Bottles-of-Beer/Perl/99-bottles-of-beer-3.pl @@ -0,0 +1,14 @@ +use 5.10.0; + +$num = 99; +while ($num > 0) { + my $s = "s" unless ($num == 1); + say "$num bottle$s of beer on the wall, $num bottle$s of beer"; + $num--; + my $s = "s" unless ($num == 1); + $num = "No more" if ($num == 0); + say "Take one down, pass it around, $num bottle$s of beer on the wall\n" +} + +say "No more bottles of beer on the wall, no more bottles of beer."; +say "Go to the store and buy some more, 99 bottles of beer on the wall."; diff --git a/Task/99-Bottles-of-Beer/Perl/99-bottles-of-beer-4.pl b/Task/99-Bottles-of-Beer/Perl/99-bottles-of-beer-4.pl new file mode 100644 index 0000000000..b0b0f3f214 --- /dev/null +++ b/Task/99-Bottles-of-Beer/Perl/99-bottles-of-beer-4.pl @@ -0,0 +1,16 @@ +#!/usr/bin/env perl +use strict; +use warnings; + +sub bottles() { sprintf qq{%s bottle%s of beer} + , $_ || 'No' + , $_==1 ? '' : 's'; + } +sub store() { $_=99; qq{Go to the store, buy some more...\n}; } +sub wall() { qq{ on the wall\n} } +sub take() { $_-- ? qq{Take one down, pass it around\n} : store } +do { print bottles, wall + , bottles, qq{\n} + , take + , bottles, qq{\n\n} + } for reverse 0..99; diff --git a/Task/99-Bottles-of-Beer/PicoLisp/99-bottles-of-beer.l b/Task/99-Bottles-of-Beer/PicoLisp/99-bottles-of-beer.l new file mode 100644 index 0000000000..3c1a50cec9 --- /dev/null +++ b/Task/99-Bottles-of-Beer/PicoLisp/99-bottles-of-beer.l @@ -0,0 +1,12 @@ +(de bottles (N) + (case N + (0 "No more beer") + (1 "One bottle of beer") + (T (cons N " bottles of beer")) ) ) + +(for (N 99 (gt0 N)) + (prinl (bottles N) " on the wall,") + (prinl (bottles N) ".") + (prinl "Take one down, pass it around,") + (prinl (bottles (dec 'N)) " on the wall.") + (prinl) ) diff --git a/Task/99-Bottles-of-Beer/Prolog/99-bottles-of-beer-1.pro b/Task/99-Bottles-of-Beer/Prolog/99-bottles-of-beer-1.pro new file mode 100644 index 0000000000..2160c6cb06 --- /dev/null +++ b/Task/99-Bottles-of-Beer/Prolog/99-bottles-of-beer-1.pro @@ -0,0 +1,10 @@ +bottles(0):-!. +bottles(X):- + writef('%t bottles of beer on the wall \n',[X]), + writef('%t bottles of beer\n',[X]), + write('Take one down, pass it around\n'), + succ(XN,X), + writef('%t bottles of beer on the wall \n\n',[XN]), + bottles(XN). + +:- bottles(99). diff --git a/Task/99-Bottles-of-Beer/Prolog/99-bottles-of-beer-2.pro b/Task/99-Bottles-of-Beer/Prolog/99-bottles-of-beer-2.pro new file mode 100644 index 0000000000..996a5d7fbf --- /dev/null +++ b/Task/99-Bottles-of-Beer/Prolog/99-bottles-of-beer-2.pro @@ -0,0 +1,19 @@ +line1(X):- line2(X),write(' on the wall'). +line2(0):- write('no more bottles of beer'). +line2(1):- write('1 bottle of beer'). +line2(X):- writef('%t bottles of beer',[X]). +line3(1):- write('Take it down, pass it around'). +line3(X):- write('Take one down, pass it around'). +line4(X):- line1(X). + +bottles(0):-!. +bottles(X):- + succ(XN,X), + line1(X),nl, + line2(X),nl, + line3(X),nl, + line4(XN),nl,nl, + !, + bottles(XN). + +:- bottles(99). diff --git a/Task/99-Bottles-of-Beer/Python/99-bottles-of-beer-1.py b/Task/99-Bottles-of-Beer/Python/99-bottles-of-beer-1.py new file mode 100644 index 0000000000..de0103c5aa --- /dev/null +++ b/Task/99-Bottles-of-Beer/Python/99-bottles-of-beer-1.py @@ -0,0 +1,14 @@ +def plural(word, amount): # Correctly pluralize a word. + if amount == 1: + return word + else: + return word + 's' + +def sing(b, end): # Sing a phrase of the song, for b bottles, ending in end + print b or 'No more', plural('bottle', b), end + +for i in range(99, 0, -1): + sing(i, 'of beer on the wall,') + sing(i, 'of beer,') + print 'Take one down, pass it around,' + sing(i-1, 'of beer on the wall.\n') diff --git a/Task/99-Bottles-of-Beer/Python/99-bottles-of-beer-2.py b/Task/99-Bottles-of-Beer/Python/99-bottles-of-beer-2.py new file mode 100644 index 0000000000..0b8ed8e4c9 --- /dev/null +++ b/Task/99-Bottles-of-Beer/Python/99-bottles-of-beer-2.py @@ -0,0 +1,9 @@ +verse = '''\ +%i bottles of beer on the wall +%i bottles of beer +Take one down, pass it around +%i bottles of beer on the wall +''' + +for bottles in range(99,0,-1): + print verse % (bottles, bottles, bottles-1) diff --git a/Task/99-Bottles-of-Beer/Python/99-bottles-of-beer-3.py b/Task/99-Bottles-of-Beer/Python/99-bottles-of-beer-3.py new file mode 100644 index 0000000000..e3844fad8d --- /dev/null +++ b/Task/99-Bottles-of-Beer/Python/99-bottles-of-beer-3.py @@ -0,0 +1,9 @@ +verse = '''\ +{some} bottles of beer on the wall +{some} bottles of beer +Take one down, pass it around +{less} bottles of beer on the wall +''' + +for bottles in range(99,0,-1): + print verse.format(some=bottles, less=bottles-1) diff --git a/Task/99-Bottles-of-Beer/Python/99-bottles-of-beer-4.py b/Task/99-Bottles-of-Beer/Python/99-bottles-of-beer-4.py new file mode 100644 index 0000000000..7d5e47be3f --- /dev/null +++ b/Task/99-Bottles-of-Beer/Python/99-bottles-of-beer-4.py @@ -0,0 +1,2 @@ +a, b, c, s = " bottles of beer", " on the wall\n", "Take one down, pass it around\n", str +print "\n".join(s(x)+a+b+s(x)+a+"\n"+c+s(x-1)+a+b for x in xrange(99, 0, -1)) diff --git a/Task/99-Bottles-of-Beer/Python/99-bottles-of-beer-5.py b/Task/99-Bottles-of-Beer/Python/99-bottles-of-beer-5.py new file mode 100644 index 0000000000..8324e1645a --- /dev/null +++ b/Task/99-Bottles-of-Beer/Python/99-bottles-of-beer-5.py @@ -0,0 +1,2 @@ +a = lambda n: "%u bottle%s of beer on the wall\n" % (n, "s"[n==1:]) +print "\n".join(a(x)+a(x)[:-13]+"\nTake one down, pass it around\n"+a(x-1) for x in xrange(99, 0, -1)) diff --git a/Task/99-Bottles-of-Beer/Python/99-bottles-of-beer-6.py b/Task/99-Bottles-of-Beer/Python/99-bottles-of-beer-6.py new file mode 100644 index 0000000000..3cd3b209d1 --- /dev/null +++ b/Task/99-Bottles-of-Beer/Python/99-bottles-of-beer-6.py @@ -0,0 +1,14 @@ +#!/usr/bin/env python3 +"""\ +{0} {2} of beer on the wall +{0} {2} of beer +Take one down, pass it around +{1} {3} of beer on the wall +""" +print("\n".join( + __doc__.format( + i, i - 1, + "bottle" if i == 1 else "bottles", + "bottle" if i - 1 == 1 else "bottles" + ) for i in range(99, 0, -1) +), end="") diff --git a/Task/99-Bottles-of-Beer/Python/99-bottles-of-beer-7.py b/Task/99-Bottles-of-Beer/Python/99-bottles-of-beer-7.py new file mode 100644 index 0000000000..614f67c2e8 --- /dev/null +++ b/Task/99-Bottles-of-Beer/Python/99-bottles-of-beer-7.py @@ -0,0 +1,39 @@ +ones = ( +'', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine' +) +prefixes = ('thir', 'four', 'fif', 'six', 'seven', 'eigh', 'nine') +tens = ['', '', 'twenty' ] +teens = ['ten', 'eleven', 'twelve'] +for prefix in prefixes: + tens.append(prefix + 'ty') + teens.append(prefix +'teen') +tens[4] = 'forty' + +def number(num): + "get the wordy version of a number" + ten, one = divmod(num, 10) + if ten == 0 and one == 0: + return 'no' + elif ten == 0: + return ones[one] + elif ten == 1: + return teens[one] + elif one == 0: + return tens[ten] + else: + return "%s-%s" % (tens[ten], ones[one]) + +def bottles(beer): + "our rephrase" + return "%s bottle%s of beer" % ( + number(beer).capitalize(), 's' if beer > 1 else '' + ) + +onthewall = 'on the wall' +takeonedown = 'Take one down, pass it around' +for beer in range(99, 0, -1): + print bottles(beer), onthewall + print bottles(beer) + print takeonedown + print bottles(beer-1), onthewall + print diff --git a/Task/99-Bottles-of-Beer/Python/99-bottles-of-beer-8.py b/Task/99-Bottles-of-Beer/Python/99-bottles-of-beer-8.py new file mode 100644 index 0000000000..930169b060 --- /dev/null +++ b/Task/99-Bottles-of-Beer/Python/99-bottles-of-beer-8.py @@ -0,0 +1,7 @@ +for n in xrange(99, 0, -1): + ## The formatting performs a conditional check on the variable. + ## If it formats the first open for False, and the second for True + print n, 'bottle%s of beer on the the wall.' % ('s', '')[n == 1] + print n, 'bottle%s of beer.' % ('s', '')[n == 1] + print 'Take one down, pass it around.' + print n - 1, 'bottle%s of beer on the wall.\n' % ('s', '')[n - 1 == 1] diff --git a/Task/99-Bottles-of-Beer/R/99-bottles-of-beer-1.r b/Task/99-Bottles-of-Beer/R/99-bottles-of-beer-1.r new file mode 100644 index 0000000000..ff73b7fb20 --- /dev/null +++ b/Task/99-Bottles-of-Beer/R/99-bottles-of-beer-1.r @@ -0,0 +1,16 @@ +#a naive function to sing for N bottles of beer... + +song = function(bottles){ + + for(i in bottles:1){ #for every integer bottles, bottles-1 ... 1 + + cat(bottles," bottles of beer on the wall \n",bottles," bottles of beer \nTake one down, pass it around \n", + bottles-1, " bottles of beer on the wall \n"," \n" ,sep="") #join and print the text (\n means new line) + + bottles = bottles - 1 #take one down... + + } + +} + +song(99)#play the song by calling the function diff --git a/Task/99-Bottles-of-Beer/R/99-bottles-of-beer-2.r b/Task/99-Bottles-of-Beer/R/99-bottles-of-beer-2.r new file mode 100644 index 0000000000..6e1f3d6005 --- /dev/null +++ b/Task/99-Bottles-of-Beer/R/99-bottles-of-beer-2.r @@ -0,0 +1,5 @@ +#only one line! +cat(paste(99:1,ifelse((99:1)!=1," bottles"," bottle")," of beer on the wall\n",99:1,ifelse((99:1)!=1," bottles"," bottle")," of beer\n","Take one down, pass it around\n",98:0,ifelse((98:0)!=1," bottles"," bottle")," of beer on the wall\n\n",sep=""),sep="") + +#alternative +cat(paste(lapply(99:1,function(i){paste(paste(rep(paste(i,' bottle',if(i!=1)'s',' of beer',sep=''),2),collapse =' on the wall\n'),'Take one down, pass it around',paste(i-1,' bottle',if(i!=2)'s',' of beer on the wall',sep=''), sep='\n')}),collapse='\n\n')) diff --git a/Task/99-Bottles-of-Beer/REXX/99-bottles-of-beer.rexx b/Task/99-Bottles-of-Beer/REXX/99-bottles-of-beer.rexx new file mode 100644 index 0000000000..eb77bd2cd5 --- /dev/null +++ b/Task/99-Bottles-of-Beer/REXX/99-bottles-of-beer.rexx @@ -0,0 +1,19 @@ +/*REXX pgm displays words to the song "99 Bottles of Beer on the Wall". */ + + do j=99 by -1 to 1 /*start countdown | singdown*/ + say j 'bottle's(j) "of beer on the wall," /*sing the #bottles of beer.*/ + say j 'bottle's(j) "of beer." /* ... and the refrain. */ + say 'Take one down, pass it around,' /*get a bottle and share it.*/ + n=j-1 /*N is #bottles we have now.*/ + if n==0 then n='no' /*use "no" instead of 0. */ + say n 'bottle's(n) "of beer on the wall." /*sing beer bottle inventory*/ + say /*blank line between verses.*/ + end /*j*/ + +say 'No more bottles of beer on the wall,' /*Finally! The last verse.*/ +say 'no more bottles of beer.' /*so sad ... */ +say 'Go to the store and buy some more,' /*replenishment of the beer.*/ +say '99 bottles of beer on the wall.' /*All is well in the tavern.*/ +exit /*we're done & also sloshed.*/ +/*───────────────────────────────────S subroutine───────────────────────*/ +s: if arg(1)=1 then return ''; return 's' /*a simple pluralizer funct.*/ diff --git a/Task/99-Bottles-of-Beer/Racket/99-bottles-of-beer.rkt b/Task/99-Bottles-of-Beer/Racket/99-bottles-of-beer.rkt new file mode 100644 index 0000000000..1f56319152 --- /dev/null +++ b/Task/99-Bottles-of-Beer/Racket/99-bottles-of-beer.rkt @@ -0,0 +1,11 @@ +#lang racket + +(define (plural n) + (string-append (number->string n) " bottle" (if (equal? n 1) "" "s"))) + +(define (sing bottles) + (printf "~a of beer on the wall\n~a of beer\nTake on down, pass it around\n~a of beer on the wall\n\n" + (plural bottles) (plural bottles) (plural (sub1 bottles)))) + +(for ((i (in-range 100 0 -1))) + (sing i)) diff --git a/Task/99-Bottles-of-Beer/Ruby/99-bottles-of-beer-1.rb b/Task/99-Bottles-of-Beer/Ruby/99-bottles-of-beer-1.rb new file mode 100644 index 0000000000..d6dc5973d5 --- /dev/null +++ b/Task/99-Bottles-of-Beer/Ruby/99-bottles-of-beer-1.rb @@ -0,0 +1,13 @@ +plural = 's' +99.downto(1) do |i| + puts "#{i} bottle#{plural} of beer on the wall," + puts "#{i} bottle#{plural} of beer" + puts "Take one down, pass it around!" + plural = '' if i - 1 == 1 + if i > 1 + puts "#{i-1} bottle#{plural} of beer on the wall!" + puts + else + puts "No more bottles of beer on the wall!" + end +end diff --git a/Task/99-Bottles-of-Beer/Ruby/99-bottles-of-beer-2.rb b/Task/99-Bottles-of-Beer/Ruby/99-bottles-of-beer-2.rb new file mode 100644 index 0000000000..855400814d --- /dev/null +++ b/Task/99-Bottles-of-Beer/Ruby/99-bottles-of-beer-2.rb @@ -0,0 +1,12 @@ +trace_var :$bottle_num do |val| + $bottles = %Q{#{val == 0 ? 'No more' : val.to_s} bottle#{val == 1 ? '' : 's'}} +end + +($bottle_num = 99).times do + puts "#{$bottles} of beer on the wall" + puts "#{$bottles} of beer" + puts "Take one down, pass it around" + $bottle_num -= 1 + puts "#{$bottles} of beer on the wall" + puts "" +end diff --git a/Task/99-Bottles-of-Beer/Ruby/99-bottles-of-beer-3.rb b/Task/99-Bottles-of-Beer/Ruby/99-bottles-of-beer-3.rb new file mode 100644 index 0000000000..1b2e9bdda7 --- /dev/null +++ b/Task/99-Bottles-of-Beer/Ruby/99-bottles-of-beer-3.rb @@ -0,0 +1,15 @@ +def bottles(of_beer, ending) + puts "#{of_beer} bottle#{ending} of beer on the wall," + puts "#{of_beer} bottle#{ending} of beer" + puts "Take one down, pass it around!" +end + +99.downto(0) do |left| + if left > 1 + bottles(left, "s") + elsif left == 1 + bottles(left, "") + else + puts "No more bottles of beer on the wall!" + end +end diff --git a/Task/99-Bottles-of-Beer/Ruby/99-bottles-of-beer-4.rb b/Task/99-Bottles-of-Beer/Ruby/99-bottles-of-beer-4.rb new file mode 100644 index 0000000000..04a2d53e2c --- /dev/null +++ b/Task/99-Bottles-of-Beer/Ruby/99-bottles-of-beer-4.rb @@ -0,0 +1,14 @@ +def bottles(beer, wall = false) + "#{beer>0 ? beer : "no more"} bottle#{"s" if beer!=1} of beer#{" on the wall" if wall}" +end + +99.downto(0) do |remaining| + puts "#{bottles(remaining,true).capitalize}, #{bottles(remaining)}." + if remaining==0 + print "Go to the store and buy some more" + remaining=100 + else + print "Take one down, pass it around" + end + puts ", #{bottles(remaining-1,true)}.\n\n" +end diff --git a/Task/99-Bottles-of-Beer/SNUSP/99-bottles-of-beer.snusp b/Task/99-Bottles-of-Beer/SNUSP/99-bottles-of-beer.snusp new file mode 100644 index 0000000000..67356a27ff --- /dev/null +++ b/Task/99-Bottles-of-Beer/SNUSP/99-bottles-of-beer.snusp @@ -0,0 +1,19 @@ + /=!/===========!/==+++++++++# +9 + | | /=!/=====@/==@@@+@+++++# +48 (itoa) + | | | | /==!/==@@@@=++++# +32 (space) + | | | | | \==@@++\!+++++++++++++\!+++++\ + 9 9 '9 9' space 'b' 'o' 't' + $@/>@/>@/>@/>@/>========@/>============@/>====@/>++++++++++ \n setup +/====================================loop=====>\!=>\!<<<<<<<< / +\@\@\>cr.@\< ?\<->+++++++++>->+++++++++\ | | + ! | | \===-========>=>-==BCD==!\< @\< ?/< ?/# no more beer! + /=|=====|================================/ + | | \<++t.<<----a.>----k.<++++e.<_.>>++++o.-n.< e.<_.>-d.>+o.>+++w.<-n.<<_.\ + | | / / + | | \>---a.>n.<+++d.<_.>>++p.<---a.>>----s.s.<<<_.>>-------i.>+t.<<<_.\ + | | / / + | | \>a.>>--r.<++++++o.>+++u.<-n.<+++d.>>>cr.<-T<+O<--B<<<# + | ! + \@\<<<_.>>o.-n.<<_.>>>++t.<<+++h.---e.<_.>>>+++w.<<----a.>--l.l.>>CR.<---T<+++O<+B<<<# + | + \9.>9.>_.>B.>O.>T.t.<---l.<+++e.>>-s.<<<_.>>+++O.<+f.<_.>----b.+++e.E.>>-R.# diff --git a/Task/99-Bottles-of-Beer/Sather/99-bottles-of-beer.sa b/Task/99-Bottles-of-Beer/Sather/99-bottles-of-beer.sa new file mode 100644 index 0000000000..4c34fe298b --- /dev/null +++ b/Task/99-Bottles-of-Beer/Sather/99-bottles-of-beer.sa @@ -0,0 +1,14 @@ +class MAIN is + main is + s :STR; + p1 ::= "<##> bottle<#> of beer"; + w ::= " on the wall"; + t ::= "Take one down, pass it around\n"; + loop i ::= 99.downto!(0); + if i /= 1 then s := "s" else s := ""; end; + #OUT + #FMT(p1 + w + "\n", i, "s"); + #OUT + #FMT(p1 + "\n", i, "s"); + if i > 0 then #OUT + t; end; + end; + end; +end; diff --git a/Task/99-Bottles-of-Beer/Scheme/99-bottles-of-beer.ss b/Task/99-Bottles-of-Beer/Scheme/99-bottles-of-beer.ss new file mode 100644 index 0000000000..f05d51e6a0 --- /dev/null +++ b/Task/99-Bottles-of-Beer/Scheme/99-bottles-of-beer.ss @@ -0,0 +1,7 @@ +(define (bottles x) + (format #t "~a bottles of beer on the wall~%" x) + (format #t "~a bottles of beer~%" x) + (format #t "Take one down, pass it around~%") + (format #t "~a bottles of beer on the wall~%" (- x 1)) + (if (> (- x 1) 0) + (bottles (- x 1)))) diff --git a/Task/99-Bottles-of-Beer/Smalltalk/99-bottles-of-beer.st b/Task/99-Bottles-of-Beer/Smalltalk/99-bottles-of-beer.st new file mode 100644 index 0000000000..6209118238 --- /dev/null +++ b/Task/99-Bottles-of-Beer/Smalltalk/99-bottles-of-beer.st @@ -0,0 +1,15 @@ +Smalltalk at: #sr put: 0 ; at: #s put: 0 ! +sr := Dictionary new. +sr at: 0 put: ' bottle' ; + at: 1 put: ' bottles' ; + at: 2 put: ' of beer' ; + at: 3 put: ' on the wall' ; + at: 4 put: 'Take one down, pass it around' ! +99 to: 0 by: -1 do: [:v | v print. + ( v == 1 ) ifTrue: [ s := 0. ] + ifFalse: [ s := 1. ]. + Transcript show: (sr at:s) ; show: (sr at:2) ; show: (sr at:3) ; cr. + v print. + Transcript show: (sr at:s) ; show: (sr at:2) ; cr. + (v ~~ 0) ifTrue: [ Transcript show: (sr at:4) ; cr. ]. + ]. diff --git a/Task/99-Bottles-of-Beer/Tcl/99-bottles-of-beer-1.tcl b/Task/99-Bottles-of-Beer/Tcl/99-bottles-of-beer-1.tcl new file mode 100644 index 0000000000..f6ccf91bd9 --- /dev/null +++ b/Task/99-Bottles-of-Beer/Tcl/99-bottles-of-beer-1.tcl @@ -0,0 +1,10 @@ +set s "s"; set ob "of beer"; set otw "on the wall"; set more "Take one down and pass it around" +for {set n 100} {$n ne "No more"} {} { + switch -- [incr n -1] { + 1 {set s ""} + 0 {set s "s"; set n "No more"; set more "Go to the store and buy some more"} + } + lappend verse ". $n bottle$s $ob $otw.\n" + lappend verse "\n$n bottle$s $ob $otw, [string tolower $n] bottle$s $ob.\n$more" +} +puts -nonewline [join [lreplace $verse 0 0] ""][lindex $verse 0] diff --git a/Task/99-Bottles-of-Beer/Tcl/99-bottles-of-beer-2.tcl b/Task/99-Bottles-of-Beer/Tcl/99-bottles-of-beer-2.tcl new file mode 100644 index 0000000000..1bf1a247c2 --- /dev/null +++ b/Task/99-Bottles-of-Beer/Tcl/99-bottles-of-beer-2.tcl @@ -0,0 +1,28 @@ +proc 0-19 {n} { + lindex {"no more" one two three four five six seven eight nine ten eleven + twelve thirteen fourteen fifteen sixteen seventeen eighteen nineteen} $n +} + +proc TENS {n} { + lindex {twenty thirty fourty fifty sixty seventy eighty ninety} [expr {$n - 2}] +} + +proc num2words {n} { + if {$n < 20} {return [0-19 $n]} + set tens [expr {$n / 10}] + set ones [expr {$n % 10}] + if {$ones == 0} {return [TENS $tens]} + return "[TENS $tens]-[0-19 $ones]" +} + +proc get_words {n} { + return "[num2words $n] bottle[expr {$n != 1 ? "s" : ""}] of beer" +} + +for {set i 99} {$i > 0} {incr i -1} { + puts [string totitle "[get_words $i] on the wall, [get_words $i]."] + puts "Take one down and pass it around, [get_words [expr {$i - 1}]] on the wall.\n" +} + +puts "No more bottles of beer on the wall, no more bottles of beer." +puts "Go to the store and buy some more, 99 bottles of beer on the wall." diff --git a/Task/Ackermann-function/0DESCRIPTION b/Task/Ackermann-function/0DESCRIPTION new file mode 100644 index 0000000000..c270cadb62 --- /dev/null +++ b/Task/Ackermann-function/0DESCRIPTION @@ -0,0 +1,12 @@ +The '''[[wp:Ackermann function|Ackermann function]]''' is a classic recursive example in computer science. It is a function that grows very quickly (in its value and in the size of its call tree). It is defined as follows: + +: A(m, n) = + \begin{cases} + n+1 & \mbox{if } m = 0 \\ + A(m-1, 1) & \mbox{if } m > 0 \mbox{ and } n = 0 \\ + A(m-1, A(m, n-1)) & \mbox{if } m > 0 \mbox{ and } n > 0. + \end{cases} + + + +Its arguments are never negative and it always terminates. Write a function which returns the value of A(m, n). Arbitrary precision is preferred (since the function grows so quickly), but not required. diff --git a/Task/Ackermann-function/1META.yaml b/Task/Ackermann-function/1META.yaml new file mode 100644 index 0000000000..890caf4e99 --- /dev/null +++ b/Task/Ackermann-function/1META.yaml @@ -0,0 +1,5 @@ +--- +category: +- Memoization +- Classic CS problems and programs +note: Recursion diff --git a/Task/Ackermann-function/ABAP/ackermann-function.abap b/Task/Ackermann-function/ABAP/ackermann-function.abap new file mode 100644 index 0000000000..c449db95dc --- /dev/null +++ b/Task/Ackermann-function/ABAP/ackermann-function.abap @@ -0,0 +1,45 @@ +REPORT zhuberv_ackermann. + +CLASS zcl_ackermann DEFINITION. + PUBLIC SECTION. + CLASS-METHODS ackermann IMPORTING m TYPE i + n TYPE i + RETURNING value(v) TYPE i. +ENDCLASS. "zcl_ackermann DEFINITION + + +CLASS zcl_ackermann IMPLEMENTATION. + + METHOD: ackermann. + + DATA: lv_new_m TYPE i, + lv_new_n TYPE i. + + IF m = 0. + v = n + 1. + ELSEIF m > 0 AND n = 0. + lv_new_m = m - 1. + lv_new_n = 1. + v = ackermann( m = lv_new_m n = lv_new_n ). + ELSEIF m > 0 AND n > 0. + lv_new_m = m - 1. + + lv_new_n = n - 1. + lv_new_n = ackermann( m = m n = lv_new_n ). + + v = ackermann( m = lv_new_m n = lv_new_n ). + ENDIF. + + ENDMETHOD. "ackermann + +ENDCLASS. "zcl_ackermann IMPLEMENTATION + + +PARAMETERS: pa_m TYPE i, + pa_n TYPE i. + +DATA: lv_result TYPE i. + +START-OF-SELECTION. + lv_result = zcl_ackermann=>ackermann( m = pa_m n = pa_n ). + WRITE: / lv_result. diff --git a/Task/Ackermann-function/AWK/ackermann-function.awk b/Task/Ackermann-function/AWK/ackermann-function.awk new file mode 100644 index 0000000000..91c20e0931 --- /dev/null +++ b/Task/Ackermann-function/AWK/ackermann-function.awk @@ -0,0 +1,18 @@ +function ackermann(m, n) +{ + if ( m == 0 ) { + return n+1 + } + if ( n == 0 ) { + return ackermann(m-1, 1) + } + return ackermann(m-1, ackermann(m, n-1)) +} + +BEGIN { + for(n=0; n < 7; n++) { + for(m=0; m < 4; m++) { + print "A(" m "," n ") = " ackermann(m,n) + } + } +} diff --git a/Task/Ackermann-function/ActionScript/ackermann-function.as b/Task/Ackermann-function/ActionScript/ackermann-function.as new file mode 100644 index 0000000000..0caa027f75 --- /dev/null +++ b/Task/Ackermann-function/ActionScript/ackermann-function.as @@ -0,0 +1,13 @@ +public function ackermann(m:uint, n:uint):uint +{ + if (m == 0) + { + return n + 1; + } + if (n == 0) + { + return ackermann(m - 1, 1); + } + + return ackermann(m - 1, ackermann(m, n - 1)); +} diff --git a/Task/Ackermann-function/Ada/ackermann-function.ada b/Task/Ackermann-function/Ada/ackermann-function.ada new file mode 100644 index 0000000000..bbabde3783 --- /dev/null +++ b/Task/Ackermann-function/Ada/ackermann-function.ada @@ -0,0 +1,21 @@ +with Ada.Text_IO; use Ada.Text_IO; + +procedure Test_Ackermann is + function Ackermann (M, N : Natural) return Natural is + begin + if M = 0 then + return N + 1; + elsif N = 0 then + return Ackermann (M - 1, 1); + else + return Ackermann (M - 1, Ackermann (M, N - 1)); + end if; + end Ackermann; +begin + for M in 0..3 loop + for N in 0..6 loop + Put (Natural'Image (Ackermann (M, N))); + end loop; + New_Line; + end loop; +end Test_Ackermann; diff --git a/Task/Ackermann-function/BASIC/ackermann-function.bas b/Task/Ackermann-function/BASIC/ackermann-function.bas new file mode 100644 index 0000000000..cdd53f134e --- /dev/null +++ b/Task/Ackermann-function/BASIC/ackermann-function.bas @@ -0,0 +1,12 @@ +DECLARE FUNCTION ack! (m!, n!) + +FUNCTION ack (m!, n!) + IF m = 0 THEN ack = n + 1 + + IF m > 0 AND n = 0 THEN + ack = ack(m - 1, 1) + END IF + IF m > 0 AND n > 0 THEN + ack = ack(m - 1, ack(m, n - 1)) + END IF +END FUNCTION diff --git a/Task/Ackermann-function/Babel/ackermann-function.pb b/Task/Ackermann-function/Babel/ackermann-function.pb new file mode 100644 index 0000000000..4b841dfa87 --- /dev/null +++ b/Task/Ackermann-function/Babel/ackermann-function.pb @@ -0,0 +1,53 @@ +main: + {((0 0) (0 1) (0 2) + (0 3) (0 4) (1 0) + (1 1) (1 2) (1 3) + (1 4) (2 0) (2 1) + (2 2) (2 3) (3 0) + (3 1) (3 2) (4 0)) + + { dup + "A(" << { %d " " . << } ... ") = " << + reverse give + ack + %d cr << } ... } + +ack!: + { dup zero? + { <-> dup zero? + { <-> + cp + 1 - + <- <- 1 - -> + ack -> + ack } + { <-> + 1 - + <- 1 -> + ack } + if } + { zap 1 + } + if } + +zero?!: { 0 = } + +Output: + +A(0 0 ) = 1 +A(0 1 ) = 2 +A(0 2 ) = 3 +A(0 3 ) = 4 +A(0 4 ) = 5 +A(1 0 ) = 2 +A(1 1 ) = 3 +A(1 2 ) = 4 +A(1 3 ) = 5 +A(1 4 ) = 6 +A(2 0 ) = 3 +A(2 1 ) = 5 +A(2 2 ) = 7 +A(2 3 ) = 9 +A(3 0 ) = 5 +A(3 1 ) = 13 +A(3 2 ) = 29 +A(4 0 ) = 13 diff --git a/Task/Ackermann-function/Befunge/ackermann-function.bf b/Task/Ackermann-function/Befunge/ackermann-function.bf new file mode 100644 index 0000000000..8ac2939324 --- /dev/null +++ b/Task/Ackermann-function/Befunge/ackermann-function.bf @@ -0,0 +1,8 @@ +r[1&&{0 +>v + j +u>.@ +1> \:v +^ v:\_$1+ +\^v_$1\1- +u^>1-0fp:1-\0fg101- diff --git a/Task/Ackermann-function/C/ackermann-function-1.c b/Task/Ackermann-function/C/ackermann-function-1.c new file mode 100644 index 0000000000..95d226d252 --- /dev/null +++ b/Task/Ackermann-function/C/ackermann-function-1.c @@ -0,0 +1,18 @@ +#include + +int ackermann(int m, int n) +{ + if (!m) return n + 1; + if (!n) return ackermann(m - 1, 1); + return ackermann(m - 1, ackermann(m, n - 1)); +} + +int main() +{ + int m, n; + for (m = 0; m <= 4; m++) + for (n = 0; n < 6 - m; n++) + printf("A(%d, %d) = %d\n", m, n, ackermann(m, n)); + + return 0; +} diff --git a/Task/Ackermann-function/C/ackermann-function-2.c b/Task/Ackermann-function/C/ackermann-function-2.c new file mode 100644 index 0000000000..4046392f61 --- /dev/null +++ b/Task/Ackermann-function/C/ackermann-function-2.c @@ -0,0 +1,41 @@ +#include +#include +#include + +int m_bits, n_bits; +int *cache; + +int ackermann(int m, int n) +{ + int idx, res; + if (!m) return n + 1; + + if (n >= 1< + if m is 0 then n + 1 + else if m > 0 and n is 0 then ackermann m - 1, 1 + else ackermann m - 1, ackermann m, n - 1 diff --git a/Task/Ackermann-function/Dylan/ackermann-function.dylan b/Task/Ackermann-function/Dylan/ackermann-function.dylan new file mode 100644 index 0000000000..6c79f966ba --- /dev/null +++ b/Task/Ackermann-function/Dylan/ackermann-function.dylan @@ -0,0 +1,6 @@ +define method ack(m == 0, n :: ) + n + 1 +end; +define method ack(m :: , n :: ) + ack(m - 1, if (n == 0) 1 else ack(m, n - 1) end) +end; diff --git a/Task/Ackermann-function/Eiffel/ackermann-function.e b/Task/Ackermann-function/Eiffel/ackermann-function.e new file mode 100644 index 0000000000..25a0bdd19a --- /dev/null +++ b/Task/Ackermann-function/Eiffel/ackermann-function.e @@ -0,0 +1,41 @@ +note + description: "Example of Ackerman function" + URI: "http://rosettacode.org/wiki/Ackermann_function" + +class + ACKERMAN_EXAMPLE + +create + make + +feature {NONE} -- Initialization + + make + do + print ("%N A(0,0):" + ackerman (0, 0).out) + print ("%N A(1,0):" + ackerman (1, 0).out) + print ("%N A(0,1):" + ackerman (0, 1).out) + print ("%N A(1,1):" + ackerman (1, 1).out) + print ("%N A(2,0):" + ackerman (2, 0).out) + print ("%N A(2,1):" + ackerman (2, 1).out) + print ("%N A(2,2):" + ackerman (2, 2).out) + print ("%N A(0,2):" + ackerman (0, 2).out) + print ("%N A(1,2):" + ackerman (1, 2).out) + print ("%N A(3,3):" + ackerman (3, 3).out) + print ("%N A(3,4):" + ackerman (3, 4).out) + end + +feature -- Access + + ackerman (m: NATURAL; n: NATURAL): NATURAL + do + if m = 0 then + Result := n + 1 + elseif m > 0 and n = 0 then + Result := ackerman (m - 1, 1) + elseif m > 0 and n > 0 then + Result := ackerman (m - 1, ackerman (m, n - 1)) + end + end + +end diff --git a/Task/Ackermann-function/Erlang/ackermann-function.erl b/Task/Ackermann-function/Erlang/ackermann-function.erl new file mode 100644 index 0000000000..d59d55aed7 --- /dev/null +++ b/Task/Ackermann-function/Erlang/ackermann-function.erl @@ -0,0 +1,11 @@ +-module(main). +-export([main/1]). + +main( [ A | [ B |[]]]) -> + io:fwrite("~p~n",[ack(toi(A),toi(B))]). + +toi(E) -> element(1,string:to_integer(E)). + +ack(0,N) -> N + 1; +ack(M,0) -> ack(M-1, 1); +ack(M,N) -> ack(M-1,ack(M,N-1)). diff --git a/Task/Ackermann-function/Forth/ackermann-function-1.fth b/Task/Ackermann-function/Forth/ackermann-function-1.fth new file mode 100644 index 0000000000..a6e6c303b9 --- /dev/null +++ b/Task/Ackermann-function/Forth/ackermann-function-1.fth @@ -0,0 +1,5 @@ +: acker ( m n -- u ) + over 0= IF nip 1+ EXIT THEN + swap 1- swap ( m-1 n -- ) + dup 0= IF 1+ recurse EXIT THEN + 1- over 1+ swap recurse recurse ; diff --git a/Task/Ackermann-function/Forth/ackermann-function-2.fth b/Task/Ackermann-function/Forth/ackermann-function-2.fth new file mode 100644 index 0000000000..ecb84779b3 --- /dev/null +++ b/Task/Ackermann-function/Forth/ackermann-function-2.fth @@ -0,0 +1,14 @@ +: ackermann ( m n -- u ) + over ( case statement) + 0 over = if drop nip 1+ else + 1 over = if drop nip 2 + else + 2 over = if drop nip 2* 3 + else + 3 over = if drop swap 5 + swap lshift 3 - else + drop swap 1- swap dup + if + 1- over 1+ swap recurse recurse exit + else + 1+ recurse exit \ allow tail recursion + then + then then then then +; diff --git a/Task/Ackermann-function/Fortran/ackermann-function.f b/Task/Ackermann-function/Fortran/ackermann-function.f new file mode 100644 index 0000000000..a58587772d --- /dev/null +++ b/Task/Ackermann-function/Fortran/ackermann-function.f @@ -0,0 +1,27 @@ +PROGRAM EXAMPLE + IMPLICIT NONE + + INTEGER :: i, j + + DO i = 0, 3 + DO j = 0, 6 + WRITE(*, "(I10)", ADVANCE="NO") Ackermann(i, j) + END DO + WRITE(*,*) + END DO + +CONTAINS + + RECURSIVE FUNCTION Ackermann(m, n) RESULT(ack) + INTEGER :: ack, m, n + + IF (m == 0) THEN + ack = n + 1 + ELSE IF (n == 0) THEN + ack = Ackermann(m - 1, 1) + ELSE + ack = Ackermann(m - 1, Ackermann(m, n - 1)) + END IF + END FUNCTION Ackermann + +END PROGRAM EXAMPLE diff --git a/Task/Ackermann-function/Go/ackermann-function-1.go b/Task/Ackermann-function/Go/ackermann-function-1.go new file mode 100644 index 0000000000..ea2c7a2614 --- /dev/null +++ b/Task/Ackermann-function/Go/ackermann-function-1.go @@ -0,0 +1,9 @@ +func Ackermann(m, n uint) uint { + switch { + case m == 0: + return n + 1 + case n == 0: + return Ackermann(m - 1, 1) + } + return Ackermann(m - 1, Ackermann(m, n - 1)) +} diff --git a/Task/Ackermann-function/Go/ackermann-function-2.go b/Task/Ackermann-function/Go/ackermann-function-2.go new file mode 100644 index 0000000000..33271a6aaf --- /dev/null +++ b/Task/Ackermann-function/Go/ackermann-function-2.go @@ -0,0 +1,15 @@ +func Ackermann2(m, n uint) uint { + switch { + case m == 0: + return n + 1 + case m == 1: + return n + 2 + case m == 2: + return 2*n + 3 + case m == 3: + return 8 << n - 3 + case n == 0: + return Ackermann2(m - 1, 1) + } + return Ackermann2(m - 1, Ackermann2(m, n - 1)) +} diff --git a/Task/Ackermann-function/Go/ackermann-function-3.go b/Task/Ackermann-function/Go/ackermann-function-3.go new file mode 100644 index 0000000000..dafdf5cea5 --- /dev/null +++ b/Task/Ackermann-function/Go/ackermann-function-3.go @@ -0,0 +1,53 @@ +package main + +import ( + "fmt" + "math/big" + "unsafe" +) + +var one = big.NewInt(1) +var two = big.NewInt(2) +var three = big.NewInt(3) +var eight = big.NewInt(8) +var u uint +var uBits = int(unsafe.Sizeof(u))*8 - 1 + +func Ackermann2(m, n *big.Int) *big.Int { + if m.Cmp(three) <= 0 { + switch m.Int64() { + case 0: + return new(big.Int).Add(n, one) + case 1: + return new(big.Int).Add(n, two) + case 2: + r := new(big.Int).Lsh(n, 1) + return r.Add(r, three) + case 3: + if n.BitLen() > uBits { + panic("way too big") + } + r := new(big.Int).Lsh(eight, uint(n.Int64())) + return r.Sub(r, three) + } + } + if n.BitLen() == 0 { + return Ackermann2(new(big.Int).Sub(m, one), one) + } + return Ackermann2(new(big.Int).Sub(m, one), + Ackermann2(m, new(big.Int).Sub(n, one))) +} + +func main() { + show(0, 0) + show(1, 2) + show(2, 4) + show(3, 100) + show(4, 1) + show(4, 3) +} + +func show(m, n int64) { + fmt.Printf("A(%d, %d) = ", m, n) + fmt.Println(Ackermann2(big.NewInt(m), big.NewInt(n))) +} diff --git a/Task/Ackermann-function/Haskell/ackermann-function-1.hs b/Task/Ackermann-function/Haskell/ackermann-function-1.hs new file mode 100644 index 0000000000..53f36fffb1 --- /dev/null +++ b/Task/Ackermann-function/Haskell/ackermann-function-1.hs @@ -0,0 +1,3 @@ +ack 0 n = n + 1 +ack m 0 = ack (m-1) 1 +ack m n = ack (m-1) (ack m (n-1)) diff --git a/Task/Ackermann-function/Haskell/ackermann-function-2.hs b/Task/Ackermann-function/Haskell/ackermann-function-2.hs new file mode 100644 index 0000000000..25b4cbf489 --- /dev/null +++ b/Task/Ackermann-function/Haskell/ackermann-function-2.hs @@ -0,0 +1,9 @@ +-- everything here are [Int] or [[Int]], which would overflow +-- * had it not overrun the stack first * +ackermann = iterate ack [1..] where + ack a = s where + s = a!!1 : f (tail a) (zipWith (-) s (1:s)) + f a (b:bs) = (head aa) : f aa bs where + aa = drop b a + +main = mapM_ print $ map (\n -> take (6 - n) $ ackermann !! n) [0..5] diff --git a/Task/Ackermann-function/Java/ackermann-function.java b/Task/Ackermann-function/Java/ackermann-function.java new file mode 100644 index 0000000000..55feb01b0a --- /dev/null +++ b/Task/Ackermann-function/Java/ackermann-function.java @@ -0,0 +1,8 @@ +import java.math.BigInteger; + +public static BigInteger ack(BigInteger m, BigInteger n) { + return m.equals(BigInteger.ZERO) + ? n.add(BigInteger.ONE) + : ack(m.subtract(BigInteger.ONE), + n.equals(BigInteger.ZERO) ? BigInteger.ONE : ack(m, n.subtract(BigInteger.ONE))); +} diff --git a/Task/Ackermann-function/JavaScript/ackermann-function.js b/Task/Ackermann-function/JavaScript/ackermann-function.js new file mode 100644 index 0000000000..8b07754850 --- /dev/null +++ b/Task/Ackermann-function/JavaScript/ackermann-function.js @@ -0,0 +1,4 @@ +function ack(m, n) +{ + return m === 0 ? n + 1 : ack(m - 1, n === 0 ? 1 : ack(m, n - 1)); +} diff --git a/Task/Ackermann-function/Lua/ackermann-function.lua b/Task/Ackermann-function/Lua/ackermann-function.lua new file mode 100644 index 0000000000..39e54d9b1c --- /dev/null +++ b/Task/Ackermann-function/Lua/ackermann-function.lua @@ -0,0 +1,5 @@ +function ack(M,N) + if M == 0 then return N + 1 end + if N == 0 then return ack(M-1,1) end + return ack(M-1,ack(M, N-1)) +end diff --git a/Task/Ackermann-function/PHP/ackermann-function.php b/Task/Ackermann-function/PHP/ackermann-function.php new file mode 100644 index 0000000000..80bde22702 --- /dev/null +++ b/Task/Ackermann-function/PHP/ackermann-function.php @@ -0,0 +1,15 @@ +function ackermann( $m , $n ) +{ + if ( $m==0 ) + { + return $n + 1; + } + elseif ( $n==0 ) + { + return ackermann( $m-1 , 1 ); + } + return ackermann( $m-1, ackermann( $m , $n-1 ) ); +} + +echo ackermann( 3, 4 ); +// prints 125 diff --git a/Task/Ackermann-function/Perl/ackermann-function-1.pl b/Task/Ackermann-function/Perl/ackermann-function-1.pl new file mode 100644 index 0000000000..8ff2769053 --- /dev/null +++ b/Task/Ackermann-function/Perl/ackermann-function-1.pl @@ -0,0 +1,13 @@ +{ + my @memo; + sub A { + my( $m, $n ) = @_; + $memo[ $m ][ $n ] and return $memo[ $m ][ $n ]; + $m or return $n + 1; + return $memo[ $m ][ $n ] = ( + $n + ? A( $m - 1, A( $m, $n - 1 ) ) + : A( $m - 1, 1 ) + ); + } +} diff --git a/Task/Ackermann-function/Perl/ackermann-function-2.pl b/Task/Ackermann-function/Perl/ackermann-function-2.pl new file mode 100644 index 0000000000..170af44845 --- /dev/null +++ b/Task/Ackermann-function/Perl/ackermann-function-2.pl @@ -0,0 +1,6 @@ +sub A { + my ($m, $n) = @_; + if ($m == 0) { $n + 1 } + elsif ($n == 0) { A($m - 1, 1) } + else { A($m - 1, A($m, $n - 1)) } +} diff --git a/Task/Ackermann-function/Perl/ackermann-function-3.pl b/Task/Ackermann-function/Perl/ackermann-function-3.pl new file mode 100644 index 0000000000..72fc9acaf6 --- /dev/null +++ b/Task/Ackermann-function/Perl/ackermann-function-3.pl @@ -0,0 +1,6 @@ +sub A { + my ($m, $n) = @_; + $m == 0 ? $n + 1 : + $n == 0 ? A($m - 1, 1) : + A($m - 1, A($m, $n - 1)) +} diff --git a/Task/Ackermann-function/PicoLisp/ackermann-function.l b/Task/Ackermann-function/PicoLisp/ackermann-function.l new file mode 100644 index 0000000000..e16bd5a491 --- /dev/null +++ b/Task/Ackermann-function/PicoLisp/ackermann-function.l @@ -0,0 +1,5 @@ +(de ack (X Y) + (cond + ((=0 X) (inc Y)) + ((=0 Y) (ack (dec X) 1)) + (T (ack (dec X) (ack X (dec Y)))) ) ) diff --git a/Task/Ackermann-function/Prolog/ackermann-function.pro b/Task/Ackermann-function/Prolog/ackermann-function.pro new file mode 100644 index 0000000000..73d8af0421 --- /dev/null +++ b/Task/Ackermann-function/Prolog/ackermann-function.pro @@ -0,0 +1,3 @@ +ack(0, N, Ans) :- Ans is N+1. +ack(M, 0, Ans) :- M>0, X is M-1, ack(X, 1, Ans). +ack(M, N, Ans) :- M>0, N>0, X is M-1, Y is N-1, ack(M, Y, Ans2), ack(X, Ans2, Ans). diff --git a/Task/Ackermann-function/Python/ackermann-function-1.py b/Task/Ackermann-function/Python/ackermann-function-1.py new file mode 100644 index 0000000000..6e11eb7085 --- /dev/null +++ b/Task/Ackermann-function/Python/ackermann-function-1.py @@ -0,0 +1,3 @@ +def ack1(M, N): + return (N + 1) if M == 0 else ( + ack1(M-1, 1) if N == 0 else ack1(M-1, ack1(M, N-1))) diff --git a/Task/Ackermann-function/Python/ackermann-function-2.py b/Task/Ackermann-function/Python/ackermann-function-2.py new file mode 100644 index 0000000000..0245d4e659 --- /dev/null +++ b/Task/Ackermann-function/Python/ackermann-function-2.py @@ -0,0 +1,7 @@ +def ack2(M, N): + if M == 0: + return N + 1 + elif N == 0: + return ack1(M - 1, 1) + else: + return ack1(M - 1, ack1(M, N - 1)) diff --git a/Task/Ackermann-function/Python/ackermann-function-3.py b/Task/Ackermann-function/Python/ackermann-function-3.py new file mode 100644 index 0000000000..a3a6d3d33d --- /dev/null +++ b/Task/Ackermann-function/Python/ackermann-function-3.py @@ -0,0 +1,10 @@ +>>> import sys +>>> sys.setrecursionlimit(3000) +>>> ack1(0,0) +1 +>>> ack1(3,4) +125 +>>> ack2(0,0) +1 +>>> ack2(3,4) +125 diff --git a/Task/Ackermann-function/Python/ackermann-function-4.py b/Task/Ackermann-function/Python/ackermann-function-4.py new file mode 100644 index 0000000000..a8279d05d7 --- /dev/null +++ b/Task/Ackermann-function/Python/ackermann-function-4.py @@ -0,0 +1,6 @@ +def ack2(M, N): + return (N + 1) if M == 0 else ( + (N + 2) if M == 1 else ( + (2*N + 3) if M == 2 else ( + (8*(2**N - 1) + 5) if M == 3 else ( + ack2(M-1, 1) if N == 0 else ack2(M-1, ack2(M, N-1)))))) diff --git a/Task/Ackermann-function/R/ackermann-function-1.r b/Task/Ackermann-function/R/ackermann-function-1.r new file mode 100644 index 0000000000..60c879ae66 --- /dev/null +++ b/Task/Ackermann-function/R/ackermann-function-1.r @@ -0,0 +1,9 @@ +ackermann <- function(m, n) { + if ( m == 0 ) { + n+1 + } else if ( n == 0 ) { + ackermann(m-1, 1) + } else { + ackermann(m-1, ackermann(m, n-1)) + } +} diff --git a/Task/Ackermann-function/R/ackermann-function-2.r b/Task/Ackermann-function/R/ackermann-function-2.r new file mode 100644 index 0000000000..300d6c4294 --- /dev/null +++ b/Task/Ackermann-function/R/ackermann-function-2.r @@ -0,0 +1,3 @@ +for ( i in 0:3 ) { + print(ackermann(i, 4)) +} diff --git a/Task/Ackermann-function/REXX/ackermann-function-1.rexx b/Task/Ackermann-function/REXX/ackermann-function-1.rexx new file mode 100644 index 0000000000..30e4659fb6 --- /dev/null +++ b/Task/Ackermann-function/REXX/ackermann-function-1.rexx @@ -0,0 +1,25 @@ +/*REXX program calculates/shows some values for the Ackermann function. */ + + /*Note: the Ackermann function (as implemented) is */ + /* higly recursive and is limited by the */ + /* biggest number that can have "1" added to */ + /* a number (successfully, accurately). */ +high=24 + do j=0 to 3; say + do k=0 to high%(max(1,j)) + call Ackermann_tell j,k + end /*k*/ + end /*j*/ +exit /*stick a fork in it, we're done.*/ +/*──────────────────────────────────ACKERMANN_TELL subroutine───────────*/ +ackermann_tell: parse arg mm,nn; calls=0 /*display an echo message.*/ +nnn=right(nn,length(high)) +say 'Ackermann('mm","nnn')='right(ackermann(mm,nn),high), + left('',12) 'calls='right(calls,high) +return +/*──────────────────────────────────ACKERMANN subroutine────────────────*/ +ackermann: procedure expose calls /*compute the Ackerman function. */ +parse arg m,n; calls=calls+1 +if m==0 then return n+1 +if n==0 then return ackermann(m-1,1) + return ackermann(m-1,ackermann(m,n-1)) diff --git a/Task/Ackermann-function/REXX/ackermann-function-2.rexx b/Task/Ackermann-function/REXX/ackermann-function-2.rexx new file mode 100644 index 0000000000..072ea29706 --- /dev/null +++ b/Task/Ackermann-function/REXX/ackermann-function-2.rexx @@ -0,0 +1,21 @@ +/*REXX program calculates/shows some values for the Ackermann function. */ +high=24 + do j=0 to 3; say + do k=0 to high%(max(1,j)) + call Ackermann_tell j,k + end /*k*/ + end /*j*/ +exit /*stick a fork in it, we're done.*/ +/*──────────────────────────────────ACKERMANN_TELL subroutine───────────*/ +ackermann_tell: parse arg mm,nn; calls=0 /*display an echo message.*/ +nnn=right(nn,length(high)) +say 'Ackermann('mm","nnn')='right(ackermann(mm,nn),high), + left('',12) 'calls='right(calls,10) +return +/*──────────────────────────────────ACKERMANN subroutine────────────────*/ +ackermann: procedure expose calls /*compute the Ackerman function. */ +parse arg m,n; calls=calls+1 +if m==0 then return n+1 +if n==0 then return ackermann(m-1,1) +if m==2 then return n*2+3 + return ackermann(m-1,ackermann(m,n-1)) diff --git a/Task/Ackermann-function/REXX/ackermann-function-3.rexx b/Task/Ackermann-function/REXX/ackermann-function-3.rexx new file mode 100644 index 0000000000..d4cecef861 --- /dev/null +++ b/Task/Ackermann-function/REXX/ackermann-function-3.rexx @@ -0,0 +1,36 @@ +/*REXX program calculates/shows some values for the Ackermann function. */ +high=24 +numeric digits 100 /*have REXX to use up to 100 digit integers.*/ + + /*When REXX raises a number to a power (via */ + /* the ** operator), the power must be an */ + /* integer (positive, zero, or negative). */ + + do j=0 to 4; say /*Ackermann(5,1) is a bit impractical to calc.*/ + do k=0 to high%(max(1,j)) + call Ackermann_tell j,k + if j==4 & k==2 then leave /*no sense in going overboard.*/ + end /*k*/ + end /*j*/ +exit /*stick a fork in it, we're done.*/ +/*──────────────────────────────────ACKERMANN_TELL subroutine───────────*/ +ackermann_tell: parse arg mm,nn; calls=0 /*display an echo message.*/ +nnn=right(nn,length(high)) +say 'Ackermann('mm","nnn')='right(ackermann(mm,nn),high), + left('',12) 'calls='right(calls,10) +return +/*──────────────────────────────────ACKERMANN subroutine────────────────*/ +ackermann: procedure expose calls /*compute the Ackerman function. */ +parse arg m,n; calls=calls+1 +if m==0 then return n+1 +if m==1 then return n+2 +if m==2 then return n+n+3 +if m==3 then return 2**(n+3)-3 +if m==4 then do; a=2 + do (n+3)-1 /*ugh!*/ + a=2**a + end + return a-3 + end +if n==0 then return ackermann(m-1,1) + return ackermann(m-1,ackermann(m,n-1)) diff --git a/Task/Ackermann-function/Racket/ackermann-function.rkt b/Task/Ackermann-function/Racket/ackermann-function.rkt new file mode 100644 index 0000000000..554373d035 --- /dev/null +++ b/Task/Ackermann-function/Racket/ackermann-function.rkt @@ -0,0 +1,7 @@ +#lang racket +(define (ackermann m n) + (cond [(zero? m) (add1 n)] + [(and (> m 0) (zero? n)) + (ackermann (sub1 m) 1)] + [(and (> m 0) (> n 0)) + (ackermann (sub1 m) (ackermann m (sub1 n)))])) diff --git a/Task/Ackermann-function/Ruby/ackermann-function-1.rb b/Task/Ackermann-function/Ruby/ackermann-function-1.rb new file mode 100644 index 0000000000..b60f0d44e9 --- /dev/null +++ b/Task/Ackermann-function/Ruby/ackermann-function-1.rb @@ -0,0 +1,9 @@ +def ack(m, n) + if m == 0 + n + 1 + elsif n == 0 + ack(m-1, 1) + else + ack(m-1, ack(m, n-1)) + end +end diff --git a/Task/Ackermann-function/Ruby/ackermann-function-2.rb b/Task/Ackermann-function/Ruby/ackermann-function-2.rb new file mode 100644 index 0000000000..15994be3e6 --- /dev/null +++ b/Task/Ackermann-function/Ruby/ackermann-function-2.rb @@ -0,0 +1,4 @@ +(0..3).each do |m| + (0..6).each { |n| print ack(m, n), ' ' } + puts +end diff --git a/Task/Ackermann-function/SNUSP/ackermann-function.snusp b/Task/Ackermann-function/SNUSP/ackermann-function.snusp new file mode 100644 index 0000000000..c85c68fd75 --- /dev/null +++ b/Task/Ackermann-function/SNUSP/ackermann-function.snusp @@ -0,0 +1,12 @@ + /==!/==atoi=@@@-@-----# + | | Ackermann function + | | /=========\!==\!====\ recursion: +$,@/>,@/==ack=!\?\<+# | | | A(0,j) -> j+1 + j i \-@/# | | A(i,0) -> A(i-1,1) + \@\>@\->@/@\<-@/# A(i,j) -> A(i-1,A(i,j-1)) + | | | + # # | | | /+<<<-\ + /-<<+>>\!=/ \=====|==!/========?\>>>=?/<<# + ? ? | \<<<+>+>>-/ + \>>+<<-/!==========/ + # # diff --git a/Task/Ackermann-function/Sather/ackermann-function-1.sa b/Task/Ackermann-function/Sather/ackermann-function-1.sa new file mode 100644 index 0000000000..035f9ab382 --- /dev/null +++ b/Task/Ackermann-function/Sather/ackermann-function-1.sa @@ -0,0 +1,19 @@ +class MAIN is + + ackermann(m, n:INT):INT + pre m >= 0 and n >= 0 + is + if m = 0 then return n + 1; end; + if n = 0 then return ackermann(m-1, 1); end; + return ackermann(m-1, ackermann(m, n-1)); + end; + + main is + n, m :INT; + loop n := 0.upto!(6); + loop m := 0.upto!(3); + #OUT + "A(" + m + ", " + n + ") = " + ackermann(m, n) + "\n"; + end; + end; + end; +end; diff --git a/Task/Ackermann-function/Sather/ackermann-function-2.sa b/Task/Ackermann-function/Sather/ackermann-function-2.sa new file mode 100644 index 0000000000..bdbd3d2f3e --- /dev/null +++ b/Task/Ackermann-function/Sather/ackermann-function-2.sa @@ -0,0 +1,19 @@ +class MAIN is + + ackermann(m, n:INTI):INTI is + zero ::= 0.inti; -- to avoid type conversion each time + one ::= 1.inti; + if m = zero then return n + one; end; + if n = zero then return ackermann(m-one, one); end; + return ackermann(m-one, ackermann(m, n-one)); + end; + + main is + n, m :INT; + loop n := 0.upto!(6); + loop m := 0.upto!(3); + #OUT + "A(" + m + ", " + n + ") = " + ackermann(m.inti, n.inti) + "\n"; + end; + end; + end; +end; diff --git a/Task/Ackermann-function/Scala/ackermann-function-1.scala b/Task/Ackermann-function/Scala/ackermann-function-1.scala new file mode 100644 index 0000000000..c2886c2fb2 --- /dev/null +++ b/Task/Ackermann-function/Scala/ackermann-function-1.scala @@ -0,0 +1,5 @@ +def ack(m: BigInt, n: BigInt): BigInt = { + if (m==0) n+1 + else if (n==0) ack(m-1, 1) + else ack(m-1, ack(m, n-1)) +} diff --git a/Task/Ackermann-function/Scala/ackermann-function-2.scala b/Task/Ackermann-function/Scala/ackermann-function-2.scala new file mode 100644 index 0000000000..7c2af8c321 --- /dev/null +++ b/Task/Ackermann-function/Scala/ackermann-function-2.scala @@ -0,0 +1,2 @@ +scala> for ( m <- 0 to 3; n <- 0 to 6 ) yield ack(m,n) +res0: Seq.Projection[BigInt] = RangeG(1, 2, 3, 4, 5, 6, 7, 2, 3, 4, 5, 6, 7, 8, 3, 5, 7, 9, 11, 13, 15, 5, 13, 29, 61, 125, 253, 509) diff --git a/Task/Ackermann-function/Scala/ackermann-function-3.scala b/Task/Ackermann-function/Scala/ackermann-function-3.scala new file mode 100644 index 0000000000..569da392e8 --- /dev/null +++ b/Task/Ackermann-function/Scala/ackermann-function-3.scala @@ -0,0 +1,40 @@ +val maxDepth = 4 + +val ackMMap = scala.collection.mutable.Map[BigInt, BigInt]() +val ackNMaps = Array.fill(maxDepth + 1) { scala.collection.mutable.Map[BigInt, BigInt]() } + +def ack(m: Int, n: BigInt): BigInt = { + if ((m < 0) || (n < 0)) { + throw new Exception("Negative parameters are not allowed: ack(%s, %s)".format(m, n)) + } + if (m > maxDepth) { + throw new Exception("First parameter is greater as %s: ack(%s, %s)".format(maxDepth, m, n)) + } + + val newM = m - 1 + val newN = n - 1 + + if (m == 0) { + n + 1 + } else if (n == 0) { + ackMMap.getOrElseUpdate(newM, ack(newM, 1)) + } else { + val createStep = 125 + val index = m + val mapCurrent = ackNMaps(index) + val mapPrevious = ackNMaps(index - 1) + val maxRecursion = 2 * createStep + val nrOfElements : BigInt = if (mapCurrent.isEmpty) 0 else mapCurrent.max._1 + + if ((nrOfElements + maxRecursion) < n) { + for (i <- nrOfElements + createStep to n by createStep) { + mapCurrent.getOrElseUpdate(i, ack(m, i)) + } + } + mapCurrent.getOrElseUpdate(n, { + val ackVal = mapCurrent.getOrElseUpdate(newN, ack(m, newN)) + + mapPrevious.getOrElseUpdate(ackVal, ack(newM, ackVal)) + }) + } +} diff --git a/Task/Ackermann-function/Scala/ackermann-function-4.scala b/Task/Ackermann-function/Scala/ackermann-function-4.scala new file mode 100644 index 0000000000..4f35e77f97 --- /dev/null +++ b/Task/Ackermann-function/Scala/ackermann-function-4.scala @@ -0,0 +1,5 @@ + if ((nrOfElements + maxRecursion) < n) { + for (i <- nrOfElements + createStep to n by createStep) { + mapCurrent.getOrElseUpdate(i, ack(m, i)) + } + } diff --git a/Task/Ackermann-function/Scheme/ackermann-function.ss b/Task/Ackermann-function/Scheme/ackermann-function.ss new file mode 100644 index 0000000000..0df3c1c4da --- /dev/null +++ b/Task/Ackermann-function/Scheme/ackermann-function.ss @@ -0,0 +1,5 @@ +(define (A m n) + (cond + ((= m 0) (+ n 1)) + ((= n 0) (A (- m 1) 1)) + (else (A (- m 1) (A m (- n 1)))))) diff --git a/Task/Ackermann-function/Smalltalk/ackermann-function.st b/Task/Ackermann-function/Smalltalk/ackermann-function.st new file mode 100644 index 0000000000..382b2e3f34 --- /dev/null +++ b/Task/Ackermann-function/Smalltalk/ackermann-function.st @@ -0,0 +1,15 @@ +|ackermann| +ackermann := [ :n :m | + (n = 0) ifTrue: [ (m + 1) ] + ifFalse: [ + (m = 0) ifTrue: [ ackermann value: (n-1) value: 1 ] + ifFalse: [ + ackermann value: (n-1) + value: ( ackermann value: n + value: (m-1) ) + ] + ] +]. + +(ackermann value: 0 value: 0) displayNl. +(ackermann value: 3 value: 4) displayNl. diff --git a/Task/Ackermann-function/Tcl/ackermann-function-1.tcl b/Task/Ackermann-function/Tcl/ackermann-function-1.tcl new file mode 100644 index 0000000000..e48b4a59e9 --- /dev/null +++ b/Task/Ackermann-function/Tcl/ackermann-function-1.tcl @@ -0,0 +1,9 @@ +proc ack {m n} { + if {$m == 0} { + expr {$n + 1} + } elseif {$n == 0} { + ack [expr {$m - 1}] 1 + } else { + ack [expr {$m - 1}] [ack $m [expr {$n - 1}]] + } +} diff --git a/Task/Ackermann-function/Tcl/ackermann-function-2.tcl b/Task/Ackermann-function/Tcl/ackermann-function-2.tcl new file mode 100644 index 0000000000..f04087533c --- /dev/null +++ b/Task/Ackermann-function/Tcl/ackermann-function-2.tcl @@ -0,0 +1,9 @@ +proc ack {m n} { + if {$m == 0} { + expr {$n + 1} + } elseif {$n == 0} { + tailcall ack [expr {$m - 1}] 1 + } else { + tailcall ack [expr {$m - 1}] [ack $m [expr {$n - 1}]] + } +} diff --git a/Task/Ackermann-function/Tcl/ackermann-function-3.tcl b/Task/Ackermann-function/Tcl/ackermann-function-3.tcl new file mode 100644 index 0000000000..8e8a89ced6 --- /dev/null +++ b/Task/Ackermann-function/Tcl/ackermann-function-3.tcl @@ -0,0 +1,55 @@ +package require Tcl 8.6 + +# A memoization engine, from http://wiki.tcl.tk/18152 +oo::class create cache { + filter Memoize + variable ValueCache + method Memoize args { + # Do not filter the core method implementations + if {[lindex [self target] 0] eq "::oo::object"} { + return [next {*}$args] + } + + # Check if the value is already in the cache + set key [self target],$args + if {[info exist ValueCache($key)]} { + return $ValueCache($key) + } + + # Compute value, insert into cache, and return it + return [set ValueCache($key) [next {*}$args]] + } + method flushCache {} { + unset ValueCache + # Skip the cacheing + return -level 2 "" + } +} + +# Make an object, attach the cache engine to it, and define ack as a method +oo::object create cached +oo::objdefine cached { + mixin cache + method ack {m n} { + if {$m==0} { + expr {$n+1} + } elseif {$m==1} { + # From the Mathematica version + expr {$m+2} + } elseif {$m==2} { + # From the Mathematica version + expr {2*$n+3} + } elseif {$m==3} { + # From the Mathematica version + expr {8*(2**$n-1)+5} + } elseif {$n==0} { + tailcall my ack [expr {$m-1}] 1 + } else { + tailcall my ack [expr {$m-1}] [my ack $m [expr {$n-1}]] + } + } +} + +# Some small tweaks... +interp recursionlimit {} 100000 +interp alias {} ack {} cacheable ack diff --git a/Task/Anagrams/ABAP/anagrams.abap b/Task/Anagrams/ABAP/anagrams.abap new file mode 100644 index 0000000000..90285cf840 --- /dev/null +++ b/Task/Anagrams/ABAP/anagrams.abap @@ -0,0 +1,102 @@ +report zz_anagrams no standard page heading. +define update_progress. + call function 'SAPGUI_PROGRESS_INDICATOR' + exporting + text = &1. +end-of-definition. + +" Selection screen segment allowing the person to choose which file will act as input. +selection-screen begin of block file_choice. + parameters p_file type string lower case. +selection-screen end of block file_choice. + +" When the user requests help with input, run the routine to allow them to navigate the presentation server. +at selection-screen on value-request for p_file. + perform getfile using p_file. + +at selection-screen output. + %_p_file_%_app_%-text = 'Input File: '. + +start-of-selection. + data: gt_data type table of string. + + " Read the specified file from the presentation server into memory. + perform readfile using p_file changing gt_data. + " After the file has been read into memory, loop through it line-by-line and make anagrams. + perform anagrams using gt_data. + +" Subroutine for generating a list of anagrams. +" The supplied input is a table, with each entry corresponding to a word. +form anagrams using it_data like gt_data. + types begin of ty_map. + types key type string. + types value type string. + types end of ty_map. + + data: lv_char type c, + lv_len type i, + lv_string type string, + ls_entry type ty_map, + lt_anagrams type standard table of ty_map, + lt_c_tab type table of string. + + field-symbols: type string. + " Loop through each word in the table, and make an associative array. + loop at gt_data assigning . + " First, we need to re-order the word alphabetically. This generated a key. All anagrams will use this same key. + " Add each character to a table, which we will then sort alphabetically. + lv_len = strlen( ). + refresh lt_c_tab. + do lv_len times. + lv_len = sy-index - 1. + append +lv_len(1) to lt_c_tab. + enddo. + sort lt_c_tab as text. + " Now append the characters to a string and add it as a key into the map. + clear lv_string. + loop at lt_c_tab into lv_char. + concatenate lv_char lv_string into lv_string respecting blanks. + endloop. + ls_entry-key = lv_string. + ls_entry-value = . + append ls_entry to lt_anagrams. + endloop. + " After we're done processing, output a list of the anagrams. + clear lv_string. + loop at lt_anagrams into ls_entry. + " Is it part of the same key --> Output in the same line, else a new entry. + if lv_string = ls_entry-key. + write: ', ', ls_entry-value. + else. + if sy-tabix <> 1. + write: ']'. + endif. + write: / '[', ls_entry-value. + endif. + lv_string = ls_entry-key. + endloop. + " Close last entry. + write ']'. +endform. + +" Read a specified file from the presentation server. +form readfile using i_file type string changing it_raw like gt_data. + data: l_datat type string, + l_msg(2048), + l_lines(10). + + " Read the file into memory. + update_progress 'Reading file...'. + call method cl_gui_frontend_services=>gui_upload + exporting + filename = i_file + changing + data_tab = it_raw + exceptions + others = 1. + " Output error if the file could not be uploaded. + if sy-subrc <> 0. + write : / 'Error reading the supplied file!'. + return. + endif. +endform. diff --git a/Task/Anagrams/Ada/anagrams.ada b/Task/Anagrams/Ada/anagrams.ada new file mode 100644 index 0000000000..f09af9e3af --- /dev/null +++ b/Task/Anagrams/Ada/anagrams.ada @@ -0,0 +1,69 @@ +with Ada.Text_IO; use Ada.Text_IO; + +with Ada.Containers.Indefinite_Ordered_Maps; +with Ada.Containers.Indefinite_Ordered_Sets; + +procedure Words_Of_Equal_Characters is + package Set_Of_Words is new Ada.Containers.Indefinite_Ordered_Sets (String); + use Ada.Containers, Set_Of_Words; + package Anagrams is new Ada.Containers.Indefinite_Ordered_Maps (String, Set); + use Anagrams; + + File : File_Type; + Result : Map; + Max : Count_Type := 1; + + procedure Put (Position : Anagrams.Cursor) is + First : Boolean := True; + List : Set renames Element (Position); + procedure Put (Position : Set_Of_Words.Cursor) is + begin + if First then + First := False; + else + Put (','); + end if; + Put (Element (Position)); + end Put; + begin + if List.Length = Max then + Iterate (List, Put'Access); + New_Line; + end if; + end Put; + +begin + Open (File, In_File, "unixdict.txt"); + loop + declare + Word : constant String := Get_Line (File); + Key : String (Word'Range) := (others => Character'Last); + List : Set; + Position : Anagrams.Cursor; + begin + for I in Word'Range loop + for J in Word'Range loop + if Key (J) > Word (I) then + Key (J + 1..I) := Key (J..I - 1); + Key (J) := Word (I); + exit; + end if; + end loop; + end loop; + Position := Find (Result, Key); + if Has_Element (Position) then + List := Element (Position); + Insert (List, Word); + Replace_Element (Result, Position, List); + else + Insert (List, Word); + Include (Result, Key, List); + end if; + Max := Count_Type'Max (Max, Length (List)); + end; + end loop; +exception + when End_Error => + Iterate (Result, Put'Access); + Close (File); +end Words_Of_Equal_Characters; diff --git a/Task/Anagrams/C/anagrams-1.c b/Task/Anagrams/C/anagrams-1.c new file mode 100644 index 0000000000..e67ae03b51 --- /dev/null +++ b/Task/Anagrams/C/anagrams-1.c @@ -0,0 +1,160 @@ +#include +#include +#include +#include +#include + +char *sortedWord(const char *word, char *wbuf) +{ + char *p1, *p2, *endwrd; + char t; + int swaps; + + strcpy(wbuf, word); + endwrd = wbuf+strlen(wbuf); + do { + swaps = 0; + p1 = wbuf; p2 = endwrd-1; + while (p1 *p1) { + t = *p2; *p2 = *p1; *p1 = t; + swaps = 1; + } + p1++; p2--; + } + p1 = wbuf; p2 = p1+1; + while(p2 < endwrd) { + if (*p2 > *p1) { + t = *p2; *p2 = *p1; *p1 = t; + swaps = 1; + } + p1++; p2++; + } + } while (swaps); + return wbuf; +} + +static +short cxmap[] = { + 0x06, 0x1f, 0x4d, 0x0c, 0x5c, 0x28, 0x5d, 0x0e, 0x09, 0x33, 0x31, 0x56, + 0x52, 0x19, 0x29, 0x53, 0x32, 0x48, 0x35, 0x55, 0x5e, 0x14, 0x27, 0x24, + 0x02, 0x3e, 0x18, 0x4a, 0x3f, 0x4c, 0x45, 0x30, 0x08, 0x2c, 0x1a, 0x03, + 0x0b, 0x0d, 0x4f, 0x07, 0x20, 0x1d, 0x51, 0x3b, 0x11, 0x58, 0x00, 0x49, + 0x15, 0x2d, 0x41, 0x17, 0x5f, 0x39, 0x16, 0x42, 0x37, 0x22, 0x1c, 0x0f, + 0x43, 0x5b, 0x46, 0x4b, 0x0a, 0x26, 0x2e, 0x40, 0x12, 0x21, 0x3c, 0x36, + 0x38, 0x1e, 0x01, 0x1b, 0x05, 0x4e, 0x44, 0x3d, 0x04, 0x10, 0x5a, 0x2a, + 0x23, 0x34, 0x25, 0x2f, 0x2b, 0x50, 0x3a, 0x54, 0x47, 0x59, 0x13, 0x57, + }; +#define CXMAP_SIZE (sizeof(cxmap)/sizeof(short)) + + +int Str_Hash( const char *key, int ix_max ) +{ + const char *cp; + short mash; + int hash = 33501551; + for (cp = key; *cp; cp++) { + mash = cxmap[*cp % CXMAP_SIZE]; + hash = (hash >>4) ^ 0x5C5CF5C ^ ((hash<<1) + (mash<<5)); + hash &= 0x3FFFFFFF; + } + return hash % ix_max; +} + +typedef struct sDictWord *DictWord; +struct sDictWord { + const char *word; + DictWord next; +}; + +typedef struct sHashEntry *HashEntry; +struct sHashEntry { + const char *key; + HashEntry next; + DictWord words; + HashEntry link; + short wordCount; +}; + +#define HT_SIZE 8192 + +HashEntry hashTable[HT_SIZE]; + +HashEntry mostPerms = NULL; + +int buildAnagrams( FILE *fin ) +{ + char buffer[40]; + char bufr2[40]; + char *hkey; + int hix; + HashEntry he, *hep; + DictWord we; + int maxPC = 2; + int numWords = 0; + + while ( fgets(buffer, 40, fin)) { + for(hkey = buffer; *hkey && (*hkey!='\n'); hkey++); + *hkey = 0; + hkey = sortedWord(buffer, bufr2); + hix = Str_Hash(hkey, HT_SIZE); + he = hashTable[hix]; hep = &hashTable[hix]; + while( he && strcmp(he->key , hkey) ) { + hep = &he->next; + he = he->next; + } + if ( ! he ) { + he = malloc(sizeof(struct sHashEntry)); + he->next = NULL; + he->key = strdup(hkey); + he->wordCount = 0; + he->words = NULL; + he->link = NULL; + *hep = he; + } + we = malloc(sizeof(struct sDictWord)); + we->word = strdup(buffer); + we->next = he->words; + he->words = we; + he->wordCount++; + if ( maxPC < he->wordCount) { + maxPC = he->wordCount; + mostPerms = he; + he->link = NULL; + } + else if (maxPC == he->wordCount) { + he->link = mostPerms; + mostPerms = he; + } + + numWords++; + } + printf("%d words in dictionary max ana=%d\n", numWords, maxPC); + return maxPC; +} + + +int main( ) +{ + HashEntry he; + DictWord we; + FILE *f1; + + f1 = fopen("unixdict.txt","r"); + buildAnagrams(f1); + fclose(f1); + + f1 = fopen("anaout.txt","w"); +// f1 = stdout; + + for (he = mostPerms; he; he = he->link) { + fprintf(f1,"%d:", he->wordCount); + for(we = he->words; we; we = we->next) { + fprintf(f1,"%s, ", we->word); + } + fprintf(f1, "\n"); + } + + fclose(f1); + return 0; +} diff --git a/Task/Anagrams/CoffeeScript/anagrams-1.coffee b/Task/Anagrams/CoffeeScript/anagrams-1.coffee new file mode 100644 index 0000000000..5e93433fae --- /dev/null +++ b/Task/Anagrams/CoffeeScript/anagrams-1.coffee @@ -0,0 +1,31 @@ +http = require 'http' + +show_large_anagram_sets = (word_lst) -> + anagrams = {} + max_size = 0 + + for word in word_lst + key = word.split('').sort().join('') + anagrams[key] ?= [] + anagrams[key].push word + size = anagrams[key].length + max_size = size if size > max_size + + for key, variations of anagrams + if variations.length == max_size + console.log variations.join ' ' + +get_word_list = (process) -> + options = + host: "www.puzzlers.org" + path: "/pub/wordlists/unixdict.txt" + + req = http.request options, (res) -> + s = '' + res.on 'data', (chunk) -> + s += chunk + res.on 'end', -> + process s.split '\n' + req.end() + +get_word_list show_large_anagram_sets diff --git a/Task/Anagrams/Go/anagrams-1.go b/Task/Anagrams/Go/anagrams-1.go new file mode 100644 index 0000000000..e26b0ab87a --- /dev/null +++ b/Task/Anagrams/Go/anagrams-1.go @@ -0,0 +1,39 @@ +package main + +import ( + "fmt" + "io/ioutil" + "sort" + "strings" +) + +func main() { + b, err := ioutil.ReadFile("unixdict.txt") + if err != nil { + fmt.Println(err) + return + } + var ma int + m := make(map[string][]string) + for _, word := range strings.Split(string(b), "\n") { + bs := byteSlice(word) + sort.Sort(bs) + k := string(bs) + a := append(m[k], word) + if len(a) > ma { + ma = len(a) + } + m[k] = a + } + for _, a := range m { + if len(a) == ma { + fmt.Println(a) + } + } +} + +type byteSlice []byte + +func (b byteSlice) Len() int { return len(b) } +func (b byteSlice) Swap(i, j int) { b[i], b[j] = b[j], b[i] } +func (b byteSlice) Less(i, j int) bool { return b[i] < b[j] } diff --git a/Task/Anagrams/Perl/anagrams-1.pl b/Task/Anagrams/Perl/anagrams-1.pl new file mode 100644 index 0000000000..7dbf4662aa --- /dev/null +++ b/Task/Anagrams/Perl/anagrams-1.pl @@ -0,0 +1,15 @@ +use LWP::Simple; +use List::Util qw(max); + +my @words = split(' ', get('http://www.puzzlers.org/pub/wordlists/unixdict.txt')); +my %anagram; +foreach my $word (@words) { + push @{ $anagram{join('', sort(split(//, $word)))} }, $word; +} + +my $count = max(map {scalar @$_} values %anagram); +foreach my $ana (values %anagram) { + if (@$ana >= $count) { + print "@$ana\n"; + } +} diff --git a/Task/Anagrams/PicoLisp/anagrams-1.l b/Task/Anagrams/PicoLisp/anagrams-1.l new file mode 100644 index 0000000000..9214020b26 --- /dev/null +++ b/Task/Anagrams/PicoLisp/anagrams-1.l @@ -0,0 +1,4 @@ +(flip + (by length sort + (by '((L) (sort (copy L))) group + (in "unixdict.txt" (make (while (line) (link @)))) ) ) ) diff --git a/Task/Anagrams/Python/anagrams-1.py b/Task/Anagrams/Python/anagrams-1.py new file mode 100644 index 0000000000..8db99dec25 --- /dev/null +++ b/Task/Anagrams/Python/anagrams-1.py @@ -0,0 +1,12 @@ +>>> import urllib.request +>>> from collections import defaultdict +>>> words = urllib.request.urlopen('http://www.puzzlers.org/pub/wordlists/unixdict.txt').read().split() +>>> anagram = defaultdict(list) # map sorted chars to anagrams +>>> for word in words: + anagram[tuple(sorted(word))].append( word ) + + +>>> count = max(len(ana) for ana in anagram.values()) +>>> for ana in anagram.values(): + if len(ana) >= count: + print ([x.decode() for x in ana]) diff --git a/Task/Anagrams/Racket/anagrams-1.rkt b/Task/Anagrams/Racket/anagrams-1.rkt new file mode 100644 index 0000000000..b6a10447e4 --- /dev/null +++ b/Task/Anagrams/Racket/anagrams-1.rkt @@ -0,0 +1,21 @@ +#lang racket + +(require net/url) + +(define (get-lines url-string) + (define port (get-pure-port (string->url url-string))) + (for/list ([l (in-lines port)]) l)) + +(define (hash-words words) + (for/fold ([ws-hash (hash)]) ([w words]) + (hash-update ws-hash + (list->string (sort (string->list w) < #:key (λ (c) (char->integer c)))) + (λ (ws) (cons w ws)) + (λ () '())))) + +(define (get-maxes h) + (define max-ws (apply max (map length (hash-values h)))) + (define max-keys (filter (λ (k) (= (length (hash-ref h k)) max-ws)) (hash-keys h))) + (map (λ (k) (hash-ref h k)) max-keys)) + +(get-maxes (hash-words (get-lines "http://www.puzzlers.org/pub/wordlists/unixdict.txt"))) diff --git a/Task/Anagrams/Ruby/anagrams-1.rb b/Task/Anagrams/Ruby/anagrams-1.rb new file mode 100644 index 0000000000..af3ba231c1 --- /dev/null +++ b/Task/Anagrams/Ruby/anagrams-1.rb @@ -0,0 +1,17 @@ +require 'open-uri' + +anagram = Hash.new {|hash, key| hash[key] = []} # map sorted chars to anagrams + +open('http://www.puzzlers.org/pub/wordlists/unixdict.txt') do |f| + words = f.read.split + for word in words + anagram[word.split('').sort] << word + end +end + +count = anagram.values.map {|ana| ana.length}.max +anagram.each_value do |ana| + if ana.length >= count + p ana + end +end diff --git a/Task/Anagrams/Scala/anagrams-1.scala b/Task/Anagrams/Scala/anagrams-1.scala new file mode 100644 index 0000000000..580e0b4d89 --- /dev/null +++ b/Task/Anagrams/Scala/anagrams-1.scala @@ -0,0 +1,4 @@ +val src = io.Source fromURL "http://www.puzzlers.org/pub/wordlists/unixdict.txt" +val vls = src.getLines.toList.groupBy(_.sorted).values +val max = vls.map(_.size).max +vls filter (_.size == max) map (_ mkString " ") mkString "\n" diff --git a/Task/Anagrams/Smalltalk/anagrams-1.st b/Task/Anagrams/Smalltalk/anagrams-1.st new file mode 100644 index 0000000000..abd141c650 --- /dev/null +++ b/Task/Anagrams/Smalltalk/anagrams-1.st @@ -0,0 +1,7 @@ +list:= (FillInTheBlank request: 'myMessageBoxTitle') subStrings: String crlf. +dict:= Dictionary new. +list do: [:val| + (dict at: val copy sort ifAbsent: [dict at: val copy sort put: OrderedCollection new]) + add: val. + ]. +sorted:=dict asSortedCollection: [:a :b| a size > b size]. diff --git a/Task/Arrays/ACL2/arrays.acl2 b/Task/Arrays/ACL2/arrays.acl2 new file mode 100644 index 0000000000..f6beb59e52 --- /dev/null +++ b/Task/Arrays/ACL2/arrays.acl2 @@ -0,0 +1,15 @@ +;; Create an array and store it in array-example +(assign array-example + (compress1 'array-example + (list '(:header :dimensions (10) + :maximum-length 11)))) + +;; Set a[5] to 22 +(assign array-example + (aset1 'array-example + (@ array-example) + 5 + 22)) + +;; Get a[5] +(aref1 'array-example (@ array-example) 5) diff --git a/Task/Arrays/Ada/arrays.ada b/Task/Arrays/Ada/arrays.ada new file mode 100644 index 0000000000..b713c838f7 --- /dev/null +++ b/Task/Arrays/Ada/arrays.ada @@ -0,0 +1,43 @@ +procedure Array_Test is + + A, B : array (1..20) of Integer; + + -- Ada array indices may begin at any value, not just 0 or 1 + C : array (-37..20) of integer + + -- Ada arrays may be indexed by enumerated types, which are + -- discrete non-numeric types + type Days is (Mon, Tue, Wed, Thu, Fri, Sat, Sun); + type Activities is (Work, Fish); + type Daily_Activities is array(Days) of Activities; + This_Week : Daily_Activities := (Mon..Fri => Work, Others => Fish); + + -- Or any numeric type + type Fingers is range 1..4; -- exclude thumb + type Fingers_Extended_Type is array(fingers) of Boolean; + Fingers_Extended : Fingers_Extended_Type; + + -- Array types may be unconstrained. The variables of the type + -- must be constrained + type Arr is array (Integer range <>) of Integer; + Uninitialized : Arr (1 .. 10); + Initialized_1 : Arr (1 .. 20) := (others => 1); + Initialized_2 : Arr := (1 .. 30 => 2); + Const : constant Arr := (1 .. 10 => 1, 11 .. 20 => 2, 21 | 22 => 3); + Centered : Arr (-50..50) := (0 => 1, Others => 0); + + Result : Integer +begin + + A := (others => 0); -- Assign whole array + B := (1 => 1, 2 => 1, 3 => 2, others => 0); + -- Assign whole array, different values + A (1) := -1; -- Assign individual element + A (2..4) := B (1..3); -- Assign a slice + A (3..5) := (2, 4, -1); -- Assign a constant slice + A (3..5) := A (4..6); -- It is OK to overlap slices when assigned + + Fingers_Extended'First := False; -- Set first element of array + Fingers_Extended'Last := False; -- Set last element of array + +end Array_Test; diff --git a/Task/Arrays/BASIC/arrays-1.bas b/Task/Arrays/BASIC/arrays-1.bas new file mode 100644 index 0000000000..0f421ab4f0 --- /dev/null +++ b/Task/Arrays/BASIC/arrays-1.bas @@ -0,0 +1,2 @@ + OPTION BASE 1 + DIM myArray(100) AS INTEGER diff --git a/Task/Arrays/C/arrays-1.c b/Task/Arrays/C/arrays-1.c new file mode 100644 index 0000000000..52409e7fec --- /dev/null +++ b/Task/Arrays/C/arrays-1.c @@ -0,0 +1,2 @@ +int myArray2[10] = { 1, 2, 0 }; /* the rest of elements get the value 0 */ +float myFloats[] ={1.2, 2.5, 3.333, 4.92, 11.2, 22.0 }; /* automatically sizes */ diff --git a/Task/Arrays/CoffeeScript/arrays-1.coffee b/Task/Arrays/CoffeeScript/arrays-1.coffee new file mode 100644 index 0000000000..6ab2780268 --- /dev/null +++ b/Task/Arrays/CoffeeScript/arrays-1.coffee @@ -0,0 +1,8 @@ +array1 = [] +array1[0] = "Dillenidae" +array1[1] = "animus" +array1[2] = "Kona" +alert "Elements of array1: " + array1 # Dillenidae,animus,Kona + +array2 = ["Cepphus", "excreta", "Gansu"] +alert "Value of array2[1]: " + array2[1] # excreta diff --git a/Task/Arrays/Forth/arrays-1.fth b/Task/Arrays/Forth/arrays-1.fth new file mode 100644 index 0000000000..4c0e27160b --- /dev/null +++ b/Task/Arrays/Forth/arrays-1.fth @@ -0,0 +1,7 @@ +create MyArray 1 , 2 , 3 , 4 , 5 , 5 cells allot +here constant MyArrayEnd + +30 MyArray 7 cells + ! +MyArray 7 cells + @ . \ 30 + +: .array MyArrayEnd MyArray do I @ . cell +loop ; diff --git a/Task/Arrays/Fortran/arrays-1.f b/Task/Arrays/Fortran/arrays-1.f new file mode 100644 index 0000000000..f53cc5e8a6 --- /dev/null +++ b/Task/Arrays/Fortran/arrays-1.f @@ -0,0 +1 @@ +integer a (10) diff --git a/Task/Arrays/Java/arrays-1.java b/Task/Arrays/Java/arrays-1.java new file mode 100644 index 0000000000..20f5bcec3b --- /dev/null +++ b/Task/Arrays/Java/arrays-1.java @@ -0,0 +1,3 @@ +int[] array = new int[10]; //optionally, replace "new int[10]" with a braced list of ints like "{1, 2, 3}" +array[0] = 42; +System.out.println(array[3]); diff --git a/Task/Arrays/PHP/arrays-1.php b/Task/Arrays/PHP/arrays-1.php new file mode 100644 index 0000000000..321a55f67c --- /dev/null +++ b/Task/Arrays/PHP/arrays-1.php @@ -0,0 +1,2 @@ +$NumberArray = array(0, 1, 2, 3, 4, 5, 6); +$LetterArray = array("a", "b", "c", "d", "e", "f"); diff --git a/Task/Arrays/PicoLisp/arrays-1.l b/Task/Arrays/PicoLisp/arrays-1.l new file mode 100644 index 0000000000..92ac9e3b9d --- /dev/null +++ b/Task/Arrays/PicoLisp/arrays-1.l @@ -0,0 +1,2 @@ +(setq A '((1 2 3) (a b c) ((d e) NIL 777))) # Create a 3x3 structure +(mapc println A) # Show it diff --git a/Task/Arrays/Prolog/arrays-1.pro b/Task/Arrays/Prolog/arrays-1.pro new file mode 100644 index 0000000000..efd56e98f2 --- /dev/null +++ b/Task/Arrays/Prolog/arrays-1.pro @@ -0,0 +1,9 @@ +singleassignment:- + functor(Array,array,100), % create a term with 100 free Variables as arguments + % index of arguments start at 1 + arg(1 ,Array,a), % put an a at position 1 + arg(12,Array,b), % put an b at position 12 + arg(1 ,Array,Value1), % get the value at position 1 + print(Value1),nl, % will print Value1 and therefore a followed by a newline + arg(4 ,Array,Value2), % get the value at position 4 which is a free Variable + print(Value2),nl. % will print that it is a free Variable followed by a newline diff --git a/Task/Arrays/Python/arrays-1.py b/Task/Arrays/Python/arrays-1.py new file mode 100644 index 0000000000..a64e25fbb8 --- /dev/null +++ b/Task/Arrays/Python/arrays-1.py @@ -0,0 +1,8 @@ +array = [] + +array.append(1) +array.append(3) + +array[0] = 2 + +print array[0] diff --git a/Task/Arrays/REXX/arrays-1.rexx b/Task/Arrays/REXX/arrays-1.rexx new file mode 100644 index 0000000000..b44345aaad --- /dev/null +++ b/Task/Arrays/REXX/arrays-1.rexx @@ -0,0 +1,9 @@ +/*REXX program demonstrates array usage. */ +a.='not found' /*value for all a.xxx (so far). */ + + do j=1 to 100 /*start at 1, define 100 array elements.*/ + a.j=-j*100 /*define element as negative J thousand.*/ + end /*the above defines 100 elements. */ + +say 'element 50 is:' a.50 +say 'element 3000 is:' a.3000 diff --git a/Task/Arrays/Scala/arrays-1.scala b/Task/Arrays/Scala/arrays-1.scala new file mode 100644 index 0000000000..8d7072e1eb --- /dev/null +++ b/Task/Arrays/Scala/arrays-1.scala @@ -0,0 +1,11 @@ +// Create a new integer array with capacity 10 +val a = new Array[Int](10) + +// Create a new array containing specified items +val b = Array("foo", "bar", "baz") + +// Assign a value to element zero +a(0) = 42 + +// Retrieve item at element 2 +val c = b(2) diff --git a/Task/Arrays/Smalltalk/arrays-1.st b/Task/Arrays/Smalltalk/arrays-1.st new file mode 100644 index 0000000000..b7ee9a071d --- /dev/null +++ b/Task/Arrays/Smalltalk/arrays-1.st @@ -0,0 +1 @@ +#(1 2 3 'four' 5.0 true false nil (10 20) $a) diff --git a/Task/Arrays/Tcl/arrays-1.tcl b/Task/Arrays/Tcl/arrays-1.tcl new file mode 100644 index 0000000000..9d450d0cad --- /dev/null +++ b/Task/Arrays/Tcl/arrays-1.tcl @@ -0,0 +1,8 @@ +set ary {} + +lappend ary 1 +lappend ary 3 + +lset ary 0 2 + +puts [lindex $ary 0] diff --git a/Task/Assertions/Ada/assertions-1.ada b/Task/Assertions/Ada/assertions-1.ada new file mode 100644 index 0000000000..299256c913 --- /dev/null +++ b/Task/Assertions/Ada/assertions-1.ada @@ -0,0 +1 @@ +pragma Assert (A = 42, "Oops!"); diff --git a/Task/Assertions/Ada/assertions-2.ada b/Task/Assertions/Ada/assertions-2.ada new file mode 100644 index 0000000000..fde9eaf5ce --- /dev/null +++ b/Task/Assertions/Ada/assertions-2.ada @@ -0,0 +1,3 @@ +with Ada.Assertions; use Ada.Assertions; +... +Assert (A = 42, "Oops!"); diff --git a/Task/Assertions/C/assertions-1.c b/Task/Assertions/C/assertions-1.c new file mode 100644 index 0000000000..b071e7f63f --- /dev/null +++ b/Task/Assertions/C/assertions-1.c @@ -0,0 +1,9 @@ +#include + +int main(){ + int a; + /* ...input or change a here */ + assert(a == 42); /* aborts program when a is not 42, unless the NDEBUG macro was defined */ + + return 0; +} diff --git a/Task/Assertions/Eiffel/assertions-1.e b/Task/Assertions/Eiffel/assertions-1.e new file mode 100644 index 0000000000..7d150d84c3 --- /dev/null +++ b/Task/Assertions/Eiffel/assertions-1.e @@ -0,0 +1,12 @@ +class MAIN + creation main + feature main is + local + test: TEST; + do + create test; + + io.read_integer; + test.assert(io.last_integer); + end +end diff --git a/Task/Assertions/Perl/assertions-1.pl b/Task/Assertions/Perl/assertions-1.pl new file mode 100644 index 0000000000..e47bd1bf69 --- /dev/null +++ b/Task/Assertions/Perl/assertions-1.pl @@ -0,0 +1 @@ +open my $fh, '<', 'file' or die "Cannot open file: $!\n"; # $! contains the error message from the last error diff --git a/Task/Assertions/PicoLisp/assertions-1.l b/Task/Assertions/PicoLisp/assertions-1.l new file mode 100644 index 0000000000..76e2fe13ae --- /dev/null +++ b/Task/Assertions/PicoLisp/assertions-1.l @@ -0,0 +1,3 @@ +... +~(assert (= N 42)) # Exists only in debug mode +... diff --git a/Task/Assertions/Racket/assertions-1.rkt b/Task/Assertions/Racket/assertions-1.rkt new file mode 100644 index 0000000000..9ee65ef3e1 --- /dev/null +++ b/Task/Assertions/Racket/assertions-1.rkt @@ -0,0 +1,13 @@ +#lang racket + +(define/contract x + (=/c 42) ; make sure x = 42 + 42) + +(define/contract f + (-> number? (or/c 'yes 'no)) ; function contract + (lambda (x) + (if (= 42 x) 'yes 'no))) + +(f 42) ; succeeds +(f "foo") ; contract error! diff --git a/Task/Assertions/Scala/assertions-1.scala b/Task/Assertions/Scala/assertions-1.scala new file mode 100644 index 0000000000..2689d74083 --- /dev/null +++ b/Task/Assertions/Scala/assertions-1.scala @@ -0,0 +1,4 @@ +assert(a == 42) +assert(a == 42, "a isn't equal to 42") +assume(a == 42) +assume(a == 42, "a isn't equal to 42") diff --git a/Task/Assertions/Smalltalk/assertions-1.st b/Task/Assertions/Smalltalk/assertions-1.st new file mode 100644 index 0000000000..34e1910aa1 --- /dev/null +++ b/Task/Assertions/Smalltalk/assertions-1.st @@ -0,0 +1,3 @@ +foo := 41. +... +self assert: (foo == 42). diff --git a/Task/Balanced-brackets/0DESCRIPTION b/Task/Balanced-brackets/0DESCRIPTION new file mode 100644 index 0000000000..e80789f1d9 --- /dev/null +++ b/Task/Balanced-brackets/0DESCRIPTION @@ -0,0 +1,10 @@ +'''Task''': +* Generate a string with \mathrm{N} opening brackets (“[”) and \mathrm{N} closing brackets (“]”), in some arbitrary order. +* Determine whether the generated string is ''balanced''; that is, whether it consists entirely of pairs of opening/closing brackets (in that order), none of which mis-nest. + +'''Examples''': + + (empty) OK + [] OK ][ NOT OK + [][] OK ][][ NOT OK + [[][]] OK []][[] NOT OK diff --git a/Task/Balanced-brackets/AWK/balanced-brackets.awk b/Task/Balanced-brackets/AWK/balanced-brackets.awk new file mode 100644 index 0000000000..e6b151f39e --- /dev/null +++ b/Task/Balanced-brackets/AWK/balanced-brackets.awk @@ -0,0 +1,21 @@ +#!/usr/bin/awk -f +BEGIN { + print isbb("[]") + print isbb("][") + print isbb("][][") + print isbb("[][]") + print isbb("[][][]") + print isbb("[]][[]") +} + +function isbb(x) { + s = 0; + for (k=1; k<=length(x); k++) { + c = substr(x,k,1); + if (c=="[") {s++;} + else { if (c=="]") s--; } + + if (s<0) {return 0}; + } + return (s==0); +} diff --git a/Task/Balanced-brackets/Ada/balanced-brackets.ada b/Task/Balanced-brackets/Ada/balanced-brackets.ada new file mode 100644 index 0000000000..a5762a9580 --- /dev/null +++ b/Task/Balanced-brackets/Ada/balanced-brackets.ada @@ -0,0 +1,57 @@ +with Ada.Numerics.Discrete_Random; +with Ada.Text_IO; +with Ada.Strings.Fixed; +procedure Brackets is + package Random_Positive is new Ada.Numerics.Discrete_Random (Positive); + Positive_Generator : Random_Positive.Generator; + procedure Swap (Left, Right : in out Character) is + Temp : constant Character := Left; + begin + Left := Right; + Right := Temp; + end Swap; + function Generate_Brackets (Bracket_Count : Natural; + Opening_Bracket : Character := '['; + Closing_Bracket : Character := ']') + return String is + use Ada.Strings.Fixed; + All_Brackets : String := Bracket_Count * Opening_Bracket & Bracket_Count * Closing_Bracket; + begin + for I in All_Brackets'Range loop + Swap (All_Brackets (I), All_Brackets (Random_Positive.Random (Positive_Generator) mod (Bracket_Count * 2) + 1)); + end loop; + return All_Brackets; + end Generate_Brackets; + + function Check_Brackets (Test : String; + Opening_Bracket : Character := '['; + Closing_Bracket : Character := ']') + return Boolean is + Open : Natural := 0; + begin + for I in Test'Range loop + if Test (I) = Opening_Bracket then + Open := Open + 1; + elsif Test (I) = Closing_Bracket then + if Open = 0 then + return False; + else + Open := Open - 1; + end if; + end if; + end loop; + return True; + end Check_Brackets; +begin + Random_Positive.Reset (Positive_Generator); + Ada.Text_IO.Put_Line ("Brackets"); + for I in 0 .. 4 loop + for J in 0 .. I loop + declare + My_String : constant String := Generate_Brackets (I); + begin + Ada.Text_IO.Put_Line (My_String & ": " & Boolean'Image (Check_Brackets (My_String))); + end; + end loop; + end loop; +end Brackets; diff --git a/Task/Balanced-brackets/BASIC/balanced-brackets.bas b/Task/Balanced-brackets/BASIC/balanced-brackets.bas new file mode 100644 index 0000000000..ffc201be3e --- /dev/null +++ b/Task/Balanced-brackets/BASIC/balanced-brackets.bas @@ -0,0 +1,57 @@ +DECLARE FUNCTION checkBrackets% (brackets AS STRING) +DECLARE FUNCTION generator$ (length AS INTEGER) + +RANDOMIZE TIMER + +DO + x$ = generator$ (10) + PRINT x$, + IF checkBrackets(x$) THEN + PRINT "OK" + ELSE + PRINT "NOT OK" + END IF +LOOP WHILE LEN(x$) + +FUNCTION checkBrackets% (brackets AS STRING) + 'returns -1 (TRUE) if everything's ok, 0 (FALSE) if not + DIM L0 AS INTEGER, sum AS INTEGER + + FOR L0 = 1 TO LEN(brackets) + SELECT CASE MID$(brackets, L0, 1) + CASE "[" + sum = sum + 1 + CASE "]" + sum = sum - 1 + END SELECT + IF sum < 0 THEN + checkBrackets% = 0 + EXIT FUNCTION + END IF + NEXT + + IF 0 = sum THEN + checkBrackets% = -1 + ELSE + checkBrackets% = 0 + END IF +END FUNCTION + +FUNCTION generator$ (length AS INTEGER) + z = INT(RND * length) + IF z < 1 THEN generator$ = "": EXIT FUNCTION + REDIM x(z * 2) AS STRING + FOR i = 0 TO z STEP 2 + x(i) = "[" + x(i + 1) = "]" + NEXT + FOR i = 1 TO UBOUND(x) + z = INT(RND * 2) + IF z THEN SWAP x(i), x(i - 1) + NEXT + xx$ = "" + FOR i = 0 TO UBOUND(x) + xx$ = xx$ + x(i) + NEXT + generator$ = xx$ +END FUNCTION diff --git a/Task/Balanced-brackets/Befunge/balanced-brackets.bf b/Task/Balanced-brackets/Befunge/balanced-brackets.bf new file mode 100644 index 0000000000..2264f098e0 --- /dev/null +++ b/Task/Balanced-brackets/Befunge/balanced-brackets.bf @@ -0,0 +1,7 @@ +v > "KO TON" ,,,,,, v +> ~ : 25*- #v_ $ | > 25*, @ + > "KO" ,, ^ + > : 1991+*+- #v_ v + > \ : 1991+*+- #v_v + \ $ +^ < <$< diff --git a/Task/Balanced-brackets/C/balanced-brackets-1.c b/Task/Balanced-brackets/C/balanced-brackets-1.c new file mode 100644 index 0000000000..3427dcb738 --- /dev/null +++ b/Task/Balanced-brackets/C/balanced-brackets-1.c @@ -0,0 +1,43 @@ +#include +#include +#include + +int isBal(const char*s,int l){ + signed c=0; + while(l--) + if(s[l]==']') ++c; + else if(s[l]=='[') if(--c<0) break; + return !c; +} + +void shuffle(char*s,int h){ + int x,t,i=h; + while(i--){ + t=s[x=rand()%h]; + s[x]=s[i]; + s[i]=t; + } +} + +void genSeq(char*s,int n){ + if(n){ + memset(s,'[',n); + memset(s+n,']',n); + shuffle(s,n*2); + } + s[n*2]=0; +} + +void doSeq(int n){ + char s[64]; + const char *o="False"; + genSeq(s,n); + if(isBal(s,n*2)) o="True"; + printf("'%s': %s\n",s,o); +} + +int main(){ + int n=0; + while(n<9) doSeq(n++); + return 0; +} diff --git a/Task/Balanced-brackets/C/balanced-brackets-2.c b/Task/Balanced-brackets/C/balanced-brackets-2.c new file mode 100644 index 0000000000..3bf22f21e3 --- /dev/null +++ b/Task/Balanced-brackets/C/balanced-brackets-2.c @@ -0,0 +1,9 @@ +'': True +'[]': True +']][[': False +'[][][]': True +'[]][[]][': False +'[]][[[[]]]': False +']]]][[[]][[[': False +']]]]]][][[[[[[': False +'[][]][[][[[]]][]': False diff --git a/Task/Balanced-brackets/Clojure/balanced-brackets.clj b/Task/Balanced-brackets/Clojure/balanced-brackets.clj new file mode 100644 index 0000000000..ebe2af1867 --- /dev/null +++ b/Task/Balanced-brackets/Clojure/balanced-brackets.clj @@ -0,0 +1,28 @@ +(defn gen-brackets [n] + (->> (concat (repeat n \[) (repeat n \])) + shuffle + (apply str ,))) + +(defn balanced? [s] + (loop [[first & coll] (seq s) + stack '()] + (if first + (if (= first \[) + (recur coll (conj stack \[)) + (when (= (peek stack) \[) + (recur coll (pop stack)))) + (zero? (count stack))))) + +user> (->> (range 10) + (map gen-brackets ,) + (map (juxt identity balanced?) ,) vec) +[["" true] + ["[]" true] + ["[[]]" true] + ["[][[]]" true] + ["[]][][][" nil] + ["[[[[[]]]]]" true] + ["]][[][][[[]]" nil] + ["[]]]][[[[]][][" nil] + ["][][[]]][[][][][" nil] + ["][][]]][]][[[][[[]" nil] diff --git a/Task/Balanced-brackets/CoffeeScript/balanced-brackets-1.coffee b/Task/Balanced-brackets/CoffeeScript/balanced-brackets-1.coffee new file mode 100644 index 0000000000..bf8c8bb817 --- /dev/null +++ b/Task/Balanced-brackets/CoffeeScript/balanced-brackets-1.coffee @@ -0,0 +1,15 @@ +isBalanced = (brackets) -> + openCount = 0 + for bracket in brackets + openCount += if bracket is '[' then 1 else -1 + return false if openCount < 0 + openCount is 0 + +bracketsCombinations = (n) -> + for i in [0...Math.pow 2, n] + str = i.toString 2 + str = '0' + str while str.length < n + str.replace(/0/g, '[').replace(/1/g, ']') + +for brackets in bracketsCombinations 4 + console.log brackets, isBalanced brackets diff --git a/Task/Balanced-brackets/CoffeeScript/balanced-brackets-2.coffee b/Task/Balanced-brackets/CoffeeScript/balanced-brackets-2.coffee new file mode 100644 index 0000000000..6cd1aec318 --- /dev/null +++ b/Task/Balanced-brackets/CoffeeScript/balanced-brackets-2.coffee @@ -0,0 +1,17 @@ +> coffee balanced.coffee +[[[[ false +[[[] false +[[][ false +[[]] true +[][[ false +[][] true +[]][ false +[]]] false +][[[ false +][[] false +][][ false +][]] false +]][[ false +]][] false +]]][ false +]]]] false diff --git a/Task/Balanced-brackets/Forth/balanced-brackets.fth b/Task/Balanced-brackets/Forth/balanced-brackets.fth new file mode 100644 index 0000000000..67263a368c --- /dev/null +++ b/Task/Balanced-brackets/Forth/balanced-brackets.fth @@ -0,0 +1,23 @@ +include lib/choose.4th ( n1 -- n2) +include lib/ctos.4th ( n -- a 1) + + 10 constant /[] \ maximum number of brackets +/[] string [] \ string with brackets + \ create string with brackets +: make[] ( --) + 0 dup [] place /[] choose 0 ?do 2 choose 2* [char] [ + c>s [] +place loop +; \ empty string, fill with brackets + \ evaluate string +: eval[] ( --) + [] count 2dup over chars + >r swap type 0 + begin \ setup string and count + over r@ < \ reached end of string? + while \ if not .. + dup 0< 0= \ unbalanced ]? + while \ if not .. + over c@ [char] \ - negate + swap char+ swap + repeat \ evaluate, goto next character + r> drop if ." NOT" then ." OK" cr drop +; \ evaluate string and print result + +make[] eval[] diff --git a/Task/Balanced-brackets/Go/balanced-brackets.go b/Task/Balanced-brackets/Go/balanced-brackets.go new file mode 100644 index 0000000000..d3354589e8 --- /dev/null +++ b/Task/Balanced-brackets/Go/balanced-brackets.go @@ -0,0 +1,55 @@ +package main + +import ( + "bytes" + "fmt" + "math/rand" + "time" +) + +func init() { + rand.Seed(time.Now().UnixNano()) +} + +func generate(n uint) string { + a := bytes.Repeat([]byte("[]"), int(n)) + for i := len(a) - 1; i >= 1; i-- { + j := rand.Intn(i + 1) + a[i], a[j] = a[j], a[i] + } + return string(a) +} + +func testBalanced(s string) { + fmt.Printf("%s: ", s) + var open int + for i := 0; i < len(s); i++ { + switch s[i] { + case '[': + open++ + case ']': + if open == 0 { + fmt.Println("not ok") + return + + } + open-- + default: + fmt.Println("not ok") + return + } + } + if open == 0 { + fmt.Println("ok") + } else { + fmt.Println("not ok") + } +} + +func main() { + rand.Seed(time.Now().UnixNano()) + for i := uint(0); i < 10; i++ { + testBalanced(generate(i)) + } + testBalanced("()") +} diff --git a/Task/Balanced-brackets/Haskell/balanced-brackets-1.hs b/Task/Balanced-brackets/Haskell/balanced-brackets-1.hs new file mode 100644 index 0000000000..0cfa89c906 --- /dev/null +++ b/Task/Balanced-brackets/Haskell/balanced-brackets-1.hs @@ -0,0 +1,29 @@ +import Control.Monad +import System.Random +import Text.Printf +import VShuffle + +-- Return whether a string contains balanced brackets. Nothing indicates a +-- balanced string, while (Just i) means an imbalance was found at, or just +-- after, the i'th bracket. We assume the string contains only brackets. +isBalanced :: String -> Maybe Int +isBalanced = bal (-1) 0 + where bal :: Int -> Int -> String -> Maybe Int + bal _ 0 [] = Nothing + bal i _ [] = Just i + bal i (-1) _ = Just i + bal i n ('[':bs) = bal (i+1) (n+1) bs + bal i n (']':bs) = bal (i+1) (n-1) bs + +-- Print a string, indicating whether it contains balanced brackets. If not, +-- indicate the bracket at which the imbalance was found. +check :: String -> IO () +check s = maybe (good s) (bad s) (isBalanced s) + where good s = printf "Good \"%s\"\n" s + bad s n = printf "Bad \"%s\"\n%*s^\n" s (n+6) " " + +main :: IO () +main = do + let bs = cycle "[]" + rs <- replicateM 10 newStdGen + zipWithM_ (\n r -> check $ shuffle (take n bs) r) [0,2..] rs diff --git a/Task/Balanced-brackets/Haskell/balanced-brackets-2.hs b/Task/Balanced-brackets/Haskell/balanced-brackets-2.hs new file mode 100644 index 0000000000..d60d6fe8e7 --- /dev/null +++ b/Task/Balanced-brackets/Haskell/balanced-brackets-2.hs @@ -0,0 +1,20 @@ +module VShuffle (shuffle) where + +import Data.List (mapAccumL) +import System.Random +import Control.Monad.ST +import qualified Data.Vector as V +import qualified Data.Vector.Generic.Mutable as M + +-- Generate a list of array index pairs, each corresponding to a swap. +pairs :: (Enum a, Random a, RandomGen g) => a -> a -> g -> [(a, a)] +pairs l u r = snd $ mapAccumL step r [l..pred u] + where step r i = let (j, r') = randomR (i, u) r in (r', (i, j)) + +-- Return a random permutation of the list. We use the algorithm described in +-- http://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle#The_modern_algorithm. +shuffle :: (RandomGen g) => [a] -> g -> [a] +shuffle xs r = V.toList . runST $ do + v <- V.unsafeThaw $ V.fromList xs + mapM_ (uncurry $ M.swap v) $ pairs 0 (M.length v - 1) r + V.unsafeFreeze v diff --git a/Task/Balanced-brackets/Java/balanced-brackets.java b/Task/Balanced-brackets/Java/balanced-brackets.java new file mode 100644 index 0000000000..66e53534f7 --- /dev/null +++ b/Task/Balanced-brackets/Java/balanced-brackets.java @@ -0,0 +1,50 @@ +public class Brackets { + public static boolean checkBrackets(String str){ + int mismatchedBrackets = 0; + for(char ch:str.toCharArray()){ + if(ch == '['){ + mismatchedBrackets++; + }else if(ch == ']'){ + mismatchedBrackets--; + }else{ + return false; //non-bracket chars + } + if(mismatchedBrackets < 0){ //close bracket before open bracket + return false; + } + } + return mismatchedBrackets == 0; + } + + public static String generate(int n){ + if(n % 2 == 1){ //if n is odd we can't match brackets + return null; + } + String ans = ""; + int openBracketsLeft = n / 2; + int unclosed = 0; + while(ans.length() < n){ + if(Math.random() >= .5 && openBracketsLeft > 0 || unclosed == 0){ + ans += '['; + openBracketsLeft--; + unclosed++; + }else{ + ans += ']'; + unclosed--; + } + } + return ans; + } + + public static void main(String[] args){ + String[] tests = {"", "[]", "][", "[][]", "][][", "[[][]]", "[]][[]"}; + for(int i = 0; i <= 16; i+=2){ + String bracks = generate(i); + System.out.println(bracks + ": " + checkBrackets(bracks)); + } + + for(String test: tests){ + System.out.println(test + ": " + checkBrackets(test)); + } + } +} diff --git a/Task/Balanced-brackets/JavaScript/balanced-brackets-1.js b/Task/Balanced-brackets/JavaScript/balanced-brackets-1.js new file mode 100644 index 0000000000..3c8c523386 --- /dev/null +++ b/Task/Balanced-brackets/JavaScript/balanced-brackets-1.js @@ -0,0 +1,43 @@ +function createRandomBracketSequence(maxlen) +{ + var chars = { '0' : '[' , '1' : ']' }; + function getRandomInteger(to) + { + return Math.floor(Math.random() * (to+1)); + } + var n = getRandomInteger(maxlen); + var result = []; + for(var i = 0; i < n; i++) + { + result.push(chars[getRandomInteger(1)]); + } + return result.join(""); +} + +function bracketsAreBalanced(s) +{ + var open = (arguments.length > 1) ? arguments[1] : '['; + var close = (arguments.length > 2) ? arguments[2] : ']'; + var c = 0; + for(var i = 0; i < s.length; i++) + { + var ch = s.charAt(i); + if ( ch == open ) + { + c++; + } + else if ( ch == close ) + { + c--; + if ( c < 0 ) return false; + } + } + return c == 0; +} + +var c = 0; +while ( c < 5 ) { + var seq = createRandomBracketSequence(8); + alert(seq + ':\t' + bracketsAreBalanced(seq)); + c++; +} diff --git a/Task/Balanced-brackets/JavaScript/balanced-brackets-2.js b/Task/Balanced-brackets/JavaScript/balanced-brackets-2.js new file mode 100644 index 0000000000..7f6f2b1ff7 --- /dev/null +++ b/Task/Balanced-brackets/JavaScript/balanced-brackets-2.js @@ -0,0 +1,29 @@ +function checkBalance(i) { + while (i.length % 2 == 0) { + j = i.replace('{}',''); + if (j == i) + break; + i = j; + } + return (i?false:true); +} + +var g = 10; +while (g--) { + var N = 10 - Math.floor(g/2), n=N, o=''; + while (n || N) { + if (N == 0 || n == 0) { + o+=Array(++N).join('}') + Array(++n).join('{'); + break; + } + if (Math.round(Math.random()) == 1) { + o+='}'; + N--; + } + else { + o+='{'; + n--; + } + } + alert(o+": "+checkBalance(o)); +} diff --git a/Task/Balanced-brackets/Lua/balanced-brackets.lua b/Task/Balanced-brackets/Lua/balanced-brackets.lua new file mode 100644 index 0000000000..54764a5b25 --- /dev/null +++ b/Task/Balanced-brackets/Lua/balanced-brackets.lua @@ -0,0 +1,20 @@ +function isBalanced(s) + --Lua pattern matching has a 'balanced' pattern that matches sets of balanced characters. + --Any two characters can be used. + return s:gsub('%b[]','')=='' and true or false +end + +function randomString() + math.randomseed(os.time()) + math.random()math.random()math.random()math.random() + local tokens={'[',']'} + local result={} + for i=1,8 do + table.insert(result,tokens[math.random(1,2)]) + end + return table.concat(result) +end + +local RS=randomString() +print(RS) +print(isBalanced(RS)) diff --git a/Task/Balanced-brackets/Perl/balanced-brackets-1.pl b/Task/Balanced-brackets/Perl/balanced-brackets-1.pl new file mode 100644 index 0000000000..f629496158 --- /dev/null +++ b/Task/Balanced-brackets/Perl/balanced-brackets-1.pl @@ -0,0 +1,13 @@ +use 5.10.0; # for given ... when construct +sub balanced { + my $depth = 0; + for (split //, shift) { + when('[') { ++$depth } + when(']') { return if --$depth < 0 } + } + return !$depth +} + +for (']', '[', '[[]', '][]', '[[]]', '[[]]]][][]]', 'x[ y [ [] z ]][ 1 ][]abcd') { + print balanced($_) ? "" : "not ", "balanced:\t'$_'\n"; +} diff --git a/Task/Balanced-brackets/Perl/balanced-brackets-2.pl b/Task/Balanced-brackets/Perl/balanced-brackets-2.pl new file mode 100644 index 0000000000..0ee712dcc8 --- /dev/null +++ b/Task/Balanced-brackets/Perl/balanced-brackets-2.pl @@ -0,0 +1,10 @@ +use 5.10.0; # for '++' non-backtrack behavior +sub balanced { + my $_ = shift; + s/(\[(?:[^\[\]]++|(?1))*\])//g; + ! /[\[\]]/; +} + +for (']', '[', '[[]', '][]', '[[]]', '[[]]]][][]]', 'x[ y [ [] z ]][ 1 ][]abcd') { + print balanced($_) ? "" : "not ", "balanced:\t'$_'\n"; +} diff --git a/Task/Balanced-brackets/PicoLisp/balanced-brackets.l b/Task/Balanced-brackets/PicoLisp/balanced-brackets.l new file mode 100644 index 0000000000..4df0137cd6 --- /dev/null +++ b/Task/Balanced-brackets/PicoLisp/balanced-brackets.l @@ -0,0 +1,17 @@ +(load "@lib/simul.l") # For 'shuffle' + +(de generateBrackets (N) + (shuffle (make (do N (link "[" "]")))) ) + +(de checkBrackets (S) + (let N 0 + (for C S + (if (= C "[") + (inc 'N) + (if2 (= C "]") (=0 N) + (off N) + (dec 'N) ) ) ) + (=0 N) ) ) + +(for N 10 + (prinl (if (checkBrackets (prin (generateBrackets N))) " OK" "not OK")) ) diff --git a/Task/Balanced-brackets/Prolog/balanced-brackets.pro b/Task/Balanced-brackets/Prolog/balanced-brackets.pro new file mode 100644 index 0000000000..fbcbbdf67d --- /dev/null +++ b/Task/Balanced-brackets/Prolog/balanced-brackets.pro @@ -0,0 +1,52 @@ +rosetta_brackets :- + test_brackets([]), + test_brackets(['[',']']), + test_brackets(['[',']','[',']']), + test_brackets(['[','[',']','[',']',']']), + test_brackets([']','[']), + test_brackets([']','[',']','[']), + test_brackets(['[',']',']','[','[',']']). + +balanced_brackets :- + gen_bracket(2, B1, []), test_brackets(B1), + gen_bracket(4, B2, []), test_brackets(B2), + gen_bracket(4, B3, []), test_brackets(B3), + gen_bracket(6, B4, []), test_brackets(B4), + gen_bracket(6, B5, []), test_brackets(B5), + gen_bracket(8, B6, []), test_brackets(B6), + gen_bracket(8, B7, []), test_brackets(B7), + gen_bracket(10, B8, []), test_brackets(B8), + gen_bracket(10, B9, []), test_brackets(B9). + +test_brackets(Goal) :- + ( Goal = [] -> write('(empty)'); maplist(write, Goal)), + ( balanced_brackets(Goal, []) -> + writeln(' succeed') + ; + writeln(' failed') + ). + +% grammar of balanced brackets +balanced_brackets --> []. + +balanced_brackets --> + ['['], + balanced_brackets, + [']']. + +balanced_brackets --> + ['[',']'], + balanced_brackets. + + +% generator of random brackets +gen_bracket(0) --> []. + +gen_bracket(N) --> + {N1 is N - 1, + R is random(2)}, + bracket(R), + gen_bracket(N1). + +bracket(0) --> ['[']. +bracket(1) --> [']']. diff --git a/Task/Balanced-brackets/Python/balanced-brackets.py b/Task/Balanced-brackets/Python/balanced-brackets.py new file mode 100644 index 0000000000..b58f162dfb --- /dev/null +++ b/Task/Balanced-brackets/Python/balanced-brackets.py @@ -0,0 +1,27 @@ +>>> def gen(N): +... txt = ['[', ']'] * N +... random.shuffle( txt ) +... return ''.join(txt) +... +>>> def balanced(txt): +... braced = 0 +... for ch in txt: +... if ch == '[': braced += 1 +... if ch == ']': +... braced -= 1 +... if braced < 0: return False +... return braced == 0 +... +>>> for txt in (gen(N) for N in range(10)): +... print ("%-22r is%s balanced" % (txt, '' if balanced(txt) else ' not')) +... +'' is balanced +'[]' is balanced +'[][]' is balanced +'][[[]]' is not balanced +'[]][[][]' is not balanced +'[][[][]]][' is not balanced +'][]][][[]][[' is not balanced +'[[]]]]][]][[[[' is not balanced +'[[[[]][]]][[][]]' is balanced +'][[][[]]][]]][[[[]' is not balanced diff --git a/Task/Balanced-brackets/R/balanced-brackets-1.r b/Task/Balanced-brackets/R/balanced-brackets-1.r new file mode 100644 index 0000000000..45503a5d9d --- /dev/null +++ b/Task/Balanced-brackets/R/balanced-brackets-1.r @@ -0,0 +1,5 @@ +balanced <- function(str){ + str <- strsplit(str, "")[[1]] + str <- ifelse(str=='[', 1, -1) + all(cumsum(str) >= 0) && sum(str) == 0 +} diff --git a/Task/Balanced-brackets/R/balanced-brackets-2.r b/Task/Balanced-brackets/R/balanced-brackets-2.r new file mode 100644 index 0000000000..7b38727c93 --- /dev/null +++ b/Task/Balanced-brackets/R/balanced-brackets-2.r @@ -0,0 +1,3 @@ +balanced <- function(str) { + regexpr('^(\\[(?1)*\\])*$', str, perl=TRUE) > -1 +} diff --git a/Task/Balanced-brackets/R/balanced-brackets-3.r b/Task/Balanced-brackets/R/balanced-brackets-3.r new file mode 100644 index 0000000000..044416269f --- /dev/null +++ b/Task/Balanced-brackets/R/balanced-brackets-3.r @@ -0,0 +1,6 @@ +rand.parens <- function(n) paste(permute(c(rep('[',n),rep(']',n))),collapse="") + +as.data.frame(within(list(), { + parens <- replicate(10, rand.parens(sample.int(10,size=1))) + balanced <- sapply(parens, balanced) +})) diff --git a/Task/Balanced-brackets/R/balanced-brackets-4.r b/Task/Balanced-brackets/R/balanced-brackets-4.r new file mode 100644 index 0000000000..834dd2fa79 --- /dev/null +++ b/Task/Balanced-brackets/R/balanced-brackets-4.r @@ -0,0 +1,11 @@ + balanced parens +1 FALSE ][][ +2 FALSE [][[]]][[]][]]][[[ +3 FALSE ][[][][]][][[] +4 FALSE ][][][][][][][ +5 TRUE [[[][]]][[[][][]]] +6 TRUE [] +7 FALSE ]][[][[] +8 FALSE []]]][[[]][[[] +9 TRUE [[[[][[][]]]]] +10 TRUE [] diff --git a/Task/Balanced-brackets/REXX/balanced-brackets-1.rexx b/Task/Balanced-brackets/REXX/balanced-brackets-1.rexx new file mode 100644 index 0000000000..5f3acdb5e0 --- /dev/null +++ b/Task/Balanced-brackets/REXX/balanced-brackets-1.rexx @@ -0,0 +1,40 @@ +/*REXX program to check for balanced brackets [] */ +@.=0 +yesno.0 = left('',40) 'unbalanced' +yesno.1 = 'balanced' + +q='[][][][[]]' ; call checkBal q; say yesno.result q +q='[][][][[]]][' ; call checkBal q; say yesno.result q +q='[' ; call checkBal q; say yesno.result q +q=']' ; call checkBal q; say yesno.result q +q='[]' ; call checkBal q; say yesno.result q +q='][' ; call checkBal q; say yesno.result q +q='][][' ; call checkBal q; say yesno.result q +q='[[]]' ; call checkBal q; say yesno.result q +q='[[[[[[[]]]]]]]' ; call checkBal q; say yesno.result q +q='[[[[[]]]][]' ; call checkBal q; say yesno.result q +q='[][]' ; call checkBal q; say yesno.result q +q='[]][[]' ; call checkBal q; say yesno.result q +q=']]][[[[]' ; call checkBal q; say yesno.result q + + do j=1 for 40 + q=translate(rand(random(1,8)),'[]',01) + call checkBal q; if result=='-1' then iterate + say yesno.result q + end +exit +/*───────────────────────────────────PAND subroutine────────────────────*/ +pand: p=random(0,1); return p || \p +/*───────────────────────────────────RAND subroutine────────────────────*/ +rand: pp=pand(); pp=pand()pp; pp=copies(pp,arg(1)) + i=random(2,length(pp)); pp=left(pp,i-1)substr(pp,i) +return pp +/*───────────────────────────────────CHECKBAL subroutine────────────────*/ +checkBal: procedure expose @.; arg y /*check for balanced brackets [] */ +nest=0; if @.y then return '-1' /*already done this expression ? */ +@.y=1 /*indicate expression processed. */ + do j=1 for length(y); _=substr(y,j,1) /*pick off character.*/ + if _=='[' then nest=nest+1 + else do; nest=nest-1; if nest<0 then return 0; end + end /*j*/ +return nest==0 diff --git a/Task/Balanced-brackets/REXX/balanced-brackets-2.rexx b/Task/Balanced-brackets/REXX/balanced-brackets-2.rexx new file mode 100644 index 0000000000..056750d32b --- /dev/null +++ b/Task/Balanced-brackets/REXX/balanced-brackets-2.rexx @@ -0,0 +1,67 @@ +/*REXX program to check for balanced brackets [] ********************** +* test strings and random string generation copied from Version 1 +* the rest restructured (shortened) to some extent +* and output made reproducible (random with a seed) +* 10.07.2012 Walter Pachl +**********************************************************************/ +yesno.0 = 'unbalanced' +yesno.1 = ' balanced' +done.=0 /* memory what's been done */ +n=0 /* number of tests */ +Call testbal '[][][][[]]' /* first some user written tests */ +Call testbal '[][][][[]]][' +Call testbal '[' +Call testbal ']' +Call testbal '[]' +Call testbal '][' +Call testbal '][][' +Call testbal '[[]]' +Call testbal '[[[[[[[]]]]]]]' +Call testbal '[[[[[]]]][]' +Call testbal '[][]' +Call testbal '[]][[]' +Call testbal ']]][[[[]' +Call testbal ']' +Call testbal '[' + /* then some random generated ones */ +Call random 1,2,12345 /* call random with a seed */ + /* makes test reproducible */ +do Until n=30 /* up to 30 tests */ + s=rand(random(1,8)) /* a 01 etc. string of length 4-32 */ + q=translate(s,'[]',01) /* turn digits into brackets */ + if done.q then /* string was already here */ + iterate /* don't test again */ + call testbal q /* test balance */ + End +exit + +testbal: /* test the given string and show result */ + n=n+1 /* number of tests */ + Parse Arg q /* get string to be tested */ + done.q=1 /* mark as done */ + call checkBal q /* test balance */ + lq=format(length(q),2) + say right(n,2) lq yesno.result q/* show result and string */ + Return + +/*-----------------------------------PAND subroutine-----------------*/ +pand: p=random(0,1); return p || \p +/*-----------------------------------RAND subroutine-----------------*/ +rand: pp=pand(); pp=pand()pp; pp=copies(pp,arg(1)) + i=random(2,length(pp)); pp=left(pp,i-1)substr(pp,i) +return pp + +checkBal: procedure /*check for balanced brackets () */ + Parse arg y + nest=0; + do While y<>'' + Parse Var y c +1 y /*pick off one character at a time */ + if c='[' then /* opening bracket */ + nest=nest+1 /* increment nesting */ + else do /* closing bracket */ + if nest=0 then /* not allowed */ + return 0; /* no success */ + nest=nest-1 /* decrement nesting */ + end + end + return nest=0 /* nest=0 -> balanced */ diff --git a/Task/Balanced-brackets/REXX/balanced-brackets-3.rexx b/Task/Balanced-brackets/REXX/balanced-brackets-3.rexx new file mode 100644 index 0000000000..86bb17a118 --- /dev/null +++ b/Task/Balanced-brackets/REXX/balanced-brackets-3.rexx @@ -0,0 +1,58 @@ +/*REXX program to check for balanced brackets [ ] */ +count=0 +nested=0 +yesno.0 = left('',40) 'unbalanced' +yesno.1 = 'balanced' +q='' ; call checkBal q; say yesno.result q +q='[][][][[]]' ; call checkBal q; say yesno.result q +q='[][][][[]]][' ; call checkBal q; say yesno.result q +q='[' ; call checkBal q; say yesno.result q +q=']' ; call checkBal q; say yesno.result q +q='[]' ; call checkBal q; say yesno.result q +q='][' ; call checkBal q; say yesno.result q +q='][][' ; call checkBal q; say yesno.result q +q='[[]]' ; call checkBal q; say yesno.result q +q='[[[[[[[]]]]]]]' ; call checkBal q; say yesno.result q +q='[[[[[]]]][]' ; call checkBal q; say yesno.result q +q='[][]' ; call checkBal q; say yesno.result q +q='[]][[]' ; call checkBal q; say yesno.result q +q=']]][[[[]' ; call checkBal q; say yesno.result q +call teller +count=0 +nested=0 + do j=1 /*generate lots of permutations. */ + q=translate(strip(x2b(d2x(j)),'L',0),"][",01) /*convert──►[].*/ + if countstr(']',q)\==countstr('[',q) then iterate /*compliant?*/ + call checkBal q + if length(q)>20 then leave /*done all 20-char possibilities?*/ + end +/*───────────────────────────────────TELLER subroutine──────────────────*/ +teller: say +say count " expressions were checked, " nested ' were balanced, ', + count-nested " were unbalanced." +return +/*───────────────────────────────────CHECKBAL subroutine────────────────*/ +checkBal: procedure expose nested count; parse arg y; count=count+1 +nest=0 + do j=1 for length(y); _=substr(y,j,1) /*pick off character.*/ + select + when _=='[' then nest=nest+1 /*opening bracket ...*/ + when _==']' then do; nest=nest-1; if nest<0 then leave; end + otherwise nop /*ignore any chaff. */ + end /*select*/ + end /*j*/ +nested=nested + (nest==0) +return nest==0 +/* ┌──────────────────────────────────────────────────────────────────┐ + │ COUNTSTR counts the number of occurances of a string (or char)│ + │ within another string (haystack) without overlap. If either arg │ + │ is null, 0 (zero) is returned. To make the subroutine case │ + │ insensative, change the PARSE ARG ... statement to ARG ... │ + │ Example: yyy = 'The quick brown fox jumped over the lazy dog.' │ + │ zz = countstr('o',yyy) /*ZZ will be set to 4 */ │ + │ Note that COUNTSTR is also a built-in function of the newer │ + │ REXX interpreters, and the result should be identical. Checks │ + │ could be added to validate if 2 or 3 arguments are passed. │ + └──────────────────────────────────────────────────────────────────┘ */ +countstr: procedure; parse arg n,h,s; if s=='' then s=1; w=length(n) + do r=0 until _==0; _=pos(n,h,s); s=_+w; end; return r diff --git a/Task/Balanced-brackets/Racket/balanced-brackets.rkt b/Task/Balanced-brackets/Racket/balanced-brackets.rkt new file mode 100644 index 0000000000..ae5071a590 --- /dev/null +++ b/Task/Balanced-brackets/Racket/balanced-brackets.rkt @@ -0,0 +1,17 @@ +#lang racket + +(define (generate n) + (list->string (shuffle (append* (make-list n '(#\[ #\])))))) + +(define (balanced? str) + (let loop ([l (string->list str)] [n 0]) + (or (null? l) + (if (eq? #\[ (car l)) + (loop (cdr l) (add1 n)) + (and (> n 0) (loop (cdr l) (sub1 n))))))) + +(define (try n) + (define s (generate n)) + (printf "~a => ~a\n" s (if (balanced? s) "OK" "NOT OK"))) + +(for ([n 10]) (try n)) diff --git a/Task/Balanced-brackets/Ruby/balanced-brackets.rb b/Task/Balanced-brackets/Ruby/balanced-brackets.rb new file mode 100644 index 0000000000..3a94339a72 --- /dev/null +++ b/Task/Balanced-brackets/Ruby/balanced-brackets.rb @@ -0,0 +1,24 @@ +re = /\A # beginning of string + (? # begin capture group + \[ # literal [ + \g* # zero or more + \] # literal ] + )* # end group, zero or more such groups +\z/x # end of string + +(0..9).each do |i| + s = "[]" * i + + # There is no String#shuffle! method. + # This is a Knuth shuffle. + (s.length - 1).downto(1) do |a; b| + b = rand(a + 1) + s[a], s[b] = s[b], s[a] + end + + puts((s =~ re ? " OK: " : "bad: ") + s) +end + +["[[]", "[]]", "[letters]"].each do |s| + puts((s =~ re ? " OK: " : "bad: ") + s) +end diff --git a/Task/Balanced-brackets/Scala/balanced-brackets.scala b/Task/Balanced-brackets/Scala/balanced-brackets.scala new file mode 100644 index 0000000000..9a94614921 --- /dev/null +++ b/Task/Balanced-brackets/Scala/balanced-brackets.scala @@ -0,0 +1,36 @@ +import scala.collection.mutable.ListBuffer +import scala.util.Random + +object BalancedBrackets extends App { + + val random = new Random() + def generateRandom: List[String] = { + import scala.util.Random._ + val shuffleIt: Int => String = i => shuffle(("["*i+"]"*i).toList).foldLeft("")(_+_) + (1 to 20).map(i=>(random.nextDouble*100).toInt).filter(_>2).map(shuffleIt(_)).toList + } + + def generate(n: Int): List[String] = { + val base = "["*n+"]"*n + var lb = ListBuffer[String]() + base.permutations.foreach(s=>lb+=s) + lb.toList.sorted + } + + def checkBalance(brackets: String):Boolean = { + def balI(brackets: String, depth: Int):Boolean = { + if (brackets == "") depth == 0 + else brackets(0) match { + case '[' => ((brackets.size > 1) && balI(brackets.substring(1), depth + 1)) + case ']' => (depth > 0) && ((brackets.size == 1) || balI(brackets.substring(1), depth -1)) + case _ => false + } + } + balI(brackets, 0) + } + + println("arbitrary random order:") + generateRandom.map(s=>Pair(s,checkBalance(s))).foreach(p=>println((if(p._2) "balanced: " else "unbalanced: ")+p._1)) + println("\n"+"check all permutations of given length:") + (1 to 5).map(generate(_)).flatten.map(s=>Pair(s,checkBalance(s))).foreach(p=>println((if(p._2) "balanced: " else "unbalanced: ")+p._1)) +} diff --git a/Task/Balanced-brackets/Scheme/balanced-brackets.ss b/Task/Balanced-brackets/Scheme/balanced-brackets.ss new file mode 100644 index 0000000000..d4c36dd866 --- /dev/null +++ b/Task/Balanced-brackets/Scheme/balanced-brackets.ss @@ -0,0 +1,23 @@ +(define (balanced-brackets string) + (define (b chars sum) + (cond ((and (null? chars) (= 0 sum)) + #t) + ((null? chars) + #f) + ((char=? #\[ (car chars)) + (b (cdr chars) (+ sum 1))) + ((= sum 0) + #f) + (else + (b (cdr chars) (- sum 1))))) + (b (string->list string) 0)) + +(balanced-brackets "") + +(balanced-brackets "[]") +(balanced-brackets "[][]") +(balanced-brackets "[[][]]") + +(balanced-brackets "][") +(balanced-brackets "][][") +(balanced-brackets "[]][[]") diff --git a/Task/Balanced-brackets/Tcl/balanced-brackets-1.tcl b/Task/Balanced-brackets/Tcl/balanced-brackets-1.tcl new file mode 100644 index 0000000000..82d7ece066 --- /dev/null +++ b/Task/Balanced-brackets/Tcl/balanced-brackets-1.tcl @@ -0,0 +1,28 @@ +proc generate {n} { + if {!$n} return + set l [lrepeat $n "\[" "\]"] + set len [llength $l] + while {$len} { + set tmp [lindex $l [set i [expr {int($len * rand())}]]] + lset l $i [lindex $l [incr len -1]] + lset l $len $tmp + } + return [join $l ""] +} + +proc balanced s { + set n 0 + foreach c [split $s ""] { + # Everything unmatched is ignored, which is what we want + switch -exact -- $c { + "\[" {incr n} + "\]" {if {[incr n -1] < 0} {return false}} + } + } + expr {!$n} +} + +for {set i 0} {$i < 15} {incr i} { + set s [generate $i] + puts "\"$s\"\t-> [expr {[balanced $s] ? {OK} : {NOT OK}}]" +} diff --git a/Task/Balanced-brackets/Tcl/balanced-brackets-2.tcl b/Task/Balanced-brackets/Tcl/balanced-brackets-2.tcl new file mode 100644 index 0000000000..f01beac2ea --- /dev/null +++ b/Task/Balanced-brackets/Tcl/balanced-brackets-2.tcl @@ -0,0 +1,8 @@ +proc constructBalancedString {n} { + set s "" + for {set i 0} {$i < $n} {incr i} { + set x [expr {int(rand() * ([string length $s] + 1))}] + set s "[string range $s 0 [expr {$x-1}]]\[\][string range $s $x end]" + } + return $s +} diff --git a/Task/Balanced-ternary/0DESCRIPTION b/Task/Balanced-ternary/0DESCRIPTION new file mode 100644 index 0000000000..eed72da3b5 --- /dev/null +++ b/Task/Balanced-ternary/0DESCRIPTION @@ -0,0 +1,16 @@ +[[wp:Balanced ternary|Balanced ternary]] is a way of representing numbers. Unlike the prevailing binary representation, a balanced ternary integer is in base 3, and each digit can have the values 1, 0, or −1. For example, decimal 11 = 32 + 31 − 30, thus can be written as "++−", while 6 = 32 − 31 + 0 × 30, i.e., "+−0". + +For this task, implement balanced ternary representation of integers with the following + +'''Requirements''' +# Support arbitrarily large integers, both positive and negative; +# Provide ways to convert to and from text strings, using digits '+', '-' and '0' (unless you are already using strings to represent balanced ternary; but see requirement 5). +# Provide ways to convert to and from native integer type (unless, improbably, your platform's native integer type ''is'' balanced ternary). If your native integers can't support arbitrary length, overflows during conversion must be indicated. +# Provide ways to perform addition, negation and multiplication directly on balanced ternary integers; do ''not'' convert to native integers first. +# Make your implementation efficient, with a reasonable definition of "effcient" (and with a reasonable definition of "reasonable"). + +'''Test case''' With balanced ternaries ''a'' from string "+-0++0+", ''b'' from native integer -436, ''c'' "+-++-": +* write out ''a'', ''b'' and ''c'' in decimal notation; +* calculate ''a'' × (''b'' − ''c''), write out the result in both ternary and decimal notations. + +'''Note:''' The pages [[generalised floating point addition]] and [[generalised floating point multiplication]] have code implementing [[wp:arbitrary precision|arbitrary precision]] [[wp:floating point|floating point]] balanced ternary. diff --git a/Task/Balanced-ternary/Ada/balanced-ternary-1.ada b/Task/Balanced-ternary/Ada/balanced-ternary-1.ada new file mode 100644 index 0000000000..dd4c353d57 --- /dev/null +++ b/Task/Balanced-ternary/Ada/balanced-ternary-1.ada @@ -0,0 +1,47 @@ +with Ada.Finalization; + +package BT is + + type Balanced_Ternary is private; + + -- conversions + function To_Balanced_Ternary (Num : Integer) return Balanced_Ternary; + function To_Balanced_Ternary (Str : String) return Balanced_Ternary; + function To_Integer (Num : Balanced_Ternary) return Integer; + function To_string (Num : Balanced_Ternary) return String; + + -- Arithmetics + -- unary minus + function "-" (Left : in Balanced_Ternary) + return Balanced_Ternary; + + -- subtraction + function "-" (Left, Right : in Balanced_Ternary) + return Balanced_Ternary; + + -- addition + function "+" (Left, Right : in Balanced_Ternary) + return Balanced_Ternary; + -- multiplication + function "*" (Left, Right : in Balanced_Ternary) + return Balanced_Ternary; + +private + -- a balanced ternary number is a unconstrained array of (1,0,-1) + -- dinamically allocated, least significant trit leftmost + type Trit is range -1..1; + type Trit_Array is array (Positive range <>) of Trit; + pragma Pack(Trit_Array); + + type Trit_Access is access Trit_Array; + + type Balanced_Ternary is new Ada.Finalization.Controlled + with record + Ref : Trit_access; + end record; + + procedure Initialize (Object : in out Balanced_Ternary); + procedure Adjust (Object : in out Balanced_Ternary); + procedure Finalize (Object : in out Balanced_Ternary); + +end BT; diff --git a/Task/Balanced-ternary/Ada/balanced-ternary-2.ada b/Task/Balanced-ternary/Ada/balanced-ternary-2.ada new file mode 100644 index 0000000000..dd743e2dec --- /dev/null +++ b/Task/Balanced-ternary/Ada/balanced-ternary-2.ada @@ -0,0 +1,181 @@ +with Ada.Unchecked_Deallocation; + +package body BT is + + procedure Free is new Ada.Unchecked_Deallocation (Trit_Array, Trit_Access); + + -- Conversions + -- String to BT + function To_Balanced_Ternary (Str: String) return Balanced_Ternary is + J : Positive := 1; + Tmp : Trit_Access; + begin + Tmp := new Trit_Array (1..Str'Last); + for I in reverse Str'Range loop + case Str(I) is + when '+' => Tmp (J) := 1; + when '-' => Tmp (J) := -1; + when '0' => Tmp (J) := 0; + when others => raise Constraint_Error; + end case; + J := J + 1; + end loop; + return (Ada.Finalization.Controlled with Ref => Tmp); + end To_Balanced_Ternary; + + -- Integer to BT + function To_Balanced_Ternary (Num: Integer) return Balanced_Ternary is + K : Integer := 0; + D : Integer; + Value : Integer := Num; + Tmp : Trit_Array(1..19); -- 19 trits is enough to contain + -- a 32 bits signed integer + begin + loop + D := (Value mod 3**(K+1))/3**K; + if D = 2 then D := -1; end if; + Value := Value - D*3**K; + K := K + 1; + Tmp(K) := Trit(D); + exit when Value = 0; + end loop; + return (Ada.Finalization.Controlled + with Ref => new Trit_Array'(Tmp(1..K))); + end To_Balanced_Ternary; + + -- BT to Integer -- + -- If the BT number is too large Ada will raise CONSTRAINT ERROR + function To_Integer (Num : Balanced_Ternary) return Integer is + Value : Integer := 0; + Pos : Integer := 1; + begin + for I in Num.Ref.all'Range loop + Value := Value + Integer(Num.Ref(I)) * Pos; + Pos := Pos * 3; + end loop; + return Value; + end To_Integer; + + -- BT to String -- + function To_String (Num : Balanced_Ternary) return String is + I : constant Integer := Num.Ref.all'Last; + Result : String (1..I); + begin + for J in Result'Range loop + case Num.Ref(I-J+1) is + when 0 => Result(J) := '0'; + when -1 => Result(J) := '-'; + when 1 => Result(J) := '+'; + end case; + end loop; + return Result; + end To_String; + + -- unary minus -- + function "-" (Left : in Balanced_Ternary) + return Balanced_Ternary is + Result : constant Balanced_Ternary := Left; + begin + for I in Result.Ref.all'Range loop + Result.Ref(I) := - Result.Ref(I); + end loop; + return Result; + end "-"; + + -- addition -- + Carry : Trit; + + function Add (Left, Right : in Trit) + return Trit is + begin + if Left /= Right then + Carry := 0; + return Left + Right; + else + Carry := Left; + return -Right; + end if; + end Add; + pragma Inline (Add); + + function "+" (Left, Right : in Trit_Array) + return Balanced_Ternary is + Max_Size : constant Integer := + Integer'Max(Left'Last, Right'Last); + Tmp_Left, Tmp_Right : Trit_Array(1..Max_Size) := (others => 0); + Result : Trit_Array(1..Max_Size+1) := (others => 0); + begin + Tmp_Left (1..Left'Last) := Left; + Tmp_Right(1..Right'Last) := Right; + for I in Tmp_Left'Range loop + Result(I) := Add (Result(I), Tmp_Left(I)); + Result(I+1) := Carry; + Result(I) := Add(Result(I), Tmp_Right(I)); + Result(I+1) := Add(Result(I+1), Carry); + end loop; + -- remove trailing zeros + for I in reverse Result'Range loop + if Result(I) /= 0 then + return (Ada.Finalization.Controlled + with Ref => new Trit_Array'(Result(1..I))); + end if; + end loop; + return (Ada.Finalization.Controlled + with Ref => new Trit_Array'(1 => 0)); + end "+"; + + function "+" (Left, Right : in Balanced_Ternary) + return Balanced_Ternary is + begin + return Left.Ref.all + Right.Ref.all; + end "+"; + + -- Subtraction + function "-" (Left, Right : in Balanced_Ternary) + return Balanced_Ternary is + begin + return Left + (-Right); + end "-"; + + -- multiplication + function "*" (Left, Right : in Balanced_Ternary) + return Balanced_Ternary is + A, B : Trit_Access; + Result : Balanced_Ternary; + begin + if Left.Ref.all'Length > Right.Ref.all'Length then + A := Right.Ref; B := Left.Ref; + else + B := Right.Ref; A := Left.Ref; + end if; + for I in A.all'Range loop + if A(I) /= 0 then + declare + Tmp_Result : Trit_Array (1..I+B.all'Length-1) := (others => 0); + begin + for J in B.all'Range loop + Tmp_Result(I+J-1) := B(J) * A(I); + end loop; + Result := Result.Ref.all + Tmp_Result; + end; + end if; + end loop; + return Result; + end "*"; + + procedure Adjust (Object : in out Balanced_Ternary) is + begin + Object.Ref := new Trit_Array'(Object.Ref.all); + end Adjust; + + procedure Finalize (Object : in out Balanced_Ternary) is + begin + Free (Object.Ref); + end Finalize; + + procedure Initialize (Object : in out Balanced_Ternary) is + begin + Object.Ref := new Trit_Array'(1 => 0); + end Initialize; + +end BT; diff --git a/Task/Balanced-ternary/Ada/balanced-ternary-3.ada b/Task/Balanced-ternary/Ada/balanced-ternary-3.ada new file mode 100644 index 0000000000..309de4f858 --- /dev/null +++ b/Task/Balanced-ternary/Ada/balanced-ternary-3.ada @@ -0,0 +1,19 @@ +with Ada.Text_Io; use Ada.Text_Io; +with Ada.Integer_Text_Io; use Ada.Integer_Text_Io; +with BT; use BT; + +procedure TestBT is + Result, A, B, C : Balanced_Ternary; +begin + A := To_Balanced_Ternary("+-0++0+"); + B := To_Balanced_Ternary(-436); + C := To_Balanced_Ternary("+-++-"); + + Result := A * (B - C); + + Put("a = "); Put(To_integer(A), 4); New_Line; + Put("b = "); Put(To_integer(B), 4); New_Line; + Put("c = "); Put(To_integer(C), 4); New_Line; + Put("a * (b - c) = "); Put(To_integer(Result), 4); + Put_Line (" " & To_String(Result)); +end TestBT; diff --git a/Task/Balanced-ternary/Erlang/balanced-ternary-1.erl b/Task/Balanced-ternary/Erlang/balanced-ternary-1.erl new file mode 100644 index 0000000000..c1acdcc270 --- /dev/null +++ b/Task/Balanced-ternary/Erlang/balanced-ternary-1.erl @@ -0,0 +1,89 @@ +-module(ternary). +-compile(export_all). + +test() -> + AS = "+-0++0+", AT = from_string(AS), A = from_ternary(AT), + B = -436, BT = to_ternary(B), BS = to_string(BT), + CS = "+-++-", CT = from_string(CS), C = from_ternary(CT), + RT = mul(AT,sub(BT,CT)), + R = from_ternary(RT), + RS = to_string(RT), + io:fwrite("A = ~s -> ~b~n",[AS, A]), + io:fwrite("B = ~s -> ~b~n",[BS, B]), + io:fwrite("C = ~s -> ~b~n",[CS, C]), + io:fwrite("A x (B - C) = ~s -> ~b~n", [RS, R]). + +to_string(T) -> [to_char(X) || X <- T]. + +from_string(S) -> [from_char(X) || X <- S]. + +to_char(-1) -> $-; +to_char(0) -> $0; +to_char(1) -> $+. + +from_char($-) -> -1; +from_char($0) -> 0; +from_char($+) -> 1. + +to_ternary(N) when N > 0 -> + to_ternary(N,[]); +to_ternary(N) -> + neg(to_ternary(-N)). + +to_ternary(0,Acc) -> + Acc; +to_ternary(N,Acc) when N rem 3 == 0 -> + to_ternary(N div 3, [0|Acc]); +to_ternary(N,Acc) when N rem 3 == 1 -> + to_ternary(N div 3, [1|Acc]); +to_ternary(N,Acc) -> + to_ternary((N+1) div 3, [-1|Acc]). + +from_ternary(T) -> from_ternary(T,0). + +from_ternary([],Acc) -> + Acc; +from_ternary([H|T],Acc) -> + from_ternary(T,Acc*3 + H). + +mul(A,B) -> mul(B,A,[]). + +mul(_,[],Acc) -> + Acc; +mul(B,[A|As],Acc) -> + BP = case A of + -1 -> neg(B); + 0 -> [0]; + 1 -> B + end, + A1 = Acc++[0], + A2=add(BP,A1), + mul(B,As,A2). + + +neg(T) -> [ -H || H <- T]. + +sub(A,B) -> add(A,neg(B)). + +add(A,B) when length(A) < length(B) -> + add(lists:duplicate(length(B)-length(A),0)++A,B); +add(A,B) when length(A) > length(B) -> + add(B,A); +add(A,B) -> + add(lists:reverse(A),lists:reverse(B),0,[]). + +add([],[],0,Acc) -> + Acc; +add([],[],C,Acc) -> + [C|Acc]; +add([A|As],[B|Bs],C,Acc) -> + [C1,D] = add_util(A+B+C), + add(As,Bs,C1,[D|Acc]). + +add_util(-3) -> [-1,0]; +add_util(-2) -> [-1,1]; +add_util(-1) -> [0,-1]; +add_util(3) -> [1,0]; +add_util(2) -> [1,-1]; +add_util(1) -> [0,1]; +add_util(0) -> [0,0]. diff --git a/Task/Balanced-ternary/Erlang/balanced-ternary-2.erl b/Task/Balanced-ternary/Erlang/balanced-ternary-2.erl new file mode 100644 index 0000000000..ae6d176738 --- /dev/null +++ b/Task/Balanced-ternary/Erlang/balanced-ternary-2.erl @@ -0,0 +1,6 @@ +234> ternary:test(). +A = +-0++0+ -> 523 +B = -++-0-- -> -436 +C = +-++- -> 65 +A x (B - C) = 0----0+--0++0 -> -262023 +ok diff --git a/Task/Balanced-ternary/Go/balanced-ternary.go b/Task/Balanced-ternary/Go/balanced-ternary.go new file mode 100644 index 0000000000..533390de65 --- /dev/null +++ b/Task/Balanced-ternary/Go/balanced-ternary.go @@ -0,0 +1,224 @@ +package main + +import ( + "fmt" + "strings" +) + +// R1: representation is a slice of int8 digits of -1, 0, or 1. +// digit at index 0 is least significant. zero value of type is +// representation of the number 0. +type bt []int8 + +// R2: string conversion: + +// btString is a constructor. valid input is a string of any length +// consisting of only '+', '-', and '0' characters. +// leading zeros are allowed but are trimmed and not represented. +// false return means input was invalid. +func btString(s string) (*bt, bool) { + s = strings.TrimLeft(s, "0") + b := make(bt, len(s)) + for i, last := 0, len(s)-1; i < len(s); i++ { + switch s[i] { + case '-': + b[last-i] = -1 + case '0': + b[last-i] = 0 + case '+': + b[last-i] = 1 + default: + return nil, false + } + } + return &b, true +} + +// String method converts the other direction, returning a string of +// '+', '-', and '0' characters representing the number. +func (b bt) String() string { + if len(b) == 0 { + return "0" + } + last := len(b) - 1 + r := make([]byte, len(b)) + for i, d := range b { + r[last-i] = "-0+"[d+1] + } + return string(r) +} + +// R3: integer conversion +// int chosen as "native integer" + +// btInt is a constructor like btString. +func btInt(i int) *bt { + if i == 0 { + return new(bt) + } + var b bt + var btDigit func(int) + btDigit = func(digit int) { + m := int8(i % 3) + i /= 3 + switch m { + case 2: + m = -1 + i++ + case -2: + m = 1 + i-- + } + if i == 0 { + b = make(bt, digit+1) + } else { + btDigit(digit + 1) + } + b[digit] = m + } + btDigit(0) + return &b +} + +// Int method converts the other way, returning the value as an int type. +// !ok means overflow occurred during conversion, not necessarily that the +// value is not representable as an int. (Of course there are other ways +// of doing it but this was chosen as "reasonable.") +func (b bt) Int() (r int, ok bool) { + pt := 1 + for _, d := range b { + dp := int(d) * pt + neg := r < 0 + r += dp + if neg { + if r > dp { + return 0, false + } + } else { + if r < dp { + return 0, false + } + } + pt *= 3 + } + return r, true +} + +// R4: negation, addition, and multiplication + +func (z *bt) Neg(b *bt) *bt { + if z != b { + if cap(*z) < len(*b) { + *z = make(bt, len(*b)) + } else { + *z = (*z)[:len(*b)] + } + } + for i, d := range *b { + (*z)[i] = -d + } + return z +} + +func (z *bt) Add(a, b *bt) *bt { + if len(*a) < len(*b) { + a, b = b, a + } + r := *z + r = r[:cap(r)] + var carry int8 + for i, da := range *a { + if i == len(r) { + n := make(bt, len(*a)+4) + copy(n, r) + r = n + } + sum := da + carry + if i < len(*b) { + sum += (*b)[i] + } + carry = sum / 3 + sum %= 3 + switch { + case sum > 1: + sum -= 3 + carry++ + case sum < -1: + sum += 3 + carry-- + } + r[i] = sum + } + last := len(*a) + if carry != 0 { + if len(r) == last { + n := make(bt, last+4) + copy(n, r) + r = n + } + r[last] = carry + *z = r[:last+1] + return z + } + for { + if last == 0 { + *z = nil + break + } + last-- + if r[last] != 0 { + *z = r[:last+1] + break + } + } + return z +} + +func (z *bt) Mul(a, b *bt) *bt { + if len(*a) < len(*b) { + a, b = b, a + } + var na bt + for _, d := range *b { + if d == -1 { + na.Neg(a) + break + } + } + r := make(bt, len(*a)+len(*b)) + for i := len(*b) - 1; i >= 0; i-- { + switch (*b)[i] { + case 1: + p := r[i:] + p.Add(&p, a) + case -1: + p := r[i:] + p.Add(&p, &na) + } + } + i := len(r) + for i > 0 && r[i-1] == 0 { + i-- + } + *z = r[:i] + return z +} + +func main() { + a, _ := btString("+-0++0+") + b := btInt(-436) + c, _ := btString("+-++-") + show("a:", a) + show("b:", b) + show("c:", c) + show("a(b-c):", a.Mul(a, b.Add(b, c.Neg(c)))) +} + +func show(label string, b *bt) { + fmt.Printf("%7s %12v ", label, b) + if i, ok := b.Int(); ok { + fmt.Printf("%7d\n", i) + } else { + fmt.Println("int overflow") + } +} diff --git a/Task/Balanced-ternary/Haskell/balanced-ternary.hs b/Task/Balanced-ternary/Haskell/balanced-ternary.hs new file mode 100644 index 0000000000..da40860af6 --- /dev/null +++ b/Task/Balanced-ternary/Haskell/balanced-ternary.hs @@ -0,0 +1,62 @@ +data BalancedTernary = Bt [Int] + +zeroTrim a = if null s then [0] else s where + s = f [] [] a + f x _ [] = x + f x y (0:zs) = f x (y++[0]) zs + f x y (z:zs) = f (x++y++[z]) [] zs + +btList (Bt a) = a + +instance Eq BalancedTernary where + (==) a b = btList a == btList b + +btNormalize = listBt . _carry 0 where + _carry c [] = if c == 0 then [] else [c] + _carry c (a:as) = r:_carry cc as where + (cc, r) = f $ (a+c) `quotRem` 3 where + f (x, 2) = (x + 1, -1) + f (x, -2) = (x - 1, 1) + f x = x + +listBt = Bt . zeroTrim + +instance Show BalancedTernary where + show = reverse . map (\d->case d of -1->'-'; 0->'0'; 1->'+') . btList + +strBt = Bt . zeroTrim.reverse.map (\c -> case c of '-' -> -1; '0' -> 0; '+' -> 1) + +intBt :: Integral a => a -> BalancedTernary +intBt = fromIntegral . toInteger + +btInt = f . btList where + f [] = 0 + f (a:as) = a + 3 * f as + +listAdd a b = take (max (length a) (length b)) $ zipWith (+) (a++[0,0..]) (b++[0,0..]) + +-- mostly for operators, also small stuff to make GHC happy +instance Num BalancedTernary where + negate = Bt . map negate . btList + (+) x y = btNormalize $ listAdd (btList x) (btList y) + (*) x y = btNormalize $ mul_ (btList x) (btList y) where + mul_ _ [] = [] + mul_ [] _ = [] + mul_ (a:as) b = listAdd (map (a*) b) (0:mul_ as b) where + + -- we don't need to define binary "-" by hand + + signum (Bt a) = if a == [0] then 0 else Bt [last a] + abs x = if signum x == Bt [-1] then negate x else x + + fromInteger = btNormalize . f where + f 0 = [] + f x = fromInteger (rem x 3) : f (quot x 3) + + +main = let (a,b,c) = (strBt "+-0++0+", intBt (-436), strBt "+-++-") + r = a * (b - c) + in do + print $ map btInt [a,b,c] + print $ r + print $ btInt r diff --git a/Task/Balanced-ternary/Prolog/balanced-ternary-1.pro b/Task/Balanced-ternary/Prolog/balanced-ternary-1.pro new file mode 100644 index 0000000000..abb9250eba --- /dev/null +++ b/Task/Balanced-ternary/Prolog/balanced-ternary-1.pro @@ -0,0 +1,67 @@ +:- module('bt_convert.pl', [bt_convert/2, + op(950, xfx, btconv), + btconv/2]). + +:- use_module(library(clpfd)). + +:- op(950, xfx, btconv). + +X btconv Y :- + bt_convert(X, Y). + +% bt_convert(?X, ?L) +bt_convert(X, L) :- + ( (nonvar(L), \+is_list(L)) ->string_to_list(L, L1); L1 = L), + convert(X, L1), + ( var(L) -> string_to_list(L, L1); true). + +% map numbers toward digits +, - 0 +plus_moins( 1, 43). +plus_moins(-1, 45). +plus_moins( 0, 48). + + +convert(X, [48| L]) :- + var(X), + ( L \= [] -> convert(X, L); X = 0, !). + +convert(0, L) :- + var(L), !, string_to_list(L, [48]). + +convert(X, L) :- + ( (nonvar(X), X > 0) + ; (var(X), X #> 0, + L = [43|_], + maplist(plus_moins, L1, L))), + !, + convert(X, 0, [], L1), + ( nonvar(X) -> maplist(plus_moins, L1, LL), string_to_list(L, LL) + ; true). + +convert(X, L) :- + ( nonvar(X) -> Y is -X + ; X #< 0, + maplist(plus_moins, L2, L), + maplist(mult(-1), L2, L1)), + convert(Y, 0, [], L1), + ( nonvar(X) -> + maplist(mult(-1), L1, L2), + maplist(plus_moins, L2, LL), + string_to_list(L, LL) + ; X #= -Y). + +mult(X, Y, Z) :- + Z #= X * Y. + + +convert(0, 0, L, L) :- !. + +convert(0, 1, L, [1 | L]) :- !. + + +convert(N, C, LC, LF) :- + R #= N mod 3 + C, + R #> 1 #<==> C1, + N1 #= N / 3, + R1 #= R - 3 * C1, % C1 #= 1, + convert(N1, C1, [R1 | LC], LF). diff --git a/Task/Balanced-ternary/Prolog/balanced-ternary-2.pro b/Task/Balanced-ternary/Prolog/balanced-ternary-2.pro new file mode 100644 index 0000000000..fcdba9d917 --- /dev/null +++ b/Task/Balanced-ternary/Prolog/balanced-ternary-2.pro @@ -0,0 +1,123 @@ +:- module('bt_add.pl', [bt_add/3, + bt_add1/3, + op(900, xfx, btplus), + op(900, xfx, btmoins), + btplus/2, + btmoins/2, + strip_nombre/3 + ]). + +:- op(900, xfx, btplus). +:- op(900, xfx, btmoins). + +% define operator btplus +A is X btplus Y :- + bt_add(X, Y, A). + +% define operator btmoins +% no need to define a predicate for the substraction +A is X btmoins Y :- + X is Y btplus A. + + +% bt_add(?X, ?Y, ?R) +% R is X + Y +% X, Y, R are strings +% At least 2 args must be instantiated +bt_add(X, Y, R) :- + ( nonvar(X) -> string_to_list(X, X1); true), + ( nonvar(Y) -> string_to_list(Y, Y1); true), + ( nonvar(R) -> string_to_list(R, R1); true), + bt_add1(X1, Y1, R1), + ( var(X) -> string_to_list(X, X1); true), + ( var(Y) -> string_to_list(Y, Y1); true), + ( var(R) -> string_to_list(R, R1); true). + + + +% bt_add1(?X, ?Y, ?R) +% R is X + Y +% X, Y, R are lists +bt_add1(X, Y, R) :- + % initialisation : X and Y must have the same length + % we add zeros at the beginning of the shortest list + ( nonvar(X) -> length(X, LX); length(R, LR)), + ( nonvar(Y) -> length(Y, LY); length(R, LR)), + ( var(X) -> LX is max(LY, LR) , length(X1, LX), Y1 = Y ; X1 = X), + ( var(Y) -> LY is max(LX, LR) , length(Y1, LY), X1 = X ; Y1 = Y), + + Delta is abs(LX - LY), + ( LX < LY -> normalise(Delta, X1, X2), Y1 = Y2 + ; LY < LX -> normalise(Delta, Y1, Y2), X1 = X2 + ; X1 = X2, Y1 = Y2), + + + % if R is instancied, it must have, at least, the same length than X or Y + Max is max(LX, LY), + ( (nonvar(R), length(R, LR), LR < Max) -> Delta1 is Max - LR, normalise(Delta1, R, R2) + ; nonvar(R) -> R = R2 + ; true), + + bt_add(X2, Y2, C, R2), + + ( C = 48 -> strip_nombre(R2, R, []), + ( var(X) -> strip_nombre(X2, X, []) ; true), + ( var(Y) -> strip_nombre(Y2, Y, []) ; true) + ; var(R) -> strip_nombre([C|R2], R, []) + ; ( select(C, [45,43], [Ca]), + ( var(X) -> strip_nombre([Ca | X2], X, []) + ; strip_nombre([Ca | Y2], Y, [])))). + + +% here we actually compute the sum +bt_add([], [], 48, []). + +bt_add([H1|T1], [H2|T2], C3, [R2 | L]) :- + bt_add(T1, T2, C, L), + % add HH1 and H2 + ternary_sum(H1, H2, R1, C1), + % add first carry, + ternary_sum(R1, C, R2, C2), + % add second carry + ternary_sum(C1, C2, C3, _). + + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% ternary_sum +% @arg1 : V1 +% @arg2 : V2 +% @arg3 : R is V1 + V2 +% @arg4 : Carry +ternary_sum(43, 43, 45, 43). + +ternary_sum(43, 45, 48, 48). + +ternary_sum(45, 43, 48, 48). + +ternary_sum(45, 45, 43, 45). + +ternary_sum(X, 48, X, 48). + +ternary_sum(48, X, X, 48). + + +% if L has a length smaller than N, complete L with 0 (code 48) +normalise(0, L, L) :- !. +normalise(N, L1, L) :- + N1 is N - 1, + normalise(N1, [48 | L1], L). + + +% contrary of normalise +% remove leading zeros. +% special case of number 0 ! +strip_nombre([48]) --> {!}, "0". + +% enlève les zéros inutiles +strip_nombre([48 | L]) --> + strip_nombre(L). + + +strip_nombre(L) --> + L. diff --git a/Task/Balanced-ternary/Prolog/balanced-ternary-3.pro b/Task/Balanced-ternary/Prolog/balanced-ternary-3.pro new file mode 100644 index 0000000000..c76b448425 --- /dev/null +++ b/Task/Balanced-ternary/Prolog/balanced-ternary-3.pro @@ -0,0 +1,170 @@ +:- module('bt_mult.pl', [op(850, xfx, btmult), + btmult/2, + multiplication/3 + ]). + +:- use_module('bt_add.pl'). + +:- op(850, xfx, btmult). +A is B btmult C :- + multiplication(B, C, A). + +neg(A, B) :- + maplist(opp, A, B). + +opp(48, 48). +opp(45, 43). +opp(43, 45). + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% the multiplication (efficient) +% multiplication(+BIn, +QIn, -AOut) +% Aout is BIn * QIn +% BIn, QIn, AOut are strings +multiplication(BIn, QIn, AOut) :- + string_to_list(BIn, B), + string_to_list(QIn, Q), + + % We work with positive numbers + ( B = [45 | _] -> Pos0 = false, neg(B,BP) ; BP = B, Pos0 = true), + ( Q = [45 | _] -> neg(Q, QP), select(Pos0, [true, false], [Pos1]); QP = Q, Pos1 = Pos0), + + multiplication_(BP, QP, [48], A), + ( Pos1 = false -> neg(A, A1); A1 = A), + string_to_list(AOut, A1). + + +multiplication_(_B, [], A, A). + +multiplication_(B, [H | T], A, AF) :- + multiplication_1(B, H, B1), + append(A, [48], A1), + bt_add1(B1, A1, A2), + multiplication_(B, T, A2, AF). + +% by 1 (digit '+' code 43) +multiplication_1(B, 43, B). + +% by 0 (digit '0' code 48) +multiplication_1(_, 48, [48]). + +% by -1 (digit '-' code 45) +multiplication_1(B, 45, B1) :- neg(B, B1). + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% the division (efficient) +% division(+AIn, +BIn, -QOut, -ROut) +% +division(AIn, BIn, QOut, ROut) :- + string_to_list(AIn, A), + string_to_list(BIn, B), + length(B, LB), + length(A, LA), + Len is LA - LB, + ( Len < 0 -> Q = [48], R = A + ; neg(B, NegB), division_(A, B, NegB, LB, Len, [], Q, R)), + string_to_list(QOut, Q), + string_to_list(ROut, R). + + +division_(A, B, NegB, LenB, LenA, QC, QF, R) :- + % if the remainder R is negative (last number A), we must decrease the quotient Q, annd add B to R + ( LenA = -1 -> (A = [45 | _] -> positive(A, B, QC, QF, R) ; QF = QC, A = R) + ; extract(LenA, _, A, AR, AF), + length(AR, LR), + + ( LR >= LenB -> ( AR = [43 | _] -> + bt_add1(AR, NegB, S), Q0 = [43], + % special case : R has the same length than B + % and his first digit is + (1) + % we must do another one substraction + ( (length(S, LenB), S = [43|_]) -> + bt_add1(S, NegB, S1), + bt_add1(QC, [43], QC1), + Q00 = [45] + ; S1 = S, QC1 = QC, Q00 = Q0) + + + ; bt_add1(AR, B, S1), Q00 = [45], QC1 = QC), + append(QC1, Q00, Q1), + append(S1, AF, A1), + strip_nombre(A1, A2, []), + LenA1 is LenA - 1, + division_(A2, B, NegB, LenB, LenA1, Q1, QF, R) + + ; append(QC, [48], Q1), LenA1 is LenA - 1, + division_(A, B, NegB, LenB, LenA1, Q1, QF, R))). + +% extract(+Len, ?N1, +L, -Head, -Tail) +% remove last N digits from the list L +% put them in Tail. +extract(Len, Len, [], [], []). + +extract(Len, N1, [H|T], AR1, AF1) :- + extract(Len, N, T, AR, AF), + N1 is N-1, + ( N > 0 -> AR = AR1, AF1 = [H | AF]; AR1 = [H | AR], AF1 = AF). + + + +positive(R, _, Q, Q, R) :- R = [43 | _]. + +positive(S, B, Q, QF, R ) :- + bt_add1(S, B, S1), + bt_add1(Q, [45], Q1), + positive(S1, B, Q1, QF, R). + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% "euclidian" division (inefficient) +% euclide(?A, +BIn, ?Q, ?R) +% A = B * Q + R +euclide(A, B, Q, R) :- + mult(A, B, Q, R). + + +mult(AIn, BIn, QIn, RIn) :- + ( nonvar(AIn) -> string_to_list(AIn, A); A = AIn), + ( nonvar(BIn) -> string_to_list(BIn, B); B = BIn), + ( nonvar(QIn) -> string_to_list(QIn, Q); Q = QIn), + ( nonvar(RIn) -> string_to_list(RIn, R); R = RIn), + + % we use positive numbers + ( B = [45 | _] -> Pos0 = false, neg(B,BP) ; BP = B, Pos0 = true), + ( (nonvar(Q), Q = [45 | _]) -> neg(Q, QP), select(Pos0, [true, false], [Pos1]) + ; nonvar(Q) -> Q = QP , Pos1 = Pos0 + ; Pos1 = Pos0), + ( (nonvar(A), A = [45 | _]) -> neg(A, AP) + ; nonvar(A) -> AP = A + ; true), + + % is R instancied ? + ( nonvar(R) -> R1 = R; true), + % multiplication ? we add B to A and substract 1 (digit '-') to Q + ( nonvar(Q) -> BC = BP, Ajout = [45], + ( nonvar(R) -> bt_add1(BC, R, AP) ; AP = BC) + % division ? we substract B to A and add 1 (digit '+') to Q + ; neg(BP, BC), Ajout = [43], QP = [48]), + + % do the real job + mult_(BC, QP, AP, R1, Resultat, Ajout), + + ( var(QIn) -> (Pos1 = false -> neg(Resultat, QT); Resultat = QT), string_to_list(QIn, QT) + ; true), + ( var(AIn) -> (Pos1 = false -> neg(Resultat, AT); Resultat = AT), string_to_list(AIn, AT) + ; true), + ( var(RIn) -> string_to_list(RIn, R1); true). + +% @arg1 : divisor +% @arg2 : quotient +% @arg3 : dividend +% @arg4 : remainder +% @arg5 : Result : receive either the dividend A +% either the quotient Q +mult_(B, Q, A, R, Resultat, Ajout) :- + bt_add1(Q, Ajout, Q1), + bt_add1(A, B, A1), + ( Q1 = [48] -> Resultat = A % a multiplication + ; ( A1 = [45 | _], Ajout = [43]) -> Resultat = Q, R = A % a division + ; mult_(B, Q1, A1, R, Resultat, Ajout)) . diff --git a/Task/Balanced-ternary/Python/balanced-ternary.py b/Task/Balanced-ternary/Python/balanced-ternary.py new file mode 100644 index 0000000000..dd659856fd --- /dev/null +++ b/Task/Balanced-ternary/Python/balanced-ternary.py @@ -0,0 +1,95 @@ +class BalancedTernary: + # Represented as a list of 0, 1 or -1s, with least significant digit first. + + str2dig = {'+': 1, '-': -1, '0': 0} # immutable + dig2str = {1: '+', -1: '-', 0: '0'} # immutable + table = ((0, -1), (1, -1), (-1, 0), (0, 0), (1, 0), (-1, 1), (0, 1)) # immutable + + def __init__(self, inp): + if isinstance(inp, str): + self.digits = [BalancedTernary.str2dig[c] for c in reversed(inp)] + elif isinstance(inp, int): + self.digits = self._int2ternary(inp) + elif isinstance(inp, BalancedTernary): + self.digits = list(inp.digits) + elif isinstance(inp, list): + if all(d in (0, 1, -1) for d in inp): + self.digits = list(inp) + else: + raise ValueError("BalancedTernary: Wrong input digits.") + else: + raise TypeError("BalancedTernary: Wrong constructor input.") + + @staticmethod + def _int2ternary(n): + if n == 0: return [] + if (n % 3) == 0: return [0] + BalancedTernary._int2ternary(n // 3) + if (n % 3) == 1: return [1] + BalancedTernary._int2ternary(n // 3) + if (n % 3) == 2: return [-1] + BalancedTernary._int2ternary((n + 1) // 3) + + def to_int(self): + return reduce(lambda y,x: x + 3 * y, reversed(self.digits), 0) + + def __repr__(self): + if not self.digits: return "0" + return "".join(BalancedTernary.dig2str[d] for d in reversed(self.digits)) + + @staticmethod + def _neg(digs): + return [-d for d in digs] + + def __neg__(self): + return BalancedTernary(BalancedTernary._neg(self.digits)) + + @staticmethod + def _add(a, b, c=0): + if not (a and b): + if c == 0: + return a or b + else: + return BalancedTernary._add([c], a or b) + else: + (d, c) = BalancedTernary.table[3 + (a[0] if a else 0) + (b[0] if b else 0) + c] + res = BalancedTernary._add(a[1:], b[1:], c) + # trim leading zeros + if res or d != 0: + return [d] + res + else: + return res + + def __add__(self, b): + return BalancedTernary(BalancedTernary._add(self.digits, b.digits)) + + def __sub__(self, b): + return self + (-b) + + @staticmethod + def _mul(a, b): + if not (a and b): + return [] + else: + if a[0] == -1: x = BalancedTernary._neg(b) + elif a[0] == 0: x = [] + elif a[0] == 1: x = b + else: assert False + y = [0] + BalancedTernary._mul(a[1:], b) + return BalancedTernary._add(x, y) + + def __mul__(self, b): + return BalancedTernary(BalancedTernary._mul(self.digits, b.digits)) + + +def main(): + a = BalancedTernary("+-0++0+") + print "a:", a.to_int(), a + + b = BalancedTernary(-436) + print "b:", b.to_int(), b + + c = BalancedTernary("+-++-") + print "c:", c.to_int(), c + + r = a * (b - c) + print "a * (b - c):", r.to_int(), r + +main() diff --git a/Task/Balanced-ternary/REXX/balanced-ternary.rexx b/Task/Balanced-ternary/REXX/balanced-ternary.rexx new file mode 100644 index 0000000000..349ef0920a --- /dev/null +++ b/Task/Balanced-ternary/REXX/balanced-ternary.rexx @@ -0,0 +1,55 @@ +/*REXX pgm converts decimal ◄───► balanced ternary; also performs arith.*/ +numeric digits 10000 /*handle almost any size numbers.*/ +Ao = '+-0++0+' ; Abt = Ao /* [↓] 2 literals used by sub.*/ +Bo = '-436' ; Bbt = d2bt(Bo) ; @ = '(decimal)' +Co = '+-++-' ; Cbt = Co ; @@ = 'balanced ternary =' + call btShow '[a]', Abt + call btShow '[b]', Bbt + call btShow '[c]', Cbt + say; $bt = btMul(Abt,btSub(Bbt,Cbt)) + call btshow '[a*(b-c)]', $bt +exit /*stick a fork in it, we're done.*/ +/*──────────────────────────────────BT2D subroutine─────────────────────*/ +d2bt: procedure; parse arg x 1; p=0; $.='-'; $.1='+'; $.0=0; #= +x=x/1 + do until x==0; _=(x//(3**(p+1)))%3**p + if _==2 then _=-1; if _=-2 then _=1 + x=x-_*(3**p); p=p+1; #=$._ || # + end /*until*/ +return # +/*──────────────────────────────────BT2D subroutine─────────────────────*/ +bt2d: procedure; parse arg x; r=reverse(x); #=0; $.=-1; $.0=0; _='+'; $._=1 + do j=1 for length(x); _=substr(r,j,1); #=#+$._*3**(j-1); end +return # +/*──────────────────────────────────BTADD subroutine────────────────────*/ +btAdd: procedure; parse arg x,y; rx=reverse(x); ry=reverse(y); carry=0 +$.='-'; $.0=0; $.1='+'; @.=0; _='-'; @._=-1; _="+"; @._=1; #= + + do j=1 for max(length(x),length(y)) + x_=substr(rx,j,1); xn=@.x_ + y_=substr(ry,j,1); yn=@.y_ + s=xn+yn+carry ; carry=0 + if s== 2 then do; s=-1; carry= 1; end + if s== 3 then do; s= 0; carry= 1; end + if s==-2 then do; s= 1; carry=-1; end + #=$.s || # + end /*j*/ +if carry\==0 then #=$.carry || #; return btNorm(#) +/*──────────────────────────────────BTMUL subroutine────────────────────*/ +btMul: procedure; parse arg x,y; if x==0 | y==0 then return 0; S=1 +x=btNorm(x); y=btNorm(y) /*handle: 0-xxx values.*/ +if left(x,1)=='-' then do; x=btNeg(x); S=-S; end /*positate.*/ +if left(y,1)=='-' then do; y=btNeg(y); S=-S; end /*positate.*/ +if length(y)>length(x) then parse value x y with y x /*optimize.*/ +P=0 + do until y==0 /*keep adding 'til done*/ + P=btAdd(P,x) /*multiple the hard way*/ + y=btSub(y,'+') /*subtract 1 from Y. */ + end /*until*/ +if S==-1 then P=btNeg(P) /*adjust product sign. */ +return P /*return the product P.*/ +/*───────────────────────────────one-line subroutines───────────────────*/ +btNeg: return translate(arg(1), '-+', "+-") /*negate the bal_tern #*/ +btNorm: _=strip(arg(1),'L',0); if _=='' then _=0; return _ /*normalize*/ +btSub: return btAdd(arg(1), btNeg(arg(2))) /*subtract two BT args.*/ +btShow: say center(arg(1),9) right(arg(2),20) @@ right(bt2d(arg(2)),9) @; return diff --git a/Task/Balanced-ternary/Ruby/balanced-ternary.rb b/Task/Balanced-ternary/Ruby/balanced-ternary.rb new file mode 100644 index 0000000000..1eec10bd32 --- /dev/null +++ b/Task/Balanced-ternary/Ruby/balanced-ternary.rb @@ -0,0 +1,128 @@ +class BalancedTernary + def initialize(str = "") + if str !~ /^[-+0]+$/ + raise ArgumentError, "invalid BalancedTernary number: #{str}" + end + @digits = trim0(str) + end + + def self.from_int(value) + n = value + digits = "" + while n != 0 + quo, rem = n.divmod(3) + case rem + when 0 + digits = "0" + digits + n = quo + when 1 + digits = "+" + digits + n = quo + when 2 + digits = "-" + digits + n = quo + 1 + end + end + new(digits) + end + + def to_int + @digits.chars.inject(0) do |sum, char| + sum *= 3 + case char + when "+" + sum += 1 + when "-" + sum -= 1 + end + sum + end + end + alias :to_i :to_int + + def to_s + @digits + end + alias :inspect :to_s + + ADDITION_TABLE = { + "-" => {"-" => ["-","+"], "0" => ["0","-"], "+" => ["0","0"]}, + "0" => {"-" => ["0","-"], "0" => ["0","0"], "+" => ["0","+"]}, + "+" => {"-" => ["0","0"], "0" => ["0","+"], "+" => ["+","-"]}, + } + + def +(other) + maxl = [to_s, other.to_s].collect {|s| s.length}.max + a = pad0(to_s, maxl) + b = pad0(other.to_s, maxl) + carry = "0" + sum = a.reverse.chars.zip( b.reverse.chars ).inject("") do |sum, (c1, c2)| + carry1, digit1 = ADDITION_TABLE[c1][c2] + carry2, digit2 = ADDITION_TABLE[carry][digit1] + sum = digit2 + sum + carry = ADDITION_TABLE[carry1][carry2][1] + sum + end + self.class.new(carry + sum) + end + + MULTIPLICATION_TABLE = { + "-" => "+0-", + "0" => "000", + "+" => "-0+", + } + + def *(other) + product = self.class.new("0") + other.to_s.each_char do |bdigit| + row = to_s.tr("-0+", MULTIPLICATION_TABLE[bdigit]) + product += self.class.new(row) + product << 1 + end + product >> 1 + end + + # negation + def -@() + self * BalancedTernary.new("-") + end + + # subtraction + def -(other) + self + (-other) + end + + # shift left + def <<(count) + @digits = trim0(@digits + "0"*count) + self + end + + # shift right + def >>(count) + @digits[-count..-1] = "" if count > 0 + @digits = trim0(@digits) + self + end + + private + + def trim0(str) + str = str.sub(/^0+/, "") + str = "0" if str.empty? + str + end + + def pad0(str, len) + str.rjust(len, "0") + end +end + +a = BalancedTernary.new("+-0++0+") +b = BalancedTernary.from_int(-436) +c = BalancedTernary.new("+-++-") +calc = a * (b - c) +puts "%s\t%d\t%s\n" % ['a', a.to_i, a] +puts "%s\t%d\t%s\n" % ['b', b.to_i, b] +puts "%s\t%d\t%s\n" % ['c', c.to_i, c] +puts "%s\t%d\t%s\n" % ['a*(b-c)', calc.to_i, calc] diff --git a/Task/Balanced-ternary/Tcl/balanced-ternary-1.tcl b/Task/Balanced-ternary/Tcl/balanced-ternary-1.tcl new file mode 100644 index 0000000000..9598aca056 --- /dev/null +++ b/Task/Balanced-ternary/Tcl/balanced-ternary-1.tcl @@ -0,0 +1,57 @@ +package require Tcl 8.5 + +proc bt-int b { + set n 0 + foreach c [split $b ""] { + set n [expr {$n * 3}] + switch -- $c { + + { incr n 1 } + - { incr n -1 } + } + } + return $n +} +proc int-bt n { + if {$n == 0} { + return "0" + } + while {$n != 0} { + lappend result [lindex {0 + -} [expr {$n % 3}]] + set n [expr {$n / 3 + ($n%3 == 2)}] + } + return [join [lreverse $result] ""] +} + +proc bt-neg b { + string map {+ - - +} $b +} +proc bt-sub {a b} { + bt-add $a [bt-neg $b] +} +proc bt-add-digits {a b c} { + if {$a eq ""} {set a 0} + if {$b eq ""} {set b 0} + if {$a ne 0} {append a 1} + if {$b ne 0} {append b 1} + lindex {{0 -1} {+ -1} {- 0} {0 0} {+ 0} {- 1} {0 1}} [expr {$a+$b+$c+3}] +} +proc bt-add {a b} { + set c 0 + set result {} + foreach ca [lreverse [split $a ""]] cb [lreverse [split $b ""]] { + lassign [bt-add-digits $ca $cb $c] d c + lappend result $d + } + if {$c ne "0"} {lappend result [lindex {0 + -} $c]} + if {![llength $result]} {return "0"} + string trimleft [join [lreverse $result] ""] 0 +} +proc bt-mul {a b} { + if {$a eq "0" || $a eq "" || $b eq "0"} {return "0"} + set sub [bt-mul [string range $a 0 end-1] $b]0 + switch -- [string index $a end] { + 0 { return $sub } + + { return [bt-add $sub $b] } + - { return [bt-sub $sub $b] } + } +} diff --git a/Task/Balanced-ternary/Tcl/balanced-ternary-2.tcl b/Task/Balanced-ternary/Tcl/balanced-ternary-2.tcl new file mode 100644 index 0000000000..6a16fc337e --- /dev/null +++ b/Task/Balanced-ternary/Tcl/balanced-ternary-2.tcl @@ -0,0 +1,10 @@ +for {set i 0} {$i<=10} {incr i} {puts "$i = [int-bt $i]"} +puts "'+-+'+'+--' = [bt-add +-+ +--] = [bt-int [bt-add +-+ +--]]" +puts "'++'*'++' = [bt-mul ++ ++] = [bt-int [bt-mul ++ ++]]" + +set a "+-0++0+" +set b [int-bt -436] +set c "+-++-" +puts "a = [bt-int $a], b = [bt-int $b], c = [bt-int $c]" +set abc [bt-mul $a [bt-sub $b $c]] +puts "a*(b-c) = $abc (== [bt-int $abc])" diff --git a/Task/Best-shuffle/0DESCRIPTION b/Task/Best-shuffle/0DESCRIPTION new file mode 100644 index 0000000000..0b0eb5b4ad --- /dev/null +++ b/Task/Best-shuffle/0DESCRIPTION @@ -0,0 +1,11 @@ +Shuffle the characters of a string in such a way that as many of the character values are in a different position as possible. Print the result as follows: original string, shuffled string, (score). The score gives the number of positions whose character value did ''not'' change. + +For example: tree, eetr, (0) + +A shuffle that produces a randomized result among the best choices is to be preferred. A deterministic approach that produces the same sequence every time is acceptable as an alternative. + +The words to test with are: abracadabra, seesaw, elk, grrrrrr, up, a + +;Cf. +* [[Anagrams/Deranged anagrams]] +* [[Permutations/Derangements]] diff --git a/Task/Best-shuffle/AWK/best-shuffle-1.awk b/Task/Best-shuffle/AWK/best-shuffle-1.awk new file mode 100644 index 0000000000..31cec9f821 --- /dev/null +++ b/Task/Best-shuffle/AWK/best-shuffle-1.awk @@ -0,0 +1,40 @@ +{ + scram = best_shuffle($0) + print $0 " -> " scram " (" unchanged($0, scram) ")" +} + +function best_shuffle(s, c, i, j, len, r, t) { + len = split(s, t, "") + + # Swap elements of t[] to get a best shuffle. + for (i = 1; i <= len; i++) { + for (j = 1; j <= len; j++) { + # Swap t[i] and t[j] if they will not match + # the original characters from s. + if (i != j && + t[i] != substr(s, j, 1) && + substr(s, i, 1) != t[j]) { + c = t[i] + t[i] = t[j] + t[j] = c + break + } + } + } + + # Join t[] into one string. + r = "" + for (i = 1; i <= len; i++) + r = r t[i] + return r +} + +function unchanged(s1, s2, count, len) { + count = 0 + len = length(s1) + for (i = 1; i <= len; i++) { + if (substr(s1, i, 1) == substr(s2, i, 1)) + count++ + } + return count +} diff --git a/Task/Best-shuffle/AWK/best-shuffle-2.awk b/Task/Best-shuffle/AWK/best-shuffle-2.awk new file mode 100644 index 0000000000..e3c0ed677e --- /dev/null +++ b/Task/Best-shuffle/AWK/best-shuffle-2.awk @@ -0,0 +1,79 @@ +# out["string"] = best shuffle of string _s_ +# out["score"] = number of matching characters +function best_shuffle(out, s, c, i, j, k, klen, p, pos, set, rlen, slen) { + slen = length(s) + for (i = 1; i <= slen; i++) { + c = substr(s, i, 1) + + # _set_ of all characters in _s_, with count + set[c] += 1 + + # _pos_ classifies positions by letter, + # such that pos[c, 1], pos[c, 2], ..., pos[c, set[c]] + # are the positions of _c_ in _s_. + pos[c, set[c]] = i + } + + # k[1], k[2], ..., k[klen] sorts letters from low to high count + klen = 0 + for (c in set) { + # insert _c_ into _k_ + i = 1 + while (i <= klen && set[k[i]] <= set[c]) + i++ # find _i_ to sort by insertion + for (j = klen; j >= i; j--) + k[j + 1] = k[j] # make room for k[i] + k[i] = c + klen++ + } + + # Fill pos[slen], ..., pos[3], pos[2], pos[1] with positions + # in the order that we want to fill them. + i = 1 + while (i <= slen) { + for (j = 1; j <= klen; j++) { + c = k[j] + if (set[c] > 0) { + pos[i] = pos[c, set[c]] + i++ + delete pos[c, set[c]] + set[c]-- + } + } + } + + # Now fill in _new_ with _letters_ according to each position + # in pos[slen], ..., pos[1], but skip ahead in _letters_ + # if we can avoid matching characters that way. + rlen = split(s, letters, "") + for (i = slen; i >= 1; i--) { + j = 1 + p = pos[i] + while (letters[j] == substr(s, p, 1) && j < rlen) + j++ + for (new[p] = letters[j]; j < rlen; j++) + letters[j] = letters[j + 1] + delete letters[rlen] + rlen-- + } + + out["string"] = "" + for (i = 1; i <= slen; i++) { + out["string"] = out["string"] new[i] + } + + out["score"] = 0 + for (i = 1; i <= slen; i++) { + if (new[i] == substr(s, i, 1)) + out["score"]++ + } +} + +BEGIN { + count = split("abracadabra seesaw elk grrrrrr up a", words) + for (i = 1; i <= count; i++) { + best_shuffle(result, words[i]) + printf "%s, %s, (%d)\n", + words[i], result["string"], result["score"] + } +} diff --git a/Task/Best-shuffle/AWK/best-shuffle-3.awk b/Task/Best-shuffle/AWK/best-shuffle-3.awk new file mode 100644 index 0000000000..8f7f2ee690 --- /dev/null +++ b/Task/Best-shuffle/AWK/best-shuffle-3.awk @@ -0,0 +1,7 @@ +$ awk -f best-shuffle.awk +abracadabra, baarrcadaab, (0) +seesaw, essewa, (0) +elk, kel, (0) +grrrrrr, rgrrrrr, (5) +up, pu, (0) +a, a, (1) diff --git a/Task/Best-shuffle/Ada/best-shuffle.ada b/Task/Best-shuffle/Ada/best-shuffle.ada new file mode 100644 index 0000000000..bbdae01e69 --- /dev/null +++ b/Task/Best-shuffle/Ada/best-shuffle.ada @@ -0,0 +1,42 @@ +with Ada.Text_IO; + +procedure Best_Shuffle is + + function Best_Shuffle(S: String) return String is + T: String(S'Range) := S; + Tmp: Character; + begin + for I in S'Range loop + for J in S'Range loop + if I /= J and S(I) /= T(J) and S(J) /= T(I) then + Tmp := T(I); + T(I) := T(J); + T(J) := Tmp; + end if; + end loop; + end loop; + return T; + end Best_Shuffle; + + Stop : Boolean := False; + +begin -- main procedure + while not Stop loop + declare + Original: String := Ada.Text_IO.Get_Line; + Shuffle: String := Best_Shuffle(Original); + Score: Natural := 0; + begin + for I in Original'Range loop + if Original(I) = Shuffle(I) then + Score := Score + 1; + end if; + end loop; + Ada.Text_Io.Put_Line(Original & ", " & Shuffle & ", (" & + Natural'Image(Score) & " )"); + if Original = "" then + Stop := True; + end if; + end; + end loop; +end Best_Shuffle; diff --git a/Task/Best-shuffle/C/best-shuffle-1.c b/Task/Best-shuffle/C/best-shuffle-1.c new file mode 100644 index 0000000000..b40ef8d06f --- /dev/null +++ b/Task/Best-shuffle/C/best-shuffle-1.c @@ -0,0 +1,111 @@ +#include +#include +#include +#include +#include + +#define DEBUG + +void best_shuffle(const char* txt, char* result) { + const size_t len = strlen(txt); + if (len == 0) + return; + +#ifdef DEBUG + // txt and result must have the same length + assert(len == strlen(result)); +#endif + + // how many of each character? + size_t counts[UCHAR_MAX]; + memset(counts, '\0', UCHAR_MAX * sizeof(int)); + size_t fmax = 0; + for (size_t i = 0; i < len; i++) { + counts[(unsigned char)txt[i]]++; + const size_t fnew = counts[(unsigned char)txt[i]]; + if (fmax < fnew) + fmax = fnew; + } + assert(fmax > 0 && fmax <= len); + + // all character positions, grouped by character + size_t *ndx1 = malloc(len * sizeof(size_t)); + if (ndx1 == NULL) + exit(EXIT_FAILURE); + for (size_t ch = 0, i = 0; ch < UCHAR_MAX; ch++) + if (counts[ch]) + for (size_t j = 0; j < len; j++) + if (ch == (unsigned char)txt[j]) { + ndx1[i] = j; + i++; + } + + // regroup them for cycles + size_t *ndx2 = malloc(len * sizeof(size_t)); + if (ndx2 == NULL) + exit(EXIT_FAILURE); + for (size_t i = 0, n = 0, m = 0; i < len; i++) { + ndx2[i] = ndx1[n]; + n += fmax; + if (n >= len) { + m++; + n = m; + } + } + + // how long can our cyclic groups be? + const size_t grp = 1 + (len - 1) / fmax; + assert(grp > 0 && grp <= len); + + // how many of them are full length? + const size_t lng = 1 + (len - 1) % fmax; + assert(lng > 0 && lng <= len); + + // rotate each group + for (size_t i = 0, j = 0; i < fmax; i++) { + const size_t first = ndx2[j]; + const size_t glen = grp - (i < lng ? 0 : 1); + for (size_t k = 1; k < glen; k++) + ndx1[j + k - 1] = ndx2[j + k]; + ndx1[j + glen - 1] = first; + j += glen; + } + + // result is original permuted according to our cyclic groups + result[len] = '\0'; + for (size_t i = 0; i < len; i++) + result[ndx2[i]] = txt[ndx1[i]]; + + free(ndx1); + free(ndx2); +} + +void display(const char* txt1, const char* txt2) { + const size_t len = strlen(txt1); + assert(len == strlen(txt2)); + int score = 0; + for (size_t i = 0; i < len; i++) + if (txt1[i] == txt2[i]) + score++; + (void)printf("%s, %s, (%u)\n", txt1, txt2, score); +} + +int main() { + const char* data[] = {"abracadabra", "seesaw", "elk", "grrrrrr", + "up", "a", "aabbbbaa", "", "xxxxx"}; + const size_t data_len = sizeof(data) / sizeof(data[0]); + for (size_t i = 0; i < data_len; i++) { + const size_t shuf_len = strlen(data[i]) + 1; + char shuf[shuf_len]; + +#ifdef DEBUG + memset(shuf, 0xFF, sizeof shuf); + shuf[shuf_len - 1] = '\0'; +#endif + + best_shuffle(data[i], shuf); + display(data[i], shuf); + } + + return EXIT_SUCCESS; +} diff --git a/Task/Best-shuffle/C/best-shuffle-2.c b/Task/Best-shuffle/C/best-shuffle-2.c new file mode 100644 index 0000000000..d210eda6e9 --- /dev/null +++ b/Task/Best-shuffle/C/best-shuffle-2.c @@ -0,0 +1,106 @@ +#include +#include +#include + +typedef struct letter_group_t { + char c; + int count; +} *letter_p; + +struct letter_group_t all_letters[26]; +letter_p letters[26]; + +/* counts how many of each letter is in a string, used later + * to generate permutations + */ +int count_letters(const char *s) +{ + int i, c; + for (i = 0; i < 26; i++) { + all_letters[i].count = 0; + all_letters[i].c = i + 'a'; + } + while (*s != '\0') { + i = *(s++); + + /* don't want to deal with bad inputs */ + if (i < 'a' || i > 'z') { + fprintf(stderr, "Abort: Bad string %s\n", s); + exit(1); + } + + all_letters[i - 'a'].count++; + } + for (i = 0, c = 0; i < 26; i++) + if (all_letters[i].count) + letters[c++] = all_letters + i; + + return c; +} + +int least_overlap, seq_no; +char out[100], orig[100], best[100]; + +void permutate(int n_letters, int pos, int overlap) +{ + int i, ol; + if (pos < 0) { + /* if enabled will show all shuffles no worse than current best */ + // printf("%s: %d\n", out, overlap); + + /* if better than current best, replace it and reset counter */ + if (overlap < least_overlap) { + least_overlap = overlap; + seq_no = 0; + } + + /* the Nth best tie has 1/N chance of being kept, so all ties + * have equal chance of being selected even though we don't + * how many there are before hand + */ + if ( (double)rand() / (RAND_MAX + 1.0) * ++seq_no <= 1) + strcpy(best, out); + + return; + } + + /* standard "try take the letter; try take not" recursive method */ + for (i = 0; i < n_letters; i++) { + if (!letters[i]->count) continue; + + out[pos] = letters[i]->c; + letters[i]->count --; + ol = (letters[i]->c == orig[pos]) ? overlap + 1 : overlap; + + /* but don't try options that's already worse than current best */ + if (ol <= least_overlap) + permutate(n_letters, pos - 1, ol); + + letters[i]->count ++; + } + return; +} + +void do_string(const char *str) +{ + least_overlap = strlen(str); + strcpy(orig, str); + + seq_no = 0; + out[least_overlap] = '\0'; + least_overlap ++; + + permutate(count_letters(str), least_overlap - 2, 0); + printf("%s -> %s, overlap %d\n", str, best, least_overlap); +} + +int main() +{ + srand(time(0)); + do_string("abracadebra"); + do_string("grrrrrr"); + do_string("elk"); + do_string("seesaw"); + do_string(""); + return 0; +} diff --git a/Task/Best-shuffle/C/best-shuffle-3.c b/Task/Best-shuffle/C/best-shuffle-3.c new file mode 100644 index 0000000000..6d55537ed1 --- /dev/null +++ b/Task/Best-shuffle/C/best-shuffle-3.c @@ -0,0 +1,5 @@ +abracadebra -> edbcarabaar, overlap 0 +grrrrrr -> rrgrrrr, overlap 5 +elk -> kel, overlap 0 +seesaw -> ewsesa, overlap 0 + -> , overlap 0 diff --git a/Task/Best-shuffle/C/best-shuffle-4.c b/Task/Best-shuffle/C/best-shuffle-4.c new file mode 100644 index 0000000000..cb5107f18d --- /dev/null +++ b/Task/Best-shuffle/C/best-shuffle-4.c @@ -0,0 +1,36 @@ +#include +#include + +#define FOR(x, y) for(x = 0; x < y; x++) +char *best_shuffle(const char *s, int *diff) +{ + int i, j = 0, max = 0, l = strlen(s), cnt[128] = {0}; + char buf[256] = {0}, *r; + + FOR(i, l) if (++cnt[(int)s[i]] > max) max = cnt[(int)s[i]]; + FOR(i, 128) while (cnt[i]--) buf[j++] = i; + + r = strdup(s); + FOR(i, l) FOR(j, l) + if (r[i] == buf[j]) { + r[i] = buf[(j + max) % l] & ~128; + buf[j] |= 128; + break; + } + + *diff = 0; + FOR(i, l) *diff += r[i] == s[i]; + + return r; +} + +int main() +{ + int i, d; + const char *r, *t[] = {"abracadabra", "seesaw", "elk", "grrrrrr", "up", "a", 0}; + for (i = 0; t[i]; i++) { + r = best_shuffle(t[i], &d); + printf("%s %s (%d)\n", t[i], r, d); + } + return 0; +} diff --git a/Task/Best-shuffle/Clojure/best-shuffle.clj b/Task/Best-shuffle/Clojure/best-shuffle.clj new file mode 100644 index 0000000000..c482714f79 --- /dev/null +++ b/Task/Best-shuffle/Clojure/best-shuffle.clj @@ -0,0 +1,54 @@ +(defn score [before after] + (->> (map = before after) + (filter true? ,) + count)) + +(defn merge-vecs [init vecs] + (reduce (fn [counts [index x]] + (assoc counts x (conj (get counts x []) index))) + init vecs)) + +(defn frequency + "Returns a collection of indecies of distinct items" + [coll] + (->> (map-indexed vector coll) + (merge-vecs {} ,))) + +(defn group-indecies [s] + (->> (frequency s) + vals + (sort-by count ,) + reverse)) + +(defn cycles [coll] + (let [n (count (first coll)) + cycle (cycle (range n)) + coll (apply concat coll)] + (->> (map vector coll cycle) + (merge-vecs [] ,)))) + +(defn rotate [n coll] + (let [c (count coll) + n (rem (+ c n) c)] + (concat (drop n coll) (take n coll)))) + +(defn best-shuffle [s] + (let [ref (cycles (group-indecies s)) + prm (apply concat (map (partial rotate 1) ref)) + ref (apply concat ref)] + (->> (map vector ref prm) + (sort-by first ,) + (map second ,) + (map (partial get s) ,) + (apply str ,) + (#(vector s % (score s %)))))) + +user> (->> ["abracadabra" "seesaw" "elk" "grrrrrr" "up" "a"] + (map best-shuffle ,) + vec) +[["abracadabra" "bdabararaac" 0] + ["seesaw" "eawess" 0] + ["elk" "lke" 0] + ["grrrrrr" "rgrrrrr" 5] + ["up" "pu" 0] + ["a" "a" 1]] diff --git a/Task/Best-shuffle/Go/best-shuffle.go b/Task/Best-shuffle/Go/best-shuffle.go new file mode 100644 index 0000000000..1126be2d4f --- /dev/null +++ b/Task/Best-shuffle/Go/best-shuffle.go @@ -0,0 +1,37 @@ +package main + +import ( + "fmt" + "math/rand" + "time" +) + +var ts = []string{"abracadabra", "seesaw", "elk", "grrrrrr", "up", "a"} + +func main() { + rand.Seed(time.Now().UnixNano()) + for _, s := range ts { + // create shuffled byte array of original string + t := make([]byte, len(s)) + for i, r := range rand.Perm(len(s)) { + t[i] = s[r] + } + // algorithm of Icon solution + for i := 0; i < len(s); i++ { + for j := 0; j < len(s); j++ { + if i != j && t[i] != s[j] && t[j] != s[i] { + t[i], t[j] = t[j], t[i] + break + } + } + } + // count unchanged and output + var count int + for i, ic := range t { + if ic == s[i] { + count++ + } + } + fmt.Printf("%s -> %s (%d)\n", s, string(t), count) + } +} diff --git a/Task/Best-shuffle/Haskell/best-shuffle-1.hs b/Task/Best-shuffle/Haskell/best-shuffle-1.hs new file mode 100644 index 0000000000..595cfbfb63 --- /dev/null +++ b/Task/Best-shuffle/Haskell/best-shuffle-1.hs @@ -0,0 +1,33 @@ +import Data.Function (on) +import Data.List +import Data.Maybe +import Data.Array +import Text.Printf + +main = mapM_ f examples + where examples = ["abracadabra", "seesaw", "elk", "grrrrrr", "up", "a"] + f s = printf "%s, %s, (%d)\n" s s' $ score s s' + where s' = bestShuffle s + +score :: Eq a => [a] -> [a] -> Int +score old new = length $ filter id $ zipWith (==) old new + +bestShuffle :: (Ord a, Eq a) => [a] -> [a] +bestShuffle s = elems $ array bs $ f positions letters + where positions = + concat $ sortBy (compare `on` length) $ + map (map fst) $ groupBy ((==) `on` snd) $ + sortBy (compare `on` snd) $ zip [0..] s + letters = map (orig !) positions + + f [] [] = [] + f (p : ps) ls = (p, ls !! i) : f ps (removeAt i ls) + where i = fromMaybe 0 $ findIndex (/= o) ls + o = orig ! p + + orig = listArray bs s + bs = (0, length s - 1) + +removeAt :: Int -> [a] -> [a] +removeAt 0 (x : xs) = xs +removeAt i (x : xs) = x : removeAt (i - 1) xs diff --git a/Task/Best-shuffle/Haskell/best-shuffle-2.hs b/Task/Best-shuffle/Haskell/best-shuffle-2.hs new file mode 100644 index 0000000000..e15edcc5c5 --- /dev/null +++ b/Task/Best-shuffle/Haskell/best-shuffle-2.hs @@ -0,0 +1,2 @@ +bestShuffle :: Eq a => [a] -> [a] +bestShuffle s = minimumBy (compare `on` score s) $ permutations s diff --git a/Task/Best-shuffle/Java/best-shuffle.java b/Task/Best-shuffle/Java/best-shuffle.java new file mode 100644 index 0000000000..2195492059 --- /dev/null +++ b/Task/Best-shuffle/Java/best-shuffle.java @@ -0,0 +1,36 @@ +import java.util.*; + +public class BestShuffle { + + public static void main(String[] args) { + String[] words = {"abracadabra", "seesaw", "grrrrrr", "pop", "up", "a"}; + for (String w : words) + System.out.println(bestShuffle(w)); + } + + public static String bestShuffle(final String s1) { + char[] s2 = s1.toCharArray(); + Collections.shuffle(Arrays.asList(s2)); + for (int i = 0; i < s2.length; i++) { + if (s2[i] != s1.charAt(i)) + continue; + for (int j = 0; j < s2.length; j++) { + if (s2[i] != s2[j] && s2[i] != s1.charAt(j) && s2[j] != s1.charAt(i)) { + char tmp = s2[i]; + s2[i] = s2[j]; + s2[j] = tmp; + break; + } + } + } + return s1 + " " + new String(s2) + " (" + count(s1, s2) + ")"; + } + + private static int count(final String s1, final char[] s2) { + int count = 0; + for (int i = 0; i < s2.length; i++) + if (s1.charAt(i) == s2[i]) + count++; + return count; + } +} diff --git a/Task/Best-shuffle/JavaScript/best-shuffle-1.js b/Task/Best-shuffle/JavaScript/best-shuffle-1.js new file mode 100644 index 0000000000..b3ce16e066 --- /dev/null +++ b/Task/Best-shuffle/JavaScript/best-shuffle-1.js @@ -0,0 +1,47 @@ +function raze(a) { // like .join('') except producing an array instead of a string + var r= []; + for (var j= 0; j

+
diff --git a/Task/Best-shuffle/JavaScript/best-shuffle-3.js b/Task/Best-shuffle/JavaScript/best-shuffle-3.js
new file mode 100644
index 0000000000..ddcdbcc7c2
--- /dev/null
+++ b/Task/Best-shuffle/JavaScript/best-shuffle-3.js
@@ -0,0 +1,6 @@
+abracadabra, raababacdar, (0)
+seesaw, ewaess, (0)
+elk, lke, (0)
+grrrrrr, rrrrrgr, (5)
+up, pu, (0)
+a, a, (1)
diff --git a/Task/Best-shuffle/PHP/best-shuffle.php b/Task/Best-shuffle/PHP/best-shuffle.php
new file mode 100644
index 0000000000..65af926459
--- /dev/null
+++ b/Task/Best-shuffle/PHP/best-shuffle.php
@@ -0,0 +1,25 @@
+foreach (split(' ', 'abracadabra seesaw pop grrrrrr up a') as $w)
+    echo bestShuffle($w) . '
'; + +function bestShuffle($s1) { + $s2 = str_shuffle($s1); + for ($i = 0; $i < strlen($s2); $i++) { + if ($s2[$i] != $s1[$i]) continue; + for ($j = 0; $j < strlen($s2); $j++) + if ($i != $j && $s2[$i] != $s1[$j] && $s2[$j] != $s1[$i]) { + $t = $s2[$i]; + $s2[$i] = $s2[$j]; + $s2[$j] = $t; + break; + } + } + return "$s1 $s2 " . countSame($s1, $s2); +} + +function countSame($s1, $s2) { + $cnt = 0; + for ($i = 0; $i < strlen($s2); $i++) + if ($s1[$i] == $s2[$i]) + $cnt++; + return "($cnt)"; +} diff --git a/Task/Best-shuffle/Perl/best-shuffle.pl b/Task/Best-shuffle/Perl/best-shuffle.pl new file mode 100644 index 0000000000..d45fe26114 --- /dev/null +++ b/Task/Best-shuffle/Perl/best-shuffle.pl @@ -0,0 +1,38 @@ +use strict; +use Algorithm::Permute; + +foreach ("abracadabra", "seesaw", "elk", "grrrrrr", "up", "a") { + best_shuffle($_); +} + +sub score { + my ($original_word,$new_word) = @_; + my $result = 0; + for (my $i = 0 ; $i < length($original_word) ; $i++) { + if (substr($original_word,$i,1) eq substr($new_word,$i,1)) { + $result++; + } + } + return $result; +} + +sub best_shuffle { + my ($original_word) = @_; + my $best_word = $original_word; + my $best_score = length($original_word); + my @array = split(//,$original_word); + + # The below was adapted from perlfaq4 + + my $p_iterator = Algorithm::Permute->new( \@array ); + + while (my @array = $p_iterator->next) { + if (score($original_word,join("",@array))<$best_score) { + $best_score = score($original_word, join("",@array)); + $best_word = join ("",@array); + } + last if ($best_score == 0); + } + + print "$original_word, $best_word, $best_score\n"; +} diff --git a/Task/Best-shuffle/PicoLisp/best-shuffle.l b/Task/Best-shuffle/PicoLisp/best-shuffle.l new file mode 100644 index 0000000000..6dedad553f --- /dev/null +++ b/Task/Best-shuffle/PicoLisp/best-shuffle.l @@ -0,0 +1,14 @@ +(de bestShuffle (Str) + (let Lst NIL + (for C (setq Str (chop Str)) + (if (assoc C Lst) + (con @ (cons C (cdr @))) + (push 'Lst (cons C)) ) ) + (setq Lst (apply conc (flip (by length sort Lst)))) + (let Res + (mapcar + '((C) + (prog1 (or (find <> Lst (circ C)) C) + (setq Lst (delete @ Lst)) ) ) + Str ) + (prinl Str " " Res " (" (cnt = Str Res) ")") ) ) ) diff --git a/Task/Best-shuffle/Prolog/best-shuffle.pro b/Task/Best-shuffle/Prolog/best-shuffle.pro new file mode 100644 index 0000000000..078f3ac787 --- /dev/null +++ b/Task/Best-shuffle/Prolog/best-shuffle.pro @@ -0,0 +1,74 @@ +:- dynamic score/2. + +best_shuffle :- + maplist(best_shuffle, ["abracadabra", "eesaw", "elk", "grrrrrr", + "up", "a"]). + +best_shuffle(Str) :- + retractall(score(_,_)), + length(Str, Len), + assert(score(Str, Len)), + calcule_min(Str, Len, Min), + repeat, + shuffle(Str, Shuffled), + maplist(comp, Str, Shuffled, Result), + sumlist(Result, V), + retract(score(Cur, VCur)), + ( V < VCur -> assert(score(Shuffled, V)); assert(score(Cur, VCur))), + V = Min, + retract(score(Cur, VCur)), + writef('%s : %s (%d)\n', [Str, Cur, VCur]). + +comp(C, C1, S):- + ( C = C1 -> S = 1; S = 0). + +% this code was written by P.Caboche and can be found here : +% http://pcaboche.developpez.com/article/prolog/listes/?page=page_3#Lshuffle +shuffle(List, Shuffled) :- + length(List, Len), + shuffle(Len, List, Shuffled). + +shuffle(0, [], []) :- !. + +shuffle(Len, List, [Elem|Tail]) :- + RandInd is random(Len), + nth0(RandInd, List, Elem), + select(Elem, List, Rest), + NewLen is Len - 1, + shuffle(NewLen, Rest, Tail). + + +% letters are sorted out then packed +% If a letter is more numerous than the rest +% the min is the difference between the quantity of this letter and +% the sum of the quantity of the other letters +calcule_min(Str, Len, Min) :- + msort(Str, SS), + packList(SS, Lst), + sort(Lst, Lst1), + last(Lst1, [N, _]), + ( N * 2 > Len -> Min is 2 * N - Len; Min = 0). + + + +% almost the same code as in "run_length" page +packList([],[]). + +packList([X],[[1,X]]) :- !. + + +packList([X|Rest],[XRun|Packed]):- + run(X,Rest, XRun,RRest), + packList(RRest,Packed). + + +run(Var,[],[1,Var],[]). + +run(Var,[Var|LRest],[N1, Var],RRest):- + run(Var,LRest,[N, Var],RRest), + N > 0, + N1 is N + 1. + + +run(Var,[Other|RRest], [1,Var],[Other|RRest]):- + dif(Var,Other). diff --git a/Task/Best-shuffle/Python/best-shuffle-1.py b/Task/Best-shuffle/Python/best-shuffle-1.py new file mode 100644 index 0000000000..4b248965a0 --- /dev/null +++ b/Task/Best-shuffle/Python/best-shuffle-1.py @@ -0,0 +1,28 @@ +from collections import Counter +import random + +def count(w1,wnew): + return sum(c1==c2 for c1,c2 in zip(w1, wnew)) + +def best_shuffle(w): + wnew = list(w) + n = len(w) + rangelists = (list(range(n)), list(range(n))) + for r in rangelists: + random.shuffle(r) + rangei, rangej = rangelists + for i in rangei: + for j in rangej: + if i != j and wnew[j] != wnew[i] and w[i] != wnew[j] and w[j] != wnew[i]: + wnew[j], wnew[i] = wnew[i], wnew[j] + wnew = ''.join(wnew) + return wnew, count(w, wnew) + + +if __name__ == '__main__': + test_words = ('tree abracadabra seesaw elk grrrrrr up a ' + + 'antidisestablishmentarianism hounddogs').split() + test_words += ['aardvarks are ant eaters', 'immediately', 'abba'] + for w in test_words: + wnew, c = best_shuffle(w) + print("%29s, %-29s ,(%i)" % (w, wnew, c)) diff --git a/Task/Best-shuffle/Python/best-shuffle-2.py b/Task/Best-shuffle/Python/best-shuffle-2.py new file mode 100644 index 0000000000..f300254142 --- /dev/null +++ b/Task/Best-shuffle/Python/best-shuffle-2.py @@ -0,0 +1,50 @@ +#!/usr/bin/env python + +def best_shuffle(s): + # Count the supply of characters. + from collections import defaultdict + count = defaultdict(int) + for c in s: + count[c] += 1 + + # Shuffle the characters. + r = [] + for x in s: + # Find the best character to replace x. + best = None + rankb = -2 + for c, rankc in count.items(): + # Prefer characters with more supply. + # (Save characters with less supply.) + # Avoid identical characters. + if c == x: rankc = -1 + if rankc > rankb: + best = c + rankb = rankc + + # Add character to list. Remove it from supply. + r.append(best) + count[best] -= 1 + if count[best] == 0: del count[best] + + # If the final letter became stuck (as "ababcd" became "bacabd", + # and the final "d" became stuck), then fix it. + i = len(s) - 1 + if r[i] == s[i]: + for j in range(i): + if r[i] != s[j] and r[j] != s[i]: + r[i], r[j] = r[j], r[i] + break + + # Convert list to string. PEP 8, "Style Guide for Python Code", + # suggests that ''.join() is faster than + when concatenating + # many strings. See http://www.python.org/dev/peps/pep-0008/ + r = ''.join(r) + + score = sum(x == y for x, y in zip(r, s)) + + return (r, score) + +for s in "abracadabra", "seesaw", "elk", "grrrrrr", "up", "a": + shuffled, score = best_shuffle(s) + print("%s, %s, (%d)" % (s, shuffled, score)) diff --git a/Task/Best-shuffle/REXX/best-shuffle-1.rexx b/Task/Best-shuffle/REXX/best-shuffle-1.rexx new file mode 100644 index 0000000000..3457ce0c20 --- /dev/null +++ b/Task/Best-shuffle/REXX/best-shuffle-1.rexx @@ -0,0 +1,42 @@ +/*REXX program to find the best shuffle (for a character string). */ +parse arg list /*get words from the command line*/ +if list='' then list='tree abracadabra seesaw elk grrrrrr up a' /*def.?*/ +w=0 /*widest word , for prettifing. */ + do i=1 for words(list) + w=max(w,length(word(list,i))) /*the maximum word width so far. */ + end /*i*/ +w=w+5 /*add five spaces to widest word.*/ + do n=1 for words(list) /*process the words in the list. */ + $=word(list,n) /*the original word in the list. */ + new=bestShuffle($) /*shufflized version of the word.*/ + say 'original:' left($,w) 'new:' left(new,w) 'count:' kSame($,new) + end /*n*/ +exit /*stick a fork in it, we're done.*/ +/*──────────────────────────────────BESTSHUFFLE subroutine──────────────*/ +bestShuffle: procedure; parse arg x 1 ox; Lx=length(x) +if Lx<3 then return reverse(x) /*fast track these puppies. */ + + do j=1 for Lx-1 /*first take care of replications*/ + a=substr(x,j ,1) + b=substr(x,j+1,1); if a\==b then iterate + _=verify(x,a); if _==0 then iterate /*switch 1st rep with some char. */ + y=substr(x,_,1); x=overlay(a,x,_) + x=overlay(y,x,j) + rx=reverse(x); _=verify(rx,a); if _==0 then iterate /*¬ enuf unique*/ + y=substr(rx,_,1); _=lastpos(y,x) /*switch 2nd rep with later char.*/ + x=overlay(a,x,_); x=overlay(y,x,j+1) /*OVERLAYs: a fast way to swap*/ + end /*j*/ + + do k=1 for Lx /*take care of same o'-same o's. */ + a=substr(x, k,1) + b=substr(ox,k,1); if a\==b then iterate + if k==Lx then x=left(x,k-2)a || substr(x,k-1,1) /*last case*/ + else x=left(x,k-1)substr(x,k+1,1)a || substr(x,k+2) + end /*k*/ +return x +/*──────────────────────────────────KSAME procedure─────────────────────*/ +kSame: procedure; parse arg x,y; k=0 + do m=1 for min(length(x),length(y)) + k=k + (substr(x,m,1) == substr(y,m,1)) + end /*m*/ +return k diff --git a/Task/Best-shuffle/REXX/best-shuffle-2.rexx b/Task/Best-shuffle/REXX/best-shuffle-2.rexx new file mode 100644 index 0000000000..c39f7425d1 --- /dev/null +++ b/Task/Best-shuffle/REXX/best-shuffle-2.rexx @@ -0,0 +1,37 @@ +def best_shuffle(s) + # Fill _pos_ with positions in the order + # that we want to fill them. + pos = [] + # g["a"] = [2, 4] implies that s[2] == s[4] == "a" + g = (0...s.length).group_by { |i| s[i] } + + # k sorts letters from low to high count + k = g.sort_by { |k, v| v.length }.map! { |k, v| k } + + until g.empty? + k.each { |letter| + g[letter] or next + pos.push(g[letter].pop) + g[letter].empty? and g.delete letter + } + end + pos.reverse! + + # Now fill in _new_ with _letters_ according to each position + # in _pos_, but skip ahead in _letters_ if we can avoid + # matching characters that way. + letters = s.dup + new = "?" * s.length + until letters.empty? + i, p = 0, pos.shift + i += 1 while letters[i] == s[p] and i < (letters.length - 1) + new[p] = letters.slice! i + end + + score = new.chars.zip(s.chars).count { |c, d| c == d } + [new, score] +end + +%w(abracadabra seesaw elk grrrrrr up a).each { |word| + printf "%s, %s, (%d)\n", word, *best_shuffle(word) +} diff --git a/Task/Best-shuffle/REXX/best-shuffle-3.rexx b/Task/Best-shuffle/REXX/best-shuffle-3.rexx new file mode 100644 index 0000000000..d7eb9abdc9 --- /dev/null +++ b/Task/Best-shuffle/REXX/best-shuffle-3.rexx @@ -0,0 +1,25 @@ +list$ = "abracadabra seesaw pop grrrrrr up a" + +while word$(list$,ii + 1," ") <> "" + ii = ii + 1 + w$ = word$(list$,ii," ") + bs$ = bestShuffle$(w$) + count = 0 + for i = 1 to len(w$) + if mid$(w$,i,1) = mid$(bs$,i,1) then count = count + 1 + next i + print w$;" ";bs$;" ";count +wend + +function bestShuffle$(s1$) + s2$ = s1$ + for i = 1 to len(s2$) + for j = 1 to len(s2$) + if (i <> j) and (mid$(s2$,i,1) <> mid$(s1$,j,1)) and (mid$(s2$,j,1) <> mid$(s1$,i,1)) then + if j < i then i1 = j:j1 = i else i1 = i:j1 = j + s2$ = left$(s2$,i1-1) + mid$(s2$,j1,1) + mid$(s2$,i1+1,(j1-i1)-1) + mid$(s2$,i1,1) + mid$(s2$,j1+1) + end if + next j + next i +bestShuffle$ = s2$ +end function diff --git a/Task/Best-shuffle/Racket/best-shuffle.rkt b/Task/Best-shuffle/Racket/best-shuffle.rkt new file mode 100644 index 0000000000..5cb2b2e797 --- /dev/null +++ b/Task/Best-shuffle/Racket/best-shuffle.rkt @@ -0,0 +1,20 @@ +#lang racket + +(define (best-shuffle s) + (define len (string-length s)) + (define @ string-ref) + (define r (list->string (shuffle (string->list s)))) + (for* ([i (in-range len)] [j (in-range len)]) + (when (not (or (= i j) (eq? (@ s i) (@ r j)) (eq? (@ s j) (@ r i)))) + (define t (@ r i)) + (string-set! r i (@ r j)) + (string-set! r j t))) + r) + +(define (count-same s1 s2) + (for/sum ([c1 (in-string s1)] [c2 (in-string s2)]) + (if (eq? c1 c2) 1 0))) + +(for ([s (in-list '("tree" "abracadabra" "seesaw" "elk" "grrrrrr" "up" "a"))]) + (define sh (best-shuffle s)) + (printf " ~a, ~a, (~a)\n" s sh (count-same s sh))) diff --git a/Task/Best-shuffle/Scheme/best-shuffle.ss b/Task/Best-shuffle/Scheme/best-shuffle.ss new file mode 100644 index 0000000000..4b94520b93 --- /dev/null +++ b/Task/Best-shuffle/Scheme/best-shuffle.ss @@ -0,0 +1,65 @@ +(define count + (lambda (str1 str2) + (let ((len (string-length str1))) + (let loop ((index 0) + (result 0)) + (if (= index len) + result + (loop (+ index 1) + (if (eq? (string-ref str1 index) + (string-ref str2 index)) + (+ result 1) + result))))))) + +(define swap + (lambda (str index1 index2) + (let ((mutable (string-copy str)) + (char1 (string-ref str index1)) + (char2 (string-ref str index2))) + (string-set! mutable index1 char2) + (string-set! mutable index2 char1) + mutable))) + +(define shift + (lambda (str) + (string-append (substring str 1 (string-length str)) + (substring str 0 1)))) + +(define shuffle + (lambda (str) + (let* ((mutable (shift str)) + (len (string-length mutable)) + (max-index (- len 1))) + (let outer ((index1 0) + (best mutable) + (best-count (count str mutable))) + (if (or (< max-index index1) + (= best-count 0)) + best + (let inner ((index2 (+ index1 1)) + (best best) + (best-count best-count)) + (if (= len index2) + (outer (+ index1 1) + best + best-count) + (let* ((next-mutable (swap best index1 index2)) + (next-count (count str next-mutable))) + (if (= 0 next-count) + next-mutable + (if (< next-count best-count) + (inner (+ index2 1) + next-mutable + next-count) + (inner (+ index2 1) + best + best-count))))))))))) + + +(for-each + (lambda (str) + (let ((shuffled (shuffle str))) + (display + (string-append str " " shuffled " (" + (number->string (count str shuffled)) ")\n")))) + '("abracadabra" "seesaw" "elk" "grrrrrr" "up" "a")) diff --git a/Task/Best-shuffle/Tcl/best-shuffle-1.tcl b/Task/Best-shuffle/Tcl/best-shuffle-1.tcl new file mode 100644 index 0000000000..3408252153 --- /dev/null +++ b/Task/Best-shuffle/Tcl/best-shuffle-1.tcl @@ -0,0 +1,21 @@ +package require Tcl 8.5 +package require struct::list + +# Simple metric function; assumes non-empty lists +proc count {l1 l2} { + foreach a $l1 b $l2 {incr total [string equal $a $b]} + return $total +} +# Find the best shuffling of the string +proc bestshuffle {str} { + set origin [split $str ""] + set best $origin + set score [llength $origin] + struct::list foreachperm p $origin { + if {$score > [set score [tcl::mathfunc::min $score [count $origin $p]]]} { + set best $p + } + } + set best [join $best ""] + return "$str,$best,($score)" +} diff --git a/Task/Best-shuffle/Tcl/best-shuffle-2.tcl b/Task/Best-shuffle/Tcl/best-shuffle-2.tcl new file mode 100644 index 0000000000..d2cd1559a0 --- /dev/null +++ b/Task/Best-shuffle/Tcl/best-shuffle-2.tcl @@ -0,0 +1,3 @@ +foreach sample {abracadabra seesaw elk grrrrrr up a} { + puts [bestshuffle $sample] +} diff --git a/Task/Binary-search/0DESCRIPTION b/Task/Binary-search/0DESCRIPTION new file mode 100644 index 0000000000..62772bf0a3 --- /dev/null +++ b/Task/Binary-search/0DESCRIPTION @@ -0,0 +1,140 @@ +A binary search divides a range of values into halves, and continues to narrow down the field of search until the unknown value is found. It is the classic example of a "divide and conquer" algorithm. + +As an analogy, consider the children's game "[[Guess the number/With feedback|guess a number]]." The scorer has a secret number, and will only tell the player if their guessed number is higher than, lower than, or equal to the secret number. The player then uses this information to guess a new number. + +As the player, an optimal strategy for the general case is to start by choosing the range's midpoint as the guess, and then asking whether the guess was higher, lower, or equal to the secret number. If the guess was too high, one would select the point exactly between the range midpoint and the beginning of the range. If the original guess was too low, one would ask about the point exactly between the range midpoint and the end of the range. This process repeats until one has reached the secret number. + +'''The Task''' + +Given the starting point of a range, the ending point of a range, and the "secret value", implement a binary search through a sorted integer array for a certain number. Implementations can be recursive or iterative (both if you can). Print out whether or not the number was in the array afterwards. If it was, print the index also. + +There are several binary search algorithms commonly seen. They differ by how they treat multiple values equal to the given value, and whether they indicate whether the element was found or not. For completeness we will present pseudocode for all of them. + +All of the following code examples use an "inclusive" upper bound (i.e. high = N-1 initially). Any of the examples can be converted into an equivalent example using "exclusive" upper bound (i.e. high = N initially) by making the following simple changes (which simply increase high by 1): +* change high = N-1 to high = N +* change high = mid-1 to high = mid +* (for recursive algorithm) change if (high < low) to if (high <= low) +* (for iterative algorithm) change while (low <= high) to while (low < high) + +; Traditional algorithm +The algorithms are as follows (from [[wp:Binary search|Wikipedia]]). The algorithms return the index of some element that equals the given value (if there are multiple such elements, it returns some arbitrary one). It is also possible, when the element is not found, to return the "insertion point" for it (the index that the value would have if it were inserted into the array). + +'''Recursive Pseudocode''': + // initially called with low = 0, high = N-1 + BinarySearch(A[0..N-1], value, low, high) { + // invariants: value > A[i] for all i < low + value < A[i] for all i > high + if (high < low) + return not_found // value would be inserted at index "low" + mid = (low + high) / 2 + if (A[mid] > value) + return BinarySearch(A, value, low, mid-1) + else if (A[mid] < value) + return BinarySearch(A, value, mid+1, high) + else + return mid + } + +'''Iterative Pseudocode''': + BinarySearch(A[0..N-1], value) { + low = 0 + high = N - 1 + while (low <= high) { + // invariants: value > A[i] for all i < low + value < A[i] for all i > high + mid = (low + high) / 2 + if (A[mid] > value) + high = mid - 1 + else if (A[mid] < value) + low = mid + 1 + else + return mid + } + return not_found // value would be inserted at index "low" + } + +; Leftmost insertion point +The following algorithms return the leftmost place where the given element can be correctly inserted (and still maintain the sorted order). This is the lower (inclusive) bound of the range of elements that are equal to the given value (if any). Equivalently, this is the lowest index where the element is greater than or equal to the given value (since if it were any lower, it would violate the ordering), or 1 past the last index if such an element does not exist. This algorithm does not determine if the element is actually found. This algorithm only requires one comparison per level. + +'''Recursive Pseudocode''': + // initially called with low = 0, high = N - 1 + BinarySearch_Left(A[0..N-1], value, low, high) { + // invariants: value > A[i] for all i < low + value <= A[i] for all i > high + if (high < low) + return low + mid = (low + high) / 2 + if (A[mid] >= value) + return BinarySearch_Left(A, value, low, mid-1) + else + return BinarySearch_Left(A, value, mid+1, high) + } + +'''Iterative Pseudocode''': + BinarySearch_Left(A[0..N-1], value) { + low = 0 + high = N - 1 + while (low <= high) { + // invariants: value > A[i] for all i < low + value <= A[i] for all i > high + mid = (low + high) / 2 + if (A[mid] >= value) + high = mid - 1 + else + low = mid + 1 + } + return low + } + +; Rightmost insertion point +The following algorithms return the rightmost place where the given element can be correctly inserted (and still maintain the sorted order). This is the upper (exclusive) bound of the range of elements that are equal to the given value (if any). Equivalently, this is the lowest index where the element is greater than the given value, or 1 past the last index if such an element does not exist. This algorithm does not determine if the element is actually found. This algorithm only requires one comparison per level. Note that these algorithms are almost exactly the same as the leftmost-insertion-point algorithms, except for how the inequality treats equal values. + +'''Recursive Pseudocode''': + // initially called with low = 0, high = N - 1 + BinarySearch_Right(A[0..N-1], value, low, high) { + // invariants: value >= A[i] for all i < low + value < A[i] for all i > high + if (high < low) + return low + mid = (low + high) / 2 + if (A[mid] > value) + return BinarySearch_Right(A, value, low, mid-1) + else + return BinarySearch_Right(A, value, mid+1, high) + } + +'''Iterative Pseudocode''': + BinarySearch_Right(A[0..N-1], value) { + low = 0 + high = N - 1 + while (low <= high) { + // invariants: value >= A[i] for all i < low + value < A[i] for all i > high + mid = (low + high) / 2 + if (A[mid] > value) + high = mid - 1 + else + low = mid + 1 + } + return low + } + +;Extra credit +Make sure it does not have overflow bugs. + +The line in the pseudocode above to calculate the mean of two integers: +
mid = (low + high) / 2
+could produce the wrong result in some programming languages when used with a bounded integer type, if the addition causes an overflow. (This can occur if the array size is greater than half the maximum integer value.) If signed integers are used, and low + high overflows, it becomes a negative number, and dividing by 2 will still result in a negative number. Indexing an array with a negative number could produce an out-of-bounds exception, or other undefined behavior. If unsigned integers are used, an overflow will result in losing the largest bit, which will produce the wrong result. + +One way to fix it is to manually add half the range to the low number: +
mid = low + (high - low) / 2
+Even though this is mathematically equivalent to the above, it is not susceptible to overflow. + +Another way for signed integers, possibly faster, is the following: +
mid = (low + high) >>> 1
+where >>> is the logical right shift operator. The reason why this works is that, for signed integers, even though it overflows, when viewed as an unsigned number, the value is still the correct sum. To divide an unsigned number by 2, simply do a logical right shift. + +'''References:'''
+:* C.f: [[Guess the number/With Feedback (Player)]] +:* [[wp:Binary search algorithm]] +:* [http://googleresearch.blogspot.com/2006/06/extra-extra-read-all-about-it-nearly.html Extra, Extra - Read All About It: Nearly All Binary Searches and Mergesorts are Broken]. diff --git a/Task/Binary-search/1META.yaml b/Task/Binary-search/1META.yaml new file mode 100644 index 0000000000..0d2b469697 --- /dev/null +++ b/Task/Binary-search/1META.yaml @@ -0,0 +1,4 @@ +--- +category: +- Recursion +note: Classic CS problems and programs diff --git a/Task/Binary-search/ACL2/binary-search.acl2 b/Task/Binary-search/ACL2/binary-search.acl2 new file mode 100644 index 0000000000..31a1607428 --- /dev/null +++ b/Task/Binary-search/ACL2/binary-search.acl2 @@ -0,0 +1,61 @@ +(defun defarray (name size initial-element) + (cons name + (compress1 name + (cons (list :HEADER + :DIMENSIONS (list size) + :MAXIMUM-LENGTH (1+ size) + :DEFAULT initial-element + :NAME name) + nil)))) + +(defconst *dim* 100000) + +(defun array-name (array) + (first array)) + +(defun set-at (array i val) + (cons (array-name array) + (aset1 (array-name array) + (cdr array) + i + val))) + +(defun populate-array-ordered (array n) + (if (zp n) + array + (populate-array-ordered (set-at array + (- *dim* n) + (- *dim* n)) + (1- n)))) +(include-book "arithmetic-3/top" :dir :system) + +(defun binary-search-r (needle haystack low high) + (declare (xargs :measure (nfix (1+ (- high low))))) + (let* ((mid (floor (+ low high) 2)) + (current (aref1 (array-name haystack) + (cdr haystack) + mid))) + (cond ((not (and (natp low) (natp high))) nil) + ((= current needle) + mid) + ((zp (1+ (- high low))) nil) + ((> current needle) + (binary-search-r needle + haystack + low + (1- mid))) + (t (binary-search-r needle + haystack + (1+ mid) + high))))) + +(defun binary-search (needle haystack) + (binary-search-r needle haystack 0 + (maximum-length (array-name haystack) + (cdr haystack)))) + +(defun test-bsearch (needle) + (binary-search needle + (populate-array-ordered + (defarray 'haystack *dim* 0) + *dim*))) diff --git a/Task/Binary-search/AWK/binary-search-1.awk b/Task/Binary-search/AWK/binary-search-1.awk new file mode 100644 index 0000000000..a8634e719e --- /dev/null +++ b/Task/Binary-search/AWK/binary-search-1.awk @@ -0,0 +1,8 @@ +function binary_search(array, value, left, right, middle) { + if (right < left) return 0 + middle = int((right + left) / 2) + if (value == array[middle]) return 1 + if (value < array[middle]) + return binary_search(array, value, left, middle - 1) + return binary_search(array, value, middle + 1, right) +} diff --git a/Task/Binary-search/AWK/binary-search-2.awk b/Task/Binary-search/AWK/binary-search-2.awk new file mode 100644 index 0000000000..9320c09ca3 --- /dev/null +++ b/Task/Binary-search/AWK/binary-search-2.awk @@ -0,0 +1,9 @@ +function binary_search(array, value, left, right, middle) { + while (left <= right) { + middle = int((right + left) / 2) + if (value == array[middle]) return 1 + if (value < array[middle]) right = middle - 1 + else left = middle + 1 + } + return 0 +} diff --git a/Task/Binary-search/Ada/binary-search-1.ada b/Task/Binary-search/Ada/binary-search-1.ada new file mode 100644 index 0000000000..f399a4debe --- /dev/null +++ b/Task/Binary-search/Ada/binary-search-1.ada @@ -0,0 +1,54 @@ +with Ada.Text_IO; use Ada.Text_IO; + +procedure Test_Recursive_Binary_Search is + Not_Found : exception; + + generic + type Index is range <>; + type Element is private; + type Array_Of_Elements is array (Index range <>) of Element; + with function "<" (L, R : Element) return Boolean is <>; + function Search (Container : Array_Of_Elements; Value : Element) return Index; + + function Search (Container : Array_Of_Elements; Value : Element) return Index is + Mid : Index; + begin + if Container'Length > 0 then + Mid := (Container'First + Container'Last) / 2; + if Value < Container (Mid) then + if Container'First /= Mid then + return Search (Container (Container'First..Mid - 1), Value); + end if; + elsif Container (Mid) < Value then + if Container'Last /= Mid then + return Search (Container (Mid + 1..Container'Last), Value); + end if; + else + return Mid; + end if; + end if; + raise Not_Found; + end Search; + + type Integer_Array is array (Positive range <>) of Integer; + function Find is new Search (Positive, Integer, Integer_Array); + + procedure Test (X : Integer_Array; E : Integer) is + begin + New_Line; + for I in X'Range loop + Put (Integer'Image (X (I))); + end loop; + Put (" contains" & Integer'Image (E) & " at" & Integer'Image (Find (X, E))); + exception + when Not_Found => + Put (" does not contain" & Integer'Image (E)); + end Test; +begin + Test ((2, 4, 6, 8, 9), 2); + Test ((2, 4, 6, 8, 9), 1); + Test ((2, 4, 6, 8, 9), 8); + Test ((2, 4, 6, 8, 9), 10); + Test ((2, 4, 6, 8, 9), 9); + Test ((2, 4, 6, 8, 9), 5); +end Test_Recursive_Binary_Search; diff --git a/Task/Binary-search/Ada/binary-search-2.ada b/Task/Binary-search/Ada/binary-search-2.ada new file mode 100644 index 0000000000..0c5133631c --- /dev/null +++ b/Task/Binary-search/Ada/binary-search-2.ada @@ -0,0 +1,56 @@ +with Ada.Text_IO; use Ada.Text_IO; + +procedure Test_Binary_Search is + Not_Found : exception; + + generic + type Index is range <>; + type Element is private; + type Array_Of_Elements is array (Index range <>) of Element; + with function "<" (L, R : Element) return Boolean is <>; + function Search (Container : Array_Of_Elements; Value : Element) return Index; + + function Search (Container : Array_Of_Elements; Value : Element) return Index is + Low : Index := Container'First; + High : Index := Container'Last; + Mid : Index; + begin + if Container'Length > 0 then + loop + Mid := (Low + High) / 2; + if Value < Container (Mid) then + exit when Low = Mid; + High := Mid - 1; + elsif Container (Mid) < Value then + exit when High = Mid; + Low := Mid + 1; + else + return Mid; + end if; + end loop; + end if; + raise Not_Found; + end Search; + + type Integer_Array is array (Positive range <>) of Integer; + function Find is new Search (Positive, Integer, Integer_Array); + + procedure Test (X : Integer_Array; E : Integer) is + begin + New_Line; + for I in X'Range loop + Put (Integer'Image (X (I))); + end loop; + Put (" contains" & Integer'Image (E) & " at" & Integer'Image (Find (X, E))); + exception + when Not_Found => + Put (" does not contain" & Integer'Image (E)); + end Test; +begin + Test ((2, 4, 6, 8, 9), 2); + Test ((2, 4, 6, 8, 9), 1); + Test ((2, 4, 6, 8, 9), 8); + Test ((2, 4, 6, 8, 9), 10); + Test ((2, 4, 6, 8, 9), 9); + Test ((2, 4, 6, 8, 9), 5); +end Test_Binary_Search; diff --git a/Task/Binary-search/BASIC/binary-search-1.bas b/Task/Binary-search/BASIC/binary-search-1.bas new file mode 100644 index 0000000000..2d297a2078 --- /dev/null +++ b/Task/Binary-search/BASIC/binary-search-1.bas @@ -0,0 +1,17 @@ +FUNCTION binary_search ( array() AS Integer, value AS Integer, lo AS Integer, hi AS Integer) AS Integer + DIM middle AS Integer + + IF hi < lo THEN + binary_search = 0 + ELSE + middle = (hi + lo) / 2 + SELECT CASE value + CASE IS < array(middle) + binary_search = binary_search(array(), value, lo, middle-1) + CASE IS > array(middle) + binary_search = binary_search(array(), value, middle+1, hi) + CASE ELSE + binary_search = middle + END SELECT + END IF +END FUNCTION diff --git a/Task/Binary-search/BASIC/binary-search-2.bas b/Task/Binary-search/BASIC/binary-search-2.bas new file mode 100644 index 0000000000..357c24f623 --- /dev/null +++ b/Task/Binary-search/BASIC/binary-search-2.bas @@ -0,0 +1,17 @@ +FUNCTION binary_search ( array() AS Integer, value AS Integer, lo AS Integer, hi AS Integer) AS Integer + DIM middle AS Integer + + WHILE lo <= hi + middle = (hi + lo) / 2 + SELECT CASE value + CASE IS < array(middle) + hi = middle - 1 + CASE IS > array(middle) + lo = middle + 1 + CASE ELSE + binary_search = middle + EXIT FUNCTION + END SELECT + WEND + binary_search = 0 +END FUNCTION diff --git a/Task/Binary-search/BASIC/binary-search-3.bas b/Task/Binary-search/BASIC/binary-search-3.bas new file mode 100644 index 0000000000..5f8102ec31 --- /dev/null +++ b/Task/Binary-search/BASIC/binary-search-3.bas @@ -0,0 +1,23 @@ +SUB search (array() AS Integer, value AS Integer) + DIM idx AS Integer + + idx = binary_search(array(), value, LBOUND(array), UBOUND(array)) + PRINT "Value "; value; + IF idx < 1 THEN + PRINT " not found" + ELSE + PRINT " found at index "; idx + END IF +END SUB + +DIM test(1 TO 10) AS Integer +DIM i AS Integer + +DATA 2, 3, 5, 6, 8, 10, 11, 15, 19, 20 +FOR i = 1 TO 10 ' Fill the test array + READ test(i) +NEXT i + +search test(), 4 +search test(), 8 +search test(), 20 diff --git a/Task/Binary-search/C/binary-search-1.c b/Task/Binary-search/C/binary-search-1.c new file mode 100644 index 0000000000..d68f733aaa --- /dev/null +++ b/Task/Binary-search/C/binary-search-1.c @@ -0,0 +1,36 @@ +/* http://www.solipsys.co.uk/b_search/spec.htm */ +typedef int Object; + +int cmpObject(Object* pa, Object *pb) +{ + Object a = *pa; + Object b = *pb; + if (a < b) return -1; + if (a == b) return 0; + if (a > b) return 1; + assert(0); +} + +int bsearch(Object Array[], int n, Object *KeyPtr, + int (*cmp)(Object *, Object *), + int NotFound) +{ + unsigned left = 1, right = n; /* `unsigned' to avoid overflow in `(left + right)/2' */ + + if ( ! (Array && n > 0 && KeyPtr && cmp)) + return NotFound; /* invalid input or empty array */ + + while (left < right) + { + /* invariant: a[left] <= *KeyPtr <= a[right] or *KeyPtr not in Array */ + unsigned m = (left + right) / 2; /*NOTE: *intentionally* truncate for odd sum */ + + if (cmp(Array + m, KeyPtr) < 0) + left = m + 1; /* a[m] < *KeyPtr <= a[right] or *KeyPtr not in Array */ + else + /* assert(right != m) or infinite loop possible */ + right = m; /* a[left] <= *KeyPtr <= a[m] or *KeyPtr not in Array */ + } + /* assert(left == right) */ + return (cmp(Array + right, KeyPtr) == 0) ? right : NotFound; +} diff --git a/Task/Binary-search/C/binary-search-2.c b/Task/Binary-search/C/binary-search-2.c new file mode 100644 index 0000000000..0a92817172 --- /dev/null +++ b/Task/Binary-search/C/binary-search-2.c @@ -0,0 +1,38 @@ +#define DUMMY -1 /* dummy element of array (to adjust indexing from 1..n) */ + +int main(void) +{ + Object a[] = {DUMMY, 0, 1, 1, 2, 5}; /* allowed indices from 1 to n including */ + int n = sizeof(a)/sizeof(*a) - 1; + const int NotFound = -1; + + /* key not in Array */ + Object key = 4; + assert(NotFound == bsearch(a, n, &key, cmpObject, NotFound)); + key = DUMMY; + assert(NotFound == bsearch(a, n, &key, cmpObject, NotFound)); + key = 7; + assert(NotFound == bsearch(a, n, &key, cmpObject, NotFound)); + + /* all possible `n' and `k' for `a' array */ + int k; + key = 10; /* not in `a` array */ + for (n = 0; n <= sizeof(a)/sizeof(*a) - 1; ++n) + for (k = n; k>=1; --k) { + int index = bsearch(a, n, &a[k], cmpObject, NotFound); + assert(index == k || (k==3 && index == 2) || n == 0); /* for equal `1's */ + assert(NotFound == bsearch(a, n, &key, cmpObject, NotFound)); + } + n = sizeof(a)/sizeof(*a) - 1; + + /* NULL array */ + assert(NotFound == bsearch(NULL, n, &key, cmpObject, NotFound)); + /* NULL &key */ + assert(NotFound == bsearch(a, n, NULL, cmpObject, NotFound)); + /* NULL cmpObject */ + assert(1 == bsearch(a, n, &a[1], cmpObject, NotFound)); + assert(NotFound == bsearch(a, n, &a[1], NULL, NotFound)); + + printf("OK\n"); + return 0; +} diff --git a/Task/Binary-search/C/binary-search-3.c b/Task/Binary-search/C/binary-search-3.c new file mode 100644 index 0000000000..673888784a --- /dev/null +++ b/Task/Binary-search/C/binary-search-3.c @@ -0,0 +1,21 @@ +#include /* for bsearch */ +#include + +int intcmp(const void *a, const void *b) +{ + /* this is only correct if it doesn't overflow */ + return *(const int *)a - *(const int *)b; +} + +int main() +{ + int nums[5] = {2, 3, 5, 6, 8}; + int desired = 6; + int *ptr = bsearch(&desired, nums, 5, sizeof(int), intcmp); + if (ptr == NULL) + printf("not found\n"); + else + printf("index = %d\n", ptr - nums); + + return 0; +} diff --git a/Task/Binary-search/Clojure/binary-search.clj b/Task/Binary-search/Clojure/binary-search.clj new file mode 100644 index 0000000000..9da2d9e9c8 --- /dev/null +++ b/Task/Binary-search/Clojure/binary-search.clj @@ -0,0 +1,16 @@ +(defn bsearch + ([coll t] + (bsearch coll 0 (dec (count coll)) t)) + ([coll l u t] + (if (> l u) -1 + (let [m (quot (+ l u) 2) mth (nth coll m)] + (cond + ; the middle element is greater than t + ; so search the lower half + (> mth t) (recur coll l (dec m) t) + ; the middle element is less than t + ; so search the upper half + (< mth t) (recur coll (inc m) u t) + ; we've found our target + ; so return its index + (= mth t) m))))) diff --git a/Task/Binary-search/CoffeeScript/binary-search.coffee b/Task/Binary-search/CoffeeScript/binary-search.coffee new file mode 100644 index 0000000000..b78af45ce3 --- /dev/null +++ b/Task/Binary-search/CoffeeScript/binary-search.coffee @@ -0,0 +1,16 @@ +binsearch = (arr, k) -> + low = 0 + high = arr.length - 1 + while low <= high + mid = Math.floor (low + high) / 2 + return mid if arr[mid] == k + if arr[mid] < k + low = mid + 1 + else + high = mid - 1 + null + +arr = [1,3,5,7,9,11] +for i in [0..12] + pos = binsearch arr, i + console.log "found #{i} at pos #{pos}" if pos? diff --git a/Task/Binary-search/Erlang/binary-search.erl b/Task/Binary-search/Erlang/binary-search.erl new file mode 100644 index 0000000000..5a086c5ce9 --- /dev/null +++ b/Task/Binary-search/Erlang/binary-search.erl @@ -0,0 +1,27 @@ +%% Task: Binary Search algorithm +%% Author: Abhay Jain + +-module(searching_algorithm). +-export([start/0]). + +start() -> + List = [1,2,3], + binary_search(List, 5, 1, length(List)). + + +binary_search(List, Value, Low, High) -> + if Low > High -> + io:format("Number ~p not found~n", [Value]), + not_found; + true -> + Mid = (Low + High) div 2, + MidNum = lists:nth(Mid, List), + if MidNum > Value -> + binary_search(List, Value, Low, Mid-1); + MidNum < Value -> + binary_search(List, Value, Mid+1, High); + true -> + io:format("Number ~p found at index ~p", [Value, Mid]), + Mid + end + end. diff --git a/Task/Binary-search/Forth/binary-search.fth b/Task/Binary-search/Forth/binary-search.fth new file mode 100644 index 0000000000..a16fe79e63 --- /dev/null +++ b/Task/Binary-search/Forth/binary-search.fth @@ -0,0 +1,31 @@ +defer (compare) +' - is (compare) \ default to numbers + +: cstr-compare ( cstr1 cstr2 -- <=> ) \ counted strings + swap count rot count compare ; + +: mid ( u l -- mid ) tuck - 2/ -cell and + ; + +: bsearch ( item upper lower -- where found? ) + rot >r + begin 2dup > + while 2dup mid + dup @ r@ (compare) + dup + while 0< + if nip cell+ ( upper mid+1 ) + else rot drop swap ( mid lower ) + then + repeat drop nip nip true + else max ( insertion-point ) false + then + r> drop ; + +create test 2 , 4 , 6 , 9 , 11 , 99 , +: probe ( n -- ) test 5 cells bounds bsearch . @ . cr ; +1 probe \ 0 2 +2 probe \ -1 2 +3 probe \ 0 4 +10 probe \ 0 11 +11 probe \ -1 11 +12 probe \ 0 99 diff --git a/Task/Binary-search/Fortran/binary-search-1.f b/Task/Binary-search/Fortran/binary-search-1.f new file mode 100644 index 0000000000..543a1f53b7 --- /dev/null +++ b/Task/Binary-search/Fortran/binary-search-1.f @@ -0,0 +1,18 @@ +recursive function binarySearch_R (a, value) result (bsresult) + real, intent(in) :: a(:), value + integer :: bsresult, mid + + mid = size(a)/2 + 1 + if (size(a) == 0) then + bsresult = 0 ! not found + else if (a(mid) > value) then + bsresult= binarySearch_R(a(:mid-1), value) + else if (a(mid) < value) then + bsresult = binarySearch_R(a(mid+1:), value) + if (bsresult /= 0) then + bsresult = mid + bsresult + end if + else + bsresult = mid ! SUCCESS!! + end if +end function binarySearch_R diff --git a/Task/Binary-search/Fortran/binary-search-2.f b/Task/Binary-search/Fortran/binary-search-2.f new file mode 100644 index 0000000000..8f741a0a47 --- /dev/null +++ b/Task/Binary-search/Fortran/binary-search-2.f @@ -0,0 +1,23 @@ +function binarySearch_I (a, value) + integer :: binarySearch_I + real, intent(in), target :: a(:) + real, intent(in) :: value + real, pointer :: p(:) + integer :: mid, offset + + p => a + binarySearch_I = 0 + offset = 0 + do while (size(p) > 0) + mid = size(p)/2 + 1 + if (p(mid) > value) then + p => p(:mid-1) + else if (p(mid) < value) then + offset = offset + mid + p => p(mid+1:) + else + binarySearch_I = offset + mid ! SUCCESS!! + return + end if + end do +end function binarySearch_I diff --git a/Task/Binary-search/Go/binary-search-1.go b/Task/Binary-search/Go/binary-search-1.go new file mode 100644 index 0000000000..228c200c9b --- /dev/null +++ b/Task/Binary-search/Go/binary-search-1.go @@ -0,0 +1,12 @@ +func binarySearch(a []float64, value float64, low int, high int) int { + if high < low { + return -1 + } + mid := (low + high) / 2 + if a[mid] > value { + return binarySearch(a, value, low, mid-1) + } else if a[mid] < value { + return binarySearch(a, value, mid+1, high) + } + return mid +} diff --git a/Task/Binary-search/Go/binary-search-2.go b/Task/Binary-search/Go/binary-search-2.go new file mode 100644 index 0000000000..72eecdfbe4 --- /dev/null +++ b/Task/Binary-search/Go/binary-search-2.go @@ -0,0 +1,15 @@ +func binarySearch(a []float64, value float64) int { + low := 0 + high := len(a) - 1 + for low <= high { + mid := (low + high) / 2 + if a[mid] > value { + high = mid - 1 + } else if a[mid] < value { + low = mid + 1 + } else { + return mid + } + } + return -1 +} diff --git a/Task/Binary-search/Go/binary-search-3.go b/Task/Binary-search/Go/binary-search-3.go new file mode 100644 index 0000000000..8ac9166591 --- /dev/null +++ b/Task/Binary-search/Go/binary-search-3.go @@ -0,0 +1,5 @@ +import "sort" + +//... + +sort.SearchInts([]int{0,1,4,5,6,7,8,9}, 6) // evaluates to 4 diff --git a/Task/Binary-search/Haskell/binary-search-1.hs b/Task/Binary-search/Haskell/binary-search-1.hs new file mode 100644 index 0000000000..32e526faf4 --- /dev/null +++ b/Task/Binary-search/Haskell/binary-search-1.hs @@ -0,0 +1,9 @@ +binarySearch :: Integral a => (a -> Ordering) -> (a, a) -> Maybe a +binarySearch p (low,high) + | high < low = Nothing + | otherwise = + let mid = (low + high) `div` 2 in + case p mid of + LT -> binarySearch p (low, mid-1) + GT -> binarySearch p (mid+1, high) + EQ -> Just mid diff --git a/Task/Binary-search/Haskell/binary-search-2.hs b/Task/Binary-search/Haskell/binary-search-2.hs new file mode 100644 index 0000000000..e94148580b --- /dev/null +++ b/Task/Binary-search/Haskell/binary-search-2.hs @@ -0,0 +1,5 @@ +import Data.Array + +binarySearchArray :: (Ix i, Integral i, Ord e) => Array i e -> e -> Maybe i +binarySearchArray a x = binarySearch p (bounds a) where + p m = x `compare` (a ! m) diff --git a/Task/Binary-search/Java/binary-search-1.java b/Task/Binary-search/Java/binary-search-1.java new file mode 100644 index 0000000000..6d7bb6f14f --- /dev/null +++ b/Task/Binary-search/Java/binary-search-1.java @@ -0,0 +1,27 @@ +... +//check will be the number we are looking for +//nums will be the array we are searching through +public static int binarySearch(int[] nums, int check){ + int hi = nums.length - 1; + int lo = 0; + while(hi >= lo){ + guess = lo + ((hi - lo) / 2); + if(nums[guess] > check){ + hi = guess - 1; + }else if(nums[guess] < check){ + lo = guess + 1; + }else{ + return guess; + } + } + return -1; +} + +public static void main(String[] args){ + int[] searchMe; + int someNumber; + ... + int index = binarySearch(searchMe, someNumber); + System.out.println(someNumber + ((index == -1) ? " is not in the array" : (" is at index " + index))); + ... +} diff --git a/Task/Binary-search/Java/binary-search-2.java b/Task/Binary-search/Java/binary-search-2.java new file mode 100644 index 0000000000..5cc5eb0dce --- /dev/null +++ b/Task/Binary-search/Java/binary-search-2.java @@ -0,0 +1,21 @@ +public static void main(String[] args){ + int[] searchMe; + int someNumber; + ... + int index = binarySearch(searchMe, someNumber, 0, searchMe.length); + System.out.println(someNumber + ((index == -1) ? " is not in the array" : (" is at index " + index))); + ... +} + +public static int binarySearch(int[] nums, int check, int lo, int hi){ + if(hi < lo){ + return -1; //impossible index for "not found" + } + int guess = (hi + lo) / 2; + if(nums[guess] > check){ + return binarySearch(nums, check, lo, guess - 1); + }else if(nums[guess] value) + return binary_search_recursive(a, value, lo, mid-1); + else if (a[mid] < value) + return binary_search_recursive(a, value, mid+1, hi); + else + return mid; +} diff --git a/Task/Binary-search/JavaScript/binary-search-2.js b/Task/Binary-search/JavaScript/binary-search-2.js new file mode 100644 index 0000000000..b2ba949fff --- /dev/null +++ b/Task/Binary-search/JavaScript/binary-search-2.js @@ -0,0 +1,14 @@ +function binary_search_iterative(a, value) { + lo = 0; + hi = a.length - 1; + while (lo <= hi) { + var mid = Math.floor((lo+hi)/2); + if (a[mid] > value) + hi = mid - 1; + else if (a[mid] < value) + lo = mid + 1; + else + return mid; + } + return null; +} diff --git a/Task/Binary-search/Lua/binary-search-1.lua b/Task/Binary-search/Lua/binary-search-1.lua new file mode 100644 index 0000000000..a47e98803b --- /dev/null +++ b/Task/Binary-search/Lua/binary-search-1.lua @@ -0,0 +1,14 @@ +function binarySearch (list,value) + local low = 1 + local high = #list + local mid = 0 + while low <= high do + mid = math.floor((low+high)/2) + if list[mid] > value then high = mid - 1 + else if list[mid] < value then low = mid + 1 + else return mid + end + end + end + return false +end diff --git a/Task/Binary-search/Lua/binary-search-2.lua b/Task/Binary-search/Lua/binary-search-2.lua new file mode 100644 index 0000000000..5e57d23c09 --- /dev/null +++ b/Task/Binary-search/Lua/binary-search-2.lua @@ -0,0 +1,9 @@ +function binarySearch (list, value) + local function search(low, high) + local mid = math.floor((low+high)/2) + if list[mid] > value then return search(low,mid-1) end + if list[mid] < value then return search(mid+1,high) end + return mid + end + return search(1,#list) +end diff --git a/Task/Binary-search/PHP/binary-search-1.php b/Task/Binary-search/PHP/binary-search-1.php new file mode 100644 index 0000000000..d5478c2c29 --- /dev/null +++ b/Task/Binary-search/PHP/binary-search-1.php @@ -0,0 +1,19 @@ +function binary_search( $array, $secret, $start, $end ) +{ + do + { + $guess = (int)($start + ( ( $end - $start ) / 2 )); + + if ( $array[$guess] > $secret ) + $end = $guess; + + if ( $array[$guess] < $secret ) + $start = $guess; + + if ( $end < $start) + return -1; + + } while ( $array[$guess] != $secret ); + + return $guess; +} diff --git a/Task/Binary-search/PHP/binary-search-2.php b/Task/Binary-search/PHP/binary-search-2.php new file mode 100644 index 0000000000..88158badc2 --- /dev/null +++ b/Task/Binary-search/PHP/binary-search-2.php @@ -0,0 +1,15 @@ +function binary_search( $array, $secret, $start, $end ) +{ + $guess = (int)($start + ( ( $end - $start ) / 2 )); + + if ( $end < $start) + return -1; + + if ( $array[$guess] > $secret ) + return (binary_search( $array, $secret, $start, $guess )); + + if ( $array[$guess] < $secret ) + return (binary_search( $array, $secret, $guess, $end ) ); + + return $guess; +} diff --git a/Task/Binary-search/Perl/binary-search-1.pl b/Task/Binary-search/Perl/binary-search-1.pl new file mode 100644 index 0000000000..037b86103d --- /dev/null +++ b/Task/Binary-search/Perl/binary-search-1.pl @@ -0,0 +1,15 @@ +sub binary_search { + ($array_ref, $value, $left, $right) = @_; + while ($left <= $right) { + $middle = ($right + $left) / 2; + if ($array_ref->[$middle] == $value) { + return 1; + } + if ($value < $array_ref->[$middle]) { + $right = $middle - 1; + } else { + $left = $middle + 1; + } + } + return 0; +} diff --git a/Task/Binary-search/Perl/binary-search-2.pl b/Task/Binary-search/Perl/binary-search-2.pl new file mode 100644 index 0000000000..230f4bb380 --- /dev/null +++ b/Task/Binary-search/Perl/binary-search-2.pl @@ -0,0 +1,15 @@ +sub binary_search { + ($array_ref, $value, $left, $right) = @_; + if ($right < $left) { + return 0; + } + $middle = ($right + $left) / 2; + if ($array_ref->[$middle] == $value) { + return 1; + } + if ($value < $array_ref->[$middle]) { + binary_search($array_ref, $value, $left, $middle - 1); + } else { + binary_search($array_ref, $value, $middle + 1, $right); + } +} diff --git a/Task/Binary-search/PicoLisp/binary-search-1.l b/Task/Binary-search/PicoLisp/binary-search-1.l new file mode 100644 index 0000000000..ae715b84b4 --- /dev/null +++ b/Task/Binary-search/PicoLisp/binary-search-1.l @@ -0,0 +1,8 @@ +(de recursiveSearch (Val Lst Len) + (unless (=0 Len) + (let (N (inc (/ Len 2)) L (nth Lst N)) + (cond + ((= Val (car L)) Val) + ((> Val (car L)) + (recursiveSearch Val (cdr L) (- Len N)) ) + (T (recursiveSearch Val Lst (dec N))) ) ) ) ) diff --git a/Task/Binary-search/PicoLisp/binary-search-2.l b/Task/Binary-search/PicoLisp/binary-search-2.l new file mode 100644 index 0000000000..21fbd00055 --- /dev/null +++ b/Task/Binary-search/PicoLisp/binary-search-2.l @@ -0,0 +1,11 @@ +(de iterativeSearch (Val Lst Len) + (use (N L) + (loop + (T (=0 Len)) + (setq + N (inc (/ Len 2)) + L (nth Lst N) ) + (T (= Val (car L)) Val) + (if (> Val (car L)) + (setq Lst (cdr L) Len (- Len N)) + (setq Len (dec N)) ) ) ) ) diff --git a/Task/Binary-search/Python/binary-search-1.py b/Task/Binary-search/Python/binary-search-1.py new file mode 100644 index 0000000000..f5152151fc --- /dev/null +++ b/Task/Binary-search/Python/binary-search-1.py @@ -0,0 +1,9 @@ +def binary_search(l, value): + low = 0 + high = len(l)-1 + while low <= high: + mid = (low+high)//2 + if l[mid] > value: high = mid-1 + elif l[mid] < value: low = mid+1 + else: return mid + return -1 diff --git a/Task/Binary-search/Python/binary-search-2.py b/Task/Binary-search/Python/binary-search-2.py new file mode 100644 index 0000000000..c92cd43337 --- /dev/null +++ b/Task/Binary-search/Python/binary-search-2.py @@ -0,0 +1,10 @@ +def binary_search(l, value, low = 0, high = -1): + if not l: return -1 + if(high == -1): high = len(l)-1 + if low == high: + if l[low] == value: return low + else: return -1 + mid = (low+high)//2 + if l[mid] > value: return binary_search(l, value, low, mid-1) + elif l[mid] < value: return binary_search(l, value, mid+1, high) + else: return mid diff --git a/Task/Binary-search/Python/binary-search-3.py b/Task/Binary-search/Python/binary-search-3.py new file mode 100644 index 0000000000..fbf079ee81 --- /dev/null +++ b/Task/Binary-search/Python/binary-search-3.py @@ -0,0 +1,8 @@ +index = bisect.bisect_left(list, item) # leftmost insertion point +index = bisect.bisect_right(list, item) # rightmost insertion point +index = bisect.bisect(list, item) # same as bisect_right + +# same as above but actually insert the item into the list at the given place: +bisect.insort_left(list, item) +bisect.insort_right(list, item) +bisect.insort(list, item) diff --git a/Task/Binary-search/R/binary-search-1.r b/Task/Binary-search/R/binary-search-1.r new file mode 100644 index 0000000000..899577a219 --- /dev/null +++ b/Task/Binary-search/R/binary-search-1.r @@ -0,0 +1,13 @@ +BinSearch <- function(A, value, low, high) { + if ( high < low ) { + return(NULL) + } else { + mid <- floor((low + high) / 2) + if ( A[mid] > value ) + BinSearch(A, value, low, mid-1) + else if ( A[mid] < value ) + BinSearch(A, value, mid+1, high) + else + mid + } +} diff --git a/Task/Binary-search/R/binary-search-2.r b/Task/Binary-search/R/binary-search-2.r new file mode 100644 index 0000000000..425750fd7f --- /dev/null +++ b/Task/Binary-search/R/binary-search-2.r @@ -0,0 +1,15 @@ +IterBinSearch <- function(A, value) { + low = 1 + high = length(A) + i = 0 + while ( low <= high ) { + mid <- floor((low + high)/2) + if ( A[mid] > value ) + high <- mid - 1 + else if ( A[mid] < value ) + low <- mid + 1 + else + return(mid) + } + NULL +} diff --git a/Task/Binary-search/R/binary-search-3.r b/Task/Binary-search/R/binary-search-3.r new file mode 100644 index 0000000000..bca1a195ab --- /dev/null +++ b/Task/Binary-search/R/binary-search-3.r @@ -0,0 +1,4 @@ +a <- 1:100 +IterBinSearch(a, 50) +BinSearch(a, 50, 1, length(a)) # output 50 +IterBinSearch(a, 101) # outputs NULL diff --git a/Task/Binary-search/REXX/binary-search-1.rexx b/Task/Binary-search/REXX/binary-search-1.rexx new file mode 100644 index 0000000000..dde8d834d6 --- /dev/null +++ b/Task/Binary-search/REXX/binary-search-1.rexx @@ -0,0 +1,34 @@ +/*REXX program finds a value in a list using a recursive binary search. */ +@=' 11 17 29 37 41 59 67 71 79 97 101 107 127 137 149', + '163 179 191 197 223 227 239 251 269 277 281 307 311 331 347', + '367 379 397 419 431 439 457 461 479 487 499 521 541 557 569', + '587 599 613 617 631 641 659 673 701 719 727 739 751 757 769', + '787 809 821 827 853 857 877 881 907 929 937 967 991 1009' + /*(above) list of strong primes.*/ + +parse arg ? . /*get a number the user specified*/ +if ?=='' then do + say; say '*** error! *** no arg specified.'; say + exit 13 + end + low = 1 +high = words(@) +avg=(word(@,1)+word(@,high))/2 + loc = binarySearch(low,high) + +if loc==-1 then do + say ? "wasn't found in the list." + exit /*stick a fork in it, we're done.*/ + end + else say ? 'is in the list, its index is:' loc +say +say 'arithmetic mean of the' high "values=" avg +exit /*stick a fork in it, we're done.*/ +/*─────────────────────────────────────BINARYSEARCH subroutine──────────*/ +binarySearch: procedure expose @ ?; parse arg low,high +if high? then return binarySearch(low,mid-1) + return binarySearch(mid+1,high) diff --git a/Task/Binary-search/REXX/binary-search-2.rexx b/Task/Binary-search/REXX/binary-search-2.rexx new file mode 100644 index 0000000000..0d257886d4 --- /dev/null +++ b/Task/Binary-search/REXX/binary-search-2.rexx @@ -0,0 +1,31 @@ +/*REXX program finds a value in a list using an iterative binary search.*/ +@=' 3 7 13 19 23 31 43 47 61 73 83 89 103 109 113 131', + '139 151 167 181 193 199 229 233 241 271 283 293 313 317 337 349', + '353 359 383 389 401 409 421 433 443 449 463 467 491 503 509 523', + '547 571 577 601 619 643 647 661 677 683 691 709 743 761 773 797', + '811 823 829 839 859 863 883 887 911 919 941 953 971 983 1013' + /*(above) list of weak primes. */ + +parse arg ? . /*get a number the user specified*/ + +if ?=='' then do + say; say '*** error! *** no arg specified.'; say + exit 13 + end + low = 1 +high = words(@) +say 'arithmetic mean of the' high "values=" (word(@,1)+word(@,high))/2 +say + do while low<=high; mid=(low+high)%2; y=word(@,mid) + + if ?=y then do + say ? 'is in the list, its index is:' mid + exit /*stick a fork in it, we're done.*/ + end + + if y>? then high=mid-1 + else low=mid+1 + end /*while*/ + +say ? "wasn't found in the list." + /*stick a fork in it, we're done.*/ diff --git a/Task/Binary-search/Racket/binary-search.rkt b/Task/Binary-search/Racket/binary-search.rkt new file mode 100644 index 0000000000..a0f4264016 --- /dev/null +++ b/Task/Binary-search/Racket/binary-search.rkt @@ -0,0 +1,13 @@ +#lang racket +(define (binary-search x v) + ; loop : index index -> index or #f + ; return i s.t. l<=i= l h) #f] + [else (define m (quotient (+ l h) 2)) + (define y (vector-ref v m)) + (cond + [(> y x) (loop l (- m 1))] + [(< y x) (loop (+ m 1) h)] + [else m])])) + (loop 0 (vector-length v))) diff --git a/Task/Binary-search/Ruby/binary-search-1.rb b/Task/Binary-search/Ruby/binary-search-1.rb new file mode 100644 index 0000000000..44153a9b41 --- /dev/null +++ b/Task/Binary-search/Ruby/binary-search-1.rb @@ -0,0 +1,24 @@ +class Array + def binary_search(val, low=0, high=(length - 1)) + return nil if high < low + mid = (low + high) / 2 + case + when self[mid] > val then binary_search(val, low, mid-1) + when self[mid] < val then binary_search(val, mid+1, high) + else mid + end + end +end + +def do_a_binary_search(val, ary, method) + i = ary.send(method, val) + if i + puts "found #{val} at index #{i}: #{ary[i]}" + else + puts "#{val} not found in array" + end +end + +ary = [0,1,4,5,6,7,8,9,12,26,45,67,78,90,98,123,211,234,456,769,865,2345,3215,14345,24324] +do_a_binary_search(45, ary, :binary_search) +do_a_binary_search(42, ary, :binary_search) diff --git a/Task/Binary-search/Ruby/binary-search-2.rb b/Task/Binary-search/Ruby/binary-search-2.rb new file mode 100644 index 0000000000..4b237fe043 --- /dev/null +++ b/Task/Binary-search/Ruby/binary-search-2.rb @@ -0,0 +1,18 @@ +class Array + def binary_search_iterative(val) + low, high = 0, length - 1 + while low <= high + mid = (low + high) / 2 + case + when self[mid] > val then high = mid - 1 + when self[mid] < val then low = mid + 1 + else return mid + end + end + nil + end +end + +ary = [0,1,4,5,6,7,8,9,12,26,45,67,78,90,98,123,211,234,456,769,865,2345,3215,14345,24324] +do_a_binary_search(45, ary, :binary_search_iterative) +do_a_binary_search(42, ary, :binary_search_iterative) diff --git a/Task/Binary-search/Scala/binary-search.scala b/Task/Binary-search/Scala/binary-search.scala new file mode 100644 index 0000000000..c37ebb4fe4 --- /dev/null +++ b/Task/Binary-search/Scala/binary-search.scala @@ -0,0 +1,9 @@ +def binarySearch[A <% Ordered[A]](a: IndexedSeq[A], v: A) = { + def recurse(low: Int, high: Int): Option[Int] = (low + high) / 2 match { + case _ if high < low => None + case mid if a(mid) > v => recurse(low, mid - 1) + case mid if a(mid) < v => recurse(mid + 1, high) + case mid => Some(mid) + } + recurse(0, a.size - 1) +} diff --git a/Task/Binary-search/Scheme/binary-search.ss b/Task/Binary-search/Scheme/binary-search.ss new file mode 100644 index 0000000000..ef2b9fac8d --- /dev/null +++ b/Task/Binary-search/Scheme/binary-search.ss @@ -0,0 +1,11 @@ +(define (binary-search value vector) + (let helper ((low 0) + (high (- (vector-length vector) 1))) + (if (< high low) + #f + (let ((middle (quotient (+ low high) 2))) + (cond ((> (vector-ref vector middle) value) + (helper low (- middle 1))) + ((< (vector-ref vector middle) value) + (helper (+ middle 1) high)) + (else middle)))))) diff --git a/Task/Binary-search/Tcl/binary-search-1.tcl b/Task/Binary-search/Tcl/binary-search-1.tcl new file mode 100644 index 0000000000..269e6a02a4 --- /dev/null +++ b/Task/Binary-search/Tcl/binary-search-1.tcl @@ -0,0 +1,25 @@ +proc binSrch {lst x} { + set len [llength $lst] + if {$len == 0} { + return -1 + } else { + set pivotIndex [expr {$len / 2}] + set pivotValue [lindex $lst $pivotIndex] + if {$pivotValue == $x} { + return $pivotIndex + } elseif {$pivotValue < $x} { + set recursive [binSrch [lrange $lst $pivotIndex+1 end] $x] + return [expr {$recursive > -1 ? $recursive + $pivotIndex + 1 : -1}] + } elseif {$pivotValue > $x} { + set recursive [binSrch [lrange $lst 0 $pivotIndex-1] $x] + return [expr {$recursive > -1 ? $recursive : -1}] + } + } +} +proc binary_search {lst x} { + if {[set idx [binSrch $lst $x]] == -1} { + puts "element $x not found in list" + } else { + puts "element $x found at index $idx" + } +} diff --git a/Task/Binary-search/Tcl/binary-search-2.tcl b/Task/Binary-search/Tcl/binary-search-2.tcl new file mode 100644 index 0000000000..0417090760 --- /dev/null +++ b/Task/Binary-search/Tcl/binary-search-2.tcl @@ -0,0 +1,8 @@ +proc binarySearch {lst x} { + set idx [lsearch -sorted -exact $lst $x] + if {$idx == -1} { + puts "element $x not found in list" + } else { + puts "element $x found at index $idx" + } +} diff --git a/Task/Binary-strings/0DESCRIPTION b/Task/Binary-strings/0DESCRIPTION new file mode 100644 index 0000000000..11a69294bb --- /dev/null +++ b/Task/Binary-strings/0DESCRIPTION @@ -0,0 +1,14 @@ +Many languages have powerful and useful ('''binary safe''') [[wp:String (computer science)|string]] [[wp:Comparison of programming languages (string functions)|manipulation functions]], while others don't, making it harder for these languages to accomplish some tasks. +This task is about creating functions to handle ''binary'' strings (strings made of arbitrary bytes, i.e. ''byte strings'' according to Wikipedia) for those languages that don't have built-in support for them. If your language of choice does have this built-in support, show a possible alternative implementation for the ''functions'' or ''abilities'' already provided by the language. +In particular the functions you need to create are: +* String creation and destruction (when needed and if there's no [[garbage collection]] or similar mechanism) +* String assignment +* String comparison +* String cloning and copying +* Check if a string is empty +* Append a byte to a string +* Extract a substring from a string +* Replace every occurrence of a byte (or a string) in a string with another string +* Join strings + +Possible contexts of use: compression algorithms (like [[LZW compression]]), L-systems (manipulation of symbols), many more. diff --git a/Task/Binary-strings/1META.yaml b/Task/Binary-strings/1META.yaml new file mode 100644 index 0000000000..ae625822b7 --- /dev/null +++ b/Task/Binary-strings/1META.yaml @@ -0,0 +1,2 @@ +--- +note: String manipulation diff --git a/Task/Binary-strings/Ada/binary-strings-1.ada b/Task/Binary-strings/Ada/binary-strings-1.ada new file mode 100644 index 0000000000..2ac3851060 --- /dev/null +++ b/Task/Binary-strings/Ada/binary-strings-1.ada @@ -0,0 +1,17 @@ +declare + Data : Storage_Array (1..20); -- Data created +begin + Data := (others => 0); -- Assign all zeros + if Data = (1..10 => 0) then -- Compare with 10 zeros + declare + Copy : Storage_Array := Data; -- Copy Data + begin + if Data'Length = 0 then -- If empty + ... + end if; + end; + end if; + ... Data & 1 ... -- The result is Data with byte 1 appended + ... Data & (1,2,3,4) ... -- The result is Data with bytes 1,2,3,4 appended + ... Data (3..5) ... -- The result the substring of Data from 3 to 5 +end; -- Data destructed diff --git a/Task/Binary-strings/Ada/binary-strings-2.ada b/Task/Binary-strings/Ada/binary-strings-2.ada new file mode 100644 index 0000000000..34ba140c32 --- /dev/null +++ b/Task/Binary-strings/Ada/binary-strings-2.ada @@ -0,0 +1,3 @@ +type Octet is mod 2**8; +for Octet'Size use 8; +type Octet_String is array (Positive range <>) of Octet; diff --git a/Task/Binary-strings/Ada/binary-strings-3.ada b/Task/Binary-strings/Ada/binary-strings-3.ada new file mode 100644 index 0000000000..c12234d0cb --- /dev/null +++ b/Task/Binary-strings/Ada/binary-strings-3.ada @@ -0,0 +1,4 @@ +with Interfaces; use Interfaces; +... +type Octet is new Interfaces.Unsigned_8; +type Octet_String is array (Positive range <>) of Octet; diff --git a/Task/Binary-strings/BASIC/binary-strings.bas b/Task/Binary-strings/BASIC/binary-strings.bas new file mode 100644 index 0000000000..d3c3fe1ecf --- /dev/null +++ b/Task/Binary-strings/BASIC/binary-strings.bas @@ -0,0 +1,13 @@ +10 REM create two strings +20 LET s$ = "Hello" +30 LET t$ = "Bob" +40 REM choose any random character +50 LET c = INT(RND*256) +60 REM add the character to the string +70 LET s$ = s$ + CHR$(c) +80 REM check if the string is empty +90 IF s$ = "" THEN PRINT "String is empty" +100 REM compare two strings +110 IF s$ = t$ THEN PRINT "Strings are the same" +120 REM print characters 2 to 4 of a string (a substring) +130 PRINT s$(2 TO 4) diff --git a/Task/Binary-strings/C/binary-strings.c b/Task/Binary-strings/C/binary-strings.c new file mode 100644 index 0000000000..5e9f6db1f4 --- /dev/null +++ b/Task/Binary-strings/C/binary-strings.c @@ -0,0 +1,138 @@ +#include +#include +#include + +typedef struct str_t { + size_t len, alloc; + unsigned char *s; +} bstr_t, *bstr; + +#define str_len(s) ((s)->len) +bstr str_new(size_t len) +{ + bstr s = malloc(sizeof(bstr_t)); + if (len < 8) len = 8; + s->alloc = len; + s->s = malloc(len); + s->len = 0; + return s; +} + +void str_extend(bstr s) +{ + size_t ns = s->alloc * 2; + if (ns - s->alloc > 1024) ns = s->alloc + 1024; + s->s = realloc(s->s, ns); + s->alloc = ns; +} + +void str_del(bstr s) +{ + free(s->s), free(s); +} + +int str_cmp(bstr l, bstr r) +{ + int res, len = l->len; + if (len > r->len) len = r->len; + + if ((res = memcmp(l->s, r->s, len))) return res; + return l->len > r->len ? 1 : -1; +} + +bstr str_dup(bstr src) +{ + bstr x = str_new(src->len); + memcpy(x->s, src->s, src->len); + x->len = src->len; + return x; +} + +bstr str_from_chars(const char *t) +{ + if (!t) return str_new(0); + size_t l = strlen(t); + bstr x = str_new(l + 1); + x->len = l; + memcpy(x->s, t, l); + return x; +} + +void str_append(bstr s, unsigned char b) +{ + if (s->len >= s->alloc) str_extend(s); + s->s[s->len++] = b; +} + +bstr str_substr(bstr s, int from, int to) +{ + if (!to) to = s->len; + if (from < 0) from += s->len; + if (from < 0 || from >= s->len) + return 0; + if (to < from) to = from + 1; + bstr x = str_new(to - from); + x->len = to - from; + memcpy(x->s, s->s + from, x->len); + return x; +} + +bstr str_cat(bstr s, bstr s2) +{ + while (s->alloc < s->len + s2->len) str_extend(s); + memcpy(s->s + s->len, s2->s, s2->len); + s->len += s2->len; + return s; +} + +void str_swap(bstr a, bstr b) +{ + size_t tz; + unsigned char *ts; + tz = a->alloc; a->alloc = b->alloc; b->alloc = tz; + tz = a->len; a->len = b->len; b->len = tz; + ts = a->s; a->s = b->s; b->s = ts; +} + +bstr str_subst(bstr tgt, bstr pat, bstr repl) +{ + bstr tmp = str_new(0); + int i; + for (i = 0; i + pat->len <= tgt->len;) { + if (memcmp(tgt->s + i, pat->s, pat->len)) { + str_append(tmp, tgt->s[i]); + i++; + } else { + str_cat(tmp, repl); + i += pat->len; + if (!pat->len) str_append(tmp, tgt->s[i++]); + } + } + while (i < tgt->len) str_append(tmp, tgt->s[i++]); + str_swap(tmp, tgt); + str_del(tmp); + return tgt; +} + +void str_set(bstr dest, bstr src) +{ + while (dest->len < src->len) str_extend(dest); + memcpy(dest->s, src->s, src->len); + dest->len = src->len; +} + +int main() +{ + bstr s = str_from_chars("aaaaHaaaaaFaaaaHa"); + bstr s2 = str_from_chars("___."); + bstr s3 = str_from_chars(""); + + str_subst(s, s3, s2); + printf("%.*s\n", s->len, s->s); + + str_del(s); + str_del(s2); + str_del(s3); + + return 0; +} diff --git a/Task/Binary-strings/Forth/binary-strings-1.fth b/Task/Binary-strings/Forth/binary-strings-1.fth new file mode 100644 index 0000000000..e0f90e0512 --- /dev/null +++ b/Task/Binary-strings/Forth/binary-strings-1.fth @@ -0,0 +1,8 @@ +create cstr1 ," A sample string" +create cstr2 ," another string" +create buf 256 allot + +cstr1 count buf place +s" and " buf +place +cstr2 count buf +place +buf count type \ A sample string and another string diff --git a/Task/Binary-strings/Forth/binary-strings-2.fth b/Task/Binary-strings/Forth/binary-strings-2.fth new file mode 100644 index 0000000000..1f13f36649 --- /dev/null +++ b/Task/Binary-strings/Forth/binary-strings-2.fth @@ -0,0 +1,6 @@ +: empty? ( str len -- ? ) nip 0= ; +: +c ( c str len -- ) + c! ; +: replace-bytes ( from to str len -- ) + bounds do + over i c@ = if dup i c! then + loop 2drop ; diff --git a/Task/Binary-strings/Go/binary-strings.go b/Task/Binary-strings/Go/binary-strings.go new file mode 100644 index 0000000000..921e6fd7d3 --- /dev/null +++ b/Task/Binary-strings/Go/binary-strings.go @@ -0,0 +1,85 @@ +package main + +import ( + "bytes" + "fmt" +) + +// Strings in Go allow arbitrary bytes. They are implemented basically as +// immutable byte slices and syntactic sugar. This program shows functions +// required by the task on byte slices, thus it mostly highlights what +// happens behind the syntactic sugar. The program does not attempt to +// reproduce the immutability property of strings, as that does not seem +// to be the intent of the task. + +func main() { + // Task point: String creation and destruction. + // Strings are most often constructed from literals as in s := "binary" + // With byte slices, + b := []byte{'b', 'i', 'n', 'a', 'r', 'y'} + fmt.Println(b) // output shows numeric form of bytes. + // Go is garbage collected. There are no destruction operations. + + // Task point: String assignment. + // t = s assigns strings. Since strings are immutable, it is irrelevant + // whether the string is copied or not. + // With byte slices, the same works, + var c []byte + c = b + fmt.Println(c) + + // Task point: String comparison. + // operators <, <=, ==, >=, and > work directly on strings comparing them + // by lexicographic order. + // With byte slices, there are standard library functions, bytes.Equal + // and bytes.Compare. + fmt.Println(bytes.Equal(b, c)) // prints true + + // Task point: String cloning and copying. + // The immutable property of Go strings makes cloning and copying + // meaningless for strings. + // With byte slices though, it is relevant. The assignment c = b shown + // above does a reference copy, leaving both c and b based on the same + // underlying data. To clone or copy the underlying data, + d := make([]byte, len(b)) // allocate new space + copy(d, b) // copy the data + // The data can be manipulated independently now: + d[1] = 'a' + d[4] = 'n' + fmt.Println(string(b)) // convert to string for readable output + fmt.Println(string(d)) + + // Task point: Check if a string is empty. + // Most typical for strings is s == "", but len(s) == 0 works too. + // For byte slices, "" does not work, len(b) == 0 is correct. + fmt.Println(len(b) == 0) + + // Task point: Append a byte to a string. + // The language does not provide a way to do this directly with strings. + // Instead, the byte must be converted to a one-byte string first, as in, + // s += string('z') + // For byte slices, the language provides the append function, + z := append(b, 'z') + fmt.Printf("%s\n", z) // another way to get readable output + + // Task point: Extract a substring from a string. + // Slicing syntax is the for both strings and slices. + sub := b[1:3] + fmt.Println(string(sub)) + + // Task point: Replace every occurrence of a byte (or a string) + // in a string with another string. + // Go supports this with similar library functions for strings and + // byte slices. Strings: t = strings.Replace(s, "n", "m", -1). + // The byte slice equivalent returns a modified copy, leaving the + // original byte slice untouched, + f := bytes.Replace(d, []byte{'n'}, []byte{'m'}, -1) + fmt.Printf("%s -> %s\n", d, f) + + // Task point: Join strings. + // Using slicing syntax again, with strings, + // rem := s[:1] + s[3:] leaves rem == "bary". + // Only the concatenation of the parts is different with byte slices, + rem := append(append([]byte{}, b[:1]...), b[3:]...) + fmt.Println(string(rem)) +} diff --git a/Task/Binary-strings/Haskell/binary-strings-1.hs b/Task/Binary-strings/Haskell/binary-strings-1.hs new file mode 100644 index 0000000000..7060dbf032 --- /dev/null +++ b/Task/Binary-strings/Haskell/binary-strings-1.hs @@ -0,0 +1,9 @@ +import Text.Regex +{- The above import is needed only for the last function. +It is used there purely for readability and conciseness -} + +{- Assigning a string to a 'variable'. +We're being explicit about it just for show. +Haskell would be able to figure out the type +of "world" -} +string = "world" :: String diff --git a/Task/Binary-strings/Haskell/binary-strings-2.hs b/Task/Binary-strings/Haskell/binary-strings-2.hs new file mode 100644 index 0000000000..978f8721d9 --- /dev/null +++ b/Task/Binary-strings/Haskell/binary-strings-2.hs @@ -0,0 +1,8 @@ +{- Comparing two given strings and +returning a boolean result using a +simple conditional -} +strCompare :: String -> String -> Bool +strCompare x y = + if x == y + then True + else False diff --git a/Task/Binary-strings/Haskell/binary-strings-3.hs b/Task/Binary-strings/Haskell/binary-strings-3.hs new file mode 100644 index 0000000000..a36ffbaeef --- /dev/null +++ b/Task/Binary-strings/Haskell/binary-strings-3.hs @@ -0,0 +1,8 @@ +{- As strings are equivalent to lists +of characters in Haskell, test and +see if the given string is an empty list -} +strIsEmpty :: String -> Bool +strIsEmpty x = + if x == [] + then True + else False diff --git a/Task/Binary-strings/Haskell/binary-strings-4.hs b/Task/Binary-strings/Haskell/binary-strings-4.hs new file mode 100644 index 0000000000..0a50fe3858 --- /dev/null +++ b/Task/Binary-strings/Haskell/binary-strings-4.hs @@ -0,0 +1,8 @@ +{- This is the most obvious way to +append strings, using the built-in +(++) concatenation operator +Note the same would work to join +any two strings (as 'variables' or +as typed strings -} +strAppend :: String -> String -> String +strAppend x y = x ++ y diff --git a/Task/Binary-strings/Haskell/binary-strings-5.hs b/Task/Binary-strings/Haskell/binary-strings-5.hs new file mode 100644 index 0000000000..66ba1be2a1 --- /dev/null +++ b/Task/Binary-strings/Haskell/binary-strings-5.hs @@ -0,0 +1,4 @@ +{- Take the specified number of characters +from the given string -} +strExtract :: Int -> String -> String +strExtract x s = take x s diff --git a/Task/Binary-strings/Haskell/binary-strings-6.hs b/Task/Binary-strings/Haskell/binary-strings-6.hs new file mode 100644 index 0000000000..bdcc304956 --- /dev/null +++ b/Task/Binary-strings/Haskell/binary-strings-6.hs @@ -0,0 +1,4 @@ +{- Take a certain substring, specified by +two integers, from the given string -} +strPull :: Int -> Int -> String -> String +strPull x y s = take (y-x+1) (drop x s) diff --git a/Task/Binary-strings/Haskell/binary-strings-7.hs b/Task/Binary-strings/Haskell/binary-strings-7.hs new file mode 100644 index 0000000000..6fe8b75067 --- /dev/null +++ b/Task/Binary-strings/Haskell/binary-strings-7.hs @@ -0,0 +1,5 @@ +{- Much thanks to brool.com for this nice +and elegant solution. Using an imported standard library +(Text.Regex), replace a given substring with another -} +strReplace :: String -> String -> String -> String +strReplace old new orig = subRegex (mkRegex old) orig new diff --git a/Task/Binary-strings/Lua/binary-strings.lua b/Task/Binary-strings/Lua/binary-strings.lua new file mode 100644 index 0000000000..5609b2b7fe --- /dev/null +++ b/Task/Binary-strings/Lua/binary-strings.lua @@ -0,0 +1,31 @@ +foo = 'foo' -- Ducktyping foo to be string 'foo' +bar = 'bar' +assert (foo == "foo") -- Comparing string var to string literal +assert (foo ~= bar) +str = foo -- Copy foo contents to str +if #str == 0 then -- # operator returns string length + print 'str is empty' +end +str=str..string.char(50)-- Char concatenated with .. operator +substr = str:sub(1,3) -- Extract substring from index 1 to 3, inclusively + +str = "string string string string" +-- This function will replace all occurances of 'replaced' in a string with 'replacement' +function replaceAll(str,replaced,replacement) + local function sub (a,b) + if b > a then + return str:sub(a,b) + end + return nil + end + a,b = str:find(replaced) + while a do + str = str:sub(1,a-1) .. replacement .. str:sub(b+1,#str) + a,b = str:find(replaced) + end + return str +end +str = replaceAll (str, 'ing', 'ong') +print (str) + +str = foo .. bar -- Strings concatenate with .. operator diff --git a/Task/Binary-strings/PicoLisp/binary-strings-1.l b/Task/Binary-strings/PicoLisp/binary-strings-1.l new file mode 100644 index 0000000000..211129b314 --- /dev/null +++ b/Task/Binary-strings/PicoLisp/binary-strings-1.l @@ -0,0 +1,2 @@ +: (out "rawfile" + (mapc wr (range 0 255)) ) diff --git a/Task/Binary-strings/PicoLisp/binary-strings-2.l b/Task/Binary-strings/PicoLisp/binary-strings-2.l new file mode 100644 index 0000000000..f368302374 --- /dev/null +++ b/Task/Binary-strings/PicoLisp/binary-strings-2.l @@ -0,0 +1,6 @@ +: (hd "rawfile") +00000000 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F ................ +00000010 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F ................ +00000020 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F !"#$%&'()*+,-./ +00000030 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 0123456789:;<=>? +... diff --git a/Task/Binary-strings/PicoLisp/binary-strings-3.l b/Task/Binary-strings/PicoLisp/binary-strings-3.l new file mode 100644 index 0000000000..a358687705 --- /dev/null +++ b/Task/Binary-strings/PicoLisp/binary-strings-3.l @@ -0,0 +1,5 @@ +: (in '(dd "skip=32" "bs=1" "count=16" "if=rawfile") + (make + (while (rd 1) + (link @) ) ) ) +-> (32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47) diff --git a/Task/Binary-strings/PicoLisp/binary-strings-4.l b/Task/Binary-strings/PicoLisp/binary-strings-4.l new file mode 100644 index 0000000000..c0eee8ea73 --- /dev/null +++ b/Task/Binary-strings/PicoLisp/binary-strings-4.l @@ -0,0 +1,2 @@ +: (pack (mapcar char (32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47))) +-> " !\"#$%&'()*+,-./" diff --git a/Task/Binary-strings/Python/binary-strings-1.py b/Task/Binary-strings/Python/binary-strings-1.py new file mode 100644 index 0000000000..0d0b94f60c --- /dev/null +++ b/Task/Binary-strings/Python/binary-strings-1.py @@ -0,0 +1,5 @@ +s1 = "A 'string' literal \n" +s2 = 'You may use any of \' or " as delimiter' +s3 = """This text + goes over several lines + up to the closing triple quote""" diff --git a/Task/Binary-strings/Python/binary-strings-10.py b/Task/Binary-strings/Python/binary-strings-10.py new file mode 100644 index 0000000000..21e0b5ddcd --- /dev/null +++ b/Task/Binary-strings/Python/binary-strings-10.py @@ -0,0 +1,5 @@ +items = ["Smith", "John", "417 Evergreen Av", "Chimichurri", "481-3172"] +joined = ",".join(items) +print joined +# output: +# Smith,John,417 Evergreen Av,Chimichurri,481-3172 diff --git a/Task/Binary-strings/Python/binary-strings-11.py b/Task/Binary-strings/Python/binary-strings-11.py new file mode 100644 index 0000000000..287b6e5ede --- /dev/null +++ b/Task/Binary-strings/Python/binary-strings-11.py @@ -0,0 +1,5 @@ +line = "Smith,John,417 Evergreen Av,Chimichurri,481-3172" +fields = line.split(',') +print fields +# output: +# ['Smith', 'John', '417 Evergreen Av', 'Chimichurri', '481-3172'] diff --git a/Task/Binary-strings/Python/binary-strings-12.py b/Task/Binary-strings/Python/binary-strings-12.py new file mode 100644 index 0000000000..6d89152ebe --- /dev/null +++ b/Task/Binary-strings/Python/binary-strings-12.py @@ -0,0 +1,5 @@ +s1 = b"A 'byte string' literal \n" +s2 = b'You may use any of \' or " as delimiter' +s3 = b"""This text + goes over several lines + up to the closing triple quote""" diff --git a/Task/Binary-strings/Python/binary-strings-13.py b/Task/Binary-strings/Python/binary-strings-13.py new file mode 100644 index 0000000000..edd97127c8 --- /dev/null +++ b/Task/Binary-strings/Python/binary-strings-13.py @@ -0,0 +1,2 @@ +x = b'abc' +x[0] # evaluates to 97 diff --git a/Task/Binary-strings/Python/binary-strings-14.py b/Task/Binary-strings/Python/binary-strings-14.py new file mode 100644 index 0000000000..6fadc8dd94 --- /dev/null +++ b/Task/Binary-strings/Python/binary-strings-14.py @@ -0,0 +1,3 @@ +x = b'abc' +list(x) # evaluates to [97, 98, 99] +bytes([97, 98, 99]) # evaluates to b'abc' diff --git a/Task/Binary-strings/Python/binary-strings-2.py b/Task/Binary-strings/Python/binary-strings-2.py new file mode 100644 index 0000000000..83f9c0dee9 --- /dev/null +++ b/Task/Binary-strings/Python/binary-strings-2.py @@ -0,0 +1,3 @@ +s = "Hello " +t = "world!" +u = s + t # + concatenates diff --git a/Task/Binary-strings/Python/binary-strings-3.py b/Task/Binary-strings/Python/binary-strings-3.py new file mode 100644 index 0000000000..1477ec660b --- /dev/null +++ b/Task/Binary-strings/Python/binary-strings-3.py @@ -0,0 +1,4 @@ +assert "Hello" == 'Hello' +assert '\t' == '\x09' +assert "one" < "two" +assert "two" >= "three" diff --git a/Task/Binary-strings/Python/binary-strings-4.py b/Task/Binary-strings/Python/binary-strings-4.py new file mode 100644 index 0000000000..80bec42cc3 --- /dev/null +++ b/Task/Binary-strings/Python/binary-strings-4.py @@ -0,0 +1,2 @@ +if x=='': print "Empty string" +if not x: print "Empty string, provided you know x is a string" diff --git a/Task/Binary-strings/Python/binary-strings-5.py b/Task/Binary-strings/Python/binary-strings-5.py new file mode 100644 index 0000000000..87cc6303e3 --- /dev/null +++ b/Task/Binary-strings/Python/binary-strings-5.py @@ -0,0 +1,3 @@ +txt = "Some text" +txt += '\x07' +# txt refers now to a new string having "Some text\x07" diff --git a/Task/Binary-strings/Python/binary-strings-6.py b/Task/Binary-strings/Python/binary-strings-6.py new file mode 100644 index 0000000000..98bf5ea4f6 --- /dev/null +++ b/Task/Binary-strings/Python/binary-strings-6.py @@ -0,0 +1,6 @@ +txt = "Some more text" +assert txt[4] == " " +assert txt[0:4] == "Some" +assert txt[:4] == "Some" # you can omit the starting index if 0 +assert txt[5:9] == "more" +assert txt[5:] == "more text" # omitting the second index means "to the end" diff --git a/Task/Binary-strings/Python/binary-strings-7.py b/Task/Binary-strings/Python/binary-strings-7.py new file mode 100644 index 0000000000..df5071cb7b --- /dev/null +++ b/Task/Binary-strings/Python/binary-strings-7.py @@ -0,0 +1,3 @@ +txt = "Some more text" +assert txt[-1] == "t" +assert txt[-4:] == "text" diff --git a/Task/Binary-strings/Python/binary-strings-8.py b/Task/Binary-strings/Python/binary-strings-8.py new file mode 100644 index 0000000000..f01d02c768 --- /dev/null +++ b/Task/Binary-strings/Python/binary-strings-8.py @@ -0,0 +1,3 @@ +v1 = "hello world" +v2 = v1.replace("l", "L") +print v2 # prints heLLo worLd diff --git a/Task/Binary-strings/Python/binary-strings-9.py b/Task/Binary-strings/Python/binary-strings-9.py new file mode 100644 index 0000000000..374fce18b3 --- /dev/null +++ b/Task/Binary-strings/Python/binary-strings-9.py @@ -0,0 +1,3 @@ +v1 = "hello" +v2 = "world" +msg = v1 + " " + v2 diff --git a/Task/Binary-strings/REXX/binary-strings.rexx b/Task/Binary-strings/REXX/binary-strings.rexx new file mode 100644 index 0000000000..1e7136c4d7 --- /dev/null +++ b/Task/Binary-strings/REXX/binary-strings.rexx @@ -0,0 +1,31 @@ +/*REXX program shows ways to use and express binary strings. */ + +dingsta='11110101'b /*4 versions, bit str assignment.*/ +dingsta="11110101"b /*same as above. */ +dingsta='11110101'B /*same as above. */ +dingsta='1111 0101'B /*same as above. */ + +dingst2=dingsta /*clone 1 str to another (copy). */ + +other='1001 0101 1111 0111'b /*another binary (bit) string. */ + +if dingsta=other then say 'they are equal' /*compare two strings.*/ + +if other=='' then say 'OTHER is empty.' /*see if it's empty. */ +if length(other)==0 then say 'OTHER is empty.' /*another version. */ + +otherA=other || '$' /*append a dollar sign to OTHER. */ +otherB=other'$' /*same as above, with less fuss. */ + +guts=substr(c2b(other),10,3) /*get the 10th through 12th bits.*/ + /*see sub below. Some REXXes */ + /*have C2B as a built-in function*/ + +new=changestr('A',other,"Z") /*change the letter A to Z. */ + +tt=changestr('~~',other,";") /*change 2 tildes to a semicolon.*/ + +joined=dignsta || dingst2 /*join 2 strs together (concat). */ +exit /*stick a fork in it, we're done.*/ +/*─────────────────────────────────C2B subroutine───────────────────────*/ +c2b: return x2b(c2x(arg(1))) /*return the string as a binary string. */ diff --git a/Task/Binary-strings/Racket/binary-strings.rkt b/Task/Binary-strings/Racket/binary-strings.rkt new file mode 100644 index 0000000000..e63aa9e455 --- /dev/null +++ b/Task/Binary-strings/Racket/binary-strings.rkt @@ -0,0 +1,47 @@ +#lang racket + +;; Byte strings can be created either by a function (b1) +;; or as a literal string (b2). No operation is needed for +;; destruction due to garbage collection. + +(define b1 (make-bytes 5 65)) ; b1 -> #"AAAAA" +(define b2 #"BBBBB") ; b2 -> #"BBBBB" + +;; String assignment. Note that b2 cannot be +;; mutated since literal byte strings are immutable. + +(bytes-set! b1 0 66) ; b1 -> #"BAAAA" + +;; Comparison. Less than & greater than are +;; lexicographic comparison. + +(bytes=? b1 b2) ; -> #f +(bytes #t +(bytes>? b1 b2) ; -> #f + +;; Byte strings can be cloned by copying to a +;; new one or by overwriting an existing one. + +(define b3 (bytes-copy b1)) ; b3 -> #"BAAAA" +(bytes-copy! b1 0 b2) ; b1 -> #"BBBBB" + +;; Byte strings can be appended to one another. A +;; single byte is appended as a length 1 string. + +(bytes-append b1 b2) ; -> #"BBBBBBBBBB" +(bytes-append b3 #"B") ; -> #"BAAAAB" + +;; Substring + +(subbytes b3 0) ; -> #"BAAAA" +(subbytes b3 0 2) ; -> #"BA" + +;; Regular expressions can be used to do replacements +;; in a byte string (or ordinary strings) + +(regexp-replace #"B" b1 #"A") ; -> #"ABBBB" (only the first one) +(regexp-replace* #"B" b1 #"A") ; -> #"AAAAA" + +;; Joining strings + +(bytes-join (list b2 b3) #" ") ; -> #"BBBBB BAAAA" diff --git a/Task/Binary-strings/Ruby/binary-strings.rb b/Task/Binary-strings/Ruby/binary-strings.rb new file mode 100644 index 0000000000..8912bd8ce0 --- /dev/null +++ b/Task/Binary-strings/Ruby/binary-strings.rb @@ -0,0 +1,45 @@ +# string creation +x = "hello world" + +# string destruction +x = nil + +# string assignment with a null byte +x = "a\0b" +x.length # ==> 3 + +# string comparison +if x == "hello" + puts equal +else + puts "not equal" +end +y = 'bc' +if x < y + puts "#{x} is lexicographically less than #{y}" +end + +# string cloning +xx = x.dup +x == xx # true, same length and content +x.equal?(xx) # false, different objects + +# check if empty +if x.empty? + puts "is empty" +end + +# append a byte +x << "\07" + +# substring +xx = x[0..-2] + +# replace bytes +y = "hello world".tr("l", "L") + +# join strings +a = "hel" +b = "lo w" +c = "orld" +d = a + b + c diff --git a/Task/Binary-strings/Tcl/binary-strings.tcl b/Task/Binary-strings/Tcl/binary-strings.tcl new file mode 100644 index 0000000000..1a7da28fe2 --- /dev/null +++ b/Task/Binary-strings/Tcl/binary-strings.tcl @@ -0,0 +1,36 @@ +# string creation +set x "hello world" + +# string destruction +unset x + +# string assignment with a null byte +set x a\0b +string length $x ;# ==> 3 + +# string comparison +if {$x eq "hello"} {puts equal} else {puts "not equal"} +set y bc +if {$x < $y} {puts "$x is lexicographically less than $y"} + +# string copying; cloning happens automatically behind the scenes +set xx $x + +# check if empty +if {$x eq ""} {puts "is empty"} +if {[string length $x] == 0} {puts "is empty"} + +# append a byte +append x \07 + +# substring +set xx [string range $x 0 end-1] + +# replace bytes +set y [string map {l L} "hello world"] + +# join strings +set a "hel" +set b "lo w" +set c "orld" +set d $a$b$c diff --git a/Task/Bulls-and-cows/0DESCRIPTION b/Task/Bulls-and-cows/0DESCRIPTION new file mode 100644 index 0000000000..5799e899ea --- /dev/null +++ b/Task/Bulls-and-cows/0DESCRIPTION @@ -0,0 +1,14 @@ +[[wp:Bulls and Cows|This]] is an old game played with pencil and paper that was later implemented on computer. + +The task is for the program to create a four digit random number from the digits 1 to 9, without duplication. +The program should ask for guesses to this number, reject guesses that are malformed, then print the score for the guess. + +The score is computed as: +# The player wins if the guess is the same as the randomly chosen number, and the program ends. +# A score of one '''bull''' is accumulated for each digit in the guess that equals the corresponding digit in the randomly chosen initial number. +# A score of one '''cow''' is accumulated for each digit in the guess that also appears in the randomly chosen number, but in the wrong position. + +;Cf, +* [[Bulls and cows/Player]] +* [[Guess the number]] +* [[Guess the number/With Feedback]] diff --git a/Task/Bulls-and-cows/1META.yaml b/Task/Bulls-and-cows/1META.yaml new file mode 100644 index 0000000000..a2413d963b --- /dev/null +++ b/Task/Bulls-and-cows/1META.yaml @@ -0,0 +1,2 @@ +--- +note: Games diff --git a/Task/Bulls-and-cows/Ada/bulls-and-cows.ada b/Task/Bulls-and-cows/Ada/bulls-and-cows.ada new file mode 100644 index 0000000000..44363d6546 --- /dev/null +++ b/Task/Bulls-and-cows/Ada/bulls-and-cows.ada @@ -0,0 +1,53 @@ +with Ada.Text_IO; use Ada.Text_IO; +with Ada.Numerics.Discrete_Random; + +procedure Bulls_And_Cows is + package Random_Natural is new Ada.Numerics.Discrete_Random (Natural); + Number : String (1..4); +begin + declare -- Generation of number + use Random_Natural; + Digit : String := "123456789"; + Size : Positive := 9; + Dice : Generator; + Position : Natural; + begin + Reset (Dice); + for I in Number'Range loop + Position := Random (Dice) mod Size + 1; + Number (I) := Digit (Position); + Digit (Position..Size - 1) := Digit (Position + 1..Size); + Size := Size - 1; + end loop; + end; + loop -- Guessing loop + Put ("Enter four digits:"); + declare + Guess : String := Get_Line; + Bulls : Natural := 0; + Cows : Natural := 0; + begin + if Guess'Length /= 4 then + raise Data_Error; + end if; + for I in Guess'Range loop + for J in Number'Range loop + if Guess (I) not in '1'..'9' or else (I < J and then Guess (I) = Guess (J)) then + raise Data_Error; + end if; + if Number (I) = Guess (J) then + if I = J then + Bulls := Bulls + 1; + else + Cows := Cows + 1; + end if; + end if; + end loop; + end loop; + exit when Bulls = 4; + Put_Line (Integer'Image (Bulls) & " bulls," & Integer'Image (Cows) & " cows"); + exception + when Data_Error => Put_Line ("You should enter four different digits 1..9"); + end; + end loop; +end Bulls_And_Cows; diff --git a/Task/Bulls-and-cows/BASIC/bulls-and-cows.bas b/Task/Bulls-and-cows/BASIC/bulls-and-cows.bas new file mode 100644 index 0000000000..e21a3f870a --- /dev/null +++ b/Task/Bulls-and-cows/BASIC/bulls-and-cows.bas @@ -0,0 +1,41 @@ +DEFINT A-Z + +DIM secret AS STRING +DIM guess AS STRING +DIM c AS STRING +DIM bulls, cows, guesses, i + +RANDOMIZE TIMER +DO WHILE LEN(secret) < 4 + c = CHR$(INT(RND * 10) + 48) + IF INSTR(secret, c) = 0 THEN secret = secret + c +LOOP + +guesses = 0 +DO + INPUT "Guess a 4-digit number with no duplicate digits: "; guess + guess = LTRIM$(RTRIM$(guess)) + IF LEN(guess) = 0 THEN EXIT DO + + IF LEN(guess) <> 4 OR VAL(guess) = 0 THEN + PRINT "** You should enter 4 numeric digits!" + GOTO looper + END IF + + bulls = 0: cows = 0: guesses = guesses + 1 + FOR i = 1 TO 4 + c = MID$(secret, i, 1) + IF MID$(guess, i, 1) = c THEN + bulls = bulls + 1 + ELSEIF INSTR(guess, c) THEN + cows = cows + 1 + END IF + NEXT i + PRINT bulls; " bulls, "; cows; " cows" + + IF guess = secret THEN + PRINT "You won after "; guesses; " guesses!" + EXIT DO + END IF +looper: +LOOP diff --git a/Task/Bulls-and-cows/C/bulls-and-cows-1.c b/Task/Bulls-and-cows/C/bulls-and-cows-1.c new file mode 100644 index 0000000000..8affa9b80e --- /dev/null +++ b/Task/Bulls-and-cows/C/bulls-and-cows-1.c @@ -0,0 +1,60 @@ +#include +#include +#include +#include +#include +#include + +#define MAX_NUM_TRIES 72 +#define LINE_BEGIN 7 +#define LAST_LINE 18 + +int yp=LINE_BEGIN, xp=0; + +char number[5]; +char guess[5]; + +#define MAX_STR 256 +void mvaddstrf(int y, int x, const char *fmt, ...) +{ + va_list args; + char buf[MAX_STR]; + + va_start(args, fmt); + vsprintf(buf, fmt, args); + move(y, x); + clrtoeol(); + addstr(buf); + va_end(args); +} + +void ask_for_a_number() +{ + int i=0; + char symbols[] = "123456789"; + + move(5,0); clrtoeol(); + addstr("Enter four digits: "); + while(i<4) { + int c = getch(); + if ( (c >= '1') && (c <= '9') && (symbols[c-'1']!=0) ) { + addch(c); + symbols[c-'1'] = 0; + guess[i++] = c; + } + } +} + +void choose_the_number() +{ + int i=0, j; + char symbols[] = "123456789"; + + while(i<4) { + j = rand() % 9; + if ( symbols[j] != 0 ) { + number[i++] = symbols[j]; + symbols[j] = 0; + } + } +} diff --git a/Task/Bulls-and-cows/C/bulls-and-cows-2.c b/Task/Bulls-and-cows/C/bulls-and-cows-2.c new file mode 100644 index 0000000000..e69c882ffd --- /dev/null +++ b/Task/Bulls-and-cows/C/bulls-and-cows-2.c @@ -0,0 +1,85 @@ +bool take_it_or_not() +{ + int i; + int cows=0, bulls=0; + + for(i=0; i < 4; i++) { + if ( number[i] == guess[i] ) { + bulls++; + } else if ( strchr(number, guess[i]) != NULL ) { + cows++; + } + } + move(yp, xp); + addstr(guess); addch(' '); + if ( bulls == 4 ) { yp++; return true; } + if ( (cows==0) && (bulls==0) ) addch('-'); + while( cows-- > 0 ) addstr("O"); + while( bulls-- > 0 ) addstr("X"); + yp++; + if ( yp > LAST_LINE ) { + yp = LINE_BEGIN; + xp += 10; + } + return false; +} + +bool ask_play_again() +{ + int i; + + while(yp-- >= LINE_BEGIN) { + move(yp, 0); clrtoeol(); + } + yp = LINE_BEGIN; xp = 0; + + move(21,0); clrtoeol(); + addstr("Do you want to play again? [y/n]"); + while(true) { + int a = getch(); + switch(a) { + case 'y': + case 'Y': + return true; + case 'n': + case 'N': + return false; + } + } +} + + +int main() +{ + bool bingo, again; + int tries = 0; + + initscr(); cbreak(); noecho(); + clear(); + + number[4] = guess[4] = 0; + + mvaddstr(0,0, "I choose a number made of 4 digits (from 1 to 9) without repetitions\n" + "You enter a number of 4 digits, and I say you how many of them are\n" + "in my secret number but in wrong position (cows or O), and how many\n" + "are in the right position (bulls or X)"); + do { + move(20,0); clrtoeol(); move(21, 0); clrtoeol(); + srand(time(NULL)); + choose_the_number(); + do { + ask_for_a_number(); + bingo = take_it_or_not(); + tries++; + } while(!bingo && (tries < MAX_NUM_TRIES)); + if ( bingo ) + mvaddstrf(20, 0, "You guessed %s correctly in %d attempts!", number, tries); + else + mvaddstrf(20,0, "Sorry, you had only %d tries...; the number was %s", + MAX_NUM_TRIES, number); + again = ask_play_again(); + tries = 0; + } while(again); + nocbreak(); echo(); endwin(); + return EXIT_SUCCESS; +} diff --git a/Task/Bulls-and-cows/Clojure/bulls-and-cows.clj b/Task/Bulls-and-cows/Clojure/bulls-and-cows.clj new file mode 100644 index 0000000000..0e85f77c1b --- /dev/null +++ b/Task/Bulls-and-cows/Clojure/bulls-and-cows.clj @@ -0,0 +1,38 @@ +(ns bulls-and-cows) + +(defn bulls [guess solution] + (count (filter true? (map = guess solution)))) + +(defn cows [guess solution] + (- + (count (filter (set solution) guess)) + (bulls guess solution))) + +(defn valid-input? + "checks whether the string is a 4 digit number with unique digits" + [user-input] + (if (re-seq #"^(?!.*(\d).*\1)\d{4}$" user-input) + true + false)) + +(defn enter-guess [] + "Let the user enter a guess. Verify the input. Repeat until valid. +returns a list of digits enters by the user (# # # #)" + (println "Enter your guess: ") + (let [guess (read-line)] + (if (valid-input? guess) + (map #(Character/digit % 10) guess) + (recur)))) + +(defn bulls-and-cows [] + "generate a random 4 digit number from the list of (1 ... 9): no repeating digits +player tries to guess the number with bull and cows rules gameplay" + (let [solution ( take 4 (shuffle (range 1 10)))] + (println "lets play some bulls and cows!") + (loop [guess (enter-guess)] + (println (bulls guess solution) " bulls and " (cows guess solution) " cows.") + (if (not= guess solution) + (recur (enter-guess)) + (println "You have won!"))))) + +(bulls-and-cows) diff --git a/Task/Bulls-and-cows/Erlang/bulls-and-cows-1.erl b/Task/Bulls-and-cows/Erlang/bulls-and-cows-1.erl new file mode 100644 index 0000000000..556ab3ff9f --- /dev/null +++ b/Task/Bulls-and-cows/Erlang/bulls-and-cows-1.erl @@ -0,0 +1,45 @@ +-module(bulls_and_cows). +-export([generate_secret/0, score_guess/2, play/0]). + +% generate the secret code +generate_secret() -> generate_secret([], 4, lists:seq(1,9)). +generate_secret(Secret, 0, _) -> Secret; +generate_secret(Secret, N, Digits) -> + Next = lists:nth(random:uniform(length(Digits)), Digits), + generate_secret(Secret ++ [Next], N - 1, Digits -- [Next]). + +% evaluate a guess +score_guess(Secret, Guess) + when length(Secret) =/= length(Guess) -> throw(badguess); +score_guess(Secret, Guess) -> + Bulls = count_bulls(Secret,Guess), + Cows = count_cows(Secret, Guess, Bulls), + [Bulls, Cows]. + +% count bulls (exact matches) +count_bulls(Secret, Guess) -> + length(lists:filter(fun(I) -> lists:nth(I,Secret) == lists:nth(I,Guess) end, + lists:seq(1, length(Secret)))). + +% count cows (digits present but out of place) +count_cows(Secret, Guess, Bulls) -> + length(lists:filter(fun(I) -> lists:member(I, Guess) end, Secret)) - Bulls. + +% play a game +play() -> play_round(generate_secret()). + +play_round(Secret) -> play_round(Secret, read_guess()). + +play_round(Secret, Guess) -> + play_round(Secret, Guess, score_guess(Secret,Guess)). + +play_round(_, _, [4,0]) -> + io:put_chars("Correct!\n"); + +play_round(Secret, _, Score) -> + io:put_chars("\tbulls:"), io:write(hd(Score)), io:put_chars(", cows:"), + io:write(hd(tl(Score))), io:put_chars("\n"), play_round(Secret). + +read_guess() -> + lists:map(fun(D)->D-48 end, + lists:sublist(io:get_line("Enter your 4-digit guess: "), 4)). diff --git a/Task/Bulls-and-cows/Erlang/bulls-and-cows-2.erl b/Task/Bulls-and-cows/Erlang/bulls-and-cows-2.erl new file mode 100644 index 0000000000..741984f471 --- /dev/null +++ b/Task/Bulls-and-cows/Erlang/bulls-and-cows-2.erl @@ -0,0 +1,3 @@ +#!/usr/bin/escript +% Play Bulls and Cows +main(_) -> random:seed(now()), bulls_and_cows:play(). diff --git a/Task/Bulls-and-cows/Forth/bulls-and-cows.fth b/Task/Bulls-and-cows/Forth/bulls-and-cows.fth new file mode 100644 index 0000000000..832085c7d5 --- /dev/null +++ b/Task/Bulls-and-cows/Forth/bulls-and-cows.fth @@ -0,0 +1,37 @@ +include random.fs + +create hidden 4 allot + +: ok? ( str -- ? ) + dup 4 <> if 2drop false exit then + 1 9 lshift 1- -rot + bounds do + i c@ '1 - + dup 0 9 within 0= if 2drop false leave then + 1 swap lshift over and + dup 0= if nip leave then + xor + loop 0<> ; + +: init + begin + hidden 4 bounds do 9 random '1 + i c! loop + hidden 4 ok? + until ; + +: check? ( addr -- solved? ) + 0 + 4 0 do + over i + c@ + 4 0 do + dup hidden i + c@ = if swap + i j = if 8 else 1 then + swap + then + loop drop + loop nip + 8 /mod tuck . ." bulls, " . ." cows" + 4 = ; + +: guess: ( "1234" -- ) + bl parse 2dup ok? 0= if 2drop ." Bad guess! (4 unique digits, 1-9)" exit then + drop check? if cr ." You guessed it!" then ; diff --git a/Task/Bulls-and-cows/Fortran/bulls-and-cows.f b/Task/Bulls-and-cows/Fortran/bulls-and-cows.f new file mode 100644 index 0000000000..f2d10f6c9e --- /dev/null +++ b/Task/Bulls-and-cows/Fortran/bulls-and-cows.f @@ -0,0 +1,84 @@ +module bac + implicit none + +contains + + subroutine Gennum(n) + integer, intent(out) :: n(4) + integer :: i, j + real :: r + + call random_number(r) + n(1) = int(r * 9.0) + 1 + i = 2 + +outer: do while (i <= 4) + call random_number(r) + n(i) = int(r * 9.0) + 1 +inner: do j = i-1 , 1, -1 + if (n(j) == n(i)) cycle outer + end do inner + i = i + 1 + end do outer + + end subroutine Gennum + + subroutine Score(n, guess, b, c) + character(*), intent(in) :: guess + integer, intent(in) :: n(0:3) + integer, intent(out) :: b, c + integer :: digit, i, j, ind + + b = 0; c = 0 + do i = 1, 4 + read(guess(i:i), "(i1)") digit + if (digit == n(i-1)) then + b = b + 1 + else + do j = i, i+2 + ind = mod(j, 4) + if (digit == n(ind)) then + c = c + 1 + exit + end if + end do + end if + end do + + end subroutine Score + +end module bac + +program Bulls_and_Cows + use bac + implicit none + + integer :: n(4) + integer :: bulls=0, cows=0, tries=0 + character(4) :: guess + + call random_seed + call Gennum(n) + + write(*,*) "I have selected a number made up of 4 digits (1-9) without repetitions." + write(*,*) "You attempt to guess this number." + write(*,*) "Every digit in your guess that is in the correct position scores 1 Bull" + write(*,*) "Every digit in your guess that is in an incorrect position scores 1 Cow" + write(*,*) + + do while (bulls /= 4) + write(*,*) "Enter a 4 digit number" + read*, guess + if (verify(guess, "123456789") /= 0) then + write(*,*) "That is an invalid entry. Please try again." + cycle + end if + tries = tries + 1 + call Score (n, guess, bulls, cows) + write(*, "(a, i1, a, i1, a)") "You scored ", bulls, " bulls and ", cows, " cows" + write(*,*) + end do + + write(*,"(a,i0,a)") "Congratulations! You correctly guessed the correct number in ", tries, " attempts" + +end program Bulls_and_Cows diff --git a/Task/Bulls-and-cows/Go/bulls-and-cows-1.go b/Task/Bulls-and-cows/Go/bulls-and-cows-1.go new file mode 100644 index 0000000000..a4b59f82ad --- /dev/null +++ b/Task/Bulls-and-cows/Go/bulls-and-cows-1.go @@ -0,0 +1,68 @@ +package main + +import ( + "bufio" + "bytes" + "fmt" + "math/rand" + "os" + "strings" + "time" +) + +func main() { + fmt.Println(`Cows and Bulls +Guess four digit number of unique digits in the range 1 to 9. +A correct digit but not in the correct place is a cow. +A correct digit in the correct place is a bull.`) + // generate pattern + pat := make([]byte, 4) + rand.Seed(time.Now().Unix()) + r := rand.Perm(9) + for i := range pat { + pat[i] = '1' + byte(r[i]) + } + + // accept and score guesses + valid := []byte("123456789") +guess: + for in := bufio.NewReader(os.Stdin); ; { + fmt.Print("Guess: ") + guess, err := in.ReadString('\n') + if err != nil { + fmt.Println("\nSo, bye.") + return + } + guess = strings.TrimSpace(guess) + if len(guess) != 4 { + // malformed: not four characters + fmt.Println("Please guess a four digit number.") + continue + } + var cows, bulls int + for ig, cg := range guess { + if strings.IndexRune(guess[:ig], cg) >= 0 { + // malformed: repeated digit + fmt.Printf("Repeated digit: %c\n", cg) + continue guess + } + switch bytes.IndexByte(pat, byte(cg)) { + case -1: + if bytes.IndexByte(valid, byte(cg)) == -1 { + // malformed: not a digit + fmt.Printf("Invalid digit: %c\n", cg) + continue guess + } + default: // I just think cows should go first + cows++ + case ig: + bulls++ + } + } + fmt.Printf("Cows: %d, bulls: %d\n", cows, bulls) + if bulls == 4 { + fmt.Println("You got it.") + return + } + } +} diff --git a/Task/Bulls-and-cows/Go/bulls-and-cows-2.go b/Task/Bulls-and-cows/Go/bulls-and-cows-2.go new file mode 100644 index 0000000000..7af3905e62 --- /dev/null +++ b/Task/Bulls-and-cows/Go/bulls-and-cows-2.go @@ -0,0 +1,117 @@ +package main + +import ( + . "fmt" + "rand" + "time" + "os" + "bufio" + "strconv" + "strings" +) + +func generateTarget() int { + rand.Seed(time.Nanoseconds()) + // loop until we find a number that doesn't have dupes + for { + target := rand.Intn(9000) + 1000 + if !hasDupes(target) { + return target + } + } + panic("Crap.") +} + +func hasDupes(num int) bool { + digs := make([]bool, 10) + for num > 0 { + if digs[num%10] { + return true + } + digs[num%10] = true + num /= 10 + } + return false +} + +func askForNumber() (int, os.Error) { + in := bufio.NewReader(os.Stdin) + + for { + Print("Give me a number: ") + line, err := in.ReadString('\n') + + if err != nil { + return -1, err + } + + // Strip off the \n + line = line[0 : len(line)-1] + number, err := strconv.Atoi(line) + + switch { + case err != nil: + Println("Give me a number fule!") + case number < 1000: + Println("Number not long enough") + case number > 9999: + Println("Number is to big") + case hasDupes(number): + Println("I said no dupes!") + default: + return number, nil + } + // Keep Asking + } + panic("Crap.") +} + +func bullsAndCows(number int, guess int) (bulls int, cows int) { + bulls, cows = 0, 0 + numberstr := strconv.Itoa(number) + guessstr := strconv.Itoa(guess) + + for i := range guessstr { + s := string(guessstr[i]) + switch { + case guessstr[i] == numberstr[i]: + bulls++ + case strings.Index(numberstr, s) >= 0: + cows++ + } + } + return; +} + +func main() { + attempts := 0 + + Print("I choose a number made of 4 digits (from 1 to 9) without repetitions\n" + "You enter a number of 4 digits, and I say you how many of them are\n" + "in my secret number but in wrong position (cows or O), and how many\n" + "are in the right position (bulls or X)\n\n") + + target := generateTarget() + + for { + guess, err := askForNumber() + attempts++ + + // Handle err + if err != nil && err != os.EOF { + Print(err) + } else if err == os.EOF { + return + } + + // Check if target matches guess + if guess == target { + Printf("Congratulations you guessed correctly in %d attempts\n", attempts) + return + } + + bulls, cows := bullsAndCows(target, guess) + Printf("%d Bulls, %d Cows\n", bulls, cows) + } + +} diff --git a/Task/Bulls-and-cows/Haskell/bulls-and-cows.hs b/Task/Bulls-and-cows/Haskell/bulls-and-cows.hs new file mode 100644 index 0000000000..f1bd9b99ba --- /dev/null +++ b/Task/Bulls-and-cows/Haskell/bulls-and-cows.hs @@ -0,0 +1,50 @@ +import Data.List (partition, intersect, nub) +import Control.Monad +import System.Random (StdGen, getStdRandom, randomR) +import Text.Printf + +numberOfDigits = 4 :: Int + +main = bullsAndCows + +bullsAndCows :: IO () +bullsAndCows = do + digits <- getStdRandom $ pick numberOfDigits ['1' .. '9'] + putStrLn "Guess away!" + loop digits + + where loop digits = do + input <- getLine + if okay input + then + let (bulls, cows) = score digits input in + if bulls == numberOfDigits then + putStrLn "You win!" + else do + printf "%d bulls, %d cows.\n" bulls cows + loop digits + else do + putStrLn "Malformed guess; try again." + loop digits + + okay :: String -> Bool + okay input = + length input == numberOfDigits && + input == nub input && + all legalchar input + where legalchar c = '1' <= c && c <= '9' + + score :: String -> String -> (Int, Int) + score secret guess = (length bulls, cows) + where (bulls, nonbulls) = partition (uncurry (==)) $ + zip secret guess + cows = length $ uncurry intersect $ unzip nonbulls + +pick :: Int -> [a] -> StdGen -> ([a], StdGen) +{- Randomly selects items from a list without replacement. -} +pick n l g = f n l g (length l - 1) [] + where f 0 _ g _ ps = (ps, g) + f n l g max ps = + f (n - 1) (left ++ right) g' (max - 1) (picked : ps) + where (i, g') = randomR (0, max) g + (left, picked : right) = splitAt i l diff --git a/Task/Bulls-and-cows/Java/bulls-and-cows.java b/Task/Bulls-and-cows/Java/bulls-and-cows.java new file mode 100644 index 0000000000..73343ba591 --- /dev/null +++ b/Task/Bulls-and-cows/Java/bulls-and-cows.java @@ -0,0 +1,52 @@ +import java.util.InputMismatchException; +import java.util.Random; +import java.util.Scanner; + +public class BullsAndCows{ + public static void main(String[] args){ + Random gen= new Random(); + int target= 0; + while(hasDupes(target= (gen.nextInt(9000) + 1000))); + String targetStr = target +""; + boolean guessed = false; + Scanner input = new Scanner(System.in); + int guesses = 0; + do{ + int bulls = 0; + int cows = 0; + System.out.print("Guess a 4-digit number with no duplicate digits: "); + int guess; + try{ + guess = input.nextInt(); + if(hasDupes(guess) || guess < 1000) continue; + }catch(InputMismatchException e){ + continue; + } + guesses++; + String guessStr = guess + ""; + for(int i= 0;i < 4;i++){ + if(guessStr.charAt(i) == targetStr.charAt(i)){ + bulls++; + }else if(targetStr.contains(guessStr.charAt(i)+"")){ + cows++; + } + } + if(bulls == 4){ + guessed = true; + }else{ + System.out.println(cows+" Cows and "+bulls+" Bulls."); + } + }while(!guessed); + System.out.println("You won after "+guesses+" guesses!"); + } + + public static boolean hasDupes(int num){ + boolean[] digs = new boolean[10]; + while(num > 0){ + if(digs[num%10]) return true; + digs[num%10] = true; + num/= 10; + } + return false; + } +} diff --git a/Task/Bulls-and-cows/JavaScript/bulls-and-cows.js b/Task/Bulls-and-cows/JavaScript/bulls-and-cows.js new file mode 100644 index 0000000000..8d2e618a10 --- /dev/null +++ b/Task/Bulls-and-cows/JavaScript/bulls-and-cows.js @@ -0,0 +1,88 @@ +#!/usr/bin/env js + +function main() { + var len = 4; + playBullsAndCows(len); +} + +function playBullsAndCows(len) { + var num = pickNum(len); + // print('The secret number is:\n ' + num.join('\n ')); + showInstructions(len); + var nGuesses = 0; + while (true) { + nGuesses++; + var guess = getGuess(nGuesses, len); + var census = countBovine(num, guess); + showScore(census.bulls, census.cows); + if (census.bulls == len) { + showFinalResult(nGuesses); + return; + } + } +} + +function showScore(nBulls, nCows) { + print(' Bulls: ' + nBulls + ', cows: ' + nCows); +} + +function showFinalResult(guesses) { + print('You win!!! Guesses needed: ' + guesses); +} + +function countBovine(num, guess) { + var count = {bulls:0, cows:0}; + var g = guess.join(''); + for (var i = 0; i < num.length; i++) { + var digPresent = g.search(num[i]) != -1; + if (num[i] == guess[i]) count.bulls++; + else if (digPresent) count.cows++; + } + return count; +} + +function getGuess(nGuesses, len) { + while (true) { + putstr('Your guess #' + nGuesses + ': '); + var guess = readline(); + guess = String(parseInt(guess)).split(''); + if (guess.length != len) { + print(' You must enter a ' + len + ' digit number.'); + continue; + } + if (hasDups(guess)) { + print(' No digits can be duplicated.'); + continue; + } + return guess; + } +} + +function hasDups(ary) { + var t = ary.concat().sort(); + for (var i = 1; i < t.length; i++) { + if (t[i] == t[i-1]) return true; + } + return false; +} + +function showInstructions(len) { + print(); + print('Bulls and Cows Game'); + print('-------------------'); + print(' You must guess the ' + len + ' digit number I am thinking of.'); + print(' The number is composed of the digits 1-9.'); + print(' No digit appears more than once.'); + print(' After each of your guesses, I will tell you:'); + print(' The number of bulls (digits in right place)'); + print(' The number of cows (correct digits, but in the wrong place)'); + print(); +} + +function pickNum(len) { + var nums = [1, 2, 3, 4, 5, 6, 7, 8, 9]; + nums.sort(function(){return Math.random() - 0.5}); + return nums.slice(0, len); +} + +main(); diff --git a/Task/Bulls-and-cows/Lua/bulls-and-cows.lua b/Task/Bulls-and-cows/Lua/bulls-and-cows.lua new file mode 100644 index 0000000000..6e3da09235 --- /dev/null +++ b/Task/Bulls-and-cows/Lua/bulls-and-cows.lua @@ -0,0 +1,101 @@ +function ShuffleArray(array) + for i=1,#array-1 do + local t = math.random(i, #array) + array[i], array[t] = array[t], array[i] + end +end + +function GenerateNumber() + local digits = {1,2,3,4,5,6,7,8,9} + + ShuffleArray(digits) + + return digits[1] * 1000 + + digits[2] * 100 + + digits[3] * 10 + + digits[4] +end + +function IsMalformed(input) + local malformed = false + + if #input == 4 then + local already_used = {} + for i=1,4 do + local digit = input:byte(i) - string.byte('0') + if digit < 1 or digit > 9 or already_used[digit] then + malformed = true + break + end + already_used[digit] = true + end + else + malformed = true + end + + return malformed +end + +math.randomseed(os.time()) +math.randomseed(math.random(2^31-1)) -- since os.time() only returns seconds + +print("\nWelcome to Bulls and Cows!") +print("") +print("The object of this game is to guess the random 4-digit number that the") +print("computer has chosen. The number is generated using only the digits 1-9,") +print("with no repeated digits. Each time you enter a guess, you will score one") +print("\"bull\" for each digit in your guess that matches the corresponding digit") +print("in the computer-generated number, and you will score one \"cow\" for each") +print("digit in your guess that appears in the computer-generated number, but is") +print("in the wrong position. Use this information to refine your guesses. When") +print("you guess the correct number, you win."); +print("") + +quit = false + +repeat + magic_number = GenerateNumber() + magic_string = tostring(magic_number) -- Easier to do scoring with a string + repeat + io.write("\nEnter your guess (or 'Q' to quit): ") + user_input = io.read() + if user_input == 'Q' or user_input == 'q' then + quit = true + break + end + + if not IsMalformed(user_input) then + if user_input == magic_string then + print("YOU WIN!!!") + else + local bulls, cows = 0, 0 + for i=1,#user_input do + local find_result = magic_string:find(user_input:sub(i,i)) + + if find_result and find_result == i then + bulls = bulls + 1 + elseif find_result then + cows = cows + 1 + end + end + print(string.format("You scored %d bulls, %d cows", bulls, cows)) + end + else + print("Malformed input. You must enter a 4-digit number with") + print("no repeated digits, using only the digits 1-9.") + end + + until user_input == magic_string + + if not quit then + io.write("\nPress to play again or 'Q' to quit: ") + user_input = io.read() + if user_input == 'Q' or user_input == 'q' then + quit = true + end + end + + if quit then + print("\nGoodbye!") + end +until quit diff --git a/Task/Bulls-and-cows/PHP/bulls-and-cows.php b/Task/Bulls-and-cows/PHP/bulls-and-cows.php new file mode 100644 index 0000000000..062f5d4f43 --- /dev/null +++ b/Task/Bulls-and-cows/PHP/bulls-and-cows.php @@ -0,0 +1,40 @@ + diff --git a/Task/Bulls-and-cows/Perl/bulls-and-cows.pl b/Task/Bulls-and-cows/Perl/bulls-and-cows.pl new file mode 100644 index 0000000000..3013aac343 --- /dev/null +++ b/Task/Bulls-and-cows/Perl/bulls-and-cows.pl @@ -0,0 +1,39 @@ +use Data::Random qw(rand_set); +use List::MoreUtils qw(uniq); + +my $size = 4; +my $chosen = join "", rand_set set => ["1".."9"], size => $size; + +print "I've chosen a number from $size unique digits from 1 to 9; you need +to input $size unique digits to guess my number\n"; + +for ( my $guesses = 1; ; $guesses++ ) { + my $guess; + while (1) { + print "\nNext guess [$guesses]: "; + $guess = ; + chomp $guess; + checkguess($guess) and last; + print "$size digits, no repetition, no 0... retry\n"; + } + if ( $guess eq $chosen ) { + print "You did it in $guesses attempts!\n"; + last; + } + my $bulls = 0; + my $cows = 0; + for my $i (0 .. $size-1) { + if ( substr($guess, $i, 1) eq substr($chosen, $i, 1) ) { + $bulls++; + } elsif ( index($chosen, substr($guess, $i, 1)) >= 0 ) { + $cows++; + } + } + print "$cows cows, $bulls bulls\n"; +} + +sub checkguess +{ + my $g = shift; + return uniq(split //, $g) == $size && $g =~ /^[1-9]{$size}$/; +} diff --git a/Task/Bulls-and-cows/PicoLisp/bulls-and-cows.l b/Task/Bulls-and-cows/PicoLisp/bulls-and-cows.l new file mode 100644 index 0000000000..07a22dc71e --- /dev/null +++ b/Task/Bulls-and-cows/PicoLisp/bulls-and-cows.l @@ -0,0 +1,20 @@ +(de ok? (N) + (let D (mapcar 'format (chop N)) + (and (num? N) + (not (member 0 D)) + (= 4 (length D)) + (= D (uniq D)) + D )) ) + +(de init-cows () + (until (setq *Hidden (ok? (rand 1234 9876)))) ) + +(de guess (N) + (let D (ok? N) + (if D + (let Bulls (cnt '= D *Hidden) + (if (= 4 Bulls) + " You guessed it!" + (let Cows (- (cnt '((N) (member N *Hidden)) D) Bulls) + (pack Bulls " bulls, " Cows " cows") ) ) ) + " Bad guess! (4 unique digits, 1-9)" ) ) ) diff --git a/Task/Bulls-and-cows/Prolog/bulls-and-cows.pro b/Task/Bulls-and-cows/Prolog/bulls-and-cows.pro new file mode 100644 index 0000000000..515b367afc --- /dev/null +++ b/Task/Bulls-and-cows/Prolog/bulls-and-cows.pro @@ -0,0 +1,56 @@ +:- use_module(library(lambda)). +:- use_module(library(clpfd)). + +% Parameters of the server + +% length of the guess +proposition(4). + +% Numbers of digits +% 0 -> 8 +digits(8). + + +bulls_and_cows_server :- + proposition(LenGuess), + length(Solution, LenGuess), + choose(Solution), + repeat, + write('Your guess : '), + read(Guess), + ( study(Solution, Guess, Bulls, Cows) + -> format('Bulls : ~w Cows : ~w~n', [Bulls, Cows]), + Bulls = LenGuess + ; digits(Digits), Max is Digits + 1, + format('Guess must be of ~w digits between 1 and ~w~n', + [LenGuess, Max]), + fail). + +choose(Solution) :- + digits(Digits), + Max is Digits + 1, + repeat, + maplist(\X^(X is random(Max) + 1), Solution), + all_distinct(Solution), + !. + +study(Solution, Guess, Bulls, Cows) :- + proposition(LenGuess), + digits(Digits), + + % compute the transformation 1234 => [1,2,3,4] + atom_chars(Guess, Chars), + maplist(\X^Y^(atom_number(X, Y)), Chars, Ms), + + % check that the guess is well formed + length(Ms, LenGuess), + maplist(\X^(X > 0, X =< Digits+1), Ms), + + % compute the digit in good place + foldl(\X^Y^V0^V1^((X = Y->V1 is V0+1; V1 = V0)),Solution, Ms, 0, Bulls), + + % compute the digits in bad place + foldl(\Y1^V2^V3^(foldl(\X2^Z2^Z3^(X2 = Y1 -> Z3 is Z2+1; Z3 = Z2), Ms, 0, TT1), + V3 is V2+ TT1), + Solution, 0, TT), + Cows is TT - Bulls. diff --git a/Task/Bulls-and-cows/Python/bulls-and-cows.py b/Task/Bulls-and-cows/Python/bulls-and-cows.py new file mode 100644 index 0000000000..e5f2850c15 --- /dev/null +++ b/Task/Bulls-and-cows/Python/bulls-and-cows.py @@ -0,0 +1,33 @@ +''' + Bulls and cows. A game pre-dating, and similar to, Mastermind. +''' + +import random + +digits = '123456789' +size = 4 +chosen = ''.join(random.sample(digits,size)) +#print chosen # Debug +print '''I have chosen a number from %s unique digits from 1 to 9 arranged in a random order. +You need to input a %i digit, unique digit number as a guess at what I have chosen''' % (size, size) +guesses = 0 +while True: + guesses += 1 + while True: + # get a good guess + guess = raw_input('\nNext guess [%i]: ' % guesses).strip() + if len(guess) == size and \ + all(char in digits for char in guess) \ + and len(set(guess)) == size: + break + print "Problem, try again. You need to enter %i unique digits from 1 to 9" % size + if guess == chosen: + print '\nCongratulations you guessed correctly in',guesses,'attempts' + break + bulls = cows = 0 + for i in range(size): + if guess[i] == chosen[i]: + bulls += 1 + elif guess[i] in chosen: + cows += 1 + print ' %i Bulls\n %i Cows' % (bulls, cows) diff --git a/Task/Bulls-and-cows/R/bulls-and-cows.r b/Task/Bulls-and-cows/R/bulls-and-cows.r new file mode 100644 index 0000000000..6ffdf363c2 --- /dev/null +++ b/Task/Bulls-and-cows/R/bulls-and-cows.r @@ -0,0 +1,19 @@ +target <- sample(1:9,4) +bulls <- 0 +cows <- 0 +attempts <- 0 +while (bulls != 4) + { + input <- readline("Guess a 4-digit number with no duplicate digits or 0s: ") + if (nchar(input) == 4) + { + input <- as.integer(strsplit(input,"")[[1]]) + if ((sum(is.na(input)+sum(input==0))>=1) | (length(table(input)) != 4)) {print("Malformed input!")} else { + bulls <- sum(input == target) + cows <- sum(input %in% target)-bulls + cat("\n",bulls," Bull(s) and ",cows, " Cow(s)\n") + attempts <- attempts + 1 + } + } else {print("Malformed input!")} + } +print(paste("You won in",attempts,"attempt(s)!")) diff --git a/Task/Bulls-and-cows/REXX/bulls-and-cows-1.rexx b/Task/Bulls-and-cows/REXX/bulls-and-cows-1.rexx new file mode 100644 index 0000000000..e1a0c31dc1 --- /dev/null +++ b/Task/Bulls-and-cows/REXX/bulls-and-cows-1.rexx @@ -0,0 +1,43 @@ +/*REXX pgm interactively plays a game of "Bulls & Cows" with CBLs. */ +/* [CBLs = Carbon Based Lifeforms.] */ +/* */ +/* This game is also known as: Cows and Bulls */ +/* Pigs and Bulls */ +/* Bulls and Cleots */ +/* MasterMind (or Master Mind) */ +/*══════════════════════════════════════════════════════════════════════*/ +?=''; do until length(?)==4 /*generate unique 4-digit number.*/ + r=random(1,9) /*change 1──►0 to allow a 0 dig*/ + if pos(r,?)\==0 then iterate /*don't allow a repeated digit. */ + ?=? || r + end /*until*/ + +prompt='[Bulls & Cows game] ', /*build the prompt text string. */ + "Please enter a 4-digit guess (with no zeroes) [or Quit]:" + + do until bulls==4 /*play until guessed |enters QUIT*/ + say prompt; pull n; n=space(n,0); if n=='' then iterate + if abbrev('QUIT',n,1) then exit /*Does the user want to quit now?*/ + g=?; L=length(n); bulls=0; cows=0 + /*bull count─────────────────────*/ + do j=1 for L; if substr(n,j,1)\==substr(g,j,1) then iterate + bulls=bulls+1 /*bump the bull count. */ + g=overlay(' ',g,j) /*disallow this for a cow count. */ + end /*j*/ + /*cow count─────────────────────*/ + do k=1 for L; x=substr(n,k,1); if pos(x,g)==0 then iterate + cows=cows+1 /*bump the cow count. */ + g=translate(g,,x) /*this allows for rule variants. */ + end /*k*/ + + if bulls\==4 then say "───── You got" bulls 'bull's(bulls) "and" cows 'cow's(cows)"." + end /*until bulls==4*/ + +say; say " ┌─────────────────────────────────────────┐" + say " │ │" + say " │ Congratulations, you've guessed it !! │" + say " │ │" + say " └─────────────────────────────────────────┘"; say +exit +/*──────────────────────────────────S subroutine────────────────────────*/ +s: if arg(1)==1 then return ''; return 's' diff --git a/Task/Bulls-and-cows/REXX/bulls-and-cows-2.rexx b/Task/Bulls-and-cows/REXX/bulls-and-cows-2.rexx new file mode 100644 index 0000000000..6218e0bfe5 --- /dev/null +++ b/Task/Bulls-and-cows/REXX/bulls-and-cows-2.rexx @@ -0,0 +1,101 @@ +/*REXX program to play the game of "Bulls & Cows". ******************* +* Changes from Version 1: +* ?= -> qq='' (righthandside mandatory and I never use ? as symbol - +* although it is available on all Rexxes) +* implemented singular/plural distinction differently +* change getRand to avoid invalid digit rejection +* check user's input for multiple digits +* add feature MM to ease guessing (MM=Mastermind - a similar game) +* add feature ? to see the solution (for the impatient player) +* program runs as is on ooRexx and on TSO (after changing | to !) +* Made source and output more compact +* formatted source 'my way' 2 July 2012 Walter Pachl +**********************************************************************/ +ask=' Please enter a four-digit guess (or QUIT):' + +b.='bulls'; b.1='bull' +c.='cows'; c.1='cow' +qq=getRand() +mm=0 +Do Forever + If get_guess()==qq Then leave + Call scorer + Say "You got" bulls b.bulls "and" cows c.cows"." + If mm Then + Say mms + End /*forever*/ +Say " *******************************************" +Say " * *" +Say " * Congratulations, you've guessed it !! *" +Say " * *" +Say " *******************************************" +Exit + +get_guess: /*get a guess from the guesser. */ + +do forever + Say ask + Parse Pull guessi + guess=translate(guessi) + bc=verify(guess,987654321) + Select + When guess='?' Then Say qq 'is the correct sequence' + When guess='QUIT' Then Exit + When guess='MM' Then Do + Say 'Mastermind output enabled' + mm=1 + End + When guess='' Then Call ser 'no argument specified.' + When words(guess)>1 Then Call ser 'too many arguments specified.' + When verify(0,guess)=0 Then Call ser 'illegal digit: 0' + When bc>0 Then Call ser 'illegal character:' substr(guessi,bc,1) + When length(guess)<4 Then Call ser 'not enough digits' + When length(guess)>4 Then Call ser 'too many digits' + When dups(guess) Then Call ser '4 DIFFERENT digits, please' + Otherwise Do + /********** Say guess ************/ + Return guess + End + End + End + +getRand: +digits='123456789' +qq='' +Do i=1 To 4 + d=random(1,length(digits)) + d=substr(digits,d,1) + qq=qq||d + digits=space(translate(digits,' ',d),0) + /************ Say qq digits ************/ + End +Return qq + +scorer: g=qq +mms='----' +bulls=0 +Do j=1 for 4 + If substr(guess,j,1)=substr(qq,j,1) Then Do + bulls=bulls+1 + guess=overlay(' ',guess,j) + mms=overlay('+',mms,j) + End + End +cows=0 +Do j=1 To 4 + If pos(substr(guess,j,1),qq)>0 Then Do + cows=cows+1 + mms=overlay('.',mms,j) + End + End +Return + +dups: Procedure +Parse Arg s +Do i=1 To 3 + If pos(substr(s,i,1),substr(s,i+1))>0 Then + Return 1 + End +Return 0 + +ser: Say '*** error ***' arg(1); Return diff --git a/Task/Bulls-and-cows/Ruby/bulls-and-cows.rb b/Task/Bulls-and-cows/Ruby/bulls-and-cows.rb new file mode 100644 index 0000000000..f8bc7a4452 --- /dev/null +++ b/Task/Bulls-and-cows/Ruby/bulls-and-cows.rb @@ -0,0 +1,44 @@ +def generate_word(len) + ([1, 2, 3, 4, 5, 6, 7, 8, 9].shuffle)[0,len].join("") +end + +def get_guess(len) + while true + print "Enter a guess: " + guess = gets.strip + err = case + when guess.match(/\D/) : "digits only" + when guess.length != len : "exactly #{len} digits" + when guess.split("").uniq.length != len: "digits must be unique " + else nil + end + break if err.nil? + puts "the word must be #{len} unique digits between 1 and 9 (#{err}). Try again." + end + guess +end + +def score(word, guess) + bulls = cows = 0 + guess.bytes.each_with_index do |byte, idx| + if word[idx] == byte + bulls += 1 + elsif word.include? byte + cows += 1 + end + end + [bulls, cows] +end + +srand +word_length = 4 +puts "I have chosen a number with #{word_length} unique digits from 1 to 9." +word = generate_word(word_length) +count = 0 +while true + guess = get_guess(word_length) + count += 1 + break if word == guess + puts "that guess has %d bulls and %d cows" % score(word, guess) +end +puts "you guessed correctly in #{count} tries." diff --git a/Task/Bulls-and-cows/Scala/bulls-and-cows.scala b/Task/Bulls-and-cows/Scala/bulls-and-cows.scala new file mode 100644 index 0000000000..d0d2da6e50 --- /dev/null +++ b/Task/Bulls-and-cows/Scala/bulls-and-cows.scala @@ -0,0 +1,42 @@ +import scala.util.Random + +object BullCow { + def main(args: Array[String]): Unit = { + val number=chooseNumber + var guessed=false + var guesses=0 + + while(!guessed){ + Console.print("Guess a 4-digit number with no duplicate digits: ") + val input=Console.readInt + val digits=input.toString.map(_.asDigit).toList + if(input>=1111 && input<=9999 && !hasDups(digits)){ + guesses+=1 + var bulls, cows=0 + for(i <- 0 to 3) + if(number(i)==digits(i)) + bulls+=1 + else if(number.contains(digits(i))) + cows+=1 + + if(bulls==4) + guessed=true + else + println("%d Cows and %d Bulls.".format(cows, bulls)) + } + } + println("You won after "+guesses+" guesses!"); + } + + def chooseNumber={ + var digits=List[Int]() + while(digits.size<4){ + val d=Random.nextInt(9)+1 + if (!digits.contains(d)) + digits=digits:+d + } + digits + } + + def hasDups(input:List[Int])=input.size!=input.distinct.size +} diff --git a/Task/Bulls-and-cows/Scheme/bulls-and-cows.ss b/Task/Bulls-and-cows/Scheme/bulls-and-cows.ss new file mode 100644 index 0000000000..e9e2c24f4d --- /dev/null +++ b/Task/Bulls-and-cows/Scheme/bulls-and-cows.ss @@ -0,0 +1,65 @@ +;generate a random non-repeating list of 4 digits, 1-9 inclusive +(define (get-num) + (define (gen lst) + (if (= (length lst) 4) lst + (let ((digit (+ (random 9) 1))) + (if (member digit lst) ;make sure the new digit isn't in the + ;list + (gen lst) + (gen (cons digit lst)))))) + (string->list (apply string-append (map number->string (gen '()))))) + +;is g a valid guess (that is, non-repeating, four digits 1-9 +;inclusive?) +(define (valid-guess? g) + (let ((g-num (string->number (apply string g)))) + ;does the same digit appear twice in lst? + (define (repeats? lst) + (cond ((null? lst) #f) + ((member (car lst) (cdr lst)) #t) + (else (repeats? (cdr lst))))) + (and g-num + (> g-num 1233) + (< g-num 9877) + (not (repeats? g))))) + +;return '(cows bulls) for the given guess +(define (score answer guess) + ;total cows + bulls + (define (cows&bulls a g) + (cond ((null? a) 0) + ((member (car a) g) (+ 1 (cows&bulls (cdr a) g))) + (else (cows&bulls (cdr a) g)))) + ;bulls only + (define (bulls a g) + (cond ((null? a) 0) + ((equal? (car a) (car g)) (+ 1 (bulls (cdr a) (cdr g)))) + (else (bulls (cdr a) (cdr g))))) + (list (- (cows&bulls answer guess) (bulls answer guess)) (bulls answer guess))) + +;play the game +(define (bull-cow answer) + ;get the user's guess as a list + (define (get-guess) + (let ((e (read))) + (if (number? e) + (string->list (number->string e)) + (string->list (symbol->string e))))) + (display "Enter a guess: ") + (let ((guess (get-guess))) + (if (valid-guess? guess) + (let ((bulls (cadr (score answer guess))) + (cows (car (score answer guess)))) + (if (= bulls 4) + (display "You win!\n") + (begin + (display bulls) + (display " bulls, ") + (display cows) + (display " cows.\n") + (bull-cow answer)))) + (begin + (display "Invalid guess.\n") + (bull-cow answer))))) + +(bull-cow (get-num)) diff --git a/Task/Bulls-and-cows/Smalltalk/bulls-and-cows.st b/Task/Bulls-and-cows/Smalltalk/bulls-and-cows.st new file mode 100644 index 0000000000..2191db7922 --- /dev/null +++ b/Task/Bulls-and-cows/Smalltalk/bulls-and-cows.st @@ -0,0 +1,58 @@ +Object subclass: BullsCows [ + |number| + BullsCows class >> new: secretNum [ |i| + i := self basicNew. + (self isValid: secretNum) + ifFalse: [ SystemExceptions.InvalidArgument + signalOn: secretNum + reason: 'You need 4 unique digits from 1 to 9' ]. + i setNumber: secretNum. + ^ i + ] + BullsCows class >> new [ |b| b := Set new. + [ b size < 4 ] + whileTrue: [ b add: ((Random between: 1 and: 9) displayString first) ]. + ^ self new: (b asString) + ] + BullsCows class >> isValid: num [ + ^ (num asSet size = 4) & ((num asSet includes: $0) not) + ] + setNumber: num [ number := num ] + check: guess [ |bc| bc := Bag new. + 1 to: 4 do: [ :i | + (number at: i) = (guess at: i) + ifTrue: [ bc add: 'bulls' ] + ifFalse: [ + (number includes: (guess at: i)) + ifTrue: [ bc add: 'cows' ] + ] + ]. + ^ bc + ] +]. + +'Guess the 4-digits number (digits from 1 to 9, no repetition)' displayNl. + +|guessMe d r tries| +[ + tries := 0. + guessMe := BullsCows new. + [ + [ + 'Write 4 digits: ' display. + d := stdin nextLine. + (BullsCows isValid: d) + ] whileFalse: [ + 'Insert 4 digits, no repetition, exclude the digit 0' displayNl + ]. + r := guessMe check: d. + tries := tries + 1. + (r occurrencesOf: 'bulls') = 4 + ] whileFalse: [ + ('%1 cows, %2 bulls' % { r occurrencesOf: 'cows'. r occurrencesOf: 'bulls' }) + displayNl. + ]. + ('Good, you guessed it in %1 tries!' % { tries }) displayNl. + 'Do you want to play again? [y/n]' display. + ( (stdin nextLine) = 'y' ) +] whileTrue: [ Character nl displayNl ]. diff --git a/Task/Bulls-and-cows/Tcl/bulls-and-cows.tcl b/Task/Bulls-and-cows/Tcl/bulls-and-cows.tcl new file mode 100644 index 0000000000..8003af180c --- /dev/null +++ b/Task/Bulls-and-cows/Tcl/bulls-and-cows.tcl @@ -0,0 +1,85 @@ +proc main {} { + fconfigure stdout -buffering none + set length 4 + + puts "I have chosen a number from $length unique digits from 1 to 9 arranged in a random order. +You need to input a $length digit, unique digit number as a guess at what I have chosen + " + + while true { + set word [generateWord $length] + set count 1 + while {[set guess [getGuess $length]] ne $word} { + printScore $length $word $guess + incr count + } + puts "You guessed correctly in $count tries." + if {[yn "Play again?"] eq "n"} break + } +} + +proc generateWord {length} { + set chars 123456789 + for {set i 1} {$i <= $length} {incr i} { + set idx [expr {int(rand() * [string length $chars])}] + append word [string index $chars $idx] + set chars [string replace $chars $idx $idx] + } + return $word + + # here's another way to generate word with no duplications + set word "" + while {[string length $word] < $length} { + set char [expr {int(1 + 9*rand())}] + if {[string first $char $word] == -1} { + append word $char + } + } +} + +proc getGuess {length} { + puts -nonewline "Enter your guess: " + while true { + gets stdin guess + if {[string match [string repeat {[1-9]} $length] $guess]} { + return $guess + } + if {[string tolower [string trim $guess]] eq "quit"} { + puts Bye + exit + } + puts "The word must be $length digits between 1 and 9 inclusive. Try again." + } +} + +proc printScore {length word guess} { + set bulls 0 + set cows 0 + for {set i 0} {$i < $length} {incr i} { + if {[string index $word $i] eq [string index $guess $i]} { + incr bulls + set word [string replace $word $i $i +] + } + } + puts " $bulls bulls" + for {set i 0} {$i < $length} {incr i} { + if {[set j [string first [string index $guess $i] $word]] != -1} { + incr cows + set word [string replace $word $j $j -] + } + } + puts " $cows cows" +} + +proc yn {msg} { + while true { + puts -nonewline "$msg \[y/n] " + gets stdin ans + set char [string tolower [string index [string trim $ans] 0]] + if {$char eq "y" || $char eq "n"} { + return $char + } + } +} + +main diff --git a/Task/Caesar-cipher/0DESCRIPTION b/Task/Caesar-cipher/0DESCRIPTION new file mode 100644 index 0000000000..62559d6480 --- /dev/null +++ b/Task/Caesar-cipher/0DESCRIPTION @@ -0,0 +1,3 @@ +Implement a [[wp:Caesar cipher|Caesar cipher]], both encryption and decryption. The key is an integer from 1 to 25. This cipher rotates the letters of the alphabet (A to Z). The encryption replaces each letter with the 1st to 25th next letter in the alphabet (wrapping Z to A). So key 2 encrypts "HI" to "JK", but key 20 encrypts "HI" to "BC". This simple "monoalphabetic substitution cipher" provides almost no security, because an attacker who has the encrypted message can either use frequency analysis to guess the key, or just try all 25 keys. + +Caesar cipher is identical to [[Vigenère cipher]] with key of length 1. Also, [[Rot-13]] is identical to Caesar cipher with key 13. diff --git a/Task/Caesar-cipher/1META.yaml b/Task/Caesar-cipher/1META.yaml new file mode 100644 index 0000000000..fdbbfe89ad --- /dev/null +++ b/Task/Caesar-cipher/1META.yaml @@ -0,0 +1,2 @@ +--- +note: Encryption diff --git a/Task/Caesar-cipher/AWK/caesar-cipher.awk b/Task/Caesar-cipher/AWK/caesar-cipher.awk new file mode 100644 index 0000000000..e8e60caec4 --- /dev/null +++ b/Task/Caesar-cipher/AWK/caesar-cipher.awk @@ -0,0 +1,42 @@ +#!/usr/bin/awk -f + +BEGIN { + message = "My hovercraft is full of eels." + key = 1 + + cypher = caesarEncode(key, message) + clear = caesarDecode(key, cypher) + + print "message: " message + print " cypher: " cypher + print " clear: " clear + exit +} + +function caesarEncode(key, message) { + return caesarXlat(key, message, "encode") +} + +function caesarDecode(key, message) { + return caesarXlat(key, message, "decode") +} + +function caesarXlat(key, message, dir, plain, cypher, i, num, s) { + plain = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + cypher = substr(plain, key+1) substr(plain, 1, key) + + if (toupper(substr(dir, 1, 1)) == "D") { + s = plain + plain = cypher + cypher = s + } + + s = "" + message = toupper(message) + for (i = 1; i <= length(message); i++) { + num = index(plain, substr(message, i, 1)) + if (num) s = s substr(cypher, num, 1) + else s = s substr(message, i, 1) + } + return s +} diff --git a/Task/Caesar-cipher/Ada/caesar-cipher.ada b/Task/Caesar-cipher/Ada/caesar-cipher.ada new file mode 100644 index 0000000000..5835a61a57 --- /dev/null +++ b/Task/Caesar-cipher/Ada/caesar-cipher.ada @@ -0,0 +1,45 @@ +with Ada.Text_IO; + +procedure Caesar is + + type M26 is mod 26; + + function To_M26(C: Character; Offset: Character) return M26 is + begin + return M26(Character'Pos(C)-Character'Pos(Offset)); + end To_M26; + + function To_Character(Value: in M26; Offset: Character) + return Character is + begin + return Character'Val(Integer(Value)+Character'Pos(Offset)); + end To_Character; + + function Encrypt (Plain: String; Key: M26) return String is + Ciph: String(Plain'Range); + + begin + for I in Plain'Range loop + case Plain(I) is + when 'A' .. 'Z' => + Ciph(I) := To_Character(To_M26(Plain(I), 'A')+Key, 'A'); + when 'a' .. 'z' => + Ciph(I) := To_Character(To_M26(Plain(I), 'a')+Key, 'a'); + when others => + Ciph(I) := Plain(I); + end case; + end loop; + return Ciph; + end Encrypt; + + Text: String := Ada.Text_IO.Get_Line; + Key: M26 := 3; -- Default key from "Commentarii de Bello Gallico" + +begin -- Caesar main program + + Ada.Text_IO.Put_Line("Plaintext ------------>" & Text); + Text := Encrypt(Text, Key); + Ada.Text_IO.Put_Line("Ciphertext ----------->" & Text); + Ada.Text_IO.Put_Line("Decrypted Ciphertext ->" & Encrypt(Text, -Key)); + +end Caesar; diff --git a/Task/Caesar-cipher/C/caesar-cipher.c b/Task/Caesar-cipher/C/caesar-cipher.c new file mode 100644 index 0000000000..d95a2d2fd0 --- /dev/null +++ b/Task/Caesar-cipher/C/caesar-cipher.c @@ -0,0 +1,36 @@ +#include +#include +#include + +#define caesar(x) rot(13, x) +#define decaesar(x) rot(13, x) +#define decrypt_rot(x, y) rot((26-x), y) + +void rot(int c, char *str) +{ + int l = strlen(str); + const char *alpha[2] = { "abcdefghijklmnopqrstuvwxyz", "ABCDEFGHIJKLMNOPQRSTUVWXYZ"}; + + int i; + for (i = 0; i < l; i++) + { + if (!isalpha(str[i])) + continue; + + str[i] = alpha[isupper(str[i])][((int)(tolower(str[i])-'a')+c)%26]; + } +} + + +int main() +{ + char str[] = "This is a top secret text message!"; + + printf("Original: %s\n", str); + caesar(str); + printf("Encrypted: %s\n", str); + decaesar(str); + printf("Decrypted: %s\n", str); + + return 0; +} diff --git a/Task/Caesar-cipher/Clojure/caesar-cipher.clj b/Task/Caesar-cipher/Clojure/caesar-cipher.clj new file mode 100644 index 0000000000..5a4e9141d6 --- /dev/null +++ b/Task/Caesar-cipher/Clojure/caesar-cipher.clj @@ -0,0 +1,23 @@ +(defn encrypt-character [offset c] + (if (Character/isLetter c) + (let [v (int c) + base (if (>= v (int \a)) + (int \a) + (int \A)) + offset (mod offset 26)] ;works with negative offsets too! + (char (+ (mod (+ (- v base) offset) 26) + base))) + c)) + +(defn encrypt [offset text] + (apply str (map #(encrypt-character offset %) text))) + +(defn decrypt [offset text] + (encrypt (- 26 offset) text)) + + +(let [text "The Quick Brown Fox Jumps Over The Lazy Dog." + enc (encrypt -1 text)] + (print "Original text:" text "\n") + (print "Encryption:" enc "\n") + (print "Decryption:" (decrypt -1 enc) "\n")) diff --git a/Task/Caesar-cipher/CoffeeScript/caesar-cipher.coffee b/Task/Caesar-cipher/CoffeeScript/caesar-cipher.coffee new file mode 100644 index 0000000000..eb4055a3ed --- /dev/null +++ b/Task/Caesar-cipher/CoffeeScript/caesar-cipher.coffee @@ -0,0 +1,10 @@ +cipher = (msg, rot) -> + msg.replace /([a-z|A-Z])/g, ($1) -> + c = $1.charCodeAt(0) + String.fromCharCode \ + if c >= 97 + then (c + rot + 26 - 97) % 26 + 97 + else (c + rot + 26 - 65) % 26 + 65 + +console.log cipher "Hello World", 2 +console.log cipher "azAz %^&*()", 3 diff --git a/Task/Caesar-cipher/Erlang/caesar-cipher-1.erl b/Task/Caesar-cipher/Erlang/caesar-cipher-1.erl new file mode 100644 index 0000000000..aec82a662b --- /dev/null +++ b/Task/Caesar-cipher/Erlang/caesar-cipher-1.erl @@ -0,0 +1,33 @@ +%% Ceasar cypher in Erlang for the rosetta code wiki. +%% Implemented by J.W. Luiten + +-module(ceasar). +-export([main/2]). + +%% rot: rotate Char by Key places +rot(Char,Key) when (Char >= $A) and (Char =< $Z) or + (Char >= $a) and (Char =< $z) -> + Offset = $A + Char band 32, + N = Char - Offset, + Offset + (N + Key) rem 26; +rot(Char, _Key) -> + Char. + +%% key: normalize key. +key(Key) when Key < 0 -> + 26 + Key rem 26; +key(Key) when Key > 25 -> + Key rem 26; +key(Key) -> + Key. + +main(PlainText, Key) -> + Encode = key(Key), + Decode = key(-Key), + + io:format("Plaintext ----> ~s~n", [PlainText]), + + CypherText = lists:map(fun(Char) -> rot(Char, Encode) end, PlainText), + io:format("Cyphertext ---> ~s~n", [CypherText]), + + PlainText = lists:map(fun(Char) -> rot(Char, Decode) end, CypherText). diff --git a/Task/Caesar-cipher/Erlang/caesar-cipher-2.erl b/Task/Caesar-cipher/Erlang/caesar-cipher-2.erl new file mode 100644 index 0000000000..177b23de5c --- /dev/null +++ b/Task/Caesar-cipher/Erlang/caesar-cipher-2.erl @@ -0,0 +1 @@ +ceasar:main("The five boxing wizards jump quickly", 3). diff --git a/Task/Caesar-cipher/Forth/caesar-cipher.fth b/Task/Caesar-cipher/Forth/caesar-cipher.fth new file mode 100644 index 0000000000..e92410572f --- /dev/null +++ b/Task/Caesar-cipher/Forth/caesar-cipher.fth @@ -0,0 +1,19 @@ +: ceasar ( c n -- c ) + over 32 or [char] a - + dup 0 26 within if + over + 25 > if 26 - then + + else 2drop then ; + +: ceasar-string ( n str len -- ) + over + swap do i c@ over ceasar i c! loop drop ; + +: ceasar-inverse ( n -- 'n ) 26 swap - 26 mod ; + +2variable test +s" The five boxing wizards jump quickly!" test 2! + +3 test 2@ ceasar-string +test 2@ cr type + +3 ceasar-inverse test 2@ ceasar-string +test 2@ cr type diff --git a/Task/Caesar-cipher/Fortran/caesar-cipher.f b/Task/Caesar-cipher/Fortran/caesar-cipher.f new file mode 100644 index 0000000000..efb4703dcb --- /dev/null +++ b/Task/Caesar-cipher/Fortran/caesar-cipher.f @@ -0,0 +1,43 @@ +program Caesar_Cipher + implicit none + + integer, parameter :: key = 3 + character(43) :: message = "The five boxing wizards jump quickly" + + write(*, "(2a)") "Original message = ", message + call encrypt(message) + write(*, "(2a)") "Encrypted message = ", message + call decrypt(message) + write(*, "(2a)") "Decrypted message = ", message + +contains + +subroutine encrypt(text) + character(*), intent(inout) :: text + integer :: i + + do i = 1, len(text) + select case(text(i:i)) + case ('A':'Z') + text(i:i) = achar(modulo(iachar(text(i:i)) - 65 + key, 26) + 65) + case ('a':'z') + text(i:i) = achar(modulo(iachar(text(i:i)) - 97 + key, 26) + 97) + end select + end do +end subroutine + +subroutine decrypt(text) + character(*), intent(inout) :: text + integer :: i + + do i = 1, len(text) + select case(text(i:i)) + case ('A':'Z') + text(i:i) = achar(modulo(iachar(text(i:i)) - 65 - key, 26) + 65) + case ('a':'z') + text(i:i) = achar(modulo(iachar(text(i:i)) - 97 - key, 26) + 97) + end select + end do +end subroutine + +end program Caesar_Cipher diff --git a/Task/Caesar-cipher/Go/caesar-cipher-1.go b/Task/Caesar-cipher/Go/caesar-cipher-1.go new file mode 100644 index 0000000000..8257b42309 --- /dev/null +++ b/Task/Caesar-cipher/Go/caesar-cipher-1.go @@ -0,0 +1,59 @@ +package main + +import ( + "fmt" + "strings" +) + +type ckey struct { + enc, dec func(rune) rune +} + +func newCaesar(k int) (*ckey, bool) { + if k < 1 || k > 25 { + return nil, false + } + rk := rune(k) + return &ckey{ + enc: func(c rune) rune { + if c >= 'a' && c <= 'z'-rk || c >= 'A' && c <= 'Z'-rk { + return c + rk + } else if c > 'z'-rk && c <= 'z' || c > 'Z'-rk && c <= 'Z' { + return c + rk - 26 + } + return c + }, + dec: func(c rune) rune { + if c >= 'a'+rk && c <= 'z' || c >= 'A'+rk && c <= 'Z' { + return c - rk + } else if c >= 'a' && c < 'a'+rk || c >= 'A' && c < 'A'+rk { + return c - rk + 26 + } + return c + }, + }, true +} + +func (ck ckey) encipher(pt string) string { + return strings.Map(ck.enc, pt) +} + +func (ck ckey) decipher(ct string) string { + return strings.Map(ck.dec, ct) +} + +func main() { + pt := "The five boxing wizards jump quickly" + fmt.Println("Plaintext:", pt) + for _, key := range []int{0, 1, 7, 25, 26} { + ck, ok := newCaesar(key) + if !ok { + fmt.Println("Key", key, "invalid") + continue + } + ct := ck.encipher(pt) + fmt.Println("Key", key) + fmt.Println(" Enciphered:", ct) + fmt.Println(" Deciphered:", ck.decipher(ct)) + } +} diff --git a/Task/Caesar-cipher/Go/caesar-cipher-2.go b/Task/Caesar-cipher/Go/caesar-cipher-2.go new file mode 100644 index 0000000000..d1e4263e4c --- /dev/null +++ b/Task/Caesar-cipher/Go/caesar-cipher-2.go @@ -0,0 +1,57 @@ +package main + +import ( + "fmt" + "strings" + "unicode" +) + +type ckey struct { + enc, dec unicode.SpecialCase +} + +func newCaesar(k int) (*ckey, bool) { + if k < 1 || k > 25 { + return nil, false + } + i := uint32(k) + r := rune(k) + return &ckey{ + unicode.SpecialCase{ + {'A', 'Z' - i, [3]rune{r}}, + {'Z' - i + 1, 'Z', [3]rune{r - 26}}, + {'a', 'z' - i, [3]rune{r}}, + {'z' - i + 1, 'z', [3]rune{r - 26}}, + }, + unicode.SpecialCase{ + {'A', 'A' + i - 1, [3]rune{26 - r}}, + {'A' + i, 'Z', [3]rune{-r}}, + {'a', 'a' + i - 1, [3]rune{26 - r}}, + {'a' + i, 'z', [3]rune{-r}}, + }, + }, true +} + +func (ck ckey) encipher(pt string) string { + return strings.ToUpperSpecial(ck.enc, pt) +} + +func (ck ckey) decipher(ct string) string { + return strings.ToUpperSpecial(ck.dec, ct) +} + +func main() { + pt := "The five boxing wizards jump quickly" + fmt.Println("Plaintext:", pt) + for _, key := range []int{0, 1, 7, 25, 26} { + ck, ok := newCaesar(key) + if !ok { + fmt.Println("Key", key, "invalid") + continue + } + ct := ck.encipher(pt) + fmt.Println("Key", key) + fmt.Println(" Enciphered:", ct) + fmt.Println(" Deciphered:", ck.decipher(ct)) + } +} diff --git a/Task/Caesar-cipher/Haskell/caesar-cipher.hs b/Task/Caesar-cipher/Haskell/caesar-cipher.hs new file mode 100644 index 0000000000..0cfb674c4c --- /dev/null +++ b/Task/Caesar-cipher/Haskell/caesar-cipher.hs @@ -0,0 +1,17 @@ +import Data.Char (ord, chr) +import Data.Ix (inRange) + +caesar :: Int -> String -> String +caesar k = map f + where + f c + | inRange ('a','z') c = tr 'a' k c + | inRange ('A','Z') c = tr 'A' k c + | otherwise = c + +unCaesar :: Int -> String -> String +unCaesar k = caesar (-k) + +-- char addition +tr :: Char -> Int -> Char -> Char +tr base offset char = chr $ ord base + (ord char - ord base + offset) `mod` 26 diff --git a/Task/Caesar-cipher/Java/caesar-cipher.java b/Task/Caesar-cipher/Java/caesar-cipher.java new file mode 100644 index 0000000000..dc6deb920e --- /dev/null +++ b/Task/Caesar-cipher/Java/caesar-cipher.java @@ -0,0 +1,26 @@ +public class Cipher { + public static void main(String[] args) { + String enc = Cipher.encode( + "The quick brown fox Jumped over the lazy Dog", 12); + System.out.println(enc); + System.out.println(Cipher.decode(enc, 12)); + } + + public static String decode(String enc, int offset) { + return encode(enc, -offset); + } + + public static String encode(String enc, int offset) { + offset = offset % 26 + 26; + StringBuilder encoded = new StringBuilder(); + for (char i : enc.toLowerCase().toCharArray()) { + if (Character.isLetter(i)) { + int j = (i - 'a' + offset) % 26; + encoded.append((char) (j + 'a')); + } else { + encoded.append(i); + } + } + return encoded.toString(); + } +} diff --git a/Task/Caesar-cipher/JavaScript/caesar-cipher.js b/Task/Caesar-cipher/JavaScript/caesar-cipher.js new file mode 100644 index 0000000000..f8a6a32ce4 --- /dev/null +++ b/Task/Caesar-cipher/JavaScript/caesar-cipher.js @@ -0,0 +1,24 @@ +Caesar +

+
diff --git a/Task/Caesar-cipher/Lua/caesar-cipher.lua b/Task/Caesar-cipher/Lua/caesar-cipher.lua
new file mode 100644
index 0000000000..517bb19671
--- /dev/null
+++ b/Task/Caesar-cipher/Lua/caesar-cipher.lua
@@ -0,0 +1,30 @@
+local function encrypt(text, key)
+	return text:gsub("%a", function(t)
+			local base = (t:lower() == t and string.byte('a') or string.byte('A'))
+
+			local r = t:byte() - base
+			r = r + key
+			r = r%26 -- works correctly even if r is negative
+			r = r + base
+			return string.char(r)
+		end)
+end
+
+local function decrypt(text, key)
+	return encrypt(text, -key)
+end
+
+caesar = {
+	encrypt = encrypt,
+	decrypt = decrypt,
+}
+
+-- test
+do
+	local text = "ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz"
+	local encrypted = caesar.encrypt(text, 7)
+	local decrypted = caesar.decrypt(encrypted, 7)
+	print("Original text:  ", text)
+	print("Encrypted text: ", encrypted)
+	print("Decrypted text: ", decrypted)
+end
diff --git a/Task/Caesar-cipher/PHP/caesar-cipher.php b/Task/Caesar-cipher/PHP/caesar-cipher.php
new file mode 100644
index 0000000000..b087101643
--- /dev/null
+++ b/Task/Caesar-cipher/PHP/caesar-cipher.php
@@ -0,0 +1,19 @@
+= $ascii_a && $char <= $ascii_z ){
+            $char = ( ( $key + $char - $ascii_a ) % 26 ) + $ascii_a;
+        }
+        $plaintext = substr( $plaintext, 1 );
+        $ciphertext .= chr( $char );
+    }
+    return $ciphertext;
+}
+
+echo caesarEncode( "The quick brown fox Jumped over the lazy Dog", 12 ), "\n";
+?>
diff --git a/Task/Caesar-cipher/Perl/caesar-cipher.pl b/Task/Caesar-cipher/Perl/caesar-cipher.pl
new file mode 100644
index 0000000000..95d5e5a41e
--- /dev/null
+++ b/Task/Caesar-cipher/Perl/caesar-cipher.pl
@@ -0,0 +1,11 @@
+sub encipher {
+        my ($_, $k, $decode) = @_;
+        $k = 26 - $k if $decode;
+        join('', map(chr(((ord(uc $_) - 65 + $k) % 26) + 65), /([a-z])/gi));
+}
+
+my $msg = 'THE FIVE BOXING WIZARDS JUMP QUICKLY';
+my $enc = encipher($msg, 10);
+my $dec = encipher($enc, 10, 'decode');
+
+print "msg: $msg\nenc: $enc\ndec: $dec\n";
diff --git a/Task/Caesar-cipher/PicoLisp/caesar-cipher.l b/Task/Caesar-cipher/PicoLisp/caesar-cipher.l
new file mode 100644
index 0000000000..cebce25396
--- /dev/null
+++ b/Task/Caesar-cipher/PicoLisp/caesar-cipher.l
@@ -0,0 +1,6 @@
+(setq *Letters (apply circ (mapcar char (range 65 90))))
+
+(de caesar (Str Key)
+   (pack
+      (mapcar '((C) (cadr (nth (member C *Letters) Key)))
+         (chop (uppc Str)) ) ) )
diff --git a/Task/Caesar-cipher/Prolog/caesar-cipher.pro b/Task/Caesar-cipher/Prolog/caesar-cipher.pro
new file mode 100644
index 0000000000..bf0e31a910
--- /dev/null
+++ b/Task/Caesar-cipher/Prolog/caesar-cipher.pro
@@ -0,0 +1,33 @@
+:- use_module(library(clpfd)).
+
+caesar :-
+	L1 = "The five boxing wizards jump quickly",
+	writef("Original : %s\n", [L1]),
+
+	% encryption of the sentence
+	encoding(3, L1, L2) ,
+	writef("Encoding : %s\n", [L2]),
+
+	% deciphering on the encoded sentence
+	encoding(3, L3, L2),
+	writef("Decoding : %s\n", [L3]).
+
+% encoding/decoding of a sentence
+encoding(Key, L1, L2) :-
+	maplist(caesar_cipher(Key), L1, L2).
+
+caesar_cipher(_, 32, 32) :- !.
+
+caesar_cipher(Key, V1, V2) :-
+	V #= Key + V1,
+
+	% we verify that we are in the limits of A-Z and a-z.
+	((V1 #=< 0'Z #/\ V #> 0'Z) #\/ (V1 #=< 0'z #/\ V #> 0'z)
+	#\/
+	(V1 #< 0'A #/\ V2 #>= 0'A)#\/ (V1 #< 0'a #/\ V2 #>= 0'a)) #==> A,
+
+	% if we are not in these limits A is 1, otherwise 0.
+	V2 #= V - A * 26,
+
+	% compute values of V1 and V2
+	label([A, V1, V2]).
diff --git a/Task/Caesar-cipher/Python/caesar-cipher-1.py b/Task/Caesar-cipher/Python/caesar-cipher-1.py
new file mode 100644
index 0000000000..975933b38c
--- /dev/null
+++ b/Task/Caesar-cipher/Python/caesar-cipher-1.py
@@ -0,0 +1,11 @@
+def caesar(s, k, decode = False):
+	if decode: k = 26 - k
+	return "".join([chr((ord(i) - 65 + k) % 26 + 65)
+				for i in s.upper()
+				if ord(i) >= 65 and ord(i) <= 90 ])
+
+msg = "The quick brown fox jumped over the lazy dogs"
+print msg
+enc = caesar(msg, 11)
+print enc
+print caesar(enc, 11, decode = True)
diff --git a/Task/Caesar-cipher/Python/caesar-cipher-2.py b/Task/Caesar-cipher/Python/caesar-cipher-2.py
new file mode 100644
index 0000000000..0f303b448d
--- /dev/null
+++ b/Task/Caesar-cipher/Python/caesar-cipher-2.py
@@ -0,0 +1,15 @@
+import string
+def caesar(s, k, decode = False):
+   if decode: k = 26 - k
+   return s.translate(
+       string.maketrans(
+           string.ascii_uppercase + string.ascii_lowercase,
+           string.ascii_uppercase[k:] + string.ascii_uppercase[:k] +
+           string.ascii_lowercase[k:] + string.ascii_lowercase[:k]
+           )
+       )
+msg = "The quick brown fox jumped over the lazy dogs"
+print msg
+enc = caesar(msg, 11)
+print enc
+print caesar(enc, 11, decode = True)
diff --git a/Task/Caesar-cipher/Python/caesar-cipher-3.py b/Task/Caesar-cipher/Python/caesar-cipher-3.py
new file mode 100644
index 0000000000..838af43dba
--- /dev/null
+++ b/Task/Caesar-cipher/Python/caesar-cipher-3.py
@@ -0,0 +1,9 @@
+from string import ascii_uppercase as abc
+
+def caesar(s, k, decode = False):
+    trans = dict(zip(abc, abc[(k,26-k)[decode]:] + abc[:(k,26-k)[decode]]))
+    return ''.join(trans[L] for L in s.upper() if L in abc)
+
+msg = "The quick brown fox jumped over the lazy dogs"
+print(caesar(msg, 11))
+print(caesar(caesar(msg, 11), 11, True))
diff --git a/Task/Caesar-cipher/REXX/caesar-cipher-1.rexx b/Task/Caesar-cipher/REXX/caesar-cipher-1.rexx
new file mode 100644
index 0000000000..96107a60d0
--- /dev/null
+++ b/Task/Caesar-cipher/REXX/caesar-cipher-1.rexx
@@ -0,0 +1,22 @@
+/*REXX pgm: Caesar cypher: Latin alphabet only, no punctuation or blanks*/
+/*     allowed,  all lowercase Latin letters are treated as uppercase.  */
+arg key p                              /*get key and text to be cyphered*/
+p=space(p,0)                           /*remove all blanks from text.   */
+                        say 'Caesar cypher key:' key
+                        say '       plain text:' p
+y=caesar(p, key)      ; say '         cyphered:' y
+z=caesar(y,-key)      ; say '       uncyphered:' z
+if z\==p then say "plain text doesn't match uncyphered cyphered text."
+exit                                   /*stick a fork in it, we're done.*/
+/*──────────────────────────────────CAESAR subroutine───────────────────*/
+caesar: procedure; arg s,k; @='ABCDEFGHIJKLMNOPQRSTUVWXYZ'; L=length(@)
+ak=abs(k)
+if ak > length(@)-1  |  k==0  |  k==''   then  call err k 'key is invalid'
+_=verify(s,@)                          /*any illegal char specified ?   */
+if _\==0 then call err 'unsupported character:' substr(s,_,1)
+                                       /*now that error checks are done:*/
+if k>0 then ky=k+1                     /*either cypher it, or ...       */
+       else ky=27-ak                   /*     decypher it.              */
+return translate(s,substr(@||@,ky,L),@)
+/*──────────────────────────────────ERR subroutine──────────────────────*/
+err:   say;    say '***error!***';    say;    say arg(1);   say;   exit 13
diff --git a/Task/Caesar-cipher/REXX/caesar-cipher-2.rexx b/Task/Caesar-cipher/REXX/caesar-cipher-2.rexx
new file mode 100644
index 0000000000..c2b2fa82fe
--- /dev/null
+++ b/Task/Caesar-cipher/REXX/caesar-cipher-2.rexx
@@ -0,0 +1,23 @@
+/*REXX pgm: Caesar cypher for almost all keyboard chars including blanks*/
+parse arg key p                        /*get key and text to be cyphered*/
+                        say 'Caesar cypher key:' key
+                        say '       plain text:' p
+y=caesar(p, key)      ; say '         cyphered:' y
+z=caesar(y,-key)      ; say '       uncyphered:' z
+if z\==p then say "plain text doesn't match uncyphered cyphered text."
+exit                                   /*stick a fork in it, we're done.*/
+/*──────────────────────────────────CAESAR subroutine───────────────────*/
+caesar:  procedure;     parse arg s,k;     @='abcdefghijklmnopqrstuvwxyz'
+@=translate(@)@'0123456789(){}[]<>'    /*add uppercase, digs, group symb*/
+@=@'~!@#$%^&*_+:";?,./`-= '''          /*add other characters here.     */
+                       /*last char is doubled, REXX quoted syntax rules.*/
+L=length(@)
+ak=abs(k)
+if ak>length(@)-1 | k==0 then call err k 'key is invalid'
+_=verify(s,@)                          /*any illegal char specified ?   */
+if _\==0 then call err 'unsupported character:' substr(s,_,1)
+if k>0 then ky=k+1
+       else ky=L+1-ak
+return translate(s,substr(@||@,ky,L),@)
+/*──────────────────────────────────ERR subroutine──────────────────────*/
+err:   say;    say '***error!***';    say;    say arg(1);   say;   exit 13
diff --git a/Task/Caesar-cipher/Racket/caesar-cipher-1.rkt b/Task/Caesar-cipher/Racket/caesar-cipher-1.rkt
new file mode 100644
index 0000000000..a51e5c7c08
--- /dev/null
+++ b/Task/Caesar-cipher/Racket/caesar-cipher-1.rkt
@@ -0,0 +1,19 @@
+#lang racket
+
+(define A (char->integer #\A))
+(define Z (char->integer #\Z))
+(define a (char->integer #\a))
+(define z (char->integer #\z))
+
+(define (rotate c n)
+  (define cnum (char->integer c))
+  (define (shift base) (integer->char (+ base (modulo (+ n (- cnum base)) 26))))
+  (cond [(<= A cnum Z) (shift A)]
+        [(<= a cnum z) (shift a)]
+        [else c]))
+
+(define (caesar s n)
+  (list->string (for/list ([c (in-string s)]) (rotate c n))))
+
+(define (encrypt s) (caesar s 1))
+(define (decrypt s) (caesar s -1))
diff --git a/Task/Caesar-cipher/Racket/caesar-cipher-2.rkt b/Task/Caesar-cipher/Racket/caesar-cipher-2.rkt
new file mode 100644
index 0000000000..3812b82940
--- /dev/null
+++ b/Task/Caesar-cipher/Racket/caesar-cipher-2.rkt
@@ -0,0 +1,5 @@
+> (define s (encrypt "The five boxing wizards jump quickly."))
+> s
+"Uif gjwf cpyjoh xjabset kvnq rvjdlmz."
+> (decrypt s)
+"The five boxing wizards jump quickly."
diff --git a/Task/Caesar-cipher/Ruby/caesar-cipher.rb b/Task/Caesar-cipher/Ruby/caesar-cipher.rb
new file mode 100644
index 0000000000..098532da34
--- /dev/null
+++ b/Task/Caesar-cipher/Ruby/caesar-cipher.rb
@@ -0,0 +1,23 @@
+@atoz = Hash.new do |hash, key|
+  str = ('A'..'Z').to_a.rotate(key).join("")
+  hash[key] = (str << str.downcase)
+end
+
+def encrypt(key, plaintext)
+  (1..25) === key or raise ArgumentError, "key not in 1..25"
+  plaintext.tr(@atoz[0], @atoz[key])
+end
+
+def decrypt(key, ciphertext)
+  (1..25) === key or raise ArgumentError, "key not in 1..25"
+  ciphertext.tr(@atoz[key], @atoz[0])
+end
+
+original = "THEYBROKEOURCIPHEREVERYONECANREADTHIS"
+en = encrypt(3, original)
+de = decrypt(3, en)
+
+[original, en, de].each {|e| puts e}
+
+puts 'OK' if
+  (1..25).all? {|k| original == decrypt(k, encrypt(k, original))}
diff --git a/Task/Caesar-cipher/Scala/caesar-cipher-1.scala b/Task/Caesar-cipher/Scala/caesar-cipher-1.scala
new file mode 100644
index 0000000000..9980d566a1
--- /dev/null
+++ b/Task/Caesar-cipher/Scala/caesar-cipher-1.scala
@@ -0,0 +1,12 @@
+object Caesar {
+  private val alphaU='A' to 'Z'
+  private val alphaL='a' to 'z'
+
+  def encode(text:String, key:Int)=text.map{
+    case c if alphaU.contains(c) => rot(alphaU, c, key)
+    case c if alphaL.contains(c) => rot(alphaL, c, key)
+    case c => c
+  }
+  def decode(text:String, key:Int)=encode(text,-key)
+  private def rot(a:IndexedSeq[Char], c:Char, key:Int)=a((c-a.head+key+a.size)%a.size)
+}
diff --git a/Task/Caesar-cipher/Scala/caesar-cipher-2.scala b/Task/Caesar-cipher/Scala/caesar-cipher-2.scala
new file mode 100644
index 0000000000..9a87816c9b
--- /dev/null
+++ b/Task/Caesar-cipher/Scala/caesar-cipher-2.scala
@@ -0,0 +1,5 @@
+val text="The five boxing wizards jump quickly"
+println("Plaintext  => " + text)
+val encoded=Caesar.encode(text, 3)
+println("Ciphertext => " + encoded)
+println("Decrypted  => " + Caesar.decode(encoded, 3))
diff --git a/Task/Caesar-cipher/Smalltalk/caesar-cipher-1.st b/Task/Caesar-cipher/Smalltalk/caesar-cipher-1.st
new file mode 100644
index 0000000000..76df1db2f6
--- /dev/null
+++ b/Task/Caesar-cipher/Smalltalk/caesar-cipher-1.st
@@ -0,0 +1 @@
+'THE QUICK BROWN FOX' rot:3 -> 'WKH TXLFN EURZQ IRA'
diff --git a/Task/Caesar-cipher/Smalltalk/caesar-cipher-2.st b/Task/Caesar-cipher/Smalltalk/caesar-cipher-2.st
new file mode 100644
index 0000000000..aa3657387a
--- /dev/null
+++ b/Task/Caesar-cipher/Smalltalk/caesar-cipher-2.st
@@ -0,0 +1,18 @@
+!CharacterArray methodsFor:'encoding'!
+rot:n
+    ^ self class
+        streamContents:[:aStream |
+            self do:[:char |
+                aStream nextPut:(char rot:n) ]]
+
+
+!Character methodsFor:'encoding'!
+rot:n
+     (self isLetter) ifTrue:[
+        self isLowercase ifTrue:[
+            ^ 'abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz' at:(self-$a+1+n)
+        ] ifFalse:[
+            ^ 'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ' at:(self-$A+1+n)
+        ]
+    ].
+    ^ self
diff --git a/Task/Caesar-cipher/Tcl/caesar-cipher-1.tcl b/Task/Caesar-cipher/Tcl/caesar-cipher-1.tcl
new file mode 100644
index 0000000000..27c85f38e0
--- /dev/null
+++ b/Task/Caesar-cipher/Tcl/caesar-cipher-1.tcl
@@ -0,0 +1,23 @@
+package require Tcl 8.6;    # Or TclOO package for 8.5
+
+oo::class create Caesar {
+    variable encryptMap decryptMap
+    constructor shift {
+	for {set i 0} {$i < 26} {incr i} {
+	    # Play fast and loose with string/list duality for shorter code
+	    append encryptMap [format "%c %c %c %c " \
+		    [expr {$i+65}] [expr {($i+$shift)%26+65}] \
+		    [expr {$i+97}] [expr {($i+$shift)%26+97}]]
+	    append decryptMap [format "%c %c %c %c " \
+		    [expr {$i+65}] [expr {($i-$shift)%26+65}] \
+		    [expr {$i+97}] [expr {($i-$shift)%26+97}]]
+	}
+    }
+
+    method encrypt text {
+	string map $encryptMap $text
+    }
+    method decrypt text {
+	string map $decryptMap $text
+    }
+}
diff --git a/Task/Caesar-cipher/Tcl/caesar-cipher-2.tcl b/Task/Caesar-cipher/Tcl/caesar-cipher-2.tcl
new file mode 100644
index 0000000000..bca315b1f9
--- /dev/null
+++ b/Task/Caesar-cipher/Tcl/caesar-cipher-2.tcl
@@ -0,0 +1,7 @@
+set caesar [Caesar new 3]
+set txt "The five boxing wizards jump quickly."
+set enc [$caesar encrypt $txt]
+set dec [$caesar decrypt $enc]
+puts "Original message  = $txt"
+puts "Encrypted message = $enc"
+puts "Decrypted message = $dec"
diff --git a/Task/Calendar/Ada/calendar-1.ada b/Task/Calendar/Ada/calendar-1.ada
new file mode 100644
index 0000000000..442ac4b3a0
--- /dev/null
+++ b/Task/Calendar/Ada/calendar-1.ada
@@ -0,0 +1,48 @@
+with Ada.Calendar.Formatting;
+
+package Printable_Calendar is
+
+   subtype String20 is String(1 .. 20);
+   type Month_Rep_Type is array (Ada.Calendar.Month_Number) of String20;
+
+   type Description is record
+      Weekday_Rep: String20;
+      Month_Rep: Month_Rep_Type;
+   end record;
+   -- for internationalization, you only need to define a new description
+
+   Default_Description: constant Description :=
+     (Weekday_Rep =>
+       "Mo Tu We Th Fr Sa So",
+      Month_Rep   =>
+      ("      January       ", "      February      ", "       March        ",
+       "       April        ", "        May         ", "        June        ",
+       "        July        ", "       August       ", "      September     ",
+       "       October      ", "      November      ", "      December      "));
+
+   type Calendar (<>) is tagged private;
+
+   -- Initialize a calendar for devices with 80- or 132-characters per row
+   function Init_80(Des: Description := Default_Description) return Calendar;
+   function Init_132(Des: Description := Default_Description) return Calendar;
+
+   -- the following procedures output to standard IO; override if neccessary
+   procedure New_Line(Cal: Calendar);
+   procedure Put_String(Cal: Calendar; S: String);
+
+   -- the following procedures do the real stuff
+   procedure Print_Line_Centered(Cal: Calendar'Class; Line: String);
+   procedure Print(Cal: Calendar'Class;
+                   Year:  Ada.Calendar.Year_Number;
+                   Year_String: String); -- this is the main Thing
+
+private
+      type Calendar is tagged record
+      Columns, Rows, Space_Between_Columns: Positive;
+      Left_Space: Natural;
+
+      Weekday_Rep: String20;
+      Month_Rep: Month_Rep_Type;
+   end record;
+
+end Printable_Calendar;
diff --git a/Task/Calendar/Ada/calendar-2.ada b/Task/Calendar/Ada/calendar-2.ada
new file mode 100644
index 0000000000..730f017d95
--- /dev/null
+++ b/Task/Calendar/Ada/calendar-2.ada
@@ -0,0 +1,176 @@
+with Ada.Text_IO;
+
+package body Printable_Calendar is
+
+   use Ada.Calendar;
+   package F renames Ada.Calendar.Formatting;
+
+   function Days_Per_Month(Year: Year_Number; Month: Month_Number)
+                          return Day_Number is
+   begin
+      case Month is
+         when 1 | 3 | 5 | 7 | 8 | 10 | 12 => return 31;
+         when 4 | 6 | 9 | 11              => return 30;
+         when 2 =>
+            if Year mod 4 /= 0 then
+               return 28;
+            elsif Year mod 100 /= 0 then
+               return 29;
+            elsif Year mod 400 /= 0 then
+               return 28;
+            else
+               return 29;
+            end if;
+      end case;
+   end Days_Per_Month;
+
+   type Full_Month_Rep is array (1 .. 6) of String20;
+   function Generate_Printable_Month (Y: Ada.Calendar.Year_Number;
+                                      M: Ada.Calendar.Month_Number)
+                                     return Full_Month_Rep is
+
+      X: Full_Month_Rep := (others => "                    ");
+      -- If X=Generate_Printable_Month(2011, 01), the result could be
+      --  "       January      ", -- Month_Rep(01)
+      --  "Mo Tu We Th Fr Sa Su"  -- Weekday_Rep
+      --  "                1  2"  -- X(1)
+      --  " 3  4  5  6  7  8  9"  -- X(2)
+      --  "10 11 12 13 14 15 16"  -- X(3)
+      --  "17 18 19 20 21 22 23"  -- X(4)
+      --  "24 25 26 27 28 29 30"  -- X(5)
+      --  "31                  "  -- X(6)
+
+      Row:       Integer range 1 .. 6  := 1;
+      Day_Index: constant array(F.Day_Name) of Positive
+        := (1, 4, 7, 10, 13, 16, 19);
+   begin
+      for I in 1 .. Days_Per_Month(Y, M) loop
+         declare
+           Weekday: constant F.Day_Name    := F.Day_Of_Week(F.Time_Of(Y, M, I));
+           Pos: constant Positive          := Day_Index(Weekday);
+           Cleartext_Name: constant String := Day_Number'Image(I);
+           L: constant Positive            := Cleartext_Name'Last;
+         begin
+            X(Row)(Pos .. Pos+1) := Cleartext_Name(L-1 .. L);
+            if F."="(Weekday, F.Sunday) then
+               Row := Row + 1;
+            end if;
+         end;
+      end loop;
+      return X;
+   end Generate_Printable_Month;
+
+
+   procedure Print(Cal: Calendar'class;
+                   Year:  Ada.Calendar.Year_Number;
+                   Year_String: String) is
+
+      The_Month: Month_Number := Month_Number'First;
+
+      procedure Write_Space(Length: Natural) is
+      begin
+         for I in 1 .. Length loop
+            Cal.Put_String(" ");
+         end loop;
+      end Write_Space;
+
+      Year_Rep: array(Month_Number) of Full_Month_Rep;
+
+   begin
+      -- print the year
+      Cal.Print_Line_Centered(Year_String);
+
+      -- generate a printable form for all the months
+      for Month in Month_Number loop
+         Year_Rep(Month) := Generate_Printable_Month(Year, Month);
+      end loop;
+
+      begin
+         while True loop
+
+            -- new line
+            Cal.New_Line;
+
+            -- write month names
+            Write_Space(Cal.Left_Space);
+            for Month in The_Month .. The_Month+Cal.Columns-2 loop
+               Cal.Put_String(Cal.Month_Rep(Month));
+               Write_Space(Cal.Space_Between_Columns);
+            end loop;
+            Cal.Put_String(Cal.Month_Rep(The_Month+Cal.Columns-1));
+            Cal.New_Line;
+
+            -- write "Mo Tu .. So" - or whatever is defined by Weekday_Rep
+            Write_Space(Cal.Left_Space);
+            for Month in The_Month .. The_Month+Cal.Columns-2 loop
+               Cal.Put_String(Cal.Weekday_Rep);
+               Write_Space(Cal.Space_Between_Columns);
+            end loop;
+            Cal.Put_String(Cal.Weekday_Rep);
+            Cal.New_Line;
+
+            -- write the dates
+            for I in 1 .. 6 loop
+               Write_Space(Cal.Left_Space);
+               for Month in The_Month .. The_Month+Cal.Columns-2 loop
+                  Cal.Put_String(Year_Rep(Month)(I));
+                  Write_Space(Cal.Space_Between_Columns);
+               end loop;
+            Cal.Put_String(Year_Rep(The_Month+Cal.Columns-1)(I));
+            Cal.New_Line;
+            end loop;
+
+            The_Month := The_Month + Cal.Columns;
+            -- this will eventually raise Constraint_Error to terminate the loop
+         end loop;
+      exception
+         when Constraint_Error => null;
+      end;
+   end Print;
+
+   procedure New_Line(Cal: Calendar) is
+   begin
+      Ada.Text_IO.New_Line;
+   end New_Line;
+
+   procedure Put_String(Cal: Calendar; S: String) is
+   begin
+      Ada.Text_IO.Put(S);
+   end Put_String;
+
+   procedure Print_Line_Centered(Cal: Calendar'Class; Line: String) is
+      Width : constant Positive := Cal.Columns*20
+        + (Cal.Columns-1)*Cal.Space_Between_Columns
+        + Cal.Left_Space;
+   begin
+      if Line'Length    >= Width-1 then
+         Cal.Put_String(Line);
+         Cal.New_Line;
+      else
+         Print_Line_Centered(Cal, " " & Line & " ");
+      end if;
+   end Print_Line_Centered;
+
+   function Init_80(Des: Description := Default_Description) return Calendar is
+      X: Calendar:=
+        (Columns => 3, Rows => 4, Space_Between_Columns => 4,
+         Left_Space => 1,
+         Weekday_Rep =>  Des.Weekday_Rep,
+         Month_Rep   =>  Des.Month_Rep
+        );
+   begin
+      return X;
+   end Init_80;
+
+   function Init_132(Des: Description := Default_Description) return Calendar is
+      X: Calendar:=
+        (Columns => 6, Rows => 2, Space_Between_Columns => 2,
+         Left_Space => 1,
+         Weekday_Rep =>  Des.Weekday_Rep,
+         Month_Rep   =>  Des.Month_Rep
+        );
+   begin
+      return X;
+   end Init_132;
+
+end Printable_Calendar;
diff --git a/Task/Calendar/Ada/calendar-3.ada b/Task/Calendar/Ada/calendar-3.ada
new file mode 100644
index 0000000000..93fd95516b
--- /dev/null
+++ b/Task/Calendar/Ada/calendar-3.ada
@@ -0,0 +1,11 @@
+with Printable_Calendar;
+
+procedure Cal is
+
+   C: Printable_Calendar.Calendar := Printable_Calendar.Init_80;
+
+begin
+   C.Print_Line_Centered("[reserved for Snoopy]");
+   C.New_Line;
+   C.Print(1969, "Nineteen-Sixty-Nine");
+end Cal;
diff --git a/Task/Calendar/Tcl/calendar-1.tcl b/Task/Calendar/Tcl/calendar-1.tcl
new file mode 100644
index 0000000000..41150455f4
--- /dev/null
+++ b/Task/Calendar/Tcl/calendar-1.tcl
@@ -0,0 +1,75 @@
+package require Tcl 8.5
+
+# Produce information about the days in a month, without any assumptions about
+# what those days actually are.
+proc calMonthDays {timezone locale year month} {
+    set days {}
+    set moment [clock scan [format "%04d-%02d-00 12:00" $year $month] \
+	    -timezone $timezone -locale $locale -format "%Y-%m-%d %H:%M"]
+    while 1 {
+	set moment [clock add $moment 1 day]
+	lassign [clock format $moment -timezone $timezone -locale $locale \
+		-format "%m %d %u"] m d dow
+	if {[scan $m %d] != $month} {
+	    return $days
+	}
+	lappend days $moment [scan $d %d] $dow
+    }
+}
+
+proc calMonth {year month timezone locale} {
+    set dow 0
+    set line ""
+    set lines {}
+    foreach {t day dayofweek} [calMonthDays $timezone $locale $year $month] {
+	if {![llength $lines]} {lappend lines $t}
+	if {$dow > $dayofweek} {
+	    lappend lines [string trimright $line]
+	    set line ""
+	    set dow 0
+	}
+	while {$dow < $dayofweek-1} {
+	    append line "   "
+	    incr dow
+	}
+	append line [format "%2d " $day]
+	set dow $dayofweek
+    }
+    lappend lines [string trimright $line]
+}
+
+proc cal3Month {year month timezone locale} {
+    # Extract the month data
+    set d1 [lassign [calMonth $year $month $timezone $locale] t1]; incr month
+    set d2 [lassign [calMonth $year $month $timezone $locale] t2]; incr month
+    set d3 [lassign [calMonth $year $month $timezone $locale] t3]
+    # Print the header line of month names
+    foreach t [list $t1 $t2 $t3] {
+	set m [clock format $t -timezone $timezone -locale $locale -format "%B"]
+	set l [expr {10 + [string length $m]/2}]
+	puts -nonewline [format "%-25s" [format "%*s" $l $m]]
+    }
+    puts ""
+    # Print the month days
+    foreach l1 $d1 l2 $d2 l3 $d3 {
+	puts [format "%-25s%-25s%s" $l1 $l2 $l3]
+    }
+}
+
+proc cal {{year ""} {timezone :localtime} {locale en}} {
+    if {$year eq ""} {
+	set year [clock format [clock seconds] -format %Y]
+    }
+    puts [format "%40s" "-- $year --"]
+    foreach m {1 4 7 10} {
+	puts ""
+	cal3Month $year $m $timezone $locale
+    }
+}
+
+proc snoopy {} {
+    puts [format "%43s\n" {[Snoopy Picture]}]
+}
+
+snoopy
+cal
diff --git a/Task/Check-that-file-exists/0DESCRIPTION b/Task/Check-that-file-exists/0DESCRIPTION
new file mode 100644
index 0000000000..ccf27b821e
--- /dev/null
+++ b/Task/Check-that-file-exists/0DESCRIPTION
@@ -0,0 +1 @@
+In this task, the job is to verify that a file called "input.txt" and the directory called "docs" exist. This should be done twice: once for the current working directory and once for a file and a directory in the filesystem root.
diff --git a/Task/Check-that-file-exists/1META.yaml b/Task/Check-that-file-exists/1META.yaml
new file mode 100644
index 0000000000..40458d9f21
--- /dev/null
+++ b/Task/Check-that-file-exists/1META.yaml
@@ -0,0 +1,2 @@
+---
+note: File System Operations
diff --git a/Task/Check-that-file-exists/Ada/check-that-file-exists-1.ada b/Task/Check-that-file-exists/Ada/check-that-file-exists-1.ada
new file mode 100644
index 0000000000..9fbc024932
--- /dev/null
+++ b/Task/Check-that-file-exists/Ada/check-that-file-exists-1.ada
@@ -0,0 +1,17 @@
+with Ada.Text_IO; use Ada.Text_IO;
+
+procedure File_Exists is
+   function Does_File_Exist (Name : String) return Boolean is
+      The_File : Ada.Text_IO.File_Type;
+   begin
+      Open (The_File, In_File, Name);
+      Close (The_File);
+      return True;
+   exception
+      when Name_Error =>
+         return False;
+   end Does_File_Exist;
+begin
+   Put_Line (Boolean'Image (Does_File_Exist ("input.txt" )));
+   Put_Line (Boolean'Image (Does_File_Exist ("\input.txt")));
+end File_Exists;
diff --git a/Task/Check-that-file-exists/Ada/check-that-file-exists-2.ada b/Task/Check-that-file-exists/Ada/check-that-file-exists-2.ada
new file mode 100644
index 0000000000..fd3bb4384b
--- /dev/null
+++ b/Task/Check-that-file-exists/Ada/check-that-file-exists-2.ada
@@ -0,0 +1,20 @@
+with Ada.Text_IO; use Ada.Text_IO;
+with Ada.Directories; use Ada.Directories;
+
+procedure File_Exists is
+   procedure Print_File_Exist (Name : String) is
+   begin
+      Put_Line ("Does " & Name & " exist? " &
+                  Boolean'Image (Exists (Name)));
+   end Print_File_Exist;
+   procedure Print_Dir_Exist (Name : String) is
+   begin
+      Put_Line ("Does directory " & Name & " exist? " &
+                  Boolean'Image (Exists (Name) and then Kind (Name) = Directory));
+   end Print_Dir_Exist;
+begin
+   Print_File_Exist ("input.txt" );
+   Print_File_Exist ("/input.txt");
+   Print_Dir_Exist ("docs");
+   Print_Dir_Exist ("/docs");
+end File_Exists;
diff --git a/Task/Check-that-file-exists/BASIC/check-that-file-exists-1.bas b/Task/Check-that-file-exists/BASIC/check-that-file-exists-1.bas
new file mode 100644
index 0000000000..8d1f97f205
--- /dev/null
+++ b/Task/Check-that-file-exists/BASIC/check-that-file-exists-1.bas
@@ -0,0 +1,28 @@
+ON ERROR GOTO ohNo
+f$ = "input.txt"
+GOSUB opener
+f$ = "\input.txt"
+GOSUB opener
+
+'can't directly check for directories,
+'but can check for the NUL device in the desired dir
+f$ = "docs\nul"
+GOSUB opener
+f$ = "\docs\nul"
+GOSUB opener
+END
+
+opener:
+    e$ = " found"
+    OPEN f$ FOR INPUT AS 1
+    PRINT f$; e$
+    CLOSE
+    RETURN
+
+ohNo:
+    IF (53 = ERR) OR (76 = ERR) THEN
+        e$ = " not" + e$
+    ELSE
+        e$ = "Unknown error"
+    END IF
+    RESUME NEXT
diff --git a/Task/Check-that-file-exists/BASIC/check-that-file-exists-2.bas b/Task/Check-that-file-exists/BASIC/check-that-file-exists-2.bas
new file mode 100644
index 0000000000..d256870060
--- /dev/null
+++ b/Task/Check-that-file-exists/BASIC/check-that-file-exists-2.bas
@@ -0,0 +1,14 @@
+ON ERROR GOTO ohNo
+d$ = "docs"
+CHDIR d$
+d$ = "\docs"
+CHDIR d$
+END
+
+ohNo:
+    IF 76 = ERR THEN
+        PRINT d$; " not found"
+    ELSE
+        PRINT "Unknown error"
+    END IF
+    RESUME NEXT
diff --git a/Task/Check-that-file-exists/BASIC/check-that-file-exists-3.bas b/Task/Check-that-file-exists/BASIC/check-that-file-exists-3.bas
new file mode 100644
index 0000000000..1ec1ca4add
--- /dev/null
+++ b/Task/Check-that-file-exists/BASIC/check-that-file-exists-3.bas
@@ -0,0 +1,21 @@
+f$ = "input.txt"
+GOSUB opener
+f$ = "\input.txt"
+GOSUB opener
+
+'can't directly check for directories,
+'but can check for the NUL device in the desired dir
+f$ = "docs\nul"
+GOSUB opener
+f$ = "\docs\nul"
+GOSUB opener
+END
+
+opener:
+    d$ = DIR$(f$)
+    IF LEN(d$) THEN
+        PRINT f$; " found"
+    ELSE
+        PRINT f$; " not found"
+    END IF
+    RETURN
diff --git a/Task/Check-that-file-exists/C/check-that-file-exists.c b/Task/Check-that-file-exists/C/check-that-file-exists.c
new file mode 100644
index 0000000000..fbced86d47
--- /dev/null
+++ b/Task/Check-that-file-exists/C/check-that-file-exists.c
@@ -0,0 +1,28 @@
+#include 
+#include 
+#include 
+#include 
+
+/* Check for regular file. */
+int check_reg(const char *path) {
+	struct stat sb;
+	return stat(path, &sb) == 0 && S_ISREG(sb.st_mode);
+}
+
+/* Check for directory. */
+int check_dir(const char *path) {
+	struct stat sb;
+	return stat(path, &sb) == 0 && S_ISDIR(sb.st_mode);
+}
+
+int main() {
+	printf("input.txt is a regular file? %s\n",
+	    check_reg("input.txt") ? "yes" : "no");
+	printf("docs is a directory? %s\n",
+	    check_dir("docs") ? "yes" : "no");
+	printf("/input.txt is a regular file? %s\n",
+	    check_reg("/input.txt") ? "yes" : "no");
+	printf("/docs is a directory? %s\n",
+	    check_dir("/docs") ? "yes" : "no");
+	return 0;
+}
diff --git a/Task/Check-that-file-exists/Clojure/check-that-file-exists.clj b/Task/Check-that-file-exists/Clojure/check-that-file-exists.clj
new file mode 100644
index 0000000000..957bc4c9db
--- /dev/null
+++ b/Task/Check-that-file-exists/Clojure/check-that-file-exists.clj
@@ -0,0 +1,17 @@
+(import '(java.io File))
+
+(defn kind [filename]
+  (let [f (File. filename)]
+    (cond
+      (.isFile f)      "file"
+      (.isDirectory f) "directory"
+      (.exists f)      "other"
+      :else            "(non-existent)" )))
+
+(defn look-for [filename]
+  (println filename ":" (kind filename)))
+
+(look-for "input.txt")
+(look-for "/input.txt")
+(look-for "docs")
+(look-for "/docs")
diff --git a/Task/Check-that-file-exists/Erlang/check-that-file-exists.erl b/Task/Check-that-file-exists/Erlang/check-that-file-exists.erl
new file mode 100644
index 0000000000..b21ff923b0
--- /dev/null
+++ b/Task/Check-that-file-exists/Erlang/check-that-file-exists.erl
@@ -0,0 +1,23 @@
+#!/usr/bin/escript
+file_exists(Filename) ->
+  { Flag, _ } = file:read_file_info(Filename), Flag == ok.
+
+dir_exists(Filename) ->
+  { Flag, Info } = file:read_file_info(Filename),
+  (Flag == ok) andalso (element(3, Info) == directory).
+
+print_result(Flag, Filename) ->
+  Tail = if
+    Flag -> "exists";
+    true -> "does not exist"
+  end,
+  io:put_chars(lists:concat([Filename, " ", Tail, "\n"])).
+
+check_file(Filename) -> print_result(file_exists(Filename), Filename).
+check_dir(Filename) -> print_result(dir_exists(Filename), Filename).
+
+main(_) ->
+  check_file("input.txt"),
+  check_dir("docs"),
+  check_file("/input.txt"),
+  check_dir("/docs").
diff --git a/Task/Check-that-file-exists/Forth/check-that-file-exists.fth b/Task/Check-that-file-exists/Forth/check-that-file-exists.fth
new file mode 100644
index 0000000000..aac193b53d
--- /dev/null
+++ b/Task/Check-that-file-exists/Forth/check-that-file-exists.fth
@@ -0,0 +1,5 @@
+: .exists ( str len -- ) 2dup file-status nip 0= if type ."  exists" else type ."  does not exist" then ;
+ s" input.txt" .exists
+s" /input.txt" .exists
+ s" docs" .exists
+s" /docs" .exists
diff --git a/Task/Check-that-file-exists/Fortran/check-that-file-exists-1.f b/Task/Check-that-file-exists/Fortran/check-that-file-exists-1.f
new file mode 100644
index 0000000000..b03ca11948
--- /dev/null
+++ b/Task/Check-that-file-exists/Fortran/check-that-file-exists-1.f
@@ -0,0 +1,4 @@
+LOGICAL :: file_exists
+INQUIRE(FILE="input.txt", EXIST=file_exists)   ! file_exists will be TRUE if the file
+                                               ! exists and FALSE otherwise
+INQUIRE(FILE="/input.txt", EXIST=file_exists)
diff --git a/Task/Check-that-file-exists/Fortran/check-that-file-exists-2.f b/Task/Check-that-file-exists/Fortran/check-that-file-exists-2.f
new file mode 100644
index 0000000000..99e99ece03
--- /dev/null
+++ b/Task/Check-that-file-exists/Fortran/check-that-file-exists-2.f
@@ -0,0 +1,9 @@
+logical :: dir_e
+! a trick to be sure docs is a dir
+inquire( file="./docs/.", exist=dir_e )
+if ( dir_e ) then
+  write(*,*), "dir exists!"
+else
+  ! workaround: it calls an extern program...
+  call system('mkdir docs')
+end if
diff --git a/Task/Check-that-file-exists/Go/check-that-file-exists.go b/Task/Check-that-file-exists/Go/check-that-file-exists.go
new file mode 100644
index 0000000000..f4fde08d58
--- /dev/null
+++ b/Task/Check-that-file-exists/Go/check-that-file-exists.go
@@ -0,0 +1,24 @@
+package main
+
+import (
+    "fmt"
+    "os"
+)
+
+func printStat(p string) {
+    switch i, err := os.Stat(p); {
+    case err != nil:
+        fmt.Println(err)
+    case i.IsDir():
+        fmt.Println(p, "is a directory")
+    default:
+        fmt.Println(p, "is a file")
+    }
+}
+
+func main() {
+    printStat("input.txt")
+    printStat("/input.txt")
+    printStat("docs")
+    printStat("/docs")
+}
diff --git a/Task/Check-that-file-exists/Haskell/check-that-file-exists.hs b/Task/Check-that-file-exists/Haskell/check-that-file-exists.hs
new file mode 100644
index 0000000000..83c6bf60c4
--- /dev/null
+++ b/Task/Check-that-file-exists/Haskell/check-that-file-exists.hs
@@ -0,0 +1,13 @@
+import System.IO
+import System.Directory
+
+check :: (FilePath -> IO Bool) -> FilePath -> IO ()
+check p s = do
+  result <- p s
+  putStrLn $ s ++ if result then " does exist" else " does not exist"
+
+main = do
+  check doesFileExist "input.txt"
+  check doesDirectoryExist "docs"
+  check doesFileExist "/input.txt"
+  check doesDirectoryExist "/docs"
diff --git a/Task/Check-that-file-exists/Java/check-that-file-exists-1.java b/Task/Check-that-file-exists/Java/check-that-file-exists-1.java
new file mode 100644
index 0000000000..4454deb2d1
--- /dev/null
+++ b/Task/Check-that-file-exists/Java/check-that-file-exists-1.java
@@ -0,0 +1,18 @@
+import java.io.File;
+public class FileExistsTest {
+   public static boolean isFileExists(String filename) {
+       boolean exists = new File(filename).exists();
+       return exists;
+   }
+   public static void test(String type, String filename) {
+       System.out.println("The following " + type + " called " + filename +
+           (isFileExists(filename) ? " exists." : " not exists.")
+       );
+   }
+   public static void main(String args[]) {
+        test("file", "input.txt");
+        test("file", File.separator + "input.txt");
+        test("directory", "docs");
+        test("directory", File.separator + "docs" + File.separator);
+   }
+}
diff --git a/Task/Check-that-file-exists/Java/check-that-file-exists-2.java b/Task/Check-that-file-exists/Java/check-that-file-exists-2.java
new file mode 100644
index 0000000000..fe89c6ade7
--- /dev/null
+++ b/Task/Check-that-file-exists/Java/check-that-file-exists-2.java
@@ -0,0 +1,20 @@
+import java.nio.file.FileSystem;
+import java.nio.file.FileSystems;
+import java.nio.file.Files;
+public class FileExistsTest{
+   private static FileSystem defaultFS = FileSystems.getDefault();
+   public static boolean isFileExists(String filename){
+       return Files.exists(defaultFS.getPath(filename));
+   }
+   public static void test(String type, String filename){
+       System.out.println("The following " + type + " called " + filename +
+           (isFileExists(filename) ? " exists." : " not exists.")
+       );
+   }
+   public static void main(String args[]){
+        test("file", "input.txt");
+        test("file", defaultFS.getSeparator() + "input.txt");
+        test("directory", "docs");
+        test("directory", defaultFS.getSeparator() + "docs" + defaultFS.getSeparator());
+   }
+}
diff --git a/Task/Check-that-file-exists/JavaScript/check-that-file-exists.js b/Task/Check-that-file-exists/JavaScript/check-that-file-exists.js
new file mode 100644
index 0000000000..bb1019ac91
--- /dev/null
+++ b/Task/Check-that-file-exists/JavaScript/check-that-file-exists.js
@@ -0,0 +1,6 @@
+var fso = new ActiveXObject("Scripting.FileSystemObject");
+
+fso.FileExists('input.txt');
+fso.FileExists('c:/input.txt');
+fso.FolderExists('docs');
+fso.FolderExists('c:/docs');
diff --git a/Task/Check-that-file-exists/Lua/check-that-file-exists-1.lua b/Task/Check-that-file-exists/Lua/check-that-file-exists-1.lua
new file mode 100644
index 0000000000..192a01934b
--- /dev/null
+++ b/Task/Check-that-file-exists/Lua/check-that-file-exists-1.lua
@@ -0,0 +1,12 @@
+function output( s, b )
+    if b then
+        print ( s, " does not exist." )
+    else
+        print ( s, " does exist." )
+    end
+end
+
+output( "input.txt",  io.open( "input.txt", "r" ) == nil )
+output( "/input.txt", io.open( "/input.txt", "r" ) == nil )
+output( "docs",  io.open( "docs", "r" ) == nil )
+output( "/docs", io.open( "/docs", "r" ) == nil )
diff --git a/Task/Check-that-file-exists/Lua/check-that-file-exists-2.lua b/Task/Check-that-file-exists/Lua/check-that-file-exists-2.lua
new file mode 100644
index 0000000000..cf6fc8a00b
--- /dev/null
+++ b/Task/Check-that-file-exists/Lua/check-that-file-exists-2.lua
@@ -0,0 +1,9 @@
+require "lfs"
+for i, path in ipairs({"input.txt", "/input.txt", "docs", "/docs"}) do
+    local mode = lfs.attributes(path, "mode")
+    if mode then
+        print(path .. " exists and is a " .. mode .. ".")
+    else
+        print(path .. " does not exist.")
+    end
+end
diff --git a/Task/Check-that-file-exists/PHP/check-that-file-exists.php b/Task/Check-that-file-exists/PHP/check-that-file-exists.php
new file mode 100644
index 0000000000..4f491fad83
--- /dev/null
+++ b/Task/Check-that-file-exists/PHP/check-that-file-exists.php
@@ -0,0 +1,4 @@
+if (file_exists('input.txt')) echo 'input.txt is here right by my side';
+if (file_exists('docs'     )) echo 'docs is here with me';
+if (file_exists('/input.txt')) echo 'input.txt is over there in the root dir';
+if (file_exists('/docs'    )) echo 'docs is over there in the root dir';
diff --git a/Task/Check-that-file-exists/Perl/check-that-file-exists.pl b/Task/Check-that-file-exists/Perl/check-that-file-exists.pl
new file mode 100644
index 0000000000..d12b48828a
--- /dev/null
+++ b/Task/Check-that-file-exists/Perl/check-that-file-exists.pl
@@ -0,0 +1,7 @@
+use File::Spec::Functions qw(catfile rootdir);
+# here
+print -e 'input.txt';
+print -d 'docs';
+# root dir
+print -e catfile rootdir, 'input.txt';
+print -d catfile rootdir, 'docs';
diff --git a/Task/Check-that-file-exists/PicoLisp/check-that-file-exists.l b/Task/Check-that-file-exists/PicoLisp/check-that-file-exists.l
new file mode 100644
index 0000000000..503ff761d7
--- /dev/null
+++ b/Task/Check-that-file-exists/PicoLisp/check-that-file-exists.l
@@ -0,0 +1,3 @@
+(if (info "file.txt")
+   (prinl "Size: " (car @) " bytes, last modified " (stamp (cadr @) (cddr @)))
+   (prinl "File doesn't exist") )
diff --git a/Task/Check-that-file-exists/Python/check-that-file-exists.py b/Task/Check-that-file-exists/Python/check-that-file-exists.py
new file mode 100644
index 0000000000..c8923a4f77
--- /dev/null
+++ b/Task/Check-that-file-exists/Python/check-that-file-exists.py
@@ -0,0 +1,6 @@
+import os
+
+os.path.exists("input.txt")
+os.path.exists("/input.txt")
+os.path.exists("docs")
+os.path.exists("/docs")
diff --git a/Task/Check-that-file-exists/R/check-that-file-exists.r b/Task/Check-that-file-exists/R/check-that-file-exists.r
new file mode 100644
index 0000000000..0b9f2b7a0f
--- /dev/null
+++ b/Task/Check-that-file-exists/R/check-that-file-exists.r
@@ -0,0 +1,7 @@
+file.exists("input.txt")
+file.exists("/input.txt")
+file.exists("docs")
+file.exists("/docs")
+
+# or
+file.exists("input.txt", "/input.txt", "docs", "/docs")
diff --git a/Task/Check-that-file-exists/Ruby/check-that-file-exists-1.rb b/Task/Check-that-file-exists/Ruby/check-that-file-exists-1.rb
new file mode 100644
index 0000000000..3eecbe44ee
--- /dev/null
+++ b/Task/Check-that-file-exists/Ruby/check-that-file-exists-1.rb
@@ -0,0 +1,4 @@
+File.file?("input.txt")
+File.file?("/input.txt")
+File.directory?("docs")
+File.directory?("/docs")
diff --git a/Task/Check-that-file-exists/Ruby/check-that-file-exists-2.rb b/Task/Check-that-file-exists/Ruby/check-that-file-exists-2.rb
new file mode 100644
index 0000000000..c41d8a3a71
--- /dev/null
+++ b/Task/Check-that-file-exists/Ruby/check-that-file-exists-2.rb
@@ -0,0 +1,4 @@
+["input.txt", "/input.txt"].each { |f|
+  printf "%s is a regular file? %s\n", f, File.file?(f) }
+["docs", "/docs"].each { |d|
+  printf "%s is a directory? %s\n", d, File.directory?(d) }
diff --git a/Task/Check-that-file-exists/Scheme/check-that-file-exists.ss b/Task/Check-that-file-exists/Scheme/check-that-file-exists.ss
new file mode 100644
index 0000000000..5a064bcb74
--- /dev/null
+++ b/Task/Check-that-file-exists/Scheme/check-that-file-exists.ss
@@ -0,0 +1 @@
+(file-exists? filename)
diff --git a/Task/Check-that-file-exists/Smalltalk/check-that-file-exists-1.st b/Task/Check-that-file-exists/Smalltalk/check-that-file-exists-1.st
new file mode 100644
index 0000000000..689e7011a3
--- /dev/null
+++ b/Task/Check-that-file-exists/Smalltalk/check-that-file-exists-1.st
@@ -0,0 +1,2 @@
+FileDirectory new fileExists: 'c:\serial'.
+(FileDirectory on: 'c:\') directoryExists: 'docs'.
diff --git a/Task/Check-that-file-exists/Smalltalk/check-that-file-exists-2.st b/Task/Check-that-file-exists/Smalltalk/check-that-file-exists-2.st
new file mode 100644
index 0000000000..99798e8395
--- /dev/null
+++ b/Task/Check-that-file-exists/Smalltalk/check-that-file-exists-2.st
@@ -0,0 +1,4 @@
+(Directory name: 'docs') exists ifTrue: [ ... ]
+(Directory name: 'c:\docs') exists ifTrue: [ ... ]
+(File name: 'serial') isFile ifTrue: [ ... ]
+(File name: 'c:\serial') isFile ifTrue: [ ... ]
diff --git a/Task/Check-that-file-exists/Tcl/check-that-file-exists.tcl b/Task/Check-that-file-exists/Tcl/check-that-file-exists.tcl
new file mode 100644
index 0000000000..748550ca14
--- /dev/null
+++ b/Task/Check-that-file-exists/Tcl/check-that-file-exists.tcl
@@ -0,0 +1,15 @@
+if { [file exists "input.txt"] } {
+    puts "input.txt exists"
+}
+
+if { [file exists [file nativename "/input.txt"]] } {
+    puts "/input.txt exists"
+}
+
+if { [file isdirectory "docs"] } {
+    puts "docs exists and is a directory"
+}
+
+if { [file isdirectory [file nativename "/docs"]] } {
+    puts "/docs exists and is a directory"
+}
diff --git a/Task/Checkpoint-synchronization/0DESCRIPTION b/Task/Checkpoint-synchronization/0DESCRIPTION
new file mode 100644
index 0000000000..3637045634
--- /dev/null
+++ b/Task/Checkpoint-synchronization/0DESCRIPTION
@@ -0,0 +1,11 @@
+The checkpoint synchronization is a problem of synchronizing multiple [[task]]s. Consider a workshop where several workers ([[task]]s) assembly details of some mechanism. When each of them completes his work they put the details together. There is no store, so a worker who finished its part first must wait for others before starting another one. Putting details together is the ''checkpoint'' at which [[task]]s synchronize themselves before going their paths apart.
+
+'''The task'''
+
+Implement checkpoint synchronization in your language.
+
+Make sure that the solution is [[Race condition|race condition]]-free. Note that a straightforward solution based on [[event]]s is exposed to [[Race condition|race condition]]. Let two [[task]]s A and B need to be synchronized at a checkpoint. Each signals its event (''EA'' and ''EB'' correspondingly), then waits for the AND-combination of the events (''EA''&''EB'') and resets its event. Consider the following scenario: A signals ''EA'' first and gets blocked waiting for ''EA''&''EB''. Then B signals ''EB'' and loses the processor. Then A is released (both events are signaled) and resets ''EA''. Now if B returns and enters waiting for ''EA''&''EB'', it gets lost.
+
+When a worker is ready it shall not continue before others finish. A typical implementation bug is when a worker is counted twice within one working cycle causing its premature completion. This happens when the quickest worker serves its cycle two times while the laziest one is lagging behind.
+
+If you can, implement workers joining and leaving.
diff --git a/Task/Checkpoint-synchronization/1META.yaml b/Task/Checkpoint-synchronization/1META.yaml
new file mode 100644
index 0000000000..f6cada46d5
--- /dev/null
+++ b/Task/Checkpoint-synchronization/1META.yaml
@@ -0,0 +1,6 @@
+---
+category:
+- Classic CS problems and programs
+note: Concurrency
+requires:
+- Concurrency
diff --git a/Task/Checkpoint-synchronization/Ada/checkpoint-synchronization.ada b/Task/Checkpoint-synchronization/Ada/checkpoint-synchronization.ada
new file mode 100644
index 0000000000..8bd5e8d809
--- /dev/null
+++ b/Task/Checkpoint-synchronization/Ada/checkpoint-synchronization.ada
@@ -0,0 +1,101 @@
+with Ada.Calendar;               use Ada.Calendar;
+with Ada.Numerics.Float_Random;
+with Ada.Text_IO;                use Ada.Text_IO;
+
+procedure Test_Checkpoint is
+
+   package FR renames Ada.Numerics.Float_Random;
+   No_Of_Cubicles: constant Positive := 3;
+     -- That many workers can work in parallel
+   No_Of_Workers: constant Positive := 6;
+     -- That many workers are potentially available
+     -- some will join the team when others quit the job
+
+   type Activity_Array is array(Character) of Boolean;
+     -- we want to know who is currently working
+
+   protected Checkpoint is
+      entry Deliver;
+      entry Join (Label : out Character; Tolerance: out Float);
+      entry Leave(Label : in Character);
+   private
+      Signaling     : Boolean   := False;
+      Ready_Count   : Natural   := 0;
+      Worker_Count  : Natural   := 0;
+      Unused_Label  : Character := 'A';
+      Likelyhood_To_Quit: Float := 1.0;
+      Active        : Activity_Array := (others => false);
+      entry Lodge;
+   end Checkpoint;
+
+   protected body Checkpoint is
+      entry Join (Label : out Character; Tolerance: out Float)
+      when not Signaling and Worker_Count < No_Of_Cubicles is
+      begin
+         Label        := Unused_Label;
+         Active(Label):= True;
+         Unused_Label := Character'Succ (Unused_Label);
+         Worker_Count := Worker_Count + 1;
+         Likelyhood_To_Quit := Likelyhood_To_Quit / 2.0;
+         Tolerance    := Likelyhood_To_Quit;
+      end Join;
+
+      entry Leave(Label: in Character) when not Signaling is
+      begin
+         Worker_Count  := Worker_Count - 1;
+         Active(Label) := False;
+      end Leave;
+
+      entry Deliver when not Signaling is
+      begin
+         Ready_Count := Ready_Count + 1;
+         requeue Lodge;
+      end Deliver;
+
+      entry Lodge when Ready_Count = Worker_Count or Signaling is
+      begin
+         if Ready_Count = Worker_Count then
+            Put("---Sync Point [");
+            for C in Character loop
+               if Active(C) then
+                  Put(C);
+               end if;
+            end loop;
+            Put_Line("]---");
+         end if;
+         Ready_Count := Ready_Count - 1;
+         Signaling   := Ready_Count /= 0;
+      end Lodge;
+   end Checkpoint;
+
+   task type Worker;
+
+   task body Worker is
+      Dice      : FR.Generator;
+      Label     : Character;
+      Tolerance : Float;
+      Shift_End : Time := Clock + 2.0;
+        -- Trade unions are hard!
+   begin
+      FR.Reset (Dice);
+      Checkpoint.Join (Label, Tolerance);
+      Put_Line(Label & " joins the team");
+      loop
+         Put_Line (Label & " is working");
+         delay Duration (FR.Random (Dice) * 0.500);
+         Put_Line (Label & " is ready");
+         Checkpoint.Deliver;
+         if FR.Random(Dice) < Tolerance then
+            Put_Line(Label & " leaves the team");
+            exit;
+         elsif Clock >= Shift_End then
+            Put_Line(Label & " ends shift");
+            exit;
+         end if;
+      end loop;
+      Checkpoint.Leave(Label);
+   end Worker;
+   Set : array (1..No_Of_Workers) of Worker;
+begin
+   null; -- Nothing to do here
+end Test_Checkpoint;
diff --git a/Task/Checkpoint-synchronization/C/checkpoint-synchronization.c b/Task/Checkpoint-synchronization/C/checkpoint-synchronization.c
new file mode 100644
index 0000000000..601c09e33a
--- /dev/null
+++ b/Task/Checkpoint-synchronization/C/checkpoint-synchronization.c
@@ -0,0 +1,31 @@
+#include 
+#include 
+#include 
+#include 
+
+int main()
+{
+        int jobs = 41, tid;
+        omp_set_num_threads(5);
+
+        #pragma omp parallel shared(jobs) private(tid)
+        {
+                tid = omp_get_thread_num();
+                while (jobs > 0) {
+                        /* this is the checkpoint */
+                        #pragma omp barrier
+                        if (!jobs) break;
+
+                        printf("%d: taking job %d\n", tid, jobs--);
+                        usleep(100000 + rand() / (double) RAND_MAX * 3000000);
+                        printf("%d: done job\n", tid);
+                }
+
+                printf("[%d] leaving\n", tid);
+
+                /* this stops jobless thread from exiting early and killing workers */
+                #pragma omp barrier
+        }
+
+        return 0;
+}
diff --git a/Task/Checkpoint-synchronization/Go/checkpoint-synchronization.go b/Task/Checkpoint-synchronization/Go/checkpoint-synchronization.go
new file mode 100644
index 0000000000..a25040b737
--- /dev/null
+++ b/Task/Checkpoint-synchronization/Go/checkpoint-synchronization.go
@@ -0,0 +1,68 @@
+package main
+
+import (
+    "log"
+    "math/rand"
+    "os"
+    "sync"
+    "time"
+)
+
+const nMech = 5
+const detailsPerMech = 4
+
+var l = log.New(os.Stdout, "", 0)
+
+func main() {
+    assemble := make(chan int)
+    var complete sync.WaitGroup
+
+    go solicit(assemble, &complete, nMech*detailsPerMech)
+
+    for i := 1; i <= nMech; i++ {
+        complete.Add(detailsPerMech)
+        for j := 0; j < detailsPerMech; j++ {
+            assemble <- 0
+        }
+        // Go checkpoint feature
+        complete.Wait()
+        // checkpoint reached
+        l.Println("mechanism", i, "completed")
+    }
+}
+
+func solicit(a chan int, c *sync.WaitGroup, nDetails int) {
+    rand.Seed(time.Now().UnixNano())
+    var id int // worker id, for output
+    for nDetails > 0 {
+        // some random time to find a worker
+        time.Sleep(time.Duration(5e8 + rand.Int63n(5e8)))
+        id++
+        // contract to assemble a certain number of details
+        contract := rand.Intn(5) + 1
+        if contract > nDetails {
+            contract = nDetails
+        }
+        dword := "details"
+        if contract == 1 {
+            dword = "detail"
+        }
+        l.Println("worker", id, "contracted to assemble", contract, dword)
+        go worker(a, c, contract, id)
+        nDetails -= contract
+    }
+}
+
+func worker(a chan int, c *sync.WaitGroup, contract, id int) {
+    // some random time it takes for this worker to assemble a detail
+    assemblyTime := time.Duration(5e8 + rand.Int63n(5e8))
+    l.Println("worker", id, "enters shop")
+    for i := 0; i < contract; i++ {
+        <-a
+        l.Println("worker", id, "assembling")
+        time.Sleep(assemblyTime)
+        l.Println("worker", id, "completed detail")
+        c.Done()
+    }
+    l.Println("worker", id, "leaves shop")
+}
diff --git a/Task/Checkpoint-synchronization/Haskell/checkpoint-synchronization-1.hs b/Task/Checkpoint-synchronization/Haskell/checkpoint-synchronization-1.hs
new file mode 100644
index 0000000000..8d99ca1bc3
--- /dev/null
+++ b/Task/Checkpoint-synchronization/Haskell/checkpoint-synchronization-1.hs
@@ -0,0 +1,82 @@
+import Control.Parallel
+
+data Task a = Idle | Make a
+type TaskList a = [a]
+type Results a = [a]
+type TaskGroups a = [TaskList a]
+type WorkerList a = [Worker a]
+type Worker a = [Task a]
+
+-- run tasks in parallel and collect their results
+-- the function doesn't return until all tasks are done, therefore
+-- finished threads wait for the others to finish.
+runTasks :: TaskList a -> Results a
+runTasks [] = []
+runTasks (x:[]) = x : []
+runTasks (x:y:[]) = y `par` x : y : []
+runTasks (x:y:ys) = y `par` x : y : runTasks ys
+
+-- take a list of workers with different numbers of tasks and group
+-- them: first the first task of each worker, then the second one etc.
+groupTasks :: WorkerList a -> TaskGroups a
+groupTasks [] = []
+groupTasks xs
+    | allWorkersIdle xs = []
+    | otherwise =
+        concatMap extractTask xs : groupTasks (map removeTask xs)
+
+-- return a task as a plain value
+extractTask :: Worker a -> [a]
+extractTask [] = []
+extractTask (Idle:_) = []
+extractTask (Make a:_) = [a]
+
+-- remove the foremost task of each worker
+removeTask :: Worker a -> Worker a
+removeTask = drop 1
+
+-- checks whether all workers are idle in this task
+allWorkersIdle :: WorkerList a -> Bool
+allWorkersIdle = all null . map extractTask
+
+-- the workers must calculate big sums. the first sum of each worker
+-- belongs to the first task, and so on.
+-- because of laziness, nothing is computed yet.
+
+-- worker1 has 5 tasks to do
+worker1 :: Worker Integer
+worker1 = map Make [ sum [1..n*1000000] | n <- [1..5] ]
+
+-- worker2 has 4 tasks to do
+worker2 :: Worker Integer
+worker2 = map Make [ sum [1..n*100000] | n <- [1..4] ]
+
+-- worker3 has 3 tasks to do
+worker3 :: Worker Integer
+worker3 = map Make [ sum [1..n*1000000] | n <- [1..3] ]
+
+-- worker4 has 5 tasks to do
+worker4 :: Worker Integer
+worker4 = map Make [ sum [1..n*300000] | n <- [1..5] ]
+
+-- worker5 has 4 tasks to do, but starts at the second task.
+worker5 :: Worker Integer
+worker5 = [Idle] ++ map Make [ sum [1..n*400000] | n <- [1..4] ]
+
+-- group the workers' tasks
+tasks :: TaskGroups Integer
+tasks = groupTasks [worker1, worker2, worker3, worker4, worker5]
+
+-- a workshop: take a function to operate the results and a group of tasks,
+-- execute the tasks showing the process and process the results
+workshop :: (Show a, Num a, Show b, Num b) => ([a] -> b) -> [[a]] -> IO ()
+workshop func a = mapM_ doWork $ zip [1..length a] a
+    where
+        doWork (x, y) = do
+            putStrLn $ "Doing task " ++ show x ++ "."
+            putStrLn $ "There are " ++ show (length y) ++ " workers for this task."
+            putStrLn "Waiting for all workers..."
+            print $ func $ runTasks y
+            putStrLn $ "Task " ++ show x ++ " done."
+
+main = workshop sum tasks
diff --git a/Task/Checkpoint-synchronization/Haskell/checkpoint-synchronization-2.hs b/Task/Checkpoint-synchronization/Haskell/checkpoint-synchronization-2.hs
new file mode 100644
index 0000000000..969e5d0b56
--- /dev/null
+++ b/Task/Checkpoint-synchronization/Haskell/checkpoint-synchronization-2.hs
@@ -0,0 +1,112 @@
+import Control.Concurrent
+import Control.Monad        -- needed for "forM", "forM_"
+
+-- (workers working, workers done, workers total)
+type Workshop = MVar (Int, Int, Int)
+-- list of IO actions to be performed by one worker
+type Actions = [IO ()]
+
+newWorkshop :: IO Workshop
+newWorkshop = newMVar (0, 0, 0)
+
+-- check point: workers wait here for the other workers to
+-- finish, before resuming execution/restarting
+checkPoint :: Workshop -> IO ()
+checkPoint w = do
+    (working, done, count) <- takeMVar w
+    -- all workers are done: reset counters and return (threads
+    -- resume execution or restart)
+    if working <= 0 && done == count
+    then do
+            putStrLn "---- Check Point"
+            putMVar w (0, 0, count)
+    -- mvar was just initialized: do nothing, just return.
+    -- otherwise, a race condition may arise
+    else if working == 0 && done == 0
+            then putMVar w (working, done, count)
+    -- workers are still working: wait for them (loop)
+    else do
+            putMVar w (working, done, count)
+            checkPoint w
+
+-- join the workshop
+addWorker :: Workshop -> ThreadId -> IO ()
+addWorker w i = do
+    (working, done, count) <- takeMVar w
+    putStrLn $ "Worker " ++ show i ++ " has joined the group."
+    putMVar w (working, done, count + 1)
+
+-- leave the workshop
+removeWorker :: Workshop -> ThreadId -> IO ()
+removeWorker w i = do
+    (working, done, count) <- takeMVar w
+    putStrLn $ "Worker " ++ show i ++ " has left the group."
+    putMVar w (working, done, count - 1)
+
+-- increase the number of workers doing something.
+-- optionally, print a message using the thread's ID
+startWork :: Workshop -> ThreadId -> IO ()
+startWork w i = do
+    (working, done, count) <- takeMVar w
+    putStrLn $ "Worker " ++ show i ++ " has started."
+    putMVar w (working + 1, done, count)
+
+-- decrease the number of workers doing something and increase the
+-- number of workers done. optionally, print a message using
+-- the thread's ID
+finishWork :: Workshop -> ThreadId -> IO ()
+finishWork w i = do
+    (working, done, count) <- takeMVar w
+    putStrLn $ "Worker " ++ show i ++ " is ready."
+    putMVar w (working - 1, done + 1, count)
+
+-- put a worker to do his tasks. the steps are:
+-- 1. join the workshop "w"
+-- 2. report that the worker has started an action
+-- 3. perform one action
+-- 4. report that the worker is ready for the next action
+-- 5. wait for the other workers to finish
+-- 6. repeat from 2 until the worker has nothing more to do
+-- 7. leave the workshop
+worker :: Workshop -> Actions -> IO ()
+worker w actions = do
+    i <- myThreadId
+    addWorker w i
+    forM_ actions $ \action -> do
+        startWork w i
+        action
+        finishWork w i
+        checkPoint w
+    removeWorker w i
+
+-- launch several worker threads. their thread ID's are returned
+shop :: Workshop -> [Actions] -> IO [ThreadId]
+shop w actions = do
+    forM actions $ \x -> forkIO (worker w x)
+
+main = do
+    -- make a workshop
+    w <- newWorkshop
+
+    -- the workers won't be doing anything special, just wait for n
+    -- regular intervals. pids gathers the ID's of the threads
+
+    -- this are the first workers joining the workshop
+    pids1 <- shop w
+        [replicate 5 $ threadDelay 1300000
+        ,replicate 10 $ threadDelay 759191
+        ,replicate 7 $ threadDelay 965300]
+
+    -- wait for 5 secs before the next workers join
+    threadDelay 5000000
+
+    -- these are other workers that join the workshop later
+    pids2 <- shop w
+        [replicate 6 $ threadDelay 380000
+        ,replicate 4 $ threadDelay 250000]
+
+    -- wait for a key press
+    getChar
+
+    -- kill all worker threads before exit, if they're still running
+    forM_ (pids1 ++ pids2) killThread
diff --git a/Task/Checkpoint-synchronization/Java/checkpoint-synchronization-1.java b/Task/Checkpoint-synchronization/Java/checkpoint-synchronization-1.java
new file mode 100644
index 0000000000..ef360c361a
--- /dev/null
+++ b/Task/Checkpoint-synchronization/Java/checkpoint-synchronization-1.java
@@ -0,0 +1,89 @@
+import java.util.Scanner;
+import java.util.Random;
+
+public class CheckpointSync{
+	public static void main(String[] args){
+		System.out.print("Enter number of workers to use: ");
+		Scanner in = new Scanner(System.in);
+		Worker.nWorkers = in.nextInt();
+		System.out.print("Enter number of tasks to complete:");
+		runTasks(in.nextInt());
+	}
+	
+	/*
+	 * Informs that workers started working on the task and
+	 * starts running threads. Prior to proceeding with next
+	 * task syncs using static Worker.checkpoint() method.
+	 */
+	private static void runTasks(int nTasks){
+		for(int i = 0; i < nTasks; i++){
+			System.out.println("Starting task number " + (i+1) + ".");
+			runThreads();
+			Worker.checkpoint();
+		}
+	}
+	
+	/*
+	 * Creates a thread for each worker and runs it.
+	 */
+	private static void runThreads(){
+		for(int i = 0; i < Worker.nWorkers; i ++){
+			new Thread(new Worker(i+1)).start();
+		}
+	}
+	
+	/*
+	 * Worker inner static class.
+	 */
+	public static class Worker implements Runnable{
+		public Worker(int threadID){
+			this.threadID = threadID;
+		}
+		public void run(){
+			work();
+		}
+		
+		/*
+		 *  Notifies that thread started running for 100 to 1000 msec.
+		 *  Once finished increments static counter 'nFinished'
+		 *  that counts number of workers finished their work.
+		 */
+		private synchronized void work(){
+			try {
+				int workTime = rgen.nextInt(900) + 100;
+				System.out.println("Worker " + threadID + " will work for " + workTime + " msec.");
+				Thread.sleep(workTime); //work for 'workTime'
+				nFinished++; //increases work finished counter
+				System.out.println("Worker " + threadID + " is ready");
+			} catch (InterruptedException e) {
+				System.err.println("Error: thread execution interrupted");
+				e.printStackTrace();
+			}
+		}
+		
+		/*
+		 * Used to synchronize Worker threads using 'nFinished' static integer.
+		 * Waits (with step of 10 msec) until 'nFinished' equals to 'nWorkers'.
+		 * Once they are equal resets 'nFinished' counter.
+		 */
+		public static synchronized void checkpoint(){
+			while(nFinished != nWorkers){
+				try {
+					Thread.sleep(10);
+				} catch (InterruptedException e) {
+					System.err.println("Error: thread execution interrupted");
+					e.printStackTrace();
+				}
+			}
+			nFinished = 0;
+		}
+	
+		/* inner class instance variables */
+		private int threadID;
+		
+		/* static variables */
+		private static Random rgen = new Random();
+		private static int nFinished = 0;
+		public static int nWorkers = 0;
+	}
+}
diff --git a/Task/Checkpoint-synchronization/Java/checkpoint-synchronization-2.java b/Task/Checkpoint-synchronization/Java/checkpoint-synchronization-2.java
new file mode 100644
index 0000000000..c47975cc1b
--- /dev/null
+++ b/Task/Checkpoint-synchronization/Java/checkpoint-synchronization-2.java
@@ -0,0 +1,48 @@
+import java.util.Random;
+import java.util.concurrent.CountDownLatch;
+
+public class Sync {
+	static class Worker implements Runnable {
+		private final CountDownLatch doneSignal;
+		private int threadID;
+
+		public Worker(int id, CountDownLatch doneSignal) {
+			this.doneSignal = doneSignal;
+			threadID = id;
+		}
+
+		public void run() {
+			doWork();
+			doneSignal.countDown();
+		}
+
+		void doWork() {
+			try {
+				int workTime = new Random().nextInt(900) + 100;
+				System.out.println("Worker " + threadID + " will work for " + workTime + " msec.");
+				Thread.sleep(workTime); //work for 'workTime'
+				System.out.println("Worker " + threadID + " is ready");
+			} catch (InterruptedException e) {
+				System.err.println("Error: thread execution interrupted");
+				e.printStackTrace();
+			}
+		}
+	}
+
+	public static void main(String[] args) {
+		int n = 3;//6 workers and 3 tasks
+		for(int task = 1; task <= n; task++) {
+			CountDownLatch latch = new CountDownLatch(n * 2);
+			System.out.println("Starting task " + task);
+			for(int worker = 0; worker < n * 2; worker++) {
+				new Thread(new Worker(worker, latch)).start();
+			}
+			try {
+				latch.await();//wait for n*2 threads to signal the latch
+			} catch (InterruptedException e) {
+				e.printStackTrace();
+			}
+			System.out.println("Task " + task + " complete");
+		}
+	}
+}
diff --git a/Task/Checkpoint-synchronization/Perl/checkpoint-synchronization.pl b/Task/Checkpoint-synchronization/Perl/checkpoint-synchronization.pl
new file mode 100644
index 0000000000..a92052dc06
--- /dev/null
+++ b/Task/Checkpoint-synchronization/Perl/checkpoint-synchronization.pl
@@ -0,0 +1,69 @@
+#!/usr/bin/perl
+use warnings;
+use strict;
+use v5.10;
+
+use Socket;
+
+my $nr_items = 3;
+
+sub short_sleep($) {
+    (my $seconds) = @_;
+    select undef, undef, undef, $seconds;
+}
+
+# This is run in a worker thread.  It repeatedly waits for a character from
+# the main thread, and sends a value back to the main thread.  A short
+# sleep introduces random timing, just to keep us honest.
+
+sub be_worker($$) {
+    my ($socket, $value) = @_;
+    for (1 .. $nr_items) {
+        sysread $socket, my $dummy, 1;
+        short_sleep rand 0.5;
+        syswrite $socket, $value;
+        ++$value;
+    }
+
+    exit;
+}
+
+# This function forks a worker and sends it a socket on which to talk to
+# the main thread, as well as an initial value to work with.  It returns
+# (to the main thread) a socket on which to talk to the worker.
+
+sub fork_worker($) {
+    (my $value) = @_;
+    socketpair my $kidsock, my $dadsock, AF_UNIX, SOCK_STREAM, PF_UNSPEC
+        or die "socketpair: $!";
+
+    if (fork // die "fork: $!") {
+        # We're the parent
+        close $dadsock;
+        return $kidsock;
+    }
+    else {
+        # We're the child
+        close $kidsock;
+        be_worker $dadsock, $value;
+        # Never returns
+    }
+}
+
+# Fork two workers, send them start signals, retrieve the values they send
+# back, and print them
+
+my $alpha_sock = fork_worker 'A';
+my $digit_sock = fork_worker 1;
+
+for (1 .. $nr_items) {
+    syswrite $_, 'x'   for $alpha_sock, $digit_sock;
+    sysread $alpha_sock, my $alpha, 1;
+    sysread $digit_sock, my $digit, 1;
+    say $alpha, $digit;
+}
+
+# If the main thread were planning to run for a long time after the
+# workers had terminate, it would need to reap them to avoid zombies:
+
+wait; wait;
diff --git a/Task/Checkpoint-synchronization/PicoLisp/checkpoint-synchronization.l b/Task/Checkpoint-synchronization/PicoLisp/checkpoint-synchronization.l
new file mode 100644
index 0000000000..919851b542
--- /dev/null
+++ b/Task/Checkpoint-synchronization/PicoLisp/checkpoint-synchronization.l
@@ -0,0 +1,19 @@
+(de checkpoints (Projects Workers)
+   (for P Projects
+      (prinl "Starting project number " P ":")
+      (for
+         (Staff
+            (mapcar
+               '((I) (worker (format I) (rand 2 5)))  # Create staff of workers
+               (range 1 Workers) )
+            Staff                                     # While still busy
+            (filter worker Staff) ) )                 # Remove finished workers
+      (prinl "Project number " P " is done.") ) )
+
+(de worker (ID Steps)
+   (co ID
+      (prinl "Worker " ID " has " Steps " steps to do")
+      (for N Steps
+         (yield ID)
+         (prinl "Worker " ID " step " N) )
+      NIL ) )
diff --git a/Task/Checkpoint-synchronization/Ruby/checkpoint-synchronization.rb b/Task/Checkpoint-synchronization/Ruby/checkpoint-synchronization.rb
new file mode 100644
index 0000000000..8319861307
--- /dev/null
+++ b/Task/Checkpoint-synchronization/Ruby/checkpoint-synchronization.rb
@@ -0,0 +1,158 @@
+require 'socket'
+
+# A Workshop runs all of its workers, then collects their results. Use
+# Workshop#add to add workers and Workshop#work to run them.
+#
+# This implementation forks some processes to run the workers in
+# parallel. Ruby must provide Kernel#fork and 'socket' library must
+# provide UNIXSocket.
+#
+# Why processes and not threads? C Ruby still has a Global VM Lock,
+# where only one thread can hold the lock. One platform, OpenBSD, still
+# has userspace threads, with all threads on one cpu core. Multiple
+# processes will not compete for a single Global VM Lock and can run
+# on multiple cpu cores.
+class Workshop
+  # Creates a Workshop.
+  def initialize
+    @sockets = {}
+  end
+
+  # Adds a worker to this Workshop. Returns a worker id _wid_ for this
+  # worker. The worker is a block that takes some _args_ and returns
+  # some value. Workshop#work will run the block.
+  #
+  # This implementation forks a process for the worker. This process
+  # will use Marshal with UNIXSocket to receive the _args_ and to send
+  # the return value. The _wid_ is a process id. The worker also
+  # inherits _IO_ objects, which might be a problem if the worker holds
+  # open a pipe or socket, and the other end never reads EOF.
+  def add
+    child, parent = UNIXSocket.pair
+
+    wid = fork do
+      # I am the child.
+      child.close
+      @sockets.each_value { |sibling| sibling.close }
+
+      # Prevent that all the children print their backtraces (to a mess
+      # of mixed lines) when user presses Control-C.
+      Signal.trap("INT") { exit! }
+
+      loop do
+        # Wait for a command.
+        begin
+          command, args = Marshal.load(parent)
+        rescue EOFError
+          # Parent probably died.
+          break
+        end
+
+        case command
+        when :work
+          # Do work. Send result to parent.
+          result = yield *args
+          Marshal.dump(result, parent)
+        when :remove
+          break
+        else
+          fail "bad command from workshop"
+        end
+      end
+    end
+
+    # I am the parent.
+    parent.close
+    @sockets[wid] = child
+    wid
+  end
+
+  # Runs all of the workers, and collects the results in a Hash. Passes
+  # the same _args_ to each of the workers. Returns a Hash that pairs
+  # _wid_ => _result_, where _wid_ is the worker id and _result_ is the
+  # return value from the worker.
+  #
+  # This implementation runs the workers in parallel, and waits until
+  # _all_ of the workers finish their results. Workshop provides no way
+  # to start the work without waiting for the work to finish. If a
+  # worker dies (for example, by raising an Exception), then
+  # Workshop#work raises a RuntimeError.
+  def work(*args)
+    message = [:work, args]
+    @sockets.each_pair do |wid, child|
+      Marshal.dump(message, child)
+    end
+
+    # Checkpoint! Wait for all workers to finish.
+    result = {}
+    @sockets.each_pair do |wid, child|
+      begin
+        # This waits until the child finishes a result.
+        result[wid] = Marshal.load(child)
+      rescue EOFError
+        fail "Worker #{wid} died"
+      end
+    end
+    result
+  end
+
+  # Removes a worker from the Workshop, who has a worker id _wid_.
+  # If there is no such worker, raises ArgumentError.
+  #
+  # This implementation kills and reaps the process for the worker.
+  def remove(wid)
+    unless child = @sockets.delete(wid)
+      raise ArgumentError, "No worker #{wid}"
+    else
+      Marshal.dump([:remove, nil], child)
+      child.close
+      Process.wait(wid)
+    end
+  end
+end
+
+
+
+# First create a Workshop.
+require 'pp'
+shop = Workshop.new
+wids = []
+
+# Our workers must not use the same random numbers after the fork.
+@fixed_rand = false
+def fix_rand
+  unless @fixed_rand; srand; @fixed_rand = true; end
+end
+
+# Start with some workers.
+6.times do
+  wids << shop.add do |i|
+    # This worker slowly calculates a Fibonacci number.
+    fix_rand
+    f = proc { |n| if n < 2 then n else f[n - 1] + f[n - 2] end }
+    [i, f[25 + rand(10)]]
+  end
+end
+
+6.times do |i|
+  # Do one cycle of work, and print the result.
+  pp shop.work(i)
+
+  # Remove a worker.
+  victim = rand(wids.length)
+  shop.remove wids[victim]
+  wids.slice! victim
+
+  # Add another worker.
+  wids << shop.add do |j|
+    # This worker slowly calculates a number from
+    # the sequence 0, 1, 2, 3, 6, 11, 20, 37, 68, 125, ...
+    fix_rand
+    f = proc { |n| if n < 3 then n else f[n - 1] + f[n - 2] + f[n - 3] end }
+    [j, i, f[20 + rand(10)]]
+  end
+end
+
+# Remove all workers.
+wids.each { |wid| shop.remove wid }
+pp shop.work(6)
diff --git a/Task/Checkpoint-synchronization/Tcl/checkpoint-synchronization-1.tcl b/Task/Checkpoint-synchronization/Tcl/checkpoint-synchronization-1.tcl
new file mode 100644
index 0000000000..d19c1a4585
--- /dev/null
+++ b/Task/Checkpoint-synchronization/Tcl/checkpoint-synchronization-1.tcl
@@ -0,0 +1,97 @@
+package require Tcl 8.5
+package require Thread
+
+namespace eval checkpoint {
+    namespace export {[a-z]*}
+    namespace ensemble create
+    variable members {}
+    variable waiting {}
+    variable event
+    # Back-end of join operation
+    proc Join {id} {
+	variable members
+	variable counter
+	if {$id ni $members} {
+	    lappend members $id
+	}
+	return $id
+    }
+    # Back-end of leave operation
+    proc Leave {id} {
+	variable members
+	set idx [lsearch -exact $members $id]
+	if {$idx > -1} {
+	    set members [lreplace $members $idx $idx]
+	    variable event
+	    if {![info exists event]} {
+		set event [after idle ::checkpoint::Release]
+	    }
+	}
+	return
+    }
+    # Back-end of deliver operation
+    proc Deliver {id} {
+	variable waiting
+	lappend waiting $id
+
+	variable event
+	if {![info exists event]} {
+	    set event [after idle ::checkpoint::Release]
+	}
+	return
+    }
+    # Releasing is done as an "idle" action to prevent deadlocks
+    proc Release {} {
+	variable members
+	variable waiting
+	variable event
+	unset event
+	if {[llength $members] != [llength $waiting]} return
+	set w $waiting
+	set waiting {}
+	foreach id $w {
+	    thread::send -async $id {incr ::checkpoint::Delivered}
+	}
+    }
+
+    # Make a thread and attach it to the public API of the checkpoint
+    proc makeThread {{script ""}} {
+	set id [thread::create thread::wait]
+	thread::send $id {
+	    namespace eval checkpoint {
+		namespace export {[a-z]*}
+		namespace ensemble create
+
+		# Call to actually join the checkpoint group
+		proc join {} {
+		    variable checkpoint
+		    thread::send $checkpoint [list \
+			    ::checkpoint::Join [thread::id]]
+		}
+		# Call to actually leave the checkpoint group
+		proc leave {} {
+		    variable checkpoint
+		    thread::send $checkpoint [list \
+			    ::checkpoint::Leave [thread::id]]
+		}
+		# Call to wait for checkpoint synchronization
+		proc deliver {} {
+		    variable checkpoint
+		    # Do this from within the [vwait] to ensure that we're already waiting
+		    after 0 [list thread::send $checkpoint [list \
+			    ::checkpoint::Deliver [thread::id]]]
+		    vwait ::checkpoint::Delivered
+		}
+	    }
+	}
+	thread::send $id [list set ::checkpoint::checkpoint [thread::id]]
+	thread::send $id $script
+	return $id
+    }
+
+    # Utility to help determine whether the checkpoint is in use
+    proc anyJoined {} {
+	variable members
+	expr {[llength $members] > 0}
+    }
+}
diff --git a/Task/Checkpoint-synchronization/Tcl/checkpoint-synchronization-2.tcl b/Task/Checkpoint-synchronization/Tcl/checkpoint-synchronization-2.tcl
new file mode 100644
index 0000000000..52b7071c13
--- /dev/null
+++ b/Task/Checkpoint-synchronization/Tcl/checkpoint-synchronization-2.tcl
@@ -0,0 +1,30 @@
+# Build the workers
+foreach worker {A B C D} {
+    dict set ids $worker [checkpoint makeThread {
+	proc task {name} {
+	    checkpoint join
+	    set deadline [expr {[clock seconds] + 2}]
+	    while {[clock seconds] <= $deadline} {
+		puts "$name is working"
+		after [expr {int(500 * rand())}]
+		puts "$name is ready"
+		checkpoint deliver
+	    }
+	    checkpoint leave
+	    thread::release; # Ask the thread to finish
+	}
+    }]
+}
+
+# Set them all processing in the background
+dict for {name id} $ids {
+    thread::send -async $id "task $name"
+}
+
+# Wait until all tasks are done (i.e., they have unregistered)
+while 1 {
+    after 100 set s 1; vwait s; # Process events for 100ms
+    if {![checkpoint anyJoined]} {
+	break
+    }
+}
diff --git a/Task/Classes/Ada/classes-1.ada b/Task/Classes/Ada/classes-1.ada
new file mode 100644
index 0000000000..784995ecb7
--- /dev/null
+++ b/Task/Classes/Ada/classes-1.ada
@@ -0,0 +1,9 @@
+package My_Package is
+   type My_Type is tagged private;
+   procedure Some_Procedure(Item : out My_Type);
+    function Set(Value : in Integer) return My_Type;
+private
+   type My_Type is tagged record
+      Variable : Integer := -12;
+   end record;
+end My_Package;
diff --git a/Task/Classes/Ada/classes-2.ada b/Task/Classes/Ada/classes-2.ada
new file mode 100644
index 0000000000..c67913211f
--- /dev/null
+++ b/Task/Classes/Ada/classes-2.ada
@@ -0,0 +1,13 @@
+ package body My_Package is
+    procedure Some_Procedure(Item : out My_Type) is
+    begin
+       Item := 2 * Item;
+    end Some_Procedure;
+
+    function Set(Value : Integer) return My_Type is
+       Temp : My_Type;
+    begin
+       Temp.Variable := Value;
+       return Temp;
+    end Set;
+end My_Package;
diff --git a/Task/Classes/Ada/classes-3.ada b/Task/Classes/Ada/classes-3.ada
new file mode 100644
index 0000000000..283518b0da
--- /dev/null
+++ b/Task/Classes/Ada/classes-3.ada
@@ -0,0 +1,8 @@
+with My_Package; use My_Package;
+
+procedure Main is
+   Foo : My_Type; -- Foo is created and initialized to -12
+begin
+   Some_Procedure(Foo); -- Foo is doubled
+   Foo := Set(2007); -- Foo.Variable is set to 2007
+end Main;
diff --git a/Task/Classes/Forth/classes-1.fth b/Task/Classes/Forth/classes-1.fth
new file mode 100644
index 0000000000..e378b68e46
--- /dev/null
+++ b/Task/Classes/Forth/classes-1.fth
@@ -0,0 +1,14 @@
+:class MyClass  1 && b.corkscrew
+}
+
+// a "constructor."
+// Also in quotes as Go does not have that exact mechanism as part of the
+// language.  A common idiom however, is a function with the name new,
+// that returns a new object of the type, fully initialized as needed and
+// ready to use.  It makes sense to use this kind of constructor function when
+// non-trivial initialization is needed.  In cases where the concise syntax
+// shown is sufficient however, it is not idiomatic to define the function.
+// Rather, code that needs a new object would simply contain &picnicBasket{...
+func newPicnicBasket(nPeople int) *picnicBasket {
+    // arbitrary code to interpret arguments, check resources, etc.
+    // ...
+    // return data new object.
+    // this is the concise syntax.  there are other ways of doing it.
+    return &picnicBasket{nPeople, nPeople > 0}
+}
+
+// how to instantiate it.
+func main() {
+    var pb picnicBasket          // create on stack (probably)
+    pbl := picnicBasket{}        // equivalent to above
+    pbp := &picnicBasket{}       // create on heap.  pbp is pointer to object.
+    pbn := new(picnicBasket)     // equivalent to above
+    forTwo := newPicnicBasket(2) // using constructor
+    // equivalent to above.  field names, called keys, are optional.
+    forToo := &picnicBasket{nServings: 2, corkscrew: true}
+
+    fmt.Println(pb.nServings, pb.corkscrew)
+    fmt.Println(pbl.nServings, pbl.corkscrew)
+    fmt.Println(pbp)
+    fmt.Println(pbn)
+    fmt.Println(forTwo)
+    fmt.Println(forToo)
+}
diff --git a/Task/Classes/Haskell/classes-1.hs b/Task/Classes/Haskell/classes-1.hs
new file mode 100644
index 0000000000..3c8cc8347f
--- /dev/null
+++ b/Task/Classes/Haskell/classes-1.hs
@@ -0,0 +1,33 @@
+class Shape a where
+    perimeter :: a -> Double
+    area      :: a -> Double
+{- A type class Shape. Types belonging to Shape must support two
+methods, perimeter and area. -}
+
+data Rectangle = Rectangle Double Double
+{- A new type with a single constructor. In the case of data types
+which have only one constructor, we conventionally give the
+constructor the same name as the type, though this isn't mandatory. -}
+
+data Circle = Circle Double
+
+instance Shape Rectangle where
+    perimeter (Rectangle width height) = 2 * width + 2 * height
+    area      (Rectangle width height) = width * height
+{- We made Rectangle an instance of the Shape class by
+implementing perimeter, area :: Rectangle -> Int. -}
+
+instance Shape Circle where
+    perimeter (Circle radius) = 2 * pi * radius
+    area      (Circle radius) = pi * radius^2
+
+apRatio :: Shape a => a -> Double
+{- A simple polymorphic function. -}
+apRatio shape = area shape / perimeter shape
+
+main = do
+    print $ apRatio $ Circle 5
+    print $ apRatio $ Rectangle 5 5
+{- The correct version of apRatio (and hence the correct
+implementations of perimeter and area) is chosen based on the type
+of the argument. -}
diff --git a/Task/Classes/Perl/classes-1.pl b/Task/Classes/Perl/classes-1.pl
new file mode 100644
index 0000000000..eeb9dc0234
--- /dev/null
+++ b/Task/Classes/Perl/classes-1.pl
@@ -0,0 +1,19 @@
+{
+     # a class is a package (i.e. a namespace) with methods in it
+    package MyClass;
+
+     # a constructor is a function that returns a blessed reference
+    sub new {
+        my $class = shift;
+        bless {variable => 0}, $class;
+         # the instance object is a hashref in disguise.
+         # (it can be a ref to anything.)
+    }
+
+     # an instance method is a function that takes an object as first argument.
+     # the -> invocation syntax takes care of that nicely, see Usage paragraph below.
+    sub some_method {
+        my $self = shift;
+        $self->{variable} = 1;
+    }
+}
diff --git a/Task/Classes/Python/classes-1.py b/Task/Classes/Python/classes-1.py
new file mode 100644
index 0000000000..af2f399327
--- /dev/null
+++ b/Task/Classes/Python/classes-1.py
@@ -0,0 +1,38 @@
+class MyClass:
+    name2 = 2 # Class attribute
+
+    def __init__(self):
+        """
+        Constructor  (Technically an initializer rather than a true "constructor")
+        """
+        self.name1 = 0 # Instance attribute
+
+    def someMethod(self):
+        """
+        Method
+        """
+        self.name1 = 1
+        MyClass.name2 = 3
+
+
+myclass = MyClass() # class name, invoked as a function is the constructor syntax.
+
+class MyOtherClass:
+    count = 0  # Population of "MyOtherClass" objects
+    def __init__(self, name, gender="Male", age=None):
+        """
+        One initializer required, others are optional (with different defaults)
+        """
+        MyOtherClass.count += 1
+        self.name = name
+        self.gender = gender
+        if age is not None:
+            self.age = age
+    def __del__(self):
+        MyOtherClass.count -= 1
+
+person1 = MyOtherClass("John")
+print person1.name, person1.gender  # "John Male"
+print person1.age                   # Raises AttributeError exception!
+person2 = MyOtherClass("Jane", "Female", 23)
+print person2.name, person2.gender, person2.age  # "Jane Female 23"
diff --git a/Task/Classes/R/classes-1.r b/Task/Classes/R/classes-1.r
new file mode 100644
index 0000000000..d3477fc0a4
--- /dev/null
+++ b/Task/Classes/R/classes-1.r
@@ -0,0 +1,13 @@
+#You define a class simply by setting the class attribute of an object
+circS3 <- list(radius=5.5, centre=c(3, 4.2))
+class(circS3) <- "circle"
+
+#plot is a generic function, so we can define a class specific method by naming it plot.classname
+plot.circle <- function(x, ...)
+{
+   t <- seq(0, 2*pi, length.out=200)
+   plot(x$centre[1] + x$radius*cos(t),
+      x$centre[2] + x$radius*sin(t),
+      type="l", ...)
+}
+plot(circS3)
diff --git a/Task/Classes/Sather/classes-1.sa b/Task/Classes/Sather/classes-1.sa
new file mode 100644
index 0000000000..a67de05839
--- /dev/null
+++ b/Task/Classes/Sather/classes-1.sa
@@ -0,0 +1,21 @@
+class CLASSTEST is
+  readonly attr x:INT; -- give a public getter, not a setter
+  private attr y:INT;  -- no getter, no setter
+  attr z:INT;          -- getter and setter
+
+  -- constructor
+  create(x, y, z:INT):CLASSTEST is
+    res :CLASSTEST := new; -- or res ::= new
+    res.x := x;
+    res.y := y;
+    res.z := z;
+    return res;
+  end;
+
+  -- a getter for the private y summed to s
+  getPrivateY(s:INT):INT is
+    -- y is not shadowed so we can write y instead of
+    -- self.y
+    return y + s;
+  end;
+end;
diff --git a/Task/Closest-pair-problem/0DESCRIPTION b/Task/Closest-pair-problem/0DESCRIPTION
new file mode 100644
index 0000000000..7dbc003b14
--- /dev/null
+++ b/Task/Closest-pair-problem/0DESCRIPTION
@@ -0,0 +1,63 @@
+{{Wikipedia|Closest pair of points problem}}
+The aim of this task is to provide a function to find the closest two points among a set of given points in two dimensions, i.e. to solve the [[wp:Closest pair of points problem|Closest pair of points problem]] in the ''planar'' case.
+
+The straightforward solution is a O(n2) algorithm (which we can call ''brute-force algorithm''); the pseudocode (using indexes) could be simply:
+
+ '''bruteForceClosestPair''' of P(1), P(2), ... P(N)
+ '''if''' N < 2 '''then'''
+   '''return''' ∞
+ '''else'''
+   minDistance ← |P(1) - P(2)|
+   minPoints ← { P(1), P(2) }
+   '''foreach''' i ∈ [1, N-1]
+     '''foreach''' j ∈ [i+1, N]
+       '''if''' |P(i) - P(j)| < minDistance '''then'''
+         minDistance ← |P(i) - P(j)|
+         minPoints ← { P(i), P(j) }
+       '''endif'''
+     '''endfor'''
+   '''endfor'''
+   '''return''' minDistance, minPoints
+  '''endif'''
+
+A better algorithm is based on the recursive divide&conquer approach, as explained also at [[wp:Closest pair of points problem#Planar_case|Wikipedia]], which is O(''n'' log ''n''); a pseudocode could be:
+
+ '''closestPair''' of (xP, yP)
+                where xP is P(1) .. P(N) sorted by x coordinate, and
+                      yP is P(1) .. P(N) sorted by y coordinate (ascending order)
+ '''if''' N ≤ 3 '''then'''
+   '''return''' closest points of xP using brute-force algorithm
+ '''else'''
+   xL ← points of xP from 1 to ⌈N/2⌉
+   xR ← points of xP from ⌈N/2⌉+1 to N
+   xm ← xP(⌈N/2⌉)x
+   yL ← { p ∈ yP : px ≤ xm }
+   yR ← { p ∈ yP : px > xm }
+   (dL, pairL) ← ''closestPair'' of (xL, yL)
+   (dR, pairR) ← ''closestPair'' of (xR, yR)
+   (dmin, pairMin) ← (dR, pairR)
+   '''if''' dL < dR '''then'''
+     (dmin, pairMin) ← (dL, pairL)
+   '''endif'''
+   yS ← { p ∈ yP : |xm - px| < dmin }
+   nS ← number of points in yS
+   (closest, closestPair) ← (dmin, pairMin)
+   '''for''' i '''from''' 1 '''to''' nS - 1
+     k ← i + 1
+     '''while''' k ≤ nS '''and''' yS(k)y - yS(i)y < dmin
+       '''if''' |yS(k) - yS(i)| < closest '''then'''
+         (closest, closestPair) ← (|yS(k) - yS(i)|, {yS(k), yS(i)})
+       '''endif'''
+       k ← k + 1
+     '''endwhile'''
+   '''endfor'''
+   '''return''' closest, closestPair
+ '''endif'''
+
+
+'''References and further readings'''
+* [[wp:Closest pair of points problem|Closest pair of points problem]]
+* [http://www.cs.mcgill.ca/~cs251/ClosestPair/ClosestPairDQ.html Closest Pair (McGill)]
+* [http://www.cs.ucsb.edu/~suri/cs235/ClosestPair.pdf Closest Pair (UCSB)]
+* [http://classes.cec.wustl.edu/~cse241/handouts/closestpair.pdf Closest pair (WUStL)]
+* [http://www.cs.iupui.edu/~xkzou/teaching/CS580/Divide-and-conquer-closestPair.ppt Closest pair (IUPUI)]
diff --git a/Task/Closest-pair-problem/1META.yaml b/Task/Closest-pair-problem/1META.yaml
new file mode 100644
index 0000000000..f407ff9d83
--- /dev/null
+++ b/Task/Closest-pair-problem/1META.yaml
@@ -0,0 +1,2 @@
+---
+note: Classic CS problems and programs
diff --git a/Task/Closest-pair-problem/Ada/closest-pair-problem.ada b/Task/Closest-pair-problem/Ada/closest-pair-problem.ada
new file mode 100644
index 0000000000..9bd7f30bbc
--- /dev/null
+++ b/Task/Closest-pair-problem/Ada/closest-pair-problem.ada
@@ -0,0 +1,67 @@
+with Ada.Numerics.Generic_Elementary_Functions;
+with Ada.Text_IO;
+
+procedure Closest is
+   package Math is new Ada.Numerics.Generic_Elementary_Functions (Float);
+
+   Dimension : constant := 2;
+   type Vector is array (1 .. Dimension) of Float;
+   type Matrix is array (Positive range <>) of Vector;
+
+   -- calculate the distance of two points
+   function Distance (Left, Right : Vector) return Float is
+      Result : Float := 0.0;
+      Offset : Natural := 0;
+   begin
+      loop
+         Result := Result + (Left(Left'First + Offset) - Right(Right'First + Offset))**2;
+         Offset := Offset + 1;
+         exit when Offset >= Left'Length;
+      end loop;
+      return Math.Sqrt (Result);
+   end Distance;
+
+   -- determine the two closest points inside a cloud of vectors
+   function Get_Closest_Points (Cloud : Matrix) return Matrix is
+      Result : Matrix (1..2);
+      Min_Distance : Float;
+   begin
+      if Cloud'Length(1) < 2 then
+         raise Constraint_Error;
+      end if;
+      Result := (Cloud (Cloud'First), Cloud (Cloud'First + 1));
+      Min_Distance := Distance (Cloud (Cloud'First), Cloud (Cloud'First + 1));
+      for I in Cloud'First (1) .. Cloud'Last(1) - 1 loop
+         for J in I + 1 .. Cloud'Last(1) loop
+            if Distance (Cloud (I), Cloud (J)) < Min_Distance then
+               Min_Distance := Distance (Cloud (I), Cloud (J));
+               Result := (Cloud (I), Cloud (J));
+            end if;
+         end loop;
+      end loop;
+      return Result;
+   end Get_Closest_Points;
+
+   Test_Cloud : constant Matrix (1 .. 10) := ( (5.0, 9.0),  (9.0, 3.0),
+                                               (2.0, 0.0),  (8.0, 4.0),
+                                               (7.0, 4.0),  (9.0, 10.0),
+                                               (1.0, 9.0),  (8.0, 2.0),
+                                               (0.0, 10.0), (9.0, 6.0));
+   Closest_Points : Matrix := Get_Closest_Points (Test_Cloud);
+
+   Second_Test : constant Matrix (1 .. 10) := ( (0.654682, 0.925557), (0.409382, 0.619391),
+                                                (0.891663, 0.888594), (0.716629,   0.9962),
+                                                (0.477721, 0.946355), (0.925092,  0.81822),
+                                                (0.624291, 0.142924), (0.211332, 0.221507),
+                                                (0.293786, 0.691701), (0.839186,  0.72826));
+   Second_Points : Matrix := Get_Closest_Points (Second_Test);
+begin
+   Ada.Text_IO.Put_Line ("Closest Points:");
+   Ada.Text_IO.Put_Line ("P1: " & Float'Image (Closest_Points (1) (1)) & " " & Float'Image (Closest_Points (1) (2)));
+   Ada.Text_IO.Put_Line ("P2: " & Float'Image (Closest_Points (2) (1)) & " " & Float'Image (Closest_Points (2) (2)));
+   Ada.Text_IO.Put_Line ("Distance: " & Float'Image (Distance (Closest_Points (1), Closest_Points (2))));
+   Ada.Text_IO.Put_Line ("Closest Points 2:");
+   Ada.Text_IO.Put_Line ("P1: " & Float'Image (Second_Points (1) (1)) & " " & Float'Image (Second_Points (1) (2)));
+   Ada.Text_IO.Put_Line ("P2: " & Float'Image (Second_Points (2) (1)) & " " & Float'Image (Second_Points (2) (2)));
+   Ada.Text_IO.Put_Line ("Distance: " & Float'Image (Distance (Second_Points (1), Second_Points (2))));
+end Closest;
diff --git a/Task/Closest-pair-problem/Clojure/closest-pair-problem.clj b/Task/Closest-pair-problem/Clojure/closest-pair-problem.clj
new file mode 100644
index 0000000000..f1cb65f17d
--- /dev/null
+++ b/Task/Closest-pair-problem/Clojure/closest-pair-problem.clj
@@ -0,0 +1,36 @@
+(defn distance [[x1 y1] [x2 y2]]
+  (let [dx (- x2 x1), dy (- y2 y1)]
+    (Math/sqrt (+ (* dx dx) (* dy dy)))))
+
+(defn brute-force [points]
+  (let [n (count points)]
+    (when (< 1 n)
+      (apply min-key first
+             (for [i (range 0 (dec n)), :let [p1 (nth points i)],
+                   j (range (inc i) n), :let [p2 (nth points j)]]
+               [(distance p1 p2) p1 p2])))))
+
+(defn combine [yS [dmin pmin1 pmin2]]
+  (apply min-key first
+         (conj (for [[p1 p2] (partition 2 1 yS)
+                     :let [[_ py1] p1 [_ py2] p2]
+                     :while (< (- py1 py2) dmin)]
+                 [(distance p1 p2) p1 p2])
+               [dmin pmin1 pmin2])))
+
+(defn closest-pair
+  ([points]
+     (closest-pair
+      (sort-by first points)
+      (sort-by second points)))
+  ([xP yP]
+     (if (< (count xP) 4)
+       (brute-force xP)
+       (let [[xL xR] (partition-all (Math/ceil (/ (count xP) 2)) xP)
+             [xm _] (last xL)
+             {yL true yR false} (group-by (fn [[px _]] (<= px xm)) yP)
+             dL&pairL (closest-pair xL yL)
+             dR&pairR (closest-pair xR yR)
+             [dmin pmin1 pmin2] (min-key first dL&pairL dR&pairR)
+             {yS true} (group-by (fn [[px _]] (< (Math/abs (- xm px)) dmin)) yP)]
+         (combine yS [dmin pmin1 pmin2])))))
diff --git a/Task/Closest-pair-problem/Go/closest-pair-problem-1.go b/Task/Closest-pair-problem/Go/closest-pair-problem-1.go
new file mode 100644
index 0000000000..14cfe73db3
--- /dev/null
+++ b/Task/Closest-pair-problem/Go/closest-pair-problem-1.go
@@ -0,0 +1,46 @@
+package main
+
+import (
+    "fmt"
+    "math"
+    "math/rand"
+)
+
+type xy struct {
+    x, y float64
+}
+
+const n = 1000
+const scale = 1.
+
+func d(p1, p2 xy) float64 {
+    dx := p2.x - p1.x
+    dy := p2.y - p1.y
+    return math.Sqrt(dx*dx + dy*dy)
+}
+
+func main() {
+    points := make([]xy, n)
+    for i := range points {
+        points[i] = xy{rand.Float64(), rand.Float64() * scale}
+    }
+    p1, p2 := closestPair(points)
+    fmt.Println(p1, p2)
+    fmt.Println("distance:", d(p1, p2))
+}
+
+func closestPair(points []xy) (p1, p2 xy) {
+    if len(points) < 2 {
+        panic("at least two points expected")
+    }
+    min := 2 * scale
+    for i, q1 := range points[:len(points)-1] {
+        for _, q2 := range points[i+1:] {
+            if dq := d(q1, q2); dq < min {
+                p1, p2 = q1, q2
+                min = dq
+            }
+        }
+    }
+    return
+}
diff --git a/Task/Closest-pair-problem/Go/closest-pair-problem-2.go b/Task/Closest-pair-problem/Go/closest-pair-problem-2.go
new file mode 100644
index 0000000000..3ff526a213
--- /dev/null
+++ b/Task/Closest-pair-problem/Go/closest-pair-problem-2.go
@@ -0,0 +1,117 @@
+// implementation following algorithm described in
+// http://www.cs.umd.edu/~samir/grant/cp.pdf
+package main
+
+import (
+    "fmt"
+    "math"
+    "math/rand"
+)
+
+// number of points to search for closest pair
+const n = 1e6
+
+// size of bounding box for points.
+// x and y will be random with uniform distribution in the range [0,scale).
+const scale = 1.
+
+// point struct
+type xy struct {
+    x, y float64 // coordinates
+    key  int64   // an annotation used in the algorithm
+}
+
+// Euclidian distance
+func d(p1, p2 xy) float64 {
+    dx := p2.x - p1.x
+    dy := p2.y - p1.y
+    return math.Sqrt(dx*dx + dy*dy)
+}
+
+func main() {
+    points := make([]xy, n)
+    for i := range points {
+        points[i] = xy{rand.Float64(), rand.Float64() * scale, 0}
+    }
+    p1, p2 := closestPair(points)
+    fmt.Println(p1, p2)
+    fmt.Println("distance:", d(p1, p2))
+}
+
+func closestPair(s []xy) (p1, p2 xy) {
+    if len(s) < 2 {
+        panic("2 points required")
+    }
+    var dxi float64
+    // step 0
+    for s1, i := s, 1; ; i++ {
+        // step 1: compute min distance to a random point
+        // (for the case of random data, it's enough to just try
+        // to pick a different point)
+        rp := i % len(s1)
+        xi := s1[rp]
+        dxi = 2 * scale
+        for p, xn := range s1 {
+            if p != rp {
+                if dq := d(xi, xn); dq < dxi {
+                    dxi = dq
+                }
+            }
+        }
+
+        // step 2: filter
+        invB := 3 / dxi             // b is size of a mesh cell
+        mx := int64(scale*invB) + 1 // mx is number of cells along a side
+        // construct map as a histogram:
+        // key is index into mesh.  value is count of points in cell
+        hm := make(map[int64]int)
+        for ip, p := range s1 {
+            key := int64(p.x*invB)*mx + int64(p.y*invB)
+            s1[ip].key = key
+            hm[key]++
+        }
+        // construct s2 = s1 less the points without neighbors
+        var s2 []xy
+        nx := []int64{-mx - 1, -mx, -mx + 1, -1, 0, 1, mx - 1, mx, mx + 1}
+        for i, p := range s1 {
+            nn := 0
+            for _, ofs := range nx {
+                nn += hm[p.key+ofs]
+                if nn > 1 {
+                    s2 = append(s2, s1[i])
+                    break
+                }
+            }
+        }
+
+        // step 3: done?
+        if len(s2) == 0 {
+            break
+        }
+        s1 = s2
+    }
+    // step 4: compute answer from approximation
+    invB := 1 / dxi
+    mx := int64(scale*invB) + 1
+    hm := make(map[int64][]int)
+    for i, p := range s {
+        key := int64(p.x*invB)*mx + int64(p.y*invB)
+        s[i].key = key
+        hm[key] = append(hm[key], i)
+    }
+    nx := []int64{-mx - 1, -mx, -mx + 1, -1, 0, 1, mx - 1, mx, mx + 1}
+    var min = scale * 2
+    for ip, p := range s {
+        for _, ofs := range nx {
+            for _, iq := range hm[p.key+ofs] {
+                if ip != iq {
+                    if d1 := d(p, s[iq]); d1 < min {
+                        min = d1
+                        p1, p2 = p, s[iq]
+                    }
+                }
+            }
+        }
+    }
+    return p1, p2
+}
diff --git a/Task/Closest-pair-problem/Haskell/closest-pair-problem-1.hs b/Task/Closest-pair-problem/Haskell/closest-pair-problem-1.hs
new file mode 100644
index 0000000000..5b9b891707
--- /dev/null
+++ b/Task/Closest-pair-problem/Haskell/closest-pair-problem-1.hs
@@ -0,0 +1,16 @@
+import Data.List
+import System.Random
+import Control.Monad
+import Control.Arrow
+import Data.Ord
+
+vecLeng [[a,b],[p,q]] = sqrt $ (a-p)^2+(b-q)^2
+
+findClosestPair =  foldl1' ((minimumBy (comparing vecLeng). ). (. return). (:)) .
+                   concatMap (\(x:xs) -> map ((x:).return) xs) . init . tails
+
+testCP = do
+    g <- newStdGen
+    let pts :: [[Double]]
+        pts = take 1000. unfoldr (Just. splitAt 2) $ randomRs(-1,1) g
+    print . (id &&& vecLeng ) . findClosestPair $ pts
diff --git a/Task/Closest-pair-problem/Haskell/closest-pair-problem-2.hs b/Task/Closest-pair-problem/Haskell/closest-pair-problem-2.hs
new file mode 100644
index 0000000000..1c959a2ef1
--- /dev/null
+++ b/Task/Closest-pair-problem/Haskell/closest-pair-problem-2.hs
@@ -0,0 +1,3 @@
+*Main> testCP
+([[0.8347201880148426,0.40774840545089647],[0.8348731214261784,0.4087113189531284]],9.749825850154334e-4)
+(4.02 secs, 488869056 bytes)
diff --git a/Task/Closest-pair-problem/Java/closest-pair-problem.java b/Task/Closest-pair-problem/Java/closest-pair-problem.java
new file mode 100644
index 0000000000..ea6873fc08
--- /dev/null
+++ b/Task/Closest-pair-problem/Java/closest-pair-problem.java
@@ -0,0 +1,186 @@
+import java.util.*;
+
+public class ClosestPair
+{
+  public static class Point
+  {
+    public final double x;
+    public final double y;
+
+    public Point(double x, double y)
+    {
+      this.x = x;
+      this.y = y;
+    }
+
+    public String toString()
+    {  return "(" + x + ", " + y + ")";  }
+  }
+
+  public static class Pair
+  {
+    public Point point1 = null;
+    public Point point2 = null;
+    public double distance = 0.0;
+
+    public Pair()
+    {  }
+
+    public Pair(Point point1, Point point2)
+    {
+      this.point1 = point1;
+      this.point2 = point2;
+      calcDistance();
+    }
+
+    public void update(Point point1, Point point2, double distance)
+    {
+      this.point1 = point1;
+      this.point2 = point2;
+      this.distance = distance;
+    }
+
+    public void calcDistance()
+    {  this.distance = distance(point1, point2);  }
+
+    public String toString()
+    {  return point1 + "-" + point2 + " : " + distance;  }
+  }
+
+  public static double distance(Point p1, Point p2)
+  {
+    double xdist = p2.x - p1.x;
+    double ydist = p2.y - p1.y;
+    return Math.hypot(xdist, ydist);
+  }
+
+  public static Pair bruteForce(List points)
+  {
+    int numPoints = points.size();
+    if (numPoints < 2)
+      return null;
+    Pair pair = new Pair(points.get(0), points.get(1));
+    if (numPoints > 2)
+    {
+      for (int i = 0; i < numPoints - 1; i++)
+      {
+        Point point1 = points.get(i);
+        for (int j = i + 1; j < numPoints; j++)
+        {
+          Point point2 = points.get(j);
+          double distance = distance(point1, point2);
+          if (distance < pair.distance)
+            pair.update(point1, point2, distance);
+        }
+      }
+    }
+    return pair;
+  }
+
+  public static void sortByX(List points)
+  {
+    Collections.sort(points, new Comparator() {
+        public int compare(Point point1, Point point2)
+        {
+          if (point1.x < point2.x)
+            return -1;
+          if (point1.x > point2.x)
+            return 1;
+          return 0;
+        }
+      }
+    );
+  }
+
+  public static void sortByY(List points)
+  {
+    Collections.sort(points, new Comparator() {
+        public int compare(Point point1, Point point2)
+        {
+          if (point1.y < point2.y)
+            return -1;
+          if (point1.y > point2.y)
+            return 1;
+          return 0;
+        }
+      }
+    );
+  }
+
+  public static Pair divideAndConquer(List points)
+  {
+    List pointsSortedByX = new ArrayList(points);
+    sortByX(pointsSortedByX);
+    List pointsSortedByY = new ArrayList(points);
+    sortByY(pointsSortedByY);
+    return divideAndConquer(pointsSortedByX, pointsSortedByY);
+  }
+
+  private static Pair divideAndConquer(List pointsSortedByX, List pointsSortedByY)
+  {
+    int numPoints = pointsSortedByX.size();
+    if (numPoints <= 3)
+      return bruteForce(pointsSortedByX);
+
+    int dividingIndex = numPoints >>> 1;
+    List leftOfCenter = pointsSortedByX.subList(0, dividingIndex);
+    List rightOfCenter = pointsSortedByX.subList(dividingIndex, numPoints);
+
+    List tempList = new ArrayList(leftOfCenter);
+    sortByY(tempList);
+    Pair closestPair = divideAndConquer(leftOfCenter, tempList);
+
+    tempList.clear();
+    tempList.addAll(rightOfCenter);
+    sortByY(tempList);
+    Pair closestPairRight = divideAndConquer(rightOfCenter, tempList);
+
+    if (closestPairRight.distance < closestPair.distance)
+      closestPair = closestPairRight;
+
+    tempList.clear();
+    double shortestDistance =closestPair.distance;
+    double centerX = rightOfCenter.get(0).x;
+    for (Point point : pointsSortedByY)
+      if (Math.abs(centerX - point.x) < shortestDistance)
+        tempList.add(point);
+
+    for (int i = 0; i < tempList.size() - 1; i++)
+    {
+      Point point1 = tempList.get(i);
+      for (int j = i + 1; j < tempList.size(); j++)
+      {
+        Point point2 = tempList.get(j);
+        if ((point2.y - point1.y) >= shortestDistance)
+          break;
+        double distance = distance(point1, point2);
+        if (distance < closestPair.distance)
+        {
+          closestPair.update(point1, point2, distance);
+          shortestDistance = distance;
+        }
+      }
+    }
+    return closestPair;
+  }
+
+  public static void main(String[] args)
+  {
+    int numPoints = (args.length == 0) ? 1000 : Integer.parseInt(args[0]);
+    List points = new ArrayList();
+    Random r = new Random();
+    for (int i = 0; i < numPoints; i++)
+      points.add(new Point(r.nextDouble(), r.nextDouble()));
+    System.out.println("Generated " + numPoints + " random points");
+    long startTime = System.currentTimeMillis();
+    Pair bruteForceClosestPair = bruteForce(points);
+    long elapsedTime = System.currentTimeMillis() - startTime;
+    System.out.println("Brute force (" + elapsedTime + " ms): " + bruteForceClosestPair);
+    startTime = System.currentTimeMillis();
+    Pair dqClosestPair = divideAndConquer(points);
+    elapsedTime = System.currentTimeMillis() - startTime;
+    System.out.println("Divide and conquer (" + elapsedTime + " ms): " + dqClosestPair);
+    if (bruteForceClosestPair.distance != dqClosestPair.distance)
+      System.out.println("MISMATCH");
+  }
+}
diff --git a/Task/Closest-pair-problem/JavaScript/closest-pair-problem.js b/Task/Closest-pair-problem/JavaScript/closest-pair-problem.js
new file mode 100644
index 0000000000..b6926543db
--- /dev/null
+++ b/Task/Closest-pair-problem/JavaScript/closest-pair-problem.js
@@ -0,0 +1,27 @@
+function distance(p1, p2) {
+  var dx = Math.abs(p1.x - p2.x);
+  var dy = Math.abs(p1.y - p2.y);
+  return Math.sqrt(dx*dx + dy*dy);
+}
+
+function bruteforceClosestPair(arr) {
+  if (arr.length < 2) {
+    return Infinity;
+  } else {
+    var minDist = distance(arr[0], arr[1]);
+    var minPoints = arr.slice(0, 2);
+
+    for (var i=0; i[0] - $b->[0])**2 +
+                 ($a->[1] - $b->[1])**2 );
+}
+
+sub closest_pair_simple
+{
+    my $ra = shift;
+    my @arr = @$ra;
+    my $inf = 1e600;
+    return $inf if scalar(@arr) < 2;
+    my ( $a, $b, $d ) = ($arr[0], $arr[1], dist($arr[0], $arr[1]));
+    while( @arr ) {
+	my $p = pop @arr;
+	foreach my $l (@arr) {
+	    my $t = dist($p, $l);
+	    ($a, $b, $d) = ($p, $l, $t) if $t < $d;	
+	}
+    }
+    return ($a, $b, $d);
+}
+
+sub closest_pair
+{
+    my $r = shift;
+    my @ax = sort { $a->[0] <=> $b->[0] } @$r;
+    my @ay = sort { $a->[1] <=> $b->[1] } @$r;
+    return closest_pair_real(\@ax, \@ay);
+}
+
+sub closest_pair_real
+{
+    my ($rx, $ry) = @_;
+    my @xP = @$rx;
+    my @yP = @$ry;
+    my $N = @xP;
+    return closest_pair_simple($rx) if scalar(@xP) <= 3;
+
+    my $inf = 1e600;
+    my $midx = ceil($N/2)-1;
+
+    my @PL = @xP[0 .. $midx];
+    my @PR = @xP[$midx+1 .. $N-1];
+
+    my $xm = ${$xP[$midx]}[0];
+
+    my @yR = ();
+    my @yL = ();
+    foreach my $p (@yP) {
+	if ( ${$p}[0] <= $xm ) {
+	    push @yR, $p;
+	} else {
+	    push @yL, $p;
+	}
+    }
+
+    my ($al, $bl, $dL) = closest_pair_real(\@PL, \@yR);
+    my ($ar, $br, $dR) = closest_pair_real(\@PR, \@yL);
+
+    my ($m1, $m2, $dmin) = ($al, $bl, $dL);
+    ($m1, $m2, $dmin) = ($ar, $br, $dR) if $dR < $dL;
+
+    my @yS = ();
+    foreach my $p (@yP) {
+	push @yS, $p if abs($xm - ${$p}[0]) < $dmin;
+    }
+
+    if ( @yS ) {
+	my ( $w1, $w2, $closest ) = ($m1, $m2, $dmin);
+	foreach my $i (0 .. ($#yS - 1)) {
+
+	    my $k = $i + 1;
+	    while ( ($k <= $#yS) && ( (${$yS[$k]}[1] - ${$yS[$i]}[1]) < $dmin) ) {
+		my $d = dist($yS[$k], $yS[$i]);
+		($w1, $w2, $closest) = ($yS[$k], $yS[$i], $d) if $d < $closest;
+		$k++;
+	    }
+
+	}
+	return ($w1, $w2, $closest);
+
+    } else {
+	return ($m1, $m2, $dmin);
+    }
+}
+
+
+
+my @points = ();
+my $N = 5000;
+
+foreach my $i (1..$N) {
+    push @points, [rand(20)-10.0, rand(20)-10.0];
+}
+
+
+my ($a, $b, $d) = closest_pair_simple(\@points);
+print "$d\n";
+
+my ($a1, $b1, $d1) = closest_pair(\@points);
+#print "$d1\n";
diff --git a/Task/Closest-pair-problem/PicoLisp/closest-pair-problem.l b/Task/Closest-pair-problem/PicoLisp/closest-pair-problem.l
new file mode 100644
index 0000000000..552d6c5846
--- /dev/null
+++ b/Task/Closest-pair-problem/PicoLisp/closest-pair-problem.l
@@ -0,0 +1,14 @@
+(de closestPairBF (Lst)
+   (let Min T
+      (use (Pt1 Pt2)
+         (for P Lst
+            (for Q Lst
+               (or
+                  (== P Q)
+                  (>=
+                     (setq N
+                        (let (A (- (car P) (car Q))  B (- (cdr P) (cdr Q)))
+                           (+ (* A A) (* B B)) ) )
+                     Min )
+                  (setq Min N  Pt1 P  Pt2 Q) ) ) )
+         (list Pt1 Pt2 (sqrt Min)) ) ) )
diff --git a/Task/Closest-pair-problem/Python/closest-pair-problem.py b/Task/Closest-pair-problem/Python/closest-pair-problem.py
new file mode 100644
index 0000000000..c2e977f6d4
--- /dev/null
+++ b/Task/Closest-pair-problem/Python/closest-pair-problem.py
@@ -0,0 +1,87 @@
+"""
+  Compute nearest pair of points using two algorithms
+
+  First algorithm is 'brute force' comparison of every possible pair.
+  Second, 'divide and conquer', is based on:
+    www.cs.iupui.edu/~xkzou/teaching/CS580/Divide-and-conquer-closestPair.ppt
+"""
+
+from random import randint, randrange
+from operator import itemgetter, attrgetter
+
+infinity = float('inf')
+
+# Note the use of complex numbers to represent 2D points making distance == abs(P1-P2)
+
+def bruteForceClosestPair(point):
+    numPoints = len(point)
+    if numPoints < 2:
+        return infinity, (None, None)
+    return min( ((abs(point[i] - point[j]), (point[i], point[j]))
+                 for i in range(numPoints-1)
+                 for j in range(i+1,numPoints)),
+                key=itemgetter(0))
+
+def closestPair(point):
+    xP = sorted(point, key= attrgetter('real'))
+    yP = sorted(point, key= attrgetter('imag'))
+    return _closestPair(xP, yP)
+
+def _closestPair(xP, yP):
+    numPoints = len(xP)
+    if numPoints <= 3:
+        return bruteForceClosestPair(xP)
+    Pl = xP[:numPoints/2]
+    Pr = xP[numPoints/2:]
+    Yl, Yr = [], []
+    xDivider = Pl[-1].real
+    for p in yP:
+        if p.real <= xDivider:
+            Yl.append(p)
+        else:
+            Yr.append(p)
+    dl, pairl = _closestPair(Pl, Yl)
+    dr, pairr = _closestPair(Pr, Yr)
+    dm, pairm = (dl, pairl) if dl < dr else (dr, pairr)
+    # Points within dm of xDivider sorted by Y coord
+    closeY = [p for p in yP  if abs(p.real - xDivider) < dm]
+    numCloseY = len(closeY)
+    if numCloseY > 1:
+        # There is a proof that you only need compare a max of 7 next points
+        closestY = min( ((abs(closeY[i] - closeY[j]), (closeY[i], closeY[j]))
+                         for i in range(numCloseY-1)
+                         for j in range(i+1,min(i+8, numCloseY))),
+                        key=itemgetter(0))
+        return (dm, pairm) if dm <= closestY[0] else closestY
+    else:
+        return dm, pairm
+
+def times():
+    ''' Time the different functions
+    '''
+    import timeit
+
+    functions = [bruteForceClosestPair, closestPair]
+    for f in functions:
+        print 'Time for', f.__name__, timeit.Timer(
+            '%s(pointList)' % f.__name__,
+            'from closestpair import %s, pointList' % f.__name__).timeit(number=1)
+
+
+
+pointList = [randint(0,1000)+1j*randint(0,1000) for i in range(2000)]
+
+if __name__ == '__main__':
+    pointList = [(5+9j), (9+3j), (2+0j), (8+4j), (7+4j), (9+10j), (1+9j), (8+2j), 10j, (9+6j)]
+    print pointList
+    print '  bruteForceClosestPair:', bruteForceClosestPair(pointList)
+    print '            closestPair:', closestPair(pointList)
+    for i in range(10):
+        pointList = [randrange(11)+1j*randrange(11) for i in range(10)]
+        print '\n', pointList
+        print ' bruteForceClosestPair:', bruteForceClosestPair(pointList)
+        print '           closestPair:', closestPair(pointList)
+    print '\n'
+    times()
+    times()
+    times()
diff --git a/Task/Closest-pair-problem/R/closest-pair-problem-1.r b/Task/Closest-pair-problem/R/closest-pair-problem-1.r
new file mode 100644
index 0000000000..0e23d00376
--- /dev/null
+++ b/Task/Closest-pair-problem/R/closest-pair-problem-1.r
@@ -0,0 +1,30 @@
+closest_pair_brute <-function(x,y,plotxy=F) {
+    xy = cbind(x,y)
+    cp = bruteforce(xy)
+    cat("\n\nShortest path found = \n From:\t\t(",cp[1],',',cp[2],")\n To:\t\t(",cp[3],',',cp[4],")\n Distance:\t",cp[5],"\n\n",sep="")
+    if(plotxy) {
+        plot(x,y,pch=19,col='black',main="Closest Pair", asp=1)
+        points(cp[1],cp[2],pch=19,col='red')
+        points(cp[3],cp[4],pch=19,col='red')
+    }
+    distance <- function(p1,p2) {
+        x1 = (p1[1])
+        y1 = (p1[2])
+        x2 = (p2[1])
+        y2 = (p2[2])
+        sqrt((x2-x1)^2 + (y2-y1)^2)
+    }
+    bf_iter <- function(m,p,idx=NA,d=NA,n=1) {
+        dd = distance(p,m[n,])
+        if((is.na(d) || dd<=d) && p!=m[n,]){d = dd; idx=n;}
+        if(n == length(m[,1])) { c(m[idx,],d) }
+        else bf_iter(m,p,idx,d,n+1)
+    }
+    bruteforce <- function(pmatrix,n=1,pd=c(NA,NA,NA,NA,NA)) {
+        p = pmatrix[n,]
+        ppd = c(p,bf_iter(pmatrix,p))
+        if(ppd[5] 1)
+	{
+		for (i in 1:(nys-1))
+		{
+			k <- i + 1
+			while (k <= nys && ys[i,"y"] - ys[k,"y"] < cp$d)
+			{
+				d <- sqrt((ys[k,"x"]-ys[i,"x"])^2 + (ys[k,"y"]-ys[i,"y"])^2)
+				if (d < cp$d) cp <- list(p1=ys[i,],p2=ys[k,],d=d)
+				k <- k + 1
+			}
+		}
+	}
+	if (swap)
+	{
+		list(p1=cbind(x=cp$p1["y"],y=cp$p1["x"]),p2=cbind(x=cp$p2["y"],y=cp$p2["x"]),d=cp$d)
+	}
+	else
+	{
+		cp
+	}
+}
+
+# Test functions
+cat("How many points?\n")
+n <- scan(what=integer(),n=1)
+x <- rnorm(n)
+y <- rnorm(n)
+tstart <- proc.time()[3]
+cat("Closest pairs divide and conquer:\n")
+print(cp <- closest.pairs.dandc(x,y))
+cat(sprintf("That took %.2f seconds.\n",proc.time()[3] - tstart))
+plot(x,y)
+points(c(cp$p1["x"],cp$p2["x"]),c(cp$p1["y"],cp$p2["y"]),col="red")
+tstart <- proc.time()[3]
+cat("\nClosest pairs brute force:\n")
+print(closest.pairs.bruteforce(x,y))
+cat(sprintf("That took %.2f seconds.\n",proc.time()[3] - tstart))
diff --git a/Task/Closest-pair-problem/REXX/closest-pair-problem.rexx b/Task/Closest-pair-problem/REXX/closest-pair-problem.rexx
new file mode 100644
index 0000000000..f929ac6413
--- /dev/null
+++ b/Task/Closest-pair-problem/REXX/closest-pair-problem.rexx
@@ -0,0 +1,37 @@
+/*REXX program to solve the  closest pair problem.                      */
+parse arg N low high seed .;  if n=='' then n=100
+if seed\=='' then call random ,,seed   /*use seed, makes rand repeatable*/
+if  low=='' |  low==','   then   low=0
+if high=='' | high==','   then  high=20000
+w=length(high);    w=w + (w//2==0)
+                                    do j=1  for N    /*gen random points*/
+                                    @.j.xx=random(low,high)
+                                    @.j.yy=random(low,high)
+                                    end   /*j*/
+nearA=1
+nearB=2
+minDD=(@.nearA.xx-@.nearB.xx)**2 + (@.nearA.yy-@.nearB.yy)**2
+
+                       do   j=1  for N-1
+                         do k=j+1  to N
+                         dd=(@.j.xx-@.k.xx)**2 + (@.j.yy-@.k.yy)**2
+                         if dd\=0 then  if dd9;  m.j=p;  p=p%2+1;   end
+      do k=j+5 to 0 by -1; if m.k>11 then numeric digits m.k; g=.5*(g+x/g); end
+      numeric digits d;  return g/1
+.sqrtG:  numeric form;   m.=11;   p=d+d%4+2
+         parse value format(x,2,1,,0) 'E0' with g 'E' _ .;   return g*.5'E'_%2
diff --git a/Task/Closest-pair-problem/Ruby/closest-pair-problem.rb b/Task/Closest-pair-problem/Ruby/closest-pair-problem.rb
new file mode 100644
index 0000000000..8dbd92a3e7
--- /dev/null
+++ b/Task/Closest-pair-problem/Ruby/closest-pair-problem.rb
@@ -0,0 +1,68 @@
+Point = Struct.new(:x, :y)
+
+def distance(p1, p2)
+  Math.hypot(p1.x - p2.x, p1.y - p2.y)
+end
+
+def closest_bruteforce(points)
+  mindist, minpts = Float::MAX, []
+  points.length.times do |i|
+    (i+1).upto(points.length - 1) do |j|
+      dist = distance(points[i], points[j])
+      if dist < mindist
+        mindist = dist
+        minpts = [points[i], points[j]]
+      end
+    end
+  end
+  [mindist, minpts]
+end
+
+def closest_recursive(points)
+  if points.length <= 3
+    return closest_bruteforce(points)
+  end
+  xP = points.sort_by {|p| p.x}
+  mid = (points.length / 2.0).ceil
+  pL = xP[0,mid]
+  pR = xP[mid..-1]
+  dL, pairL = closest_recursive(pL)
+  dR, pairR = closest_recursive(pR)
+  if dL < dR
+    dmin, dpair = dL, pairL
+  else
+    dmin, dpair = dR, pairR
+  end
+  yP = xP.find_all {|p| (pL[-1].x - p.x).abs < dmin}.sort_by {|p| p.y}
+  closest = Float::MAX
+  closestPair = []
+  0.upto(yP.length - 2) do |i|
+    (i+1).upto(yP.length - 1) do |k|
+      break if (yP[k].y - yP[i].y) >= dmin
+      dist = distance(yP[i], yP[k])
+      if dist < closest
+        closest = dist
+        closestPair = [yP[i], yP[k]]
+      end
+    end
+  end
+  if closest < dmin
+    [closest, closestPair]
+  else
+    [dmin, dpair]
+  end
+end
+
+
+points = Array.new(100) {Point.new(rand, rand)}
+p ans1 = closest_bruteforce(points)
+p ans2 = closest_recursive(points)
+fail "bogus!" if ans1[0] != ans2[0]
+
+require 'benchmark'
+
+points = Array.new(10000) {Point.new(rand, rand)}
+Benchmark.bm(12) do |x|
+  x.report("bruteforce") {ans1 = closest_bruteforce(points)}
+  x.report("recursive")  {ans2 = closest_recursive(points)}
+end
diff --git a/Task/Closest-pair-problem/Scala/closest-pair-problem.scala b/Task/Closest-pair-problem/Scala/closest-pair-problem.scala
new file mode 100644
index 0000000000..75776ad259
--- /dev/null
+++ b/Task/Closest-pair-problem/Scala/closest-pair-problem.scala
@@ -0,0 +1,24 @@
+import scala.util._
+
+object ClosestPair{
+   class Point(x:Double, y:Double) extends Pair(x,y){
+      def distance(p:Point)=math.hypot(_1-p._1, _2-p._2)
+   }
+
+   def closestPairBF(a:Array[Point])={
+      var minDist=a(0) distance a(1)
+      var minPoints=(a(0), a(1))
+
+      for(p1<-a; p2<-a if p1.ne(p2); dist=p1 distance p2 if(dist"+dist)
+   }
+}
diff --git a/Task/Closest-pair-problem/Tcl/closest-pair-problem.tcl b/Task/Closest-pair-problem/Tcl/closest-pair-problem.tcl
new file mode 100644
index 0000000000..d8c0b24f5b
--- /dev/null
+++ b/Task/Closest-pair-problem/Tcl/closest-pair-problem.tcl
@@ -0,0 +1,90 @@
+package require Tcl 8.5
+
+# retrieve the x-coordinate
+proc x p {lindex $p 0}
+# retrieve the y-coordinate
+proc y p {lindex $p 1}
+
+proc distance {p1 p2} {
+    expr {hypot(([x $p1]-[x $p2]), ([y $p1]-[y $p2]))}
+}
+
+proc closest_bruteforce {points} {
+    set n [llength $points]
+    set mindist Inf
+    set minpts {}
+    for {set i 0} {$i < $n - 1} {incr i} {
+        for {set j [expr {$i + 1}]} {$j < $n} {incr j} {
+            set p1 [lindex $points $i]
+            set p2 [lindex $points $j]
+            set dist [distance $p1 $p2]
+            if {$dist < $mindist} {
+                set mindist $dist
+                set minpts [list $p1 $p2]
+            }
+        }
+    }
+    return [list $mindist $minpts]
+}
+
+proc closest_recursive {points} {
+    set n [llength $points]
+    if {$n <= 3} {
+        return [closest_bruteforce $points]
+    }
+    set xP [lsort -real -increasing -index 0 $points]
+    set mid [expr {int(ceil($n/2.0))}]
+    set PL [lrange $xP 0 [expr {$mid-1}]]
+    set PR [lrange $xP $mid end]
+    set procname [lindex [info level 0] 0]
+    lassign [$procname $PL] dL pairL
+    lassign [$procname $PR] dR pairR
+    if {$dL < $dR} {
+        set dmin $dL
+        set dpair $pairL
+    } else {
+        set dmin $dR
+        set dpair $pairR
+    }
+
+    set xM [x [lindex $PL end]]
+    foreach p $xP {
+        if {abs($xM - [x $p]) < $dmin} {
+            lappend S $p
+        }
+    }
+    set yP [lsort -real -increasing -index 1 $S]
+    set closest Inf
+    set nP [llength $yP]
+    for {set i 0} {$i <= $nP-2} {incr i} {
+        set yPi [lindex $yP $i]
+        for {set k [expr {$i+1}]; set yPk [lindex $yP $k]} {
+            $k < $nP-1 && ([y $yPk]-[y $yPi]) < $dmin
+        } {incr k; set yPk [lindex $yP $k]} {
+            set dist [distance $yPk $yPi]
+            if {$dist < $closest} {
+                set closest $dist
+                set closestPair [list $yPi $yPk]
+            }
+        }
+    }
+    expr {$closest < $dmin ? [list $closest $closestPair] : [list $dmin $dpair]}
+}
+
+# testing
+set N 10000
+for {set i 1} {$i <= $N} {incr i} {
+    lappend points [list [expr {rand()*100}] [expr {rand()*100}]]
+}
+
+# instrument the number of calls to [distance] to examine the
+# efficiency of the recursive solution
+trace add execution distance enter comparisons
+proc comparisons args {incr ::comparisons}
+
+puts [format "%-10s  %9s  %9s  %s" method compares time closest]
+foreach method {bruteforce recursive} {
+    set ::comparisons 0
+    set time [time {set ::dist($method) [closest_$method $points]} 1]
+    puts [format "%-10s  %9d  %9d  %s" $method $::comparisons [lindex $time 0] [lindex $::dist($method) 0]]
+}
diff --git a/Task/Collections/AWK/collections-1.awk b/Task/Collections/AWK/collections-1.awk
new file mode 100644
index 0000000000..93ebd8c18c
--- /dev/null
+++ b/Task/Collections/AWK/collections-1.awk
@@ -0,0 +1 @@
+a[0]="hello"
diff --git a/Task/Collections/Ada/collections-1.ada b/Task/Collections/Ada/collections-1.ada
new file mode 100644
index 0000000000..d37db0f7dd
--- /dev/null
+++ b/Task/Collections/Ada/collections-1.ada
@@ -0,0 +1,11 @@
+procedure Array_Collection is
+
+   A : array (-3 .. -1) of Integer := (1, 2, 3);
+
+begin
+
+   A (-3) := 3;
+   A (-2) := 2;
+   A (-1) := 1;
+
+end Array_Collection;
diff --git a/Task/Collections/Ada/collections-2.ada b/Task/Collections/Ada/collections-2.ada
new file mode 100644
index 0000000000..a2bf2b7b56
--- /dev/null
+++ b/Task/Collections/Ada/collections-2.ada
@@ -0,0 +1,12 @@
+procedure Array_Collection is
+
+   type Array_Type is array (1 .. 3) of Integer;
+   A : Array_Type := (1, 2, 3);
+
+begin
+
+   A (1) := 3;
+   A (2) := 2;
+   A (3) := 1;
+
+end Array_Collection;
diff --git a/Task/Collections/Ada/collections-3.ada b/Task/Collections/Ada/collections-3.ada
new file mode 100644
index 0000000000..f02d6afda3
--- /dev/null
+++ b/Task/Collections/Ada/collections-3.ada
@@ -0,0 +1,13 @@
+procedure Array_Collection is
+
+   type Array_Type is array (positive range <>) of Integer; -- may be indexed with any positive
+                                                            -- Integer value
+   A : Array_Type(1 .. 3);  -- creates an array of three integers, indexed from 1 to 3
+
+begin
+
+   A (1) := 3;
+   A (2) := 2;
+   A (3) := 1;
+
+end Array_Collection;
diff --git a/Task/Collections/Ada/collections-4.ada b/Task/Collections/Ada/collections-4.ada
new file mode 100644
index 0000000000..dd32adaf32
--- /dev/null
+++ b/Task/Collections/Ada/collections-4.ada
@@ -0,0 +1,17 @@
+with Ada.Containers.Doubly_Linked_Lists;
+use  Ada.Containers;
+
+procedure Doubly_Linked_List is
+
+   package DL_List_Pkg is new Doubly_Linked_Lists (Integer);
+   use     DL_List_Pkg;
+
+   DL_List : List;
+
+begin
+
+   DL_List.Append (1);
+   DL_List.Append (2);
+   DL_List.Append (3);
+
+end Doubly_Linked_List;
diff --git a/Task/Collections/Ada/collections-5.ada b/Task/Collections/Ada/collections-5.ada
new file mode 100644
index 0000000000..ea4fc71f29
--- /dev/null
+++ b/Task/Collections/Ada/collections-5.ada
@@ -0,0 +1,17 @@
+with Ada.Containers.Vectors;
+use  Ada.Containers;
+
+procedure Vector_Example is
+
+   package Vector_Pkg is new Vectors (Natural, Integer);
+   use     Vector_Pkg;
+
+   V : Vector;
+
+begin
+
+   V.Append (1);
+   V.Append (2);
+   V.Append (3);
+
+end Vector_Example;
diff --git a/Task/Collections/C/collections-1.c b/Task/Collections/C/collections-1.c
new file mode 100644
index 0000000000..69c9a98589
--- /dev/null
+++ b/Task/Collections/C/collections-1.c
@@ -0,0 +1,11 @@
+#define cSize( a )  ( sizeof(a)/sizeof(a[0]) ) /* a.size() */
+int ar[10];               /* Collection ar = new ArrayList(10); */
+ar[0] = 1;                /* ar.set(0, 1); */
+ar[1] = 2;
+
+int* p;                   /* Iterator p; Integer pValue; */
+for (p=ar;                /* for( p = ar.itereator(), pValue=p.next(); */
+       p<(ar+cSize(ar));  /*        p.hasNext(); */
+       p++) {             /*        pValue=p.next() ) { */
+  printf("%d\n",*p);      /*   System.out.println(pValue); */
+}                         /* } */
diff --git a/Task/Collections/Clojure/collections-1.clj b/Task/Collections/Clojure/collections-1.clj
new file mode 100644
index 0000000000..0df46d10ed
--- /dev/null
+++ b/Task/Collections/Clojure/collections-1.clj
@@ -0,0 +1,4 @@
+{1 "a", "Q" 10} ; commas are treated as whitespace
+(hash-map 1 "a" "Q" 10) ; equivalent to the above
+(let [my-map {1 "a"}]
+  (assoc my-map "Q" 10)) ; "adding" an element
diff --git a/Task/Collections/Forth/collections-1.fth b/Task/Collections/Forth/collections-1.fth
new file mode 100644
index 0000000000..0f66cc8821
--- /dev/null
+++ b/Task/Collections/Forth/collections-1.fth
@@ -0,0 +1,7 @@
+include ffl/car.fs
+
+10 car-create ar           \ create a dynamic array with initial size 10
+
+2 0 ar car-set             \ ar[0] = 2
+3 1 ar car-set             \ ar[1] = 3
+1 0 ar car-insert          \ ar[0] = 1 ar[1] = 2 ar[2] = 3
diff --git a/Task/Collections/Haskell/collections-1.hs b/Task/Collections/Haskell/collections-1.hs
new file mode 100644
index 0000000000..c9b527da78
--- /dev/null
+++ b/Task/Collections/Haskell/collections-1.hs
@@ -0,0 +1 @@
+[1, 2, 3, 4, 5]
diff --git a/Task/Collections/Java/collections-1.java b/Task/Collections/Java/collections-1.java
new file mode 100644
index 0000000000..edbbb51ebd
--- /dev/null
+++ b/Task/Collections/Java/collections-1.java
@@ -0,0 +1,14 @@
+List arrayList = new ArrayList();
+arrayList.add(new Integer(0));
+// alternative with primitive autoboxed to an Integer object automatically
+arrayList.add(0);
+
+//other features of ArrayList
+//define the type in the arraylist, you can substitute a proprietary class in the "<>"
+List myarrlist = new ArrayList();
+
+//add several values to the arraylist to be summed later
+int sum;
+for(int i = 0; i < 10; i++) {
+    myarrlist.add(i);
+}
diff --git a/Task/Collections/JavaScript/collections-1.js b/Task/Collections/JavaScript/collections-1.js
new file mode 100644
index 0000000000..9b6f1dfb34
--- /dev/null
+++ b/Task/Collections/JavaScript/collections-1.js
@@ -0,0 +1,5 @@
+var array = [];
+array.push('abc');
+array.push(123);
+array.push(new MyClass);
+alert( array[2] );
diff --git a/Task/Collections/R/collections-1.r b/Task/Collections/R/collections-1.r
new file mode 100644
index 0000000000..97b6009ded
--- /dev/null
+++ b/Task/Collections/R/collections-1.r
@@ -0,0 +1,3 @@
+numeric(5)
+1:10
+c(1, 3, 6, 10, 7 + 8, sqrt(441))
diff --git a/Task/Collections/REXX/collections-1.rexx b/Task/Collections/REXX/collections-1.rexx
new file mode 100644
index 0000000000..38f6cb0757
--- /dev/null
+++ b/Task/Collections/REXX/collections-1.rexx
@@ -0,0 +1,36 @@
+pr.=0        /*define a default for all elements for the stemmed array.*/
+
+pr.1 =2                    /*note that this array starts at  1  (one). */
+pr.2 =3
+pr.3 =5
+pr.4 =7
+pr.6 =11
+pr.6 =13
+pr.7 =17
+pr.8 =19
+pr.9 =23
+pr.10=29
+pr.11=31
+pr.12=37
+pr.13=41
+pr.14=43
+
+y.=0                       /*define a default for all years.           */
+y.1985 =  6020
+y.1986 =  7791
+y.1987 =  8244
+y.1988 = 10075
+x = y.2000                 /*X will have a value of zero (0).          */
+
+fib.0 = 0                  /*arrays may start with  zero (0).          */
+fib.1 = 1
+fib.2 = 1
+fib.3 = 2
+fib.4 = 3
+fib.5 = 5
+fib.6 = 8
+fib.7 =17
+
+   do n=-5  to 5           /*define an array from  -5  ──►  5          */
+   sawtooth.n=n
+   end   /*n*/             /*eleven elements will be defined.          */
diff --git a/Task/Collections/Ruby/collections-1.rb b/Task/Collections/Ruby/collections-1.rb
new file mode 100644
index 0000000000..8ff9b3b5a0
--- /dev/null
+++ b/Task/Collections/Ruby/collections-1.rb
@@ -0,0 +1,8 @@
+# creating an empty array and adding values
+
+a = []            # => []
+a[0] = 1          # => [1]
+a[3] = 2          # => [1, nil, nil, 2]
+
+# creating an array with the constructor
+a = Array.new     # => []
diff --git a/Task/Collections/Scheme/collections-1.ss b/Task/Collections/Scheme/collections-1.ss
new file mode 100644
index 0000000000..8b3210d122
--- /dev/null
+++ b/Task/Collections/Scheme/collections-1.ss
@@ -0,0 +1 @@
+(list obj ...)
diff --git a/Task/Collections/Tcl/collections-1.tcl b/Task/Collections/Tcl/collections-1.tcl
new file mode 100644
index 0000000000..28fce4fe09
--- /dev/null
+++ b/Task/Collections/Tcl/collections-1.tcl
@@ -0,0 +1,12 @@
+set c [list] ;# create an empty list
+# fill it
+lappend c 10 11 13
+set c [linsert $c 2 "twelve goes here"]
+# iterate over it
+foreach elem $c {puts $elem}
+
+# pass to a proc
+proc show_size {l} {
+    puts [llength $l]
+}
+show_size $c
diff --git a/Task/Color-of-a-screen-pixel/0DESCRIPTION b/Task/Color-of-a-screen-pixel/0DESCRIPTION
new file mode 100644
index 0000000000..87d1c9bbc6
--- /dev/null
+++ b/Task/Color-of-a-screen-pixel/0DESCRIPTION
@@ -0,0 +1 @@
+Get color information from an arbitrary pixel on the screen, such as the current location of the mouse cursor.  The mouse cursor may or may not have to be active in a GUI created by your program.  These functions are OS related.
diff --git a/Task/Color-of-a-screen-pixel/1META.yaml b/Task/Color-of-a-screen-pixel/1META.yaml
new file mode 100644
index 0000000000..b5b7d9296e
--- /dev/null
+++ b/Task/Color-of-a-screen-pixel/1META.yaml
@@ -0,0 +1,4 @@
+---
+category:
+- Testing
+note: GUI
diff --git a/Task/Color-of-a-screen-pixel/BASIC/color-of-a-screen-pixel.bas b/Task/Color-of-a-screen-pixel/BASIC/color-of-a-screen-pixel.bas
new file mode 100644
index 0000000000..ab00b6f9c0
--- /dev/null
+++ b/Task/Color-of-a-screen-pixel/BASIC/color-of-a-screen-pixel.bas
@@ -0,0 +1 @@
+color = point(x, y)
diff --git a/Task/Color-of-a-screen-pixel/C/color-of-a-screen-pixel-1.c b/Task/Color-of-a-screen-pixel/C/color-of-a-screen-pixel-1.c
new file mode 100644
index 0000000000..df27509786
--- /dev/null
+++ b/Task/Color-of-a-screen-pixel/C/color-of-a-screen-pixel-1.c
@@ -0,0 +1,15 @@
+#include 
+void
+get_pixel_color (Display *d, int x, int y, XColor *color)
+{
+  XImage *image;
+  image = XGetImage (d, RootWindow (d, DefaultScreen (d)), x, y, 1, 1, AllPlanes, XYPixmap);
+  color->pixel = XGetPixel (image, 0, 0);
+  XFree (image);
+  XQueryColor (d, DefaultColormap(d, DefaultScreen (d)), color);
+}
+
+// Your code
+XColor c;
+get_pixel_color (display, 30, 40, &c);
+printf ("%d %d %d\n", c.red, c.green, c.blue);
diff --git a/Task/Color-of-a-screen-pixel/C/color-of-a-screen-pixel-2.c b/Task/Color-of-a-screen-pixel/C/color-of-a-screen-pixel-2.c
new file mode 100644
index 0000000000..f0edd20b7f
--- /dev/null
+++ b/Task/Color-of-a-screen-pixel/C/color-of-a-screen-pixel-2.c
@@ -0,0 +1,26 @@
+#include 
+
+COLORREF getColorAtCursor(void) {
+    POINT p;
+    COLORREF color;
+    HDC hDC;
+    BOOL b;
+
+    /* Get the device context for the screen */
+    hDC = GetDC(NULL);
+    if (hDC == NULL)
+        return CLR_INVALID;
+
+    /* Get the current cursor position */
+    b = GetCursorPos(&p);
+    if (!b)
+        return CLR_INVALID;
+
+    /* Retrieve the color at that position */
+    color = GetPixel(hDC, p.x, p.y);
+
+    /* Release the device context again */
+    ReleaseDC(GetDesktopWindow(), hDC);
+
+    return color;
+}
diff --git a/Task/Color-of-a-screen-pixel/Clojure/color-of-a-screen-pixel.clj b/Task/Color-of-a-screen-pixel/Clojure/color-of-a-screen-pixel.clj
new file mode 100644
index 0000000000..a93bf30d3d
--- /dev/null
+++ b/Task/Color-of-a-screen-pixel/Clojure/color-of-a-screen-pixel.clj
@@ -0,0 +1,2 @@
+(defn get-color-at [x y]
+  (.getPixelColor (java.awt.Robot.) x y))
diff --git a/Task/Color-of-a-screen-pixel/Java/color-of-a-screen-pixel.java b/Task/Color-of-a-screen-pixel/Java/color-of-a-screen-pixel.java
new file mode 100644
index 0000000000..1585bc5369
--- /dev/null
+++ b/Task/Color-of-a-screen-pixel/Java/color-of-a-screen-pixel.java
@@ -0,0 +1,3 @@
+public static Color getColorAt(int x, int y){
+   return new Robot().getPixelColor(x, y);
+}
diff --git a/Task/Color-of-a-screen-pixel/PHP/color-of-a-screen-pixel.php b/Task/Color-of-a-screen-pixel/PHP/color-of-a-screen-pixel.php
new file mode 100644
index 0000000000..972a7a8e3e
--- /dev/null
+++ b/Task/Color-of-a-screen-pixel/PHP/color-of-a-screen-pixel.php
@@ -0,0 +1,3 @@
+$img = imagegrabscreen();
+$color = imagecolorat($im, 10, 50);
+imagedestroy($im);
diff --git a/Task/Color-of-a-screen-pixel/PicoLisp/color-of-a-screen-pixel.l b/Task/Color-of-a-screen-pixel/PicoLisp/color-of-a-screen-pixel.l
new file mode 100644
index 0000000000..7dc7c09031
--- /dev/null
+++ b/Task/Color-of-a-screen-pixel/PicoLisp/color-of-a-screen-pixel.l
@@ -0,0 +1,2 @@
+(in '(grabc)
+   (mapcar hex (cdr (line NIL 1 2 2 2))) )
diff --git a/Task/Color-of-a-screen-pixel/Python/color-of-a-screen-pixel-1.py b/Task/Color-of-a-screen-pixel/Python/color-of-a-screen-pixel-1.py
new file mode 100644
index 0000000000..74f56cb70d
--- /dev/null
+++ b/Task/Color-of-a-screen-pixel/Python/color-of-a-screen-pixel-1.py
@@ -0,0 +1,9 @@
+def get_pixel_colour(i_x, i_y):
+	import win32gui
+	i_desktop_window_id = win32gui.GetDesktopWindow()
+	i_desktop_window_dc = win32gui.GetWindowDC(i_desktop_window_id)
+	long_colour = win32gui.GetPixel(i_desktop_window_dc, i_x, i_y)
+	i_colour = int(long_colour)
+	return (i_colour & 0xff), ((i_colour >> 8) & 0xff), ((i_colour >> 16) & 0xff)
+
+print get_pixel_colour(0, 0)
diff --git a/Task/Color-of-a-screen-pixel/Python/color-of-a-screen-pixel-2.py b/Task/Color-of-a-screen-pixel/Python/color-of-a-screen-pixel-2.py
new file mode 100644
index 0000000000..487d260c9c
--- /dev/null
+++ b/Task/Color-of-a-screen-pixel/Python/color-of-a-screen-pixel-2.py
@@ -0,0 +1,5 @@
+def get_pixel_colour(i_x, i_y):
+	import PIL.ImageGrab
+	return PIL.ImageGrab.grab().load()[i_x, i_y]
+
+print get_pixel_colour(0, 0)
diff --git a/Task/Color-of-a-screen-pixel/Python/color-of-a-screen-pixel-3.py b/Task/Color-of-a-screen-pixel/Python/color-of-a-screen-pixel-3.py
new file mode 100644
index 0000000000..dbd94fde84
--- /dev/null
+++ b/Task/Color-of-a-screen-pixel/Python/color-of-a-screen-pixel-3.py
@@ -0,0 +1,11 @@
+def get_pixel_colour(i_x, i_y):
+	import PIL.Image # python-imaging
+	import PIL.ImageStat # python-imaging
+	import Xlib.display # python-xlib
+	o_x_root = Xlib.display.Display().screen().root
+	o_x_image = o_x_root.get_image(i_x, i_y, 1, 1, Xlib.X.ZPixmap, 0xffffffff)
+	o_pil_image_rgb = PIL.Image.fromstring("RGB", (1, 1), o_x_image.data, "raw", "BGRX")
+	lf_colour = PIL.ImageStat.Stat(o_pil_image_rgb).mean
+	return tuple(map(int, lf_colour))
+
+print get_pixel_colour(0, 0)
diff --git a/Task/Color-of-a-screen-pixel/Python/color-of-a-screen-pixel-4.py b/Task/Color-of-a-screen-pixel/Python/color-of-a-screen-pixel-4.py
new file mode 100644
index 0000000000..e86a158555
--- /dev/null
+++ b/Task/Color-of-a-screen-pixel/Python/color-of-a-screen-pixel-4.py
@@ -0,0 +1,7 @@
+def get_pixel_colour(i_x, i_y):
+	import gtk # python-gtk2
+	o_gdk_pixbuf = gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB, False, 8, 1, 1)
+	o_gdk_pixbuf.get_from_drawable(gtk.gdk.get_default_root_window(), gtk.gdk.colormap_get_system(), i_x, i_y, 0, 0, 1, 1)
+	return tuple(o_gdk_pixbuf.get_pixels_array().tolist()[0][0])
+
+print get_pixel_colour(0, 0)
diff --git a/Task/Color-of-a-screen-pixel/Python/color-of-a-screen-pixel-5.py b/Task/Color-of-a-screen-pixel/Python/color-of-a-screen-pixel-5.py
new file mode 100644
index 0000000000..f374f5256b
--- /dev/null
+++ b/Task/Color-of-a-screen-pixel/Python/color-of-a-screen-pixel-5.py
@@ -0,0 +1,9 @@
+def get_pixel_colour(i_x, i_y):
+	import PyQt4.QtGui # python-qt4
+	app = PyQt4.QtGui.QApplication([])
+	long_qdesktop_id = PyQt4.QtGui.QApplication.desktop().winId()
+	long_colour = PyQt4.QtGui.QPixmap.grabWindow(long_qdesktop_id, i_x, i_y, 1, 1).toImage().pixel(0, 0)
+	i_colour = int(long_colour)
+	return ((i_colour >> 16) & 0xff), ((i_colour >> 8) & 0xff), (i_colour & 0xff)
+
+print get_pixel_colour(0, 0)
diff --git a/Task/Color-of-a-screen-pixel/Tcl/color-of-a-screen-pixel.tcl b/Task/Color-of-a-screen-pixel/Tcl/color-of-a-screen-pixel.tcl
new file mode 100644
index 0000000000..1a9d5d3894
--- /dev/null
+++ b/Task/Color-of-a-screen-pixel/Tcl/color-of-a-screen-pixel.tcl
@@ -0,0 +1,22 @@
+package require Tcl 8.5
+package require Tk
+
+# Farm out grabbing the screen to an external program.
+# If it was just for a Tk window, we'd use the tkimg library instead
+proc grabScreen {image} {
+    set pipe [open {|xwd -root -silent | convert xwd:- ppm:-} rb]
+    $image put [read $pipe]
+    close $pipe
+}
+# Get the RGB data for a particular pixel (global coords)
+proc getPixelAtPoint {x y} {
+    set buffer [image create photo]
+    grabScreen $buffer
+    set data [$image get $x $y]
+    image delete $buffer
+    return $data
+}
+
+# Demo...
+puts [format "pixel at mouse: (%d,%d,%d)" \
+    {*}[getPixelAtPoint {*}[winfo pointerxy .]]]
diff --git a/Task/Comments/360-Assembly/comments.360 b/Task/Comments/360-Assembly/comments.360
new file mode 100644
index 0000000000..f8b5009c23
--- /dev/null
+++ b/Task/Comments/360-Assembly/comments.360
@@ -0,0 +1,5 @@
+* An asterisk in column one denotes a comment line
+* Comments may also follow any syntactically complete instruction:
+ NOP This is a comment (after a NOP instruction)
+* Comments after instructions with omitted operands require a comma ","
+ END , Comment (without comma, "Comment" assumed an operand of "END")
diff --git a/Task/Comments/ACL2/comments.acl2 b/Task/Comments/ACL2/comments.acl2
new file mode 100644
index 0000000000..acb39e4821
--- /dev/null
+++ b/Task/Comments/ACL2/comments.acl2
@@ -0,0 +1,3 @@
+; Single line comment
+#| Multi-line
+comment |#
diff --git a/Task/Comments/Ada/comments.ada b/Task/Comments/Ada/comments.ada
new file mode 100644
index 0000000000..bffee3723b
--- /dev/null
+++ b/Task/Comments/Ada/comments.ada
@@ -0,0 +1 @@
+-- All Ada comments begin with "--" and extend to the end of the line
diff --git a/Task/Comments/Befunge/comments-1.bf b/Task/Comments/Befunge/comments-1.bf
new file mode 100644
index 0000000000..1093ad850a
--- /dev/null
+++ b/Task/Comments/Befunge/comments-1.bf
@@ -0,0 +1,2 @@
+& read a number 2+ add two .@ display result and exit
+  ^- inline comments -^     <-^- other comments
diff --git a/Task/Comments/C/comments-1.c b/Task/Comments/C/comments-1.c
new file mode 100644
index 0000000000..53d4557b7c
--- /dev/null
+++ b/Task/Comments/C/comments-1.c
@@ -0,0 +1,4 @@
+/* This is a comment. */
+/* So is this
+   multiline comment.
+ */
diff --git a/Task/Comments/Clojure/comments-1.clj b/Task/Comments/Clojure/comments-1.clj
new file mode 100644
index 0000000000..9ede8de331
--- /dev/null
+++ b/Task/Comments/Clojure/comments-1.clj
@@ -0,0 +1,3 @@
+;; This is a comment
+(defn foo []
+  123) ; also a comment
diff --git a/Task/Comments/Forth/comments-1.fth b/Task/Comments/Forth/comments-1.fth
new file mode 100644
index 0000000000..ca6ea27d69
--- /dev/null
+++ b/Task/Comments/Forth/comments-1.fth
@@ -0,0 +1,2 @@
+\ The backslash skips everything else on the line
+( The left paren skips everything up to the next right paren on the same line)
diff --git a/Task/Comments/Fortran/comments-1.f b/Task/Comments/Fortran/comments-1.f
new file mode 100644
index 0000000000..674c995170
--- /dev/null
+++ b/Task/Comments/Fortran/comments-1.f
@@ -0,0 +1,2 @@
+C     This would be some kind of comment
+C     Usually one would avoid columns 2-6 even in a comment.
diff --git a/Task/Comments/Java/comments-1.java b/Task/Comments/Java/comments-1.java
new file mode 100644
index 0000000000..af7b13120b
--- /dev/null
+++ b/Task/Comments/Java/comments-1.java
@@ -0,0 +1 @@
+/* This is a comment */
diff --git a/Task/Comments/LaTeX/comments-1.tex b/Task/Comments/LaTeX/comments-1.tex
new file mode 100644
index 0000000000..d64a88343a
--- /dev/null
+++ b/Task/Comments/LaTeX/comments-1.tex
@@ -0,0 +1 @@
+% This is a comment
diff --git a/Task/Comments/Lua/comments-1.lua b/Task/Comments/Lua/comments-1.lua
new file mode 100644
index 0000000000..7cc093cb7a
--- /dev/null
+++ b/Task/Comments/Lua/comments-1.lua
@@ -0,0 +1,4 @@
+-- A single line comment
+
+--[[A multi-line
+    comment --]]
diff --git a/Task/Comments/PHP/comments-1.php b/Task/Comments/PHP/comments-1.php
new file mode 100644
index 0000000000..aac4c5c56e
--- /dev/null
+++ b/Task/Comments/PHP/comments-1.php
@@ -0,0 +1,2 @@
+# this is commented
+// this is commented
diff --git a/Task/Comments/Perl/comments-1.pl b/Task/Comments/Perl/comments-1.pl
new file mode 100644
index 0000000000..2369670383
--- /dev/null
+++ b/Task/Comments/Perl/comments-1.pl
@@ -0,0 +1 @@
+# this is commented
diff --git a/Task/Comments/Prolog/comments-1.pro b/Task/Comments/Prolog/comments-1.pro
new file mode 100644
index 0000000000..7da8a17906
--- /dev/null
+++ b/Task/Comments/Prolog/comments-1.pro
@@ -0,0 +1 @@
+% this is a single-line comment that extends to the end of the line
diff --git a/Task/Comments/Python/comments-1.py b/Task/Comments/Python/comments-1.py
new file mode 100644
index 0000000000..910d8dddba
--- /dev/null
+++ b/Task/Comments/Python/comments-1.py
@@ -0,0 +1,9 @@
+"""Un-assigned strings in triple-quotes might be used
+   as multi-line comments
+"""
+
+'''
+   "triple quoted strings" can be delimited by either 'single' or "double" quote marks; and they can contain mixtures
+   of other quote marks without any need to \escape\ them using any special characters.  They also may span multiple
+   lines without special escape characters.
+'''
diff --git a/Task/Comments/REXX/comments-1.rexx b/Task/Comments/REXX/comments-1.rexx
new file mode 100644
index 0000000000..7080de54ba
--- /dev/null
+++ b/Task/Comments/REXX/comments-1.rexx
@@ -0,0 +1,42 @@
+/*REXX program to demonstrate various uses and types of comments. */
+
+/* everything between a "climbstar" and a "starclimb" (exclusive of literals) is
+   a comment.
+                         climbstar =  /*   [slash-asterisk]
+                         starclimb =  */   [asterisk-slash]
+
+            /* this is a nested comment, by gum! */
+            /*so is this*/
+
+Also, REXX comments can span multiple records.
+
+There can be no intervening character between the slash and asterisk  (or
+the asterisk and slash).  These two joined characters cannot be separated
+via a continued line, as in the manner of:
+
+       say 'If I were two─faced,' ,
+           'would I be wearing this one?' ,
+           '      --- Abraham Lincoln'
+
+Here come's the thingy that ends this REXX comment. ───┐
+                                                       │
+                                                       │
+                                                       ↓
+
+                                                       */
+
+    hour = 12       /*high noon                   */
+midnight = 00       /*first hour of the day       */
+   suits = 1234     /*card suits:   ♥  ♦  ♣  ♠    */
+
+hutchHdr = '/*'
+hutchEnd = "*/"
+
+    /* the previous two "hutch" assignments aren't
+       the start  nor  the end of a REXX comment. */
+
+  x=1000000 **   /*¡big power!*/   1000
+
+/*not a real good place for a comment (above),
+  but essentially, a REXX comment can be
+  anywhere whitespace is allowed.            */
diff --git a/Task/Comments/Tcl/comments-1.tcl b/Task/Comments/Tcl/comments-1.tcl
new file mode 100644
index 0000000000..69917fc2ad
--- /dev/null
+++ b/Task/Comments/Tcl/comments-1.tcl
@@ -0,0 +1,3 @@
+# comment on a line by itself. The next is a command by itself:
+set var1 $value1
+set var2 $value2 ; # comment that follows a line of code
diff --git a/Task/Death-Star/0DESCRIPTION b/Task/Death-Star/0DESCRIPTION
new file mode 100644
index 0000000000..8af42b60ea
--- /dev/null
+++ b/Task/Death-Star/0DESCRIPTION
@@ -0,0 +1,3 @@
+Death Star is a task to display a region that consists of a large sphere with part of a smaller sphere removed from it as a result of geometric subtraction. (This will basically produce a shape like a "death star".)
+
+See also: [[Draw a sphere]].
diff --git a/Task/Death-Star/1META.yaml b/Task/Death-Star/1META.yaml
new file mode 100644
index 0000000000..791c0eb3c9
--- /dev/null
+++ b/Task/Death-Star/1META.yaml
@@ -0,0 +1,6 @@
+---
+category:
+- Geometric Subtraction
+note: Constructive Solid Geometry
+requires:
+- Graphics
diff --git a/Task/Death-Star/C/death-star.c b/Task/Death-Star/C/death-star.c
new file mode 100644
index 0000000000..e7b1f1ac04
--- /dev/null
+++ b/Task/Death-Star/C/death-star.c
@@ -0,0 +1,112 @@
+#include 
+#include 
+#include 
+
+const char *shades = ".:!*oe&#%@";
+
+double light[3] = { -50, 0, 50 };
+void normalize(double * v)
+{
+	double len = sqrt(v[0]*v[0] + v[1]*v[1] + v[2]*v[2]);
+	v[0] /= len; v[1] /= len; v[2] /= len;
+}
+
+double dot(double *x, double *y)
+{
+	double d = x[0]*y[0] + x[1]*y[1] + x[2]*y[2];
+	return d < 0 ? -d : 0;
+}
+
+typedef struct { double cx, cy, cz, r; } sphere_t;
+
+/* positive shpere and negative sphere */
+sphere_t pos = { 20, 20, 0, 20 }, neg = { 1, 1, -6, 20 };
+
+/* check if a ray (x,y, -inf)->(x, y, inf) hits a sphere; if so, return
+   the intersecting z values.  z1 is closer to the eye */
+int hit_sphere(sphere_t *sph, double x, double y, double *z1, double *z2)
+{
+	double zsq;
+	x -= sph->cx;
+	y -= sph->cy;
+	zsq = sph->r * sph->r - (x * x + y * y);
+	if (zsq < 0) return 0;
+	zsq = sqrt(zsq);
+	*z1 = sph->cz - zsq;
+	*z2 = sph->cz + zsq;
+	return 1;
+}
+
+void draw_sphere(double k, double ambient)
+{
+	int i, j, intensity, hit_result;
+	double b;
+	double vec[3], x, y, zb1, zb2, zs1, zs2;
+	for (i = floor(pos.cy - pos.r); i <= ceil(pos.cy + pos.r); i++) {
+		y = i + .5;
+		for (j = floor(pos.cx - 2 * pos.r); j <= ceil(pos.cx + 2 * pos.r); j++) {
+			x = (j - pos.cx) / 2. + .5 + pos.cx;
+
+			/* ray lands in blank space, draw bg */
+			if (!hit_sphere(&pos, x, y, &zb1, &zb2))
+				hit_result = 0;
+
+			/* ray hits pos sphere but not neg, draw pos sphere surface */
+			else if (!hit_sphere(&neg, x, y, &zs1, &zs2))
+				hit_result = 1;
+
+			/* ray hits both, but pos front surface is closer */
+			else if (zs1 > zb1) hit_result = 1;
+
+			/* pos sphere surface is inside neg sphere, show bg */
+			else if (zs2 > zb2) hit_result = 0;
+
+			/* back surface on neg sphere is inside pos sphere,
+			   the only place where neg sphere surface will be shown */
+			else if (zs2 > zb1) hit_result = 2;
+			else		    hit_result = 1;
+
+			switch(hit_result) {
+			case 0:
+				putchar('+');
+				continue;
+			case 1:
+				vec[0] = x - pos.cx;
+				vec[1] = y - pos.cy;
+				vec[2] = zb1 - pos.cz;
+				break;
+			default:
+				vec[0] = neg.cx - x;
+				vec[1] = neg.cy - y;
+				vec[2] = neg.cz - zs2;
+			}
+
+			normalize(vec);
+			b = pow(dot(light, vec), k) + ambient;
+			intensity = (1 - b) * (sizeof(shades) - 1);
+			if (intensity < 0) intensity = 0;
+			if (intensity >= sizeof(shades) - 1)
+				intensity = sizeof(shades) - 2;
+			putchar(shades[intensity]);
+		}
+		putchar('\n');
+	}
+}
+
+int main()
+{
+	double ang = 0;
+
+	while (1) {
+		printf("\033[H");
+		light[1] = cos(ang * 2);
+		light[2] = cos(ang);
+		light[0] = sin(ang);
+		normalize(light);
+		ang += .05;
+
+		draw_sphere(2, .3);
+		usleep(100000);
+	}
+	return 0;
+}
diff --git a/Task/Death-Star/Go/death-star.go b/Task/Death-Star/Go/death-star.go
new file mode 100644
index 0000000000..b4a72191f9
--- /dev/null
+++ b/Task/Death-Star/Go/death-star.go
@@ -0,0 +1,103 @@
+package main
+
+import (
+    "fmt"
+    "image"
+    "image/color"
+    "image/png"
+    "math"
+    "os"
+)
+
+type vector [3]float64
+
+func (v *vector) normalize() {
+    invLen := 1 / math.Sqrt(dot(v, v))
+    v[0] *= invLen
+    v[1] *= invLen
+    v[2] *= invLen
+}
+
+func dot(x, y *vector) float64 {
+    return x[0]*y[0] + x[1]*y[1] + x[2]*y[2]
+}
+
+type sphere struct {
+    cx, cy, cz int
+    r          int
+}
+
+func (s *sphere) hit(x, y int) (z1, z2 float64, hit bool) {
+    x -= s.cx
+    y -= s.cy
+    if zsq := s.r*s.r - (x*x + y*y); zsq >= 0 {
+        zsqrt := math.Sqrt(float64(zsq))
+        return float64(s.cz) - zsqrt, float64(s.cz) + zsqrt, true
+    }
+    return 0, 0, false
+}
+
+func deathStar(pos, neg *sphere, k, amb float64, dir *vector) *image.Gray {
+    w, h := pos.r*4, pos.r*3
+    bounds := image.Rect(pos.cx-w/2, pos.cy-h/2, pos.cx+w/2, pos.cy+h/2)
+    img := image.NewGray(bounds)
+    vec := new(vector)
+    for y, yMax := pos.cy-pos.r, pos.cy+pos.r; y <= yMax; y++ {
+        for x, xMax := pos.cx-pos.r, pos.cx+pos.r; x <= xMax; x++ {
+            zb1, zb2, hit := pos.hit(x, y)
+            if !hit {
+                continue
+            }
+            zs1, zs2, hit := neg.hit(x, y)
+            if hit {
+                if zs1 > zb1 {
+                    hit = false
+                } else if zs2 > zb2 {
+                    continue
+                }
+            }
+            if hit {
+                vec[0] = float64(neg.cx - x)
+                vec[1] = float64(neg.cy - y)
+                vec[2] = float64(neg.cz) - zs2
+            } else {
+                vec[0] = float64(x - pos.cx)
+                vec[1] = float64(y - pos.cy)
+                vec[2] = zb1 - float64(pos.cz)
+            }
+            vec.normalize()
+            s := dot(dir, vec)
+            if s < 0 {
+                s = 0
+            }
+            lum := 255 * (math.Pow(s, k) + amb) / (1 + amb)
+            if lum < 0 {
+                lum = 0
+            } else if lum > 255 {
+                lum = 255
+            }
+            img.SetGray(x, y, color.Gray{uint8(lum)})
+        }
+    }
+    return img
+}
+
+func main() {
+    dir := &vector{20, -40, -10}
+    dir.normalize()
+    pos := &sphere{0, 0, 0, 120}
+    neg := &sphere{-90, -90, -30, 100}
+
+    img := deathStar(pos, neg, 1.5, .2, dir)
+    f, err := os.Create("dstar.png")
+    if err != nil {
+        fmt.Println(err)
+        return
+    }
+    if err = png.Encode(f, img); err != nil {
+        fmt.Println(err)
+    }
+    if err = f.Close(); err != nil {
+        fmt.Println(err)
+    }
+}
diff --git a/Task/Death-Star/Perl/death-star.pl b/Task/Death-Star/Perl/death-star.pl
new file mode 100644
index 0000000000..34c04d12fb
--- /dev/null
+++ b/Task/Death-Star/Perl/death-star.pl
@@ -0,0 +1,75 @@
+use strict;
+
+sub sq {
+	my $s = 0;
+	$s += $_ ** 2 for @_;
+	$s;
+}
+
+sub hit {
+	my ($sph, $x, $y) = @_;
+	$x -= $sph->[0];
+	$y -= $sph->[1];
+
+	my $z = sq($sph->[3]) - sq($x, $y);
+	return	if $z < 0;
+
+	$z = sqrt $z;
+	return $sph->[2] - $z, $sph->[2] + $z;
+}
+
+sub normalize {
+	my $v = shift;
+	my $n = sqrt sq(@$v);
+	$_ /= $n for @$v;
+	$v;
+}
+
+sub dot {
+	my ($x, $y) = @_;
+	my $s = $x->[0] * $y->[0] + $x->[1] * $y->[1] + $x->[2] * $y->[2];
+	$s > 0 ? $s : 0;
+}
+
+my $pos = [ 120, 120, 0, 120 ];
+my $neg = [ -77, -33, -100, 190 ];
+my $light = normalize([ -12, 13, -10 ]);
+sub draw {
+	my ($k, $amb) = @_;
+	binmode STDOUT, ":raw";
+	print "P5\n", $pos->[0] * 2 + 3, " ", $pos->[1] * 2 + 3, "\n255\n";
+	for my $y (($pos->[1] - $pos->[3] - 1) .. ($pos->[1] + $pos->[3] + 1)) {
+		my @row = ();
+		for my $x (($pos->[0] - $pos->[3] - 1) .. ($pos->[0] + $pos->[3] + 1)) {
+			my ($hit, @hs) = 0;
+			my @h = hit($pos, $x, $y);
+
+			if (!@h) { $hit = 0 }
+			elsif (!(@hs = hit($neg, $x, $y))) { $hit = 1 }
+			elsif ($hs[0] > $h[0]) { $hit = 1 }
+			elsif ($hs[1] > $h[0]) { $hit = $hs[1] > $h[1] ? 0 : 2 }
+			else { $hit = 1 }
+
+			my ($val, $v);
+			if ($hit == 0) { $val = 0 }
+			elsif ($hit == 1) {
+				$v = [	$x - $pos->[0],
+					$y - $pos->[1],
+					$h[0] - $pos->[2] ];
+			} else {
+				$v = [	$neg->[0] - $x,
+					$neg->[1] - $y,
+					$neg->[2] - $hs[1] ];
+			}
+			if ($v) {
+				normalize($v);
+				$val = int((dot($v, $light) ** $k + $amb) * 255);
+				$val = ($val > 255) ? 255 : ($val < 0) ? 0 : $val;
+			}
+			push @row, $val;
+		}
+		print pack("C*", @row);
+	}
+}
+
+draw(2, 0.2);
diff --git a/Task/Death-Star/Python/death-star.py b/Task/Death-Star/Python/death-star.py
new file mode 100644
index 0000000000..f122e6d06b
--- /dev/null
+++ b/Task/Death-Star/Python/death-star.py
@@ -0,0 +1,67 @@
+import sys, math, collections
+
+Sphere = collections.namedtuple("Sphere", "cx cy cz r")
+V3 = collections.namedtuple("V3", "x y z")
+
+def normalize((x, y, z)):
+    len = math.sqrt(x**2 + y**2 + z**2)
+    return V3(x / len, y / len, z / len)
+
+def dot(v1, v2):
+    d = v1.x*v2.x + v1.y*v2.y + v1.z*v2.z
+    return -d if d < 0 else 0.0
+
+def hit_sphere(sph, x0, y0):
+    x = x0 - sph.cx
+    y = y0 - sph.cy
+    zsq = sph.r ** 2 - (x ** 2 + y ** 2)
+    if zsq < 0:
+        return (False, 0, 0)
+    szsq = math.sqrt(zsq)
+    return (True, sph.cz - szsq, sph.cz + szsq)
+
+def draw_sphere(k, ambient, light):
+    shades = ".:!*oe&#%@"
+    pos = Sphere(20.0, 20.0, 0.0, 20.0)
+    neg = Sphere(1.0, 1.0, -6.0, 20.0)
+
+    for i in xrange(int(math.floor(pos.cy - pos.r)),
+                    int(math.ceil(pos.cy + pos.r) + 1)):
+        y = i + 0.5
+        for j in xrange(int(math.floor(pos.cx - 2 * pos.r)),
+                        int(math.ceil(pos.cx + 2 * pos.r) + 1)):
+            x = (j - pos.cx) / 2.0 + 0.5 + pos.cx
+
+            (h, zb1, zb2) = hit_sphere(pos, x, y)
+            if not h:
+                hit_result = 0
+            else:
+                (h, zs1, zs2) = hit_sphere(neg, x, y)
+                if not h:
+                    hit_result = 1
+                elif zs1 > zb1:
+                    hit_result = 1
+                elif zs2 > zb2:
+                    hit_result = 0
+                elif zs2 > zb1:
+                    hit_result = 2
+                else:
+                    hit_result = 1
+
+            if hit_result == 0:
+                sys.stdout.write(' ')
+                continue
+            elif hit_result == 1:
+                vec = V3(x - pos.cx, y - pos.cy, zb1 - pos.cz)
+            elif hit_result == 2:
+                vec = V3(neg.cx-x, neg.cy-y, neg.cz-zs2)
+            vec = normalize(vec)
+
+            b = dot(light, vec) ** k + ambient
+            intensity = int((1 - b) * len(shades))
+            intensity = min(len(shades), max(0, intensity))
+            sys.stdout.write(shades[intensity])
+        print
+
+light = normalize(V3(-50, 30, 50))
+draw_sphere(2, 0.5, light)
diff --git a/Task/Death-Star/REXX/death-star.rexx b/Task/Death-Star/REXX/death-star.rexx
new file mode 100644
index 0000000000..7d9e0fe031
--- /dev/null
+++ b/Task/Death-Star/REXX/death-star.rexx
@@ -0,0 +1,75 @@
+/*REXX program to draw a "deathstar", a sphere with another subtracted. */
+signal on syntax; signal on novalue    /*handle REXX program errors.    */
+numeric digits 20                      /*use a fair amount of precision.*/
+                             lightSource = norm('-50  30  50')
+call drawSphereM   2,  .5,   lightSource
+exit                                   /*stick a fork in it, we're done.*/
+/*──────────────────────────────────drawSphereM subroutine──────────────*/
+drawSphereM: procedure;  parse arg k,ambient,lightSource
+z1=0; z2=0
+parse var  lightSource   s1 s2 s3      /*break-apart the light source.  */
+
+                 shading='·:!ºoe@░▒▓'  /*shading chars for ASCI machines*/
+if 1=='f1'x then shading='.:!*oe&#%@'  /*shading chars for EBCDIC machs.*/
+
+shadesLength=length(shading)
+shades.=' ';                    do i=1  for shadesLength
+                                shades.i=substr(shading,i,1)
+                                end   /*i*/
+
+ship= 20 20  0 20 ;     parse var ship ship.cx ship.cy ship.cz ship.radius
+hole=' 1  1 -6 20';     parse var hole hole.cx hole.cy hole.cz hole.radius
+
+  do   i=floor(ship.cy-ship.radius) to ceil(ship.cy+ship.radius)+1;  y=i+.5;  aLine=
+    do j=trunc(floor(ship.cx - 2*ship.radius) )     to,
+         trunc( ceil(ship.cx + 2*ship.radius) +1)
+    x=.5*(j-ship.cx) + .5 + ship.cx;    !bg=0;    !pos=0;    !neg=0;    z1=0;   z2=0
+    ?=hitSphere(ship, x, y);            zb1=z1;   zb2=z2
+
+    if \? then !bg=1                                                             /*ray lands in blank space, draw the background.        */
+          else do
+               ?=hitsphere(hole, x, y);  zs1=z1;   zs2=z2
+               if \? then !pos=1                                                 /*ray hits ship but not the hole, draw ship surface.    */
+                     else if zs1>zb1 then !pos=1                                 /*ray hits both, but ship front surface is closer.      */
+                                     else if zs2>zb2 then !bg=1                  /*ship surface is inside hole,  show background.        */
+                                                     else if zs2>zb1 then !neg=1 /*back surface in hole is inside ship, the only place hole surface will be shown.*/
+                                                                     else !pos=1
+               end
+      select
+      when !bg   then do;  aLine=aLine' ';                iterate j;   end
+      when !pos  then      vec_=V3(x-ship.cx y-ship.cy zb1-ship.cz)
+      when !neg  then      vec_=V3(hole.cx-x hole.cy-y hole.cz-zs2)
+      end    /*select*/
+
+    nvec=norm(vec_)
+    b=dot.(lightSource,nvec)**k + ambient
+    intensity=trunc((1-b) * shadesLength)
+    intensity=min(shadesLength, max(0, intensity)) + 1
+    aLine=aLine || shades.intensity
+    end     /*j*/
+
+  if aline\=''  then say strip(aLine,'T')
+  end       /*i*/
+
+return
+/*──────────────────────────────────hitSphere subroutine────────────────*/
+hitSphere: procedure expose z1 z2; parse arg $.cx $.cy $.cz $.radius, x0, y0
+           x=x0-$.cx
+           y=y0-$.cy
+           zsq=$.radius**2 - (x**2 + y**2);        if zsq<0  then return 0
+           _=sqrt(zsq)
+           z1=$.cz-_
+           z2=$.cz+_
+           return 1
+/*──────────────────────────────────"1-liner" subroutines───────────────*/
+V3:      procedure; parse arg v; return norm(v)
+dot.:    procedure; parse arg x,y; d=dot(x,y); if d<0 then return -d; return 0
+dot:     procedure; parse arg x,y; s=0; do j=1 for words(x); s=s+word(x,j)*word(y,j); end; return s
+err:     say; say; say center(' error! ',max(40,linesize()%2),"*"); say;  do j=1 for arg(); say arg(j); say; end; say; exit 13
+novalue: syntax: call err 'REXX program' condition('C') "error", condition('D'),'REXX source statement (line' sigl"):",sourceline(sigl)
+ceil:    procedure;   parse arg x;   _=trunc(x);   return _ + (x>0) * (x\=_)
+floor:   procedure;   parse arg x;   _=trunc(x);   return _ - (x<0) * (x\=_)
+norm:    parse arg _1 _2 _3; _=sqrt(_1**2+_2**2+_3**2); return _1/_ _2/_ _3/_
+sqrt:    procedure;  parse arg x;  if x=0 then return 0;   return .sqrt(x)/1
+.sqrt:   d=digits();numeric digits 11;g=.sqrtG();do j=0 while p>9;m.j=p;p=p%2+1;end;do k=j+5 by -1 to 0;if m.k>11 then numeric digits m.k;g=.5*(g+x/g);end;return g
+.sqrtG:  numeric form;   m.=11;   p=d+d%4+2;   v=format(x,2,1,,0) 'E0';  parse var v g 'E' _ .;   return g*.5'E'_%2
diff --git a/Task/Death-Star/Tcl/death-star-1.tcl b/Task/Death-Star/Tcl/death-star-1.tcl
new file mode 100644
index 0000000000..c3c1504726
--- /dev/null
+++ b/Task/Death-Star/Tcl/death-star-1.tcl
@@ -0,0 +1,115 @@
+package require Tcl 8.5
+
+proc normalize vec {
+    upvar 1 $vec v
+    lassign $v x y z
+    set len [expr {sqrt($x**2 + $y**2 + $z**2)}]
+    set v [list [expr {$x/$len}] [expr {$y/$len}] [expr {$z/$len}]]
+    return
+}
+
+proc dot {a b} {
+    lassign $a ax ay az
+    lassign $b bx by bz
+    return [expr {-($ax*$bx + $ay*$by + $az*$bz)}]
+}
+
+# Intersection code; assumes that the vector is parallel to the Z-axis
+proc hitSphere {sphere x y z1 z2} {
+    dict with sphere {
+	set x [expr {$x - $cx}]
+	set y [expr {$y - $cy}]
+	set zsq [expr {$r**2 - $x**2 - $y**2}]
+	if {$zsq < 0} {return 0}
+	upvar 1 $z1 _1 $z2 _2
+	set zsq [expr {sqrt($zsq)}]
+	set _1 [expr {$cz - $zsq}]
+	set _2 [expr {$cz + $zsq}]
+	return 1
+    }
+}
+
+# How to do the intersection with our scene
+proc intersectDeathStar {x y vecName} {
+    global big small
+    if {![hitSphere $big $x $y zb1 zb2]} {
+	# ray lands in blank space
+	return 0
+    }
+    upvar 1 $vecName vec
+    # ray hits big sphere; check if it hit the small one first
+    set vec [if {
+	![hitSphere $small $x $y zs1 zs2] || $zs1 > $zb1 || $zs2 <= $zb1
+    } then {
+	dict with big {
+	    list [expr {$x - $cx}] [expr {$y - $cy}] [expr {$zb1 - $cz}]
+	}
+    } else {
+	dict with small {
+	    list [expr {$cx - $x}] [expr {$cy - $y}] [expr {$cz - $zs2}]
+	}
+    }]
+    normalize vec
+    return 1
+}
+
+# Intensity calculators for different lighting components
+proc diffuse {k intensity L N} {
+    expr {[dot $L $N] ** $k * $intensity}
+}
+proc specular {k intensity L N S} {
+    # Calculate reflection vector
+    set r [expr {2 * [dot $L $N]}]
+    foreach l $L n $N {lappend R [expr {$l-$r*$n}]}
+    normalize R
+    # Calculate the specular reflection term
+    return [expr {[dot $R $S] ** $k * $intensity}]
+}
+
+# Simple raytracing engine that uses parallel rays
+proc raytraceEngine {diffparms specparms ambient intersector shades renderer fx tx sx fy ty sy} {
+    global light
+    for {set y $fy} {$y <= $ty} {set y [expr {$y + $sy}]} {
+	set line {}
+	for {set x $fx} {$x <= $tx} {set x [expr {$x + $sx}]} {
+	    if {![$intersector $x $y vec]} {
+		# ray lands in blank space
+		set intensity end
+	    } else {
+		# ray hits something; we've got the normalized vector
+		set b [expr {
+		    [diffuse {*}$diffparms $light $vec]
+		    + [specular {*}$specparms $light $vec {0 0 -1}]
+		    + $ambient
+		}]
+		set intensity [expr {int((1-$b) * ([llength $shades]-1))}]
+		if {$intensity < 0} {
+		    set intensity 0
+		} elseif {$intensity >= [llength $shades]-1} {
+		    set intensity end-1
+		}
+	    }
+	    lappend line [lindex $shades $intensity]
+	}
+	{*}$renderer $line
+    }
+}
+
+# The general scene settings
+set light {-50 30 50}
+set big   {cx 20 cy 20 cz 0   r 20}
+set small {cx 7  cy 7  cz -10 r 15}
+normalize light
+
+# Render as text
+proc textDeathStar {diff spec lightBrightness ambient} {
+    global big
+    dict with big {
+	raytraceEngine [list $diff $lightBrightness] \
+	    [list $spec $lightBrightness] $ambient intersectDeathStar \
+	    [split ".:!*oe&#%@ " {}] {apply {l {puts [join $l ""]}}} \
+	    [expr {$cx+floor(-$r)}] [expr {$cx+ceil($r)+0.5}] 0.5 \
+	    [expr {$cy+floor(-$r)+0.5}] [expr {$cy+ceil($r)+0.5}] 1
+    }
+}
+textDeathStar 3 10 0.7 0.3
diff --git a/Task/Death-Star/Tcl/death-star-2.tcl b/Task/Death-Star/Tcl/death-star-2.tcl
new file mode 100644
index 0000000000..c6faa78117
--- /dev/null
+++ b/Task/Death-Star/Tcl/death-star-2.tcl
@@ -0,0 +1,18 @@
+# Render as a picture (with many hard-coded settings)
+package require Tk
+proc guiDeathStar {photo diff spec lightBrightness ambient} {
+    set row 0
+    for {set i 255} {$i>=0} {incr i -1} {
+	lappend shades [format "#%02x%02x%02x" $i $i $i]
+    }
+    raytraceEngine [list $diff $lightBrightness] \
+	[list $spec $lightBrightness] $ambient intersectDeathStar \
+	$shades {apply {l {
+	    upvar 2 photo photo row row
+	    $photo put [list $l] -to 0 $row
+	    incr row
+	    update
+	}}} 0 40 0.0625 0 40 0.0625
+}
+pack [label .l -image [image create photo ds]]
+guiDeathStar ds 3 10 0.7 0.3
diff --git a/Task/Define-a-primitive-data-type/0DESCRIPTION b/Task/Define-a-primitive-data-type/0DESCRIPTION
new file mode 100644
index 0000000000..8ae8a5e4ed
--- /dev/null
+++ b/Task/Define-a-primitive-data-type/0DESCRIPTION
@@ -0,0 +1,3 @@
+{{omit from|BBC BASIC}}
+[[Category:Type System]]
+Demonstrate how to define a type that behaves like an integer but has a lowest valid value of 1 and a highest valid value of 10. Include all bounds checking you need to write, or explain how the compiler or interpreter creates those bounds checks for you.
diff --git a/Task/Define-a-primitive-data-type/1META.yaml b/Task/Define-a-primitive-data-type/1META.yaml
new file mode 100644
index 0000000000..659c8686af
--- /dev/null
+++ b/Task/Define-a-primitive-data-type/1META.yaml
@@ -0,0 +1,2 @@
+---
+note: Basic language learning
diff --git a/Task/Define-a-primitive-data-type/Ada/define-a-primitive-data-type-1.ada b/Task/Define-a-primitive-data-type/Ada/define-a-primitive-data-type-1.ada
new file mode 100644
index 0000000000..9f9f165eff
--- /dev/null
+++ b/Task/Define-a-primitive-data-type/Ada/define-a-primitive-data-type-1.ada
@@ -0,0 +1 @@
+type My_Type is range 1..10;
diff --git a/Task/Define-a-primitive-data-type/Ada/define-a-primitive-data-type-2.ada b/Task/Define-a-primitive-data-type/Ada/define-a-primitive-data-type-2.ada
new file mode 100644
index 0000000000..d7bbcfc1ac
--- /dev/null
+++ b/Task/Define-a-primitive-data-type/Ada/define-a-primitive-data-type-2.ada
@@ -0,0 +1,2 @@
+A : My_Type := 3;
+B : My_Type := A;
diff --git a/Task/Define-a-primitive-data-type/Fortran/define-a-primitive-data-type-1.f b/Task/Define-a-primitive-data-type/Fortran/define-a-primitive-data-type-1.f
new file mode 100644
index 0000000000..212c6a3eb5
--- /dev/null
+++ b/Task/Define-a-primitive-data-type/Fortran/define-a-primitive-data-type-1.f
@@ -0,0 +1,102 @@
+module Bounded
+  implicit none
+
+  type BoundedInteger
+     integer, private :: v         ! we cannot allow direct access to this, or we
+     integer, private :: from, to  !   can't check the bounds!
+     logical, private :: critical
+  end type BoundedInteger
+
+  interface assignment(=)
+     module procedure bounded_assign_bb, bounded_assign_bi !, &
+                    ! bounded_assign_ib
+  end interface
+
+  interface operator(+)
+     module procedure bounded_add_bbb !, bounded_add_bbi, &
+                    ! bounded_add_bib, bounded_add_ibb,   &
+                    ! bounded_add_iib, bounded_add_ibi,   &
+                    ! bounded_add_bii
+  end interface
+
+  private :: bounded_assign_bb, bounded_assign_bi, &
+             bounded_add_bbb
+
+contains
+
+  subroutine set_bound(bi, lower, upper, critical, value)
+    type(BoundedInteger), intent(out) :: bi
+    integer, intent(in) :: lower, upper
+    integer, intent(in), optional :: value
+    logical, intent(in), optional :: critical
+
+    bi%from = min(lower, upper)
+    bi%to = max(lower, upper)
+    if ( present(critical) ) then
+       bi%critical = critical
+    else
+       bi%critical = .false.
+    end if
+    if ( present(value) ) then
+       bi = value
+    end if
+  end subroutine set_bound
+
+  subroutine bounded_assign_bb(a, b)
+    type(BoundedInteger), intent(out) :: a
+    type(BoundedInteger), intent(in)  :: b
+
+    call bounded_assign_bi(a, b%v)
+
+  end subroutine bounded_assign_bb
+
+
+  subroutine bounded_assign_bi(a, b)
+    type(BoundedInteger), intent(out) :: a
+    integer,              intent(in)  :: b
+
+    if ( (a%from <= b) .and. (a%to >= b) ) then
+       a%v = b
+    else
+       write(0,*) "BoundedInteger: out of bound assignment"
+       if ( a%critical ) then
+          stop
+       else
+          if ( b < a%from ) then
+             a%v = a%from
+          else
+             a%v = a%to
+          end if
+          write(0,"(A,' (',I0, ')')") "BoundedInteger: set to nearest bound", a%v
+       end if
+    end if
+  end subroutine bounded_assign_bi
+
+
+  function bounded_add_bbb(a, b) result(c)
+    type(BoundedInteger) :: c
+    type(BoundedInteger), intent(in) :: a, b
+
+    integer :: t
+
+    c%from = max(a%from, b%from)
+    c%to   = min(a%to,   b%to)
+    t = a%v + b%v
+    if ( c%from <= t .and. c%to >= t ) then
+       c%v = t
+    else
+       write(0,*) "BoundedInteger: out of bound sum"
+       if ( a%critical .or. b%critical ) then
+          stop
+       else
+          if ( t < c%from ) then
+             c%v = c%from
+          else
+             c%v = c%to
+          end if
+          write(0,"(A,' (',I0,')')") "BoundedInteger: set to nearest bound", c%v
+       end if
+    end if
+  end function bounded_add_bbb
+
+end module Bounded
diff --git a/Task/Define-a-primitive-data-type/Fortran/define-a-primitive-data-type-2.f b/Task/Define-a-primitive-data-type/Fortran/define-a-primitive-data-type-2.f
new file mode 100644
index 0000000000..5ef105b3a2
--- /dev/null
+++ b/Task/Define-a-primitive-data-type/Fortran/define-a-primitive-data-type-2.f
@@ -0,0 +1,25 @@
+program BoundedTest
+  use Bounded
+  implicit none
+
+  type(BoundedInteger)     ::  a, b, c
+
+  call set_bound(a, 1, 10)
+  ! if we want to stop the program if a is out of bounds...
+  ! call set_bound(a, 1, 10, critical=.true.)
+  call set_bound(b, 1, 10)
+  call set_bound(c, 1, 10)
+  ! if we want to init c to a specific value...:
+  ! call set_bound(c, 1, 10, value=6)
+
+  a = 1         ! ok
+  a = 4         ! ok
+  a = -1        ! warning (a=1)
+  a = 11        ! warning (a=10)
+  a = 3         ! ok
+  b = a         ! ok
+  c = a + b     ! ok (3+3)
+  c = c + a     ! ok (6+3=9)
+  c = c + b     ! warning (c=10)
+
+end program BoundedTest
diff --git a/Task/Define-a-primitive-data-type/Haskell/define-a-primitive-data-type-1.hs b/Task/Define-a-primitive-data-type/Haskell/define-a-primitive-data-type-1.hs
new file mode 100644
index 0000000000..aabf0333d6
--- /dev/null
+++ b/Task/Define-a-primitive-data-type/Haskell/define-a-primitive-data-type-1.hs
@@ -0,0 +1,44 @@
+{-# OPTIONS -fglasgow-exts #-}
+
+data Check a b = Check { unCheck :: b } deriving (Eq, Ord)
+
+class Checked a b where
+  check :: b -> Check a b
+
+lift  f x = f (unCheck x)
+liftc f x = check $ f (unCheck x)
+
+lift2  f x y = f (unCheck x) (unCheck y)
+lift2c f x y = check $ f (unCheck x) (unCheck y)
+lift2p f x y = (check u, check v) where (u,v) = f (unCheck x) (unCheck y)
+
+instance Show b => Show (Check a b) where
+  show (Check x)        = show x
+  showsPrec p (Check x) = showsPrec p x
+
+instance (Enum b, Checked a b) => Enum (Check a b) where
+  succ = liftc succ
+  pred = liftc pred
+  toEnum   = check . toEnum
+  fromEnum = lift fromEnum
+
+instance (Num b, Checked a b) => Num (Check a b) where
+  (+) = lift2c (+)
+  (-) = lift2c (-)
+  (*) = lift2c (*)
+ negate = liftc negate
+  abs    = liftc abs
+   signum = liftc signum
+  fromInteger = check . fromInteger
+
+instance (Real b, Checked a b) => Real (Check a b) where
+  toRational = lift toRational
+
+instance (Integral b, Checked a b) => Integral (Check a b) where
+  quot = lift2c quot
+  rem  = lift2c rem
+  div  = lift2c div
+  mod  = lift2c mod
+  quotRem = lift2p quotRem
+  divMod  = lift2p divMod
+  toInteger = lift toInteger
diff --git a/Task/Define-a-primitive-data-type/Haskell/define-a-primitive-data-type-2.hs b/Task/Define-a-primitive-data-type/Haskell/define-a-primitive-data-type-2.hs
new file mode 100644
index 0000000000..6d90997708
--- /dev/null
+++ b/Task/Define-a-primitive-data-type/Haskell/define-a-primitive-data-type-2.hs
@@ -0,0 +1,5 @@
+newtype TinyInt = TinyInt Int
+
+instance Checked TinyInt Int where
+  check x | x >= 0 && x <= 10  =  Check x
+          | otherwise          =  error "Out of range"
diff --git a/Task/Define-a-primitive-data-type/Haskell/define-a-primitive-data-type-3.hs b/Task/Define-a-primitive-data-type/Haskell/define-a-primitive-data-type-3.hs
new file mode 100644
index 0000000000..cea46cc875
--- /dev/null
+++ b/Task/Define-a-primitive-data-type/Haskell/define-a-primitive-data-type-3.hs
@@ -0,0 +1,5 @@
+newtype EvenInt = EvenInt Int
+
+ instance Checked EvenInt Int where
+   check x | even x     =  Check x
+           | otherwise  =  error "Not even"
diff --git a/Task/Define-a-primitive-data-type/Java/define-a-primitive-data-type.java b/Task/Define-a-primitive-data-type/Java/define-a-primitive-data-type.java
new file mode 100644
index 0000000000..4be0e1ddfc
--- /dev/null
+++ b/Task/Define-a-primitive-data-type/Java/define-a-primitive-data-type.java
@@ -0,0 +1,71 @@
+class BoundedIntOutOfBoundsException extends Exception
+{
+  public BoundedIntOutOfBoundsException(int v, int l, int u) {
+    super("value " + v + " is out of bounds [" + l + "," + u + "]");
+  }
+}
+
+class BoundedInt {
+  private int value;
+  private int lower;
+  private int upper;
+
+  public BoundedInt(int l, int u) {
+    lower = Math.min(l, u);
+    upper = Math.max(l, u);
+  }
+
+  private boolean checkBounds(int v) {
+    return (v >= this.lower) && (v <= this.upper);
+  }
+
+  public void assign(BoundedInt i) throws BoundedIntOutOfBoundsException {{
+    assign(i.value()); //could still throw Exception if the other BoundedInt has different bounds
+  }
+
+  public void assign(int v) throws BoundedIntOutOfBoundsException {
+    if ( checkBounds(v) ) {
+      this.value = v;
+    } else {
+      throw new BoundedIntOutOfBoundsException(v, this.lower, this.upper);
+    }
+  }
+
+  public int add(BoundedInt i) throws BoundedIntOutOfBoundsException {
+    return add(i.value());
+  }
+
+  public int add(int i) throws BoundedIntOutOfBoundsException {
+    if ( checkBounds(this.value + i) ) {
+      this.value += i;
+    }  else {
+      throw new BoundedIntOutOfBoundsException(this.value + i, this.lower, this.upper);
+    }
+    return this.value;
+  }
+
+  public int value() {
+    return this.value;
+  }
+}
+
+
+public class Bounded {
+  public static void main(String[] args) throws BoundedIntOutOfBoundsException {
+    BoundedInt a = new BoundedInt(1, 10);
+    BoundedInt b = new BoundedInt(1, 10);
+
+    a.assign(6);
+    try {
+      b.assign(12);
+    } catch (Exception e) {
+      System.out.println(e.getMessage());
+    }
+    b.assign(9);
+    try {
+      a.add(b.value());
+    } catch (Exception e) {
+      System.out.println(e.getMessage());
+    }
+  }
+}
diff --git a/Task/Define-a-primitive-data-type/JavaScript/define-a-primitive-data-type.js b/Task/Define-a-primitive-data-type/JavaScript/define-a-primitive-data-type.js
new file mode 100644
index 0000000000..74108fa46a
--- /dev/null
+++ b/Task/Define-a-primitive-data-type/JavaScript/define-a-primitive-data-type.js
@@ -0,0 +1,22 @@
+function Num(n){
+    n = Math.floor(n);
+    if(isNaN(n))
+        throw new TypeError("Not a Number");
+    if(n < 1 || n > 10)
+        throw new TypeError("Out of range");
+    this._value = n;
+}
+Num.prototype.valueOf = function() { return this._value; }
+Num.prototype.toString = function () { return this._value.toString();}
+
+var w = new Num(3), x = new Num(4);
+
+WScript.Echo(w + x); //7
+WScript.Echo(x - w); //1
+WScript.Echo(w * x); //12
+WScript.Echo(w / x); //0.75
+WScript.Echo(w < x); //true
+WScript.Echo(x < w); //false
+
+var y = new Num(0); //TypeError
+var z = new Num(11); //TypeError
diff --git a/Task/Define-a-primitive-data-type/Perl/define-a-primitive-data-type.pl b/Task/Define-a-primitive-data-type/Perl/define-a-primitive-data-type.pl
new file mode 100644
index 0000000000..14f85f38de
--- /dev/null
+++ b/Task/Define-a-primitive-data-type/Perl/define-a-primitive-data-type.pl
@@ -0,0 +1,20 @@
+package One_To_Ten;
+use Carp qw(croak);
+use Tie::Scalar qw();
+use base qw(Tie::StdScalar);
+
+sub STORE {
+    my $self = shift;
+    my $val = int shift;
+    croak 'out of bounds' if $val < 1 or $val > 10;
+    $$self = $val;
+};
+
+package main;
+tie my $t, 'One_To_Ten';
+$t = 3;   # ok
+$t = 5.2; # ok, silently coerced to int
+$t = -2;  # dies, too small
+$t = 11;  # dies, too big
+$t = 'xyzzy';
+# dies, too small. string is 0 interpreted numerically
diff --git a/Task/Define-a-primitive-data-type/PicoLisp/define-a-primitive-data-type.l b/Task/Define-a-primitive-data-type/PicoLisp/define-a-primitive-data-type.l
new file mode 100644
index 0000000000..2a3653134d
--- /dev/null
+++ b/Task/Define-a-primitive-data-type/PicoLisp/define-a-primitive-data-type.l
@@ -0,0 +1,32 @@
+(class +BoundedInt)
+# value lower upper
+
+(dm T (Low Up)
+   (=: lower (min Low Up))
+   (=: upper (max Low Up)) )
+
+(de "checkBounds" (Val)
+   (if (>= (: upper) Val (: lower))
+      Val
+      (throw 'boundedIntOutOfBounds
+         (pack
+            "value " Val
+            " is out of bounds [" (: lower) "," (: upper) "]" ) ) ) )
+
+(dm set> (Val)
+   (=: value ("checkBounds" Val)) )
+
+(dm +> (Val)
+   (=: value ("checkBounds" (+ Val (: value)))) )
+
+(dm val> ()
+   (: value) )
+
+(de main ()
+   (let (A (new '(+BoundedInt) 1 10)  B (new '(+BoundedInt) 1 10))
+      (set> A 6)
+      (when (catch 'boundedIntOutOfBounds (set> B 12) NIL)
+         (prinl @) )
+      (set> B 9)
+      (when (catch 'boundedIntOutOfBounds (+> A (val> B)) NIL)
+         (prinl @) ) ) )
diff --git a/Task/Define-a-primitive-data-type/Python/define-a-primitive-data-type.py b/Task/Define-a-primitive-data-type/Python/define-a-primitive-data-type.py
new file mode 100644
index 0000000000..44fbc5dd35
--- /dev/null
+++ b/Task/Define-a-primitive-data-type/Python/define-a-primitive-data-type.py
@@ -0,0 +1,22 @@
+>>> class num(int):
+    def __init__(self, b):
+        if 1 <= b <= 10:
+            return int.__init__(self+0)
+        else:
+            raise ValueError,"Value %s should be >=0 and <= 10" % b
+
+
+>>> x = num(3)
+>>> x = num(11)
+
+Traceback (most recent call last):
+  File "", line 1, in 
+    x = num(11)
+  File "", line 6, in __init__
+    raise ValueError,"Value %s should be >=0 and <= 10" % b
+ValueError: Value 11 should be >=0 and <= 10
+>>> x
+3
+>>> type(x)
+
+>>>
diff --git a/Task/Define-a-primitive-data-type/Racket/define-a-primitive-data-type-1.rkt b/Task/Define-a-primitive-data-type/Racket/define-a-primitive-data-type-1.rkt
new file mode 100644
index 0000000000..3e1bdca985
--- /dev/null
+++ b/Task/Define-a-primitive-data-type/Racket/define-a-primitive-data-type-1.rkt
@@ -0,0 +1,7 @@
+#lang racket
+
+(provide (contract-out [x 1-to-10/c]))
+
+(define 1-to-10/c (between/c 1 10))
+
+(define x 5)
diff --git a/Task/Define-a-primitive-data-type/Racket/define-a-primitive-data-type-2.rkt b/Task/Define-a-primitive-data-type/Racket/define-a-primitive-data-type-2.rkt
new file mode 100644
index 0000000000..cd2356a264
--- /dev/null
+++ b/Task/Define-a-primitive-data-type/Racket/define-a-primitive-data-type-2.rkt
@@ -0,0 +1,11 @@
+#lang typed/racket
+
+(define-type 1UpTo10 (U 1 2 3 4 5 6 7 8 9 10))
+
+;; type-checks
+(: x 1UpTo10)
+(define x 3)
+
+;; does not type-check
+(: y 1UpTo10)
+(define y 18)
diff --git a/Task/Define-a-primitive-data-type/Ruby/define-a-primitive-data-type.rb b/Task/Define-a-primitive-data-type/Ruby/define-a-primitive-data-type.rb
new file mode 100644
index 0000000000..775e8250dd
--- /dev/null
+++ b/Task/Define-a-primitive-data-type/Ruby/define-a-primitive-data-type.rb
@@ -0,0 +1,86 @@
+require 'test/unit'
+include Test::Unit::Assertions
+
+class MyInt
+  @@min = 1
+  @@max = 10
+
+  attr_reader :value
+  private :value
+
+  def initialize(val)
+    begin
+      v = Integer(val)
+    rescue ArgumentError
+      raise ArgumentError, "invalid value '#{val}', must be an integer"
+    end
+
+    unless v.between?(@@min, @@max)
+      raise ArgumentError, "invalid value '#{v}', must be between #{@@min} and #{@@max}"
+    end
+
+    @value = v
+  end
+
+  def method_missing(m, *args)
+    super unless @value.respond_to?(m)
+    myint_args = args.collect do |arg|
+      arg.kind_of?(self.class) ? arg.to_int : arg
+    end
+    result = @value.send(m, *myint_args)
+    return result if m == :coerce
+    case result
+    when Integer
+      MyInt.new(result)
+    when Array
+      result.collect do |element|
+        element.kind_of?(Integer) ? MyInt.new(element) : element
+      end
+    else
+      result
+    end
+  end
+
+  def respond_to?(method)
+    super or @value.respond_to? method
+  end
+
+  def to_int
+    @value
+  end
+  def to_f
+    Float(@value)
+  end
+  def to_s
+    @value.to_s
+  end
+  def inspect
+    to_s
+  end
+end
+
+
+assert_raise(ArgumentError) { MyInt.new("foo") }    # => invalid value 'foo', must be an integer
+assert_raise(ArgumentError) { MyInt.new(11) }       # => invalid value '11', must be an integer
+
+a = MyInt.new(7)
+b = MyInt.new(5)
+
+c = 5 + a
+assert_kind_of(Fixnum, c)
+assert_equal(12, c)
+
+c = a + 2
+assert_kind_of(MyInt, c)
+assert_equal(9, c.to_int)
+
+c = a + 2.8
+assert_kind_of(Float, c)
+assert_equal(9.8, c)
+
+c = a - b
+assert_kind_of(MyInt, c)
+assert_equal(2, c.to_int)
+
+assert_raise(ArgumentError) { c = a + b }    # => invalid value '12', must be an integer
+assert_raise(ArgumentError) { c = b - a }    # => invalid value '-2', must be an integer
diff --git a/Task/Define-a-primitive-data-type/Tcl/define-a-primitive-data-type.tcl b/Task/Define-a-primitive-data-type/Tcl/define-a-primitive-data-type.tcl
new file mode 100644
index 0000000000..f3b7abf2a5
--- /dev/null
+++ b/Task/Define-a-primitive-data-type/Tcl/define-a-primitive-data-type.tcl
@@ -0,0 +1,37 @@
+namespace eval ::myIntType {
+    variable value_cache
+    array set value_cache {}
+    variable type integer
+    variable min 1
+    variable max 10
+    variable errMsg "cannot set %s to %s: must be a $type between $min and $max"
+}
+proc ::myIntType::declare varname {
+    set ns [namespace current]
+    uplevel [list trace add variable $varname write ${ns}::write]
+    uplevel [list trace add variable $varname unset ${ns}::unset_var]
+}
+proc ::myIntType::unset_var {varname args} {
+    variable value_cache
+    unset value_cache($varname)
+}
+proc ::myIntType::validate {value} {
+    variable type
+    variable min
+    variable max
+    expr {[string is $type -strict $value] && $min <= $value && $value <= $max}
+}
+proc ::myIntType::write {varname args} {
+    variable value_cache
+    upvar $varname var
+    set value $var
+    if {[validate $value]} {
+        set value_cache($varname) $value
+    } else {
+        if {[info exists value_cache($varname)]} {
+            set var $value_cache($varname)
+        }
+        variable errMsg
+        error [format $errMsg $varname $value]
+    }
+}
diff --git a/Task/Delegates/Ada/delegates.ada b/Task/Delegates/Ada/delegates.ada
new file mode 100644
index 0000000000..2982a78c8c
--- /dev/null
+++ b/Task/Delegates/Ada/delegates.ada
@@ -0,0 +1,48 @@
+with Ada.Text_IO;  use Ada.Text_IO;
+
+procedure Delegation is
+   package Things is
+      -- We need a common root for our stuff
+      type Object is tagged null record;
+      type Object_Ptr is access all Object'Class;
+
+      -- Objects that have operation thing
+      type Substantial is new Object with null record;
+      function Thing (X : Substantial) return String;
+
+      -- Delegator objects
+      type Delegator is new Object with record
+         Delegate : Object_Ptr;
+      end record;
+      function Operation (X : Delegator) return String;
+
+      No_Thing  : aliased Object;      -- Does not have thing
+      Has_Thing : aliased Substantial; -- Has one
+   end Things;
+
+   package body Things is
+      function Thing (X : Substantial) return String is
+      begin
+         return "delegate implementation";
+      end Thing;
+
+      function Operation (X : Delegator) return String is
+      begin
+         if X.Delegate /= null and then X.Delegate.all in Substantial'Class then
+            return Thing (Substantial'Class (X.Delegate.all));
+         else
+            return "default implementation";
+         end if;
+      end Operation;
+   end Things;
+
+   use Things;
+
+   A : Delegator; -- Without a delegate
+begin
+   Put_Line (A.Operation);
+   A.Delegate := No_Thing'Access; -- Set no thing
+   Put_Line (A.Operation);
+   A.Delegate := Has_Thing'Access; -- Set a thing
+   Put_Line (A.Operation);
+end Delegation;
diff --git a/Task/Delegates/CoffeeScript/delegates-1.coffee b/Task/Delegates/CoffeeScript/delegates-1.coffee
new file mode 100644
index 0000000000..694a80fc4d
--- /dev/null
+++ b/Task/Delegates/CoffeeScript/delegates-1.coffee
@@ -0,0 +1,24 @@
+class Delegator
+  operation: ->
+    if @delegate and typeof (@delegate.thing) is "function"
+      return @delegate.thing()
+    "default implementation"
+
+class Delegate
+  thing: ->
+    "Delegate Implementation"
+
+testDelegator = ->
+  # Delegator with no delegate.
+  a = new Delegator()
+  console.log a.operation()
+
+  # Delegator with delegate not implementing "thing"
+  a.delegate = "A delegate may be any object"
+  console.log a.operation()
+
+  # Delegator with delegate that does implement "thing"
+  a.delegate = new Delegate()
+  console.log a.operation()
+
+testDelegator()
diff --git a/Task/Delegates/Perl/delegates-1.pl b/Task/Delegates/Perl/delegates-1.pl
new file mode 100644
index 0000000000..5a7aa68ccf
--- /dev/null
+++ b/Task/Delegates/Perl/delegates-1.pl
@@ -0,0 +1,38 @@
+use strict;
+
+package Delegator;
+sub new {
+   bless {}
+}
+sub operation {
+   my ($self) = @_;
+   if (defined $self->{delegate} && $self->{delegate}->can('thing')) {
+      $self->{delegate}->thing;
+   } else {
+      'default implementation';
+   }
+}
+1;
+
+package Delegate;
+sub new {
+   bless {};
+}
+sub thing {
+   'delegate implementation'
+}
+1;
+
+
+package main;
+# No delegate
+my $a = Delegator->new;
+$a->operation eq 'default implementation' or die;
+
+# With a delegate that does not implement "thing"
+$a->{delegate} = 'A delegate may be any object';
+$a->operation eq 'default implementation' or die;
+
+# With delegate that implements "thing"
+$a->{delegate} = Delegate->new;
+$a->operation eq 'delegate implementation' or die;
diff --git a/Task/Delegates/Ruby/delegates-1.rb b/Task/Delegates/Ruby/delegates-1.rb
new file mode 100644
index 0000000000..b6e12b7b70
--- /dev/null
+++ b/Task/Delegates/Ruby/delegates-1.rb
@@ -0,0 +1,31 @@
+class Delegator
+   attr_accessor :delegate
+   def operation
+      if @delegate.respond_to?(:thing)
+         @delegate.thing
+      else
+         'default implementation'
+      end
+   end
+end
+
+class Delegate
+   def thing
+      'delegate implementation'
+   end
+end
+
+if __FILE__ == $PROGRAM_NAME
+
+   # No delegate
+   a = Delegator.new
+   puts a.operation # prints "default implementation"
+
+   # With a delegate that does not implement "thing"
+   a.delegate = 'A delegate may be any object'
+   puts a.operation # prints "default implementation"
+
+   # With delegate that implements "thing"
+   a.delegate = Delegate.new
+   puts a.operation # prints "delegate implementation"
+end
diff --git a/Task/Delegates/Tcl/delegates-1.tcl b/Task/Delegates/Tcl/delegates-1.tcl
new file mode 100644
index 0000000000..0518a75c03
--- /dev/null
+++ b/Task/Delegates/Tcl/delegates-1.tcl
@@ -0,0 +1,53 @@
+package require TclOO
+
+oo::class create Delegate {
+    method thing {} {
+        return "delegate impl."
+    }
+    export thing
+}
+
+oo::class create Delegator {
+    variable delegate
+    constructor args {
+        my delegate {*}$args
+    }
+
+    method delegate args {
+        if {[llength $args] == 0} {
+            if {[info exists delegate]} {
+                return $delegate
+            }
+        } elseif {[llength $args] == 1} {
+            set delegate [lindex $args 0]
+        } else {
+            return -code error "wrong # args: should be \"[self] delegate ?target?\""
+        }
+    }
+
+    method operation {} {
+        try {
+            set result [$delegate thing]
+        } on error e {
+            set result "default implementation"
+        }
+        return $result
+    }
+}
+
+# to instantiate a named object, use: class create objname; objname aMethod
+# to have the class name the object:  set obj [class new]; $obj aMethod
+
+Delegator create a
+set b [Delegator new "not a delegate object"]
+set c [Delegator new [Delegate new]]
+
+assert {[a operation] eq "default implementation"}   ;# a "named" object, hence "a ..."
+assert {[$b operation] eq "default implementation"}  ;# an "anonymous" object, hence "$b ..."
+assert {[$c operation] ne "default implementation"}
+
+# now, set a delegate for object a
+a delegate [$c delegate]
+assert {[a operation] ne "default implementation"}
+
+puts "all assertions passed"
diff --git a/Task/Delete-a-file/0DESCRIPTION b/Task/Delete-a-file/0DESCRIPTION
new file mode 100644
index 0000000000..b9002b8537
--- /dev/null
+++ b/Task/Delete-a-file/0DESCRIPTION
@@ -0,0 +1 @@
+In this task, the job is to delete a file called "input.txt" and delete a directory called "docs". This should be done twice: once "here", i.e. in the current working directory and once in the filesystem root.
diff --git a/Task/Delete-a-file/1META.yaml b/Task/Delete-a-file/1META.yaml
new file mode 100644
index 0000000000..40458d9f21
--- /dev/null
+++ b/Task/Delete-a-file/1META.yaml
@@ -0,0 +1,2 @@
+---
+note: File System Operations
diff --git a/Task/Delete-a-file/AWK/delete-a-file.awk b/Task/Delete-a-file/AWK/delete-a-file.awk
new file mode 100644
index 0000000000..764f59ec15
--- /dev/null
+++ b/Task/Delete-a-file/AWK/delete-a-file.awk
@@ -0,0 +1,4 @@
+system("rm input.txt");
+system("rm /input.txt");
+system("rm -rf docs");
+system("rm -rf /docs");
diff --git a/Task/Delete-a-file/Ada/delete-a-file-1.ada b/Task/Delete-a-file/Ada/delete-a-file-1.ada
new file mode 100644
index 0000000000..e815e40331
--- /dev/null
+++ b/Task/Delete-a-file/Ada/delete-a-file-1.ada
@@ -0,0 +1 @@
+with Ada.Directories;  use Ada.Directories;
diff --git a/Task/Delete-a-file/Ada/delete-a-file-2.ada b/Task/Delete-a-file/Ada/delete-a-file-2.ada
new file mode 100644
index 0000000000..78bb0709fc
--- /dev/null
+++ b/Task/Delete-a-file/Ada/delete-a-file-2.ada
@@ -0,0 +1,4 @@
+Delete_File ("input.txt");
+Delete_File ("/input.txt");
+Delete_Tree ("docs");
+Delete_Tree ("/docs");
diff --git a/Task/Delete-a-file/BASIC/delete-a-file-1.bas b/Task/Delete-a-file/BASIC/delete-a-file-1.bas
new file mode 100644
index 0000000000..3e0eaeddf6
--- /dev/null
+++ b/Task/Delete-a-file/BASIC/delete-a-file-1.bas
@@ -0,0 +1,4 @@
+KILL "INPUT.TXT"
+KILL "C:\INPUT.TXT"
+SHELL "RMDIR /S /Q DIR"
+SHELL "RMDIR /S /Q C:\DIR"
diff --git a/Task/Delete-a-file/BASIC/delete-a-file-2.bas b/Task/Delete-a-file/BASIC/delete-a-file-2.bas
new file mode 100644
index 0000000000..0363d851a4
--- /dev/null
+++ b/Task/Delete-a-file/BASIC/delete-a-file-2.bas
@@ -0,0 +1 @@
+ERASE "m"; 1; "INPUTTXT"
diff --git a/Task/Delete-a-file/C/delete-a-file-1.c b/Task/Delete-a-file/C/delete-a-file-1.c
new file mode 100644
index 0000000000..2246d3e0b3
--- /dev/null
+++ b/Task/Delete-a-file/C/delete-a-file-1.c
@@ -0,0 +1,9 @@
+#include 
+
+int main() {
+  remove("input.txt");
+  remove("/input.txt");
+  remove("docs");
+  remove("/docs");
+  return 0;
+}
diff --git a/Task/Delete-a-file/C/delete-a-file-2.c b/Task/Delete-a-file/C/delete-a-file-2.c
new file mode 100644
index 0000000000..ba1ff9f996
--- /dev/null
+++ b/Task/Delete-a-file/C/delete-a-file-2.c
@@ -0,0 +1,9 @@
+#include 
+
+int main() {
+  unlink("input.txt");
+  unlink("/input.txt");
+  rmdir("docs");
+  rmdir("/docs");
+  return 0;
+}
diff --git a/Task/Delete-a-file/Clojure/delete-a-file.clj b/Task/Delete-a-file/Clojure/delete-a-file.clj
new file mode 100644
index 0000000000..018025ed71
--- /dev/null
+++ b/Task/Delete-a-file/Clojure/delete-a-file.clj
@@ -0,0 +1,6 @@
+(import '(java.io File))
+(.delete (File. "output.txt"))
+(.delete (File. "docs"))
+
+(.delete (new File (str (File/separator) "output.txt")))
+(.delete (new File (str (File/separator) "docs")))
diff --git a/Task/Delete-a-file/Erlang/delete-a-file.erl b/Task/Delete-a-file/Erlang/delete-a-file.erl
new file mode 100644
index 0000000000..9c353eb0ec
--- /dev/null
+++ b/Task/Delete-a-file/Erlang/delete-a-file.erl
@@ -0,0 +1 @@
+file:delete("file.txt").
diff --git a/Task/Delete-a-file/Forth/delete-a-file.fth b/Task/Delete-a-file/Forth/delete-a-file.fth
new file mode 100644
index 0000000000..fcc6e3e53a
--- /dev/null
+++ b/Task/Delete-a-file/Forth/delete-a-file.fth
@@ -0,0 +1,2 @@
+ s" input.txt" delete-file throw
+s" /input.txt" delete-file throw
diff --git a/Task/Delete-a-file/Fortran/delete-a-file.f b/Task/Delete-a-file/Fortran/delete-a-file.f
new file mode 100644
index 0000000000..f47583cecd
--- /dev/null
+++ b/Task/Delete-a-file/Fortran/delete-a-file.f
@@ -0,0 +1,4 @@
+OPEN (UNIT=5, FILE="input.txt", STATUS="OLD")   ! Current directory
+CLOSE (UNIT=5, STATUS="DELETE")
+OPEN (UNIT=5, FILE="/input.txt", STATUS="OLD")  ! Root directory
+CLOSE (UNIT=5, STATUS="DELETE")
diff --git a/Task/Delete-a-file/Go/delete-a-file.go b/Task/Delete-a-file/Go/delete-a-file.go
new file mode 100644
index 0000000000..90ba93da95
--- /dev/null
+++ b/Task/Delete-a-file/Go/delete-a-file.go
@@ -0,0 +1,12 @@
+package main
+import "os"
+
+func main() {
+  os.Remove("input.txt")
+  os.Remove("/input.txt")
+  os.Remove("docs")
+  os.Remove("/docs")
+  // recursively removes contents:
+  os.RemoveAll("docs")
+  os.RemoveAll("/docs")
+}
diff --git a/Task/Delete-a-file/Haskell/delete-a-file.hs b/Task/Delete-a-file/Haskell/delete-a-file.hs
new file mode 100644
index 0000000000..acb38e335b
--- /dev/null
+++ b/Task/Delete-a-file/Haskell/delete-a-file.hs
@@ -0,0 +1,8 @@
+import System.IO
+import System.Directory
+
+main = do
+  removeFile "output.txt"
+  removeDirectory "docs"
+  removeFile "/output.txt"
+  removeDirectory "/docs"
diff --git a/Task/Delete-a-file/Java/delete-a-file.java b/Task/Delete-a-file/Java/delete-a-file.java
new file mode 100644
index 0000000000..35bbfea0ca
--- /dev/null
+++ b/Task/Delete-a-file/Java/delete-a-file.java
@@ -0,0 +1,18 @@
+import java.util.File;
+public class FileDeleteTest {
+   public static boolean deleteFile(String filename) {
+       boolean exists = new File(filename).delete();
+       return exists;
+   }
+   public static void test(String type, String filename) {
+       System.out.println("The following " + type + " called " + filename +
+           (deleteFile(filename) ? " was deleted." : " could not be deleted.")
+       );
+   }
+   public static void main(String args[]) {
+        test("file", "input.txt");
+        test("file", File.seperator + "input.txt");
+        test("directory", "docs");
+        test("directory", File.seperator + "docs" + File.seperator);
+   }
+}
diff --git a/Task/Delete-a-file/JavaScript/delete-a-file-1.js b/Task/Delete-a-file/JavaScript/delete-a-file-1.js
new file mode 100644
index 0000000000..590ddd441a
--- /dev/null
+++ b/Task/Delete-a-file/JavaScript/delete-a-file-1.js
@@ -0,0 +1,7 @@
+var fso = new ActiveXObject("Scripting.FileSystemObject");
+
+fso.DeleteFile('input.txt');
+fso.DeleteFile('c:/input.txt');
+
+fso.DeleteFolder('docs');
+fso.DeleteFolder('c:/docs');
diff --git a/Task/Delete-a-file/JavaScript/delete-a-file-2.js b/Task/Delete-a-file/JavaScript/delete-a-file-2.js
new file mode 100644
index 0000000000..05a80b0c84
--- /dev/null
+++ b/Task/Delete-a-file/JavaScript/delete-a-file-2.js
@@ -0,0 +1,10 @@
+var fso = new ActiveXObject("Scripting.FileSystemObject");
+var f;
+f = fso.GetFile('input.txt');
+f.Delete();
+f = fso.GetFile('c:/input.txt');
+f.Delete();
+f = fso.GetFolder('docs');
+f.Delete();
+f = fso.GetFolder('c:/docs');
+f.Delete();
diff --git a/Task/Delete-a-file/Lua/delete-a-file.lua b/Task/Delete-a-file/Lua/delete-a-file.lua
new file mode 100644
index 0000000000..3545844427
--- /dev/null
+++ b/Task/Delete-a-file/Lua/delete-a-file.lua
@@ -0,0 +1,4 @@
+os.remove("input.txt")
+os.remove("/input.txt")
+os.remove("docs")
+os.remove("/docs")
diff --git a/Task/Delete-a-file/PHP/delete-a-file.php b/Task/Delete-a-file/PHP/delete-a-file.php
new file mode 100644
index 0000000000..e6c0ffa756
--- /dev/null
+++ b/Task/Delete-a-file/PHP/delete-a-file.php
@@ -0,0 +1,6 @@
+
diff --git a/Task/Delete-a-file/Perl/delete-a-file.pl b/Task/Delete-a-file/Perl/delete-a-file.pl
new file mode 100644
index 0000000000..223a405f1e
--- /dev/null
+++ b/Task/Delete-a-file/Perl/delete-a-file.pl
@@ -0,0 +1,7 @@
+use File::Spec::Functions qw(catfile rootdir);
+# here
+unlink 'input.txt';
+rmdir 'docs';
+# root dir
+unlink catfile rootdir, 'input.txt';
+rmdir catfile rootdir, 'docs';
diff --git a/Task/Delete-a-file/PicoLisp/delete-a-file.l b/Task/Delete-a-file/PicoLisp/delete-a-file.l
new file mode 100644
index 0000000000..a3c64534d7
--- /dev/null
+++ b/Task/Delete-a-file/PicoLisp/delete-a-file.l
@@ -0,0 +1,4 @@
+(call 'rm "input.txt")
+(call 'rmdir "docs")
+(call 'rm "/input.txt")
+(call 'rmdir "/docs")
diff --git a/Task/Delete-a-file/Python/delete-a-file-1.py b/Task/Delete-a-file/Python/delete-a-file-1.py
new file mode 100644
index 0000000000..8c6d870fab
--- /dev/null
+++ b/Task/Delete-a-file/Python/delete-a-file-1.py
@@ -0,0 +1,7 @@
+import os
+# current directory
+os.remove("output.txt")
+os.rmdir("docs")
+# root directory
+os.remove("/output.txt")
+os.rmdir("/docs")
diff --git a/Task/Delete-a-file/Python/delete-a-file-2.py b/Task/Delete-a-file/Python/delete-a-file-2.py
new file mode 100644
index 0000000000..4652f23ed6
--- /dev/null
+++ b/Task/Delete-a-file/Python/delete-a-file-2.py
@@ -0,0 +1,2 @@
+import shutil
+shutil.rmtree("docs")
diff --git a/Task/Delete-a-file/R/delete-a-file.r b/Task/Delete-a-file/R/delete-a-file.r
new file mode 100644
index 0000000000..b505cd3050
--- /dev/null
+++ b/Task/Delete-a-file/R/delete-a-file.r
@@ -0,0 +1,12 @@
+file.remove("input.txt")
+file.remove("/input.txt")
+
+# or
+file.remove("input.txt", "/input.txt")
+
+# or
+unlink("input.txt"); unlink("/input.txt")
+
+# directories needs the recursive flag
+unlink("docs", recursive = TRUE)
+unlink("/docs", recursive = TRUE)
diff --git a/Task/Delete-a-file/Ruby/delete-a-file.rb b/Task/Delete-a-file/Ruby/delete-a-file.rb
new file mode 100644
index 0000000000..4895cbe074
--- /dev/null
+++ b/Task/Delete-a-file/Ruby/delete-a-file.rb
@@ -0,0 +1,3 @@
+File.delete("output.txt", "/output.txt")
+Dir.delete("docs")
+Dir.delete("/docs")
diff --git a/Task/Delete-a-file/Scheme/delete-a-file.ss b/Task/Delete-a-file/Scheme/delete-a-file.ss
new file mode 100644
index 0000000000..004f1a97f2
--- /dev/null
+++ b/Task/Delete-a-file/Scheme/delete-a-file.ss
@@ -0,0 +1 @@
+(delete-file filename)
diff --git a/Task/Delete-a-file/Smalltalk/delete-a-file.st b/Task/Delete-a-file/Smalltalk/delete-a-file.st
new file mode 100644
index 0000000000..d86bfb01be
--- /dev/null
+++ b/Task/Delete-a-file/Smalltalk/delete-a-file.st
@@ -0,0 +1,4 @@
+File remove: 'input.txt'.
+File remove: 'docs'.
+File remove: '/input.txt'.
+File remove: '/docs'
diff --git a/Task/Delete-a-file/Tcl/delete-a-file.tcl b/Task/Delete-a-file/Tcl/delete-a-file.tcl
new file mode 100644
index 0000000000..f7bcb065a8
--- /dev/null
+++ b/Task/Delete-a-file/Tcl/delete-a-file.tcl
@@ -0,0 +1,7 @@
+file delete input.txt /input.txt
+
+# preserve directory if non-empty
+file delete docs /docs
+
+# delete even if non-empty
+file delete -force docs /docs
diff --git a/Task/Detect-division-by-zero/0DESCRIPTION b/Task/Detect-division-by-zero/0DESCRIPTION
new file mode 100644
index 0000000000..ee7afd59e8
--- /dev/null
+++ b/Task/Detect-division-by-zero/0DESCRIPTION
@@ -0,0 +1 @@
+Write a function to detect a divide by zero error without checking if the denominator is zero.
diff --git a/Task/Detect-division-by-zero/ABAP/detect-division-by-zero.abap b/Task/Detect-division-by-zero/ABAP/detect-division-by-zero.abap
new file mode 100644
index 0000000000..80f3d6d382
--- /dev/null
+++ b/Task/Detect-division-by-zero/ABAP/detect-division-by-zero.abap
@@ -0,0 +1,7 @@
+report zdiv_zero
+data x type i.
+try.
+  x = 1 / 0.
+catch CX_SY_ZERODIVIDE.
+  write 'Divide by zero.'.
+endtry.
diff --git a/Task/Detect-division-by-zero/Ada/detect-division-by-zero.ada b/Task/Detect-division-by-zero/Ada/detect-division-by-zero.ada
new file mode 100644
index 0000000000..b0d54dddc1
--- /dev/null
+++ b/Task/Detect-division-by-zero/Ada/detect-division-by-zero.ada
@@ -0,0 +1,32 @@
+-- Divide By Zero Detection
+
+with Ada.Text_Io; use Ada.Text_Io;
+with Ada.Float_Text_Io; use Ada.Float_Text_Io;
+with Ada.Integer_Text_Io; use Ada.Integer_Text_Io;
+
+procedure Divide_By_Zero is
+   Fnum : Float := 1.0;
+   Fdenom : Float := 0.0;
+   Fresult : Float;
+   Inum : Integer := 1;
+   Idenom : Integer := 0;
+   Iresult : Integer;
+begin
+   begin
+      Put("Integer divide by zero: ");
+      Iresult := Inum / Idenom;
+      Put(Item => Iresult);
+   exception
+      when Constraint_Error =>
+         Put("Division by zero detected.");
+   end;
+   New_Line;
+   Put("Floating point divide by zero: ");
+   Fresult := Fnum / Fdenom;
+   if Fresult > Float'Last then
+      Put("Division by zero detected (infinite value).");
+   else
+      Put(Item => Fresult, Aft => 9, Exp => 0);
+   end if;
+   New_Line;
+end Divide_By_Zero;
diff --git a/Task/Detect-division-by-zero/C/detect-division-by-zero.c b/Task/Detect-division-by-zero/C/detect-division-by-zero.c
new file mode 100644
index 0000000000..4bdb9c637e
--- /dev/null
+++ b/Task/Detect-division-by-zero/C/detect-division-by-zero.c
@@ -0,0 +1,100 @@
+#include 	/* INT_MIN */
+#include 	/* siglongjmp(), sigsetjmp() */
+#include 	/* perror(), printf() */
+#include 	/* exit() */
+#include 	/* sigaction(), sigemptyset() */
+
+static sigjmp_buf fpe_env;
+
+/*
+ * This SIGFPE handler jumps to fpe_env.
+ *
+ * A SIGFPE handler must not return, because the program might retry
+ * the division, which might cause an infinite loop. The only safe
+ * options are to _exit() the program or to siglongjmp() out.
+ */
+static void
+fpe_handler(int signal, siginfo_t *w, void *a)
+{
+	siglongjmp(fpe_env, w->si_code);
+	/* NOTREACHED */
+}
+
+/*
+ * Try to do x / y, but catch attempts to divide by zero.
+ */
+void
+try_division(int x, int y)
+{
+	struct sigaction act, old;
+	int code;
+	/*
+	 * The result must be volatile, else C compiler might delay
+	 * division until after sigaction() restores old handler.
+	 */
+	volatile int result;
+
+	/*
+	 * Save fpe_env so that fpe_handler() can jump back here.
+	 * sigsetjmp() returns zero.
+	 */
+	code = sigsetjmp(fpe_env, 1);
+	if (code == 0) {
+		/* Install fpe_handler() to trap SIGFPE. */
+		act.sa_sigaction = fpe_handler;
+		sigemptyset(&act.sa_mask);
+		act.sa_flags = SA_SIGINFO;
+		if (sigaction(SIGFPE, &act, &old) < 0) {
+			perror("sigaction");
+			exit(1);
+		}
+
+		/* Do division. */
+		result = x / y;
+
+		/*
+		 * Restore old hander, so that SIGFPE cannot jump out
+		 * of a call to printf(), which might cause trouble.
+		 */
+		if (sigaction(SIGFPE, &old, NULL) < 0) {
+			perror("sigaction");
+			exit(1);
+		}
+
+		printf("%d / %d is %d\n", x, y, result);
+	} else {
+		/*
+		 * We caught SIGFPE. Our fpe_handler() jumped to our
+		 * sigsetjmp() and passes a nonzero code.
+		 *
+		 * But first, restore old handler.
+		 */
+		if (sigaction(SIGFPE, &old, NULL) < 0) {
+			perror("sigaction");
+			exit(1);
+		}
+
+		/* FPE_FLTDIV should never happen with integers. */
+		switch (code) {
+		case FPE_INTDIV: /* integer division by zero */
+		case FPE_FLTDIV: /* float division by zero */
+			printf("%d / %d: caught division by zero!\n", x, y);
+			break;
+		default:
+			printf("%d / %d: caught mysterious error!\n", x, y);
+			break;
+		}
+	}
+}
+
+/* Try some division. */
+int
+main()
+{
+	try_division(-44, 0);
+	try_division(-44, 5);
+	try_division(0, 5);
+	try_division(0, 0);
+	try_division(INT_MIN, -1);
+	return 0;
+}
diff --git a/Task/Detect-division-by-zero/Clojure/detect-division-by-zero.clj b/Task/Detect-division-by-zero/Clojure/detect-division-by-zero.clj
new file mode 100644
index 0000000000..3793dab44f
--- /dev/null
+++ b/Task/Detect-division-by-zero/Clojure/detect-division-by-zero.clj
@@ -0,0 +1,7 @@
+(defn safe-/ [x y]
+  (try (/ x y)
+    (catch ArithmeticException _
+      (println "Division by zero caught!")
+      (cond (> x 0)   Double/POSITIVE_INFINITY
+            (zero? x) Double/NaN
+            :else     Double/NEGATIVE_INFINITY) )))
diff --git a/Task/Detect-division-by-zero/Eiffel/detect-division-by-zero.e b/Task/Detect-division-by-zero/Eiffel/detect-division-by-zero.e
new file mode 100644
index 0000000000..3af5596524
--- /dev/null
+++ b/Task/Detect-division-by-zero/Eiffel/detect-division-by-zero.e
@@ -0,0 +1,21 @@
+class MAIN
+    creation main
+    feature main is
+        local
+            x, y: INTEGER;
+            retried: BOOLEAN;
+        do
+            x := 42;
+            y := 0;
+
+            if not retried then
+                io.put_real(x / y);
+            else
+                print("NaN%N");
+            end
+        rescue
+            print("Caught division by zero!%N");
+            retried := True;
+            retry
+        end
+end
diff --git a/Task/Detect-division-by-zero/Erlang/detect-division-by-zero.erl b/Task/Detect-division-by-zero/Erlang/detect-division-by-zero.erl
new file mode 100644
index 0000000000..d098c610e9
--- /dev/null
+++ b/Task/Detect-division-by-zero/Erlang/detect-division-by-zero.erl
@@ -0,0 +1,5 @@
+div_check(X,Y) ->
+    case catch X/Y of
+        {'EXIT',_} -> true;
+        _ -> false
+    end.
diff --git a/Task/Detect-division-by-zero/Forth/detect-division-by-zero.fth b/Task/Detect-division-by-zero/Forth/detect-division-by-zero.fth
new file mode 100644
index 0000000000..b64ed5e5bd
--- /dev/null
+++ b/Task/Detect-division-by-zero/Forth/detect-division-by-zero.fth
@@ -0,0 +1,2 @@
+: safe-/ ( x y -- x/y )
+  ['] / catch -55 = if cr ." divide by zero!" 2drop 0 then ;
diff --git a/Task/Detect-division-by-zero/Go/detect-division-by-zero.go b/Task/Detect-division-by-zero/Go/detect-division-by-zero.go
new file mode 100644
index 0000000000..64b98d5624
--- /dev/null
+++ b/Task/Detect-division-by-zero/Go/detect-division-by-zero.go
@@ -0,0 +1,16 @@
+package main
+
+import "fmt"
+
+func divCheck(x, y int) (q int, ok bool) {
+    defer func() {
+        recover()
+    }()
+    q = x / y
+    return q, true
+}
+
+func main() {
+    fmt.Println(divCheck(3, 2))
+    fmt.Println(divCheck(3, 0))
+}
diff --git a/Task/Detect-division-by-zero/Haskell/detect-division-by-zero.hs b/Task/Detect-division-by-zero/Haskell/detect-division-by-zero.hs
new file mode 100644
index 0000000000..ff59a9713e
--- /dev/null
+++ b/Task/Detect-division-by-zero/Haskell/detect-division-by-zero.hs
@@ -0,0 +1,3 @@
+import qualified Control.Exception as C
+check x y = C.catch (x `div` y `seq` return False)
+                    (\_ -> return True)
diff --git a/Task/Detect-division-by-zero/Java/detect-division-by-zero-1.java b/Task/Detect-division-by-zero/Java/detect-division-by-zero-1.java
new file mode 100644
index 0000000000..17c2920c4f
--- /dev/null
+++ b/Task/Detect-division-by-zero/Java/detect-division-by-zero-1.java
@@ -0,0 +1,3 @@
+public static boolean infinity(double numer, double denom){
+	return Double.isInfinite(numer/denom);
+}
diff --git a/Task/Detect-division-by-zero/Java/detect-division-by-zero-2.java b/Task/Detect-division-by-zero/Java/detect-division-by-zero-2.java
new file mode 100644
index 0000000000..7d9196bd69
--- /dev/null
+++ b/Task/Detect-division-by-zero/Java/detect-division-by-zero-2.java
@@ -0,0 +1,6 @@
+public static boolean except(double numer, double denom){
+	try{
+		int dummy = (int)numer / (int)denom;//ArithmeticException is only thrown from integer math
+		return false;
+	}catch(ArithmeticException e){return true;}
+}
diff --git a/Task/Detect-division-by-zero/JavaScript/detect-division-by-zero.js b/Task/Detect-division-by-zero/JavaScript/detect-division-by-zero.js
new file mode 100644
index 0000000000..b70c131f76
--- /dev/null
+++ b/Task/Detect-division-by-zero/JavaScript/detect-division-by-zero.js
@@ -0,0 +1,7 @@
+function divByZero(dividend,divisor)
+{
+	var quotient=dividend/divisor;
+        if(isNaN(quotient)) return 0; //Can be changed to whatever is desired by the programmer to be 0, false, or Infinity
+        return quotient; //Will return Infinity or -Infinity in cases of, for example, 5/0 or -7/0 respectively
+}
+alert(divByZero(0,0));
diff --git a/Task/Detect-division-by-zero/Lua/detect-division-by-zero.lua b/Task/Detect-division-by-zero/Lua/detect-division-by-zero.lua
new file mode 100644
index 0000000000..ac4efabda8
--- /dev/null
+++ b/Task/Detect-division-by-zero/Lua/detect-division-by-zero.lua
@@ -0,0 +1,5 @@
+function div(a,b)
+  quot = a/b
+  if quot == 1/0 then error() end
+  return quot
+end
diff --git a/Task/Detect-division-by-zero/PHP/detect-division-by-zero-1.php b/Task/Detect-division-by-zero/PHP/detect-division-by-zero-1.php
new file mode 100644
index 0000000000..1a1180eb71
--- /dev/null
+++ b/Task/Detect-division-by-zero/PHP/detect-division-by-zero-1.php
@@ -0,0 +1,6 @@
+function div_check($x, $y) {
+  @trigger_error(''); // a dummy to detect when error didn't occur
+  @($x / $y);
+  $e = error_get_last();
+  return $e['message'] != '';
+}
diff --git a/Task/Detect-division-by-zero/PHP/detect-division-by-zero-2.php b/Task/Detect-division-by-zero/PHP/detect-division-by-zero-2.php
new file mode 100644
index 0000000000..e1e5d41a17
--- /dev/null
+++ b/Task/Detect-division-by-zero/PHP/detect-division-by-zero-2.php
@@ -0,0 +1,3 @@
+function div_check($x, $y) {
+  return @($x / $y) === FALSE; // works at least in PHP/5.2.6-3ubuntu4.5
+}
diff --git a/Task/Detect-division-by-zero/Perl/detect-division-by-zero.pl b/Task/Detect-division-by-zero/Perl/detect-division-by-zero.pl
new file mode 100644
index 0000000000..eab12e9398
--- /dev/null
+++ b/Task/Detect-division-by-zero/Perl/detect-division-by-zero.pl
@@ -0,0 +1,4 @@
+sub div_check
+ {local $@;
+  eval {$_[0] / $_[1]};
+  $@ and $@ =~ /division by zero/;}
diff --git a/Task/Detect-division-by-zero/PicoLisp/detect-division-by-zero.l b/Task/Detect-division-by-zero/PicoLisp/detect-division-by-zero.l
new file mode 100644
index 0000000000..3d7bd14b6c
--- /dev/null
+++ b/Task/Detect-division-by-zero/PicoLisp/detect-division-by-zero.l
@@ -0,0 +1 @@
+(catch '("Div/0") (/ A B))
diff --git a/Task/Detect-division-by-zero/Python/detect-division-by-zero.py b/Task/Detect-division-by-zero/Python/detect-division-by-zero.py
new file mode 100644
index 0000000000..7680d5441c
--- /dev/null
+++ b/Task/Detect-division-by-zero/Python/detect-division-by-zero.py
@@ -0,0 +1,7 @@
+def div_check(x, y):
+  try:
+    x / y
+  except ZeroDivisionError:
+    return True
+  else:
+    return False
diff --git a/Task/Detect-division-by-zero/R/detect-division-by-zero.r b/Task/Detect-division-by-zero/R/detect-division-by-zero.r
new file mode 100644
index 0000000000..0d571e1a07
--- /dev/null
+++ b/Task/Detect-division-by-zero/R/detect-division-by-zero.r
@@ -0,0 +1,4 @@
+d <- 5/0
+if ( !is.finite(d) ) {
+  # it is Inf, -Inf, or NaN
+}
diff --git a/Task/Detect-division-by-zero/REXX/detect-division-by-zero.rexx b/Task/Detect-division-by-zero/REXX/detect-division-by-zero.rexx
new file mode 100644
index 0000000000..36ebe3211f
--- /dev/null
+++ b/Task/Detect-division-by-zero/REXX/detect-division-by-zero.rexx
@@ -0,0 +1,22 @@
+/*REXX program demonstrates  detects and handles  division by zero.     */
+
+signal on syntax                       /*handle all REXX syntax errors. */
+x = sourceline()                       /*being cute, x=size of this pgm.*/
+y = x-x                                /*setting to zero the obtuse way.*/
+z = x/y                                /*this'll do it, furrrr shurrre. */
+exit                                   /*We're kaput.   Ja vohl !       */
+
+/*───────────────────────────────error handling subroutines and others.─*/
+err: if rc==42 then do;  say;  say     /*1st, check for a specific error*/
+                    say center(' division by zero is a no-no. ',79,'═')
+                         say;  say
+                    exit 130
+                    end
+
+     say; say; say center(' error! ',max(40,linesize()%2),"*"); say
+               do j=1 for arg(); say arg(j); say; end; say;
+               exit 13
+
+novalue: syntax: call err 'REXX program' condition('C') "error",,
+             condition('D'),'REXX source statement (line' sigl"):",,
+             sourceline(sigl)
diff --git a/Task/Detect-division-by-zero/Racket/detect-division-by-zero.rkt b/Task/Detect-division-by-zero/Racket/detect-division-by-zero.rkt
new file mode 100644
index 0000000000..89d11faeff
--- /dev/null
+++ b/Task/Detect-division-by-zero/Racket/detect-division-by-zero.rkt
@@ -0,0 +1,5 @@
+#lang racket
+
+(with-handlers ([exn:fail:contract:divide-by-zero?
+                 (λ (e) (displayln "Divided by zero"))])
+  (/ 1 0))
diff --git a/Task/Detect-division-by-zero/Ruby/detect-division-by-zero-1.rb b/Task/Detect-division-by-zero/Ruby/detect-division-by-zero-1.rb
new file mode 100644
index 0000000000..70da3f59ec
--- /dev/null
+++ b/Task/Detect-division-by-zero/Ruby/detect-division-by-zero-1.rb
@@ -0,0 +1,9 @@
+def div_check(x, y)
+  begin
+    x / y
+  rescue ZeroDivisionError
+    true
+  else
+    false
+  end
+end
diff --git a/Task/Detect-division-by-zero/Ruby/detect-division-by-zero-2.rb b/Task/Detect-division-by-zero/Ruby/detect-division-by-zero-2.rb
new file mode 100644
index 0000000000..f4de5fc780
--- /dev/null
+++ b/Task/Detect-division-by-zero/Ruby/detect-division-by-zero-2.rb
@@ -0,0 +1,4 @@
+irb(main):010:0> div_check(5, 0)
+=> true
+irb(main):011:0> div_check(5.0, 0)
+=> false
diff --git a/Task/Detect-division-by-zero/Ruby/detect-division-by-zero-3.rb b/Task/Detect-division-by-zero/Ruby/detect-division-by-zero-3.rb
new file mode 100644
index 0000000000..e8a014aaf6
--- /dev/null
+++ b/Task/Detect-division-by-zero/Ruby/detect-division-by-zero-3.rb
@@ -0,0 +1,9 @@
+def div_check(x, y)
+  begin
+    x.div y
+  rescue ZeroDivisionError
+    true
+  else
+    false
+  end
+end
diff --git a/Task/Detect-division-by-zero/Ruby/detect-division-by-zero-4.rb b/Task/Detect-division-by-zero/Ruby/detect-division-by-zero-4.rb
new file mode 100644
index 0000000000..cba4eb6100
--- /dev/null
+++ b/Task/Detect-division-by-zero/Ruby/detect-division-by-zero-4.rb
@@ -0,0 +1,4 @@
+irb(main):010:0> div_check(5, 0)
+=> true
+irb(main):011:0> div_check(5.0, 0)
+=> true
diff --git a/Task/Detect-division-by-zero/Scala/detect-division-by-zero.scala b/Task/Detect-division-by-zero/Scala/detect-division-by-zero.scala
new file mode 100644
index 0000000000..de8f397df3
--- /dev/null
+++ b/Task/Detect-division-by-zero/Scala/detect-division-by-zero.scala
@@ -0,0 +1,17 @@
+object DivideByZero extends Application {
+
+  def check(x: Int, y: Int): Boolean = {
+    try {
+      val result = x / y
+      println(result)
+      return false
+    } catch {
+      case x: ArithmeticException => {
+        return true
+      }
+    }
+  }
+
+  println("divided by zero = " + check(1, 0))
+
+}
diff --git a/Task/Detect-division-by-zero/Smalltalk/detect-division-by-zero.st b/Task/Detect-division-by-zero/Smalltalk/detect-division-by-zero.st
new file mode 100644
index 0000000000..4fe01ba8d8
--- /dev/null
+++ b/Task/Detect-division-by-zero/Smalltalk/detect-division-by-zero.st
@@ -0,0 +1,7 @@
+zeroDivide := [:aBlock |
+	[aBlock value. false] on: ZeroDivide do: [true].
+	].
+
+"Testing"
+zeroDivide value: [2/1] "------> false"
+zeroDivide value: [2/0] "------> true"
diff --git a/Task/Detect-division-by-zero/Tcl/detect-division-by-zero-1.tcl b/Task/Detect-division-by-zero/Tcl/detect-division-by-zero-1.tcl
new file mode 100644
index 0000000000..81527c265e
--- /dev/null
+++ b/Task/Detect-division-by-zero/Tcl/detect-division-by-zero-1.tcl
@@ -0,0 +1,15 @@
+proc div_check {x y} {
+    if {[catch {expr {$x/$y}} result] == 0} {
+        puts "valid division: $x/$y=$result"
+    } else {
+        if {$result eq "divide by zero"} {
+            puts "caught division by zero: $x/$y -> $result"
+        } else {
+            puts "caught another error: $x/$y -> $result"
+        }
+    }
+}
+
+foreach denom {1 0 foo} {
+    div_check 42 $denom
+}
diff --git a/Task/Detect-division-by-zero/Tcl/detect-division-by-zero-2.tcl b/Task/Detect-division-by-zero/Tcl/detect-division-by-zero-2.tcl
new file mode 100644
index 0000000000..d0fd532d2c
--- /dev/null
+++ b/Task/Detect-division-by-zero/Tcl/detect-division-by-zero-2.tcl
@@ -0,0 +1,15 @@
+proc div_check {x y} {
+    try {
+        puts "valid division: $x/$y=[expr {$x/$y}]"
+    } trap {ARITH DIVZERO} msg {
+        puts "caught division by zero: $x/$y -> $msg"
+    } trap {ARITH DOMAIN} msg {
+        puts "caught bad division: $x/$y -> $msg"
+    } on error msg {
+        puts "caught another error: $x/$y -> $msg"
+    }
+}
+
+foreach {num denom} {42 1  42 0  42.0 0.0  0 0  0.0 0.0  0 foo} {
+    div_check $num $denom
+}
diff --git a/Task/Determine-if-a-string-is-numeric/0DESCRIPTION b/Task/Determine-if-a-string-is-numeric/0DESCRIPTION
new file mode 100644
index 0000000000..fd29441306
--- /dev/null
+++ b/Task/Determine-if-a-string-is-numeric/0DESCRIPTION
@@ -0,0 +1 @@
+Create a boolean function which takes in a string and tells whether it is a numeric string (floating point and negative numbers included) in the syntax the language uses for numeric literals or numbers converted from strings.
diff --git a/Task/Determine-if-a-string-is-numeric/1META.yaml b/Task/Determine-if-a-string-is-numeric/1META.yaml
new file mode 100644
index 0000000000..88eb5468ca
--- /dev/null
+++ b/Task/Determine-if-a-string-is-numeric/1META.yaml
@@ -0,0 +1,2 @@
+---
+note: Text processing
diff --git a/Task/Determine-if-a-string-is-numeric/AWK/determine-if-a-string-is-numeric.awk b/Task/Determine-if-a-string-is-numeric/AWK/determine-if-a-string-is-numeric.awk
new file mode 100644
index 0000000000..e275298c53
--- /dev/null
+++ b/Task/Determine-if-a-string-is-numeric/AWK/determine-if-a-string-is-numeric.awk
@@ -0,0 +1,2 @@
+$ awk 'function isnum(x){return(x==x+0)}BEGIN{print isnum("hello"),isnum("-42")}'
+0 1
diff --git a/Task/Determine-if-a-string-is-numeric/ActionScript/determine-if-a-string-is-numeric.as b/Task/Determine-if-a-string-is-numeric/ActionScript/determine-if-a-string-is-numeric.as
new file mode 100644
index 0000000000..427bc3d05c
--- /dev/null
+++ b/Task/Determine-if-a-string-is-numeric/ActionScript/determine-if-a-string-is-numeric.as
@@ -0,0 +1,4 @@
+public function isNumeric(num:String):Boolean
+{
+    return !isNaN(parseInt(num));
+}
diff --git a/Task/Determine-if-a-string-is-numeric/Ada/determine-if-a-string-is-numeric-1.ada b/Task/Determine-if-a-string-is-numeric/Ada/determine-if-a-string-is-numeric-1.ada
new file mode 100644
index 0000000000..018301e1a4
--- /dev/null
+++ b/Task/Determine-if-a-string-is-numeric/Ada/determine-if-a-string-is-numeric-1.ada
@@ -0,0 +1,3 @@
+package Numeric_Tests is
+   function Is_Numeric (Item : in String) return Boolean;
+end Numeric_Tests;
diff --git a/Task/Determine-if-a-string-is-numeric/Ada/determine-if-a-string-is-numeric-2.ada b/Task/Determine-if-a-string-is-numeric/Ada/determine-if-a-string-is-numeric-2.ada
new file mode 100644
index 0000000000..ffe1ed8e19
--- /dev/null
+++ b/Task/Determine-if-a-string-is-numeric/Ada/determine-if-a-string-is-numeric-2.ada
@@ -0,0 +1,11 @@
+package body Numeric_Tests is
+   function Is_Numeric (Item : in String) return Boolean is
+      Dummy : Float;
+   begin
+      Dummy := Float'Value (Item);
+      return True;
+   exception
+      when others =>
+         return False;
+   end Is_Numeric;
+end Numeric_Tests;
diff --git a/Task/Determine-if-a-string-is-numeric/Ada/determine-if-a-string-is-numeric-3.ada b/Task/Determine-if-a-string-is-numeric/Ada/determine-if-a-string-is-numeric-3.ada
new file mode 100644
index 0000000000..d0d9beeb20
--- /dev/null
+++ b/Task/Determine-if-a-string-is-numeric/Ada/determine-if-a-string-is-numeric-3.ada
@@ -0,0 +1,12 @@
+with Ada.Text_Io; use Ada.Text_Io;
+with Numeric_Tests; use Numeric_Tests;
+
+procedure Is_Numeric_Test is
+   S1 : String := "152";
+   S2 : String := "-3.1415926";
+   S3 : String := "Foo123";
+begin
+   Put_Line(S1 & " results in " & Boolean'Image(Is_Numeric(S1)));
+   Put_Line(S2 & " results in " & Boolean'Image(Is_Numeric(S2)));
+   Put_Line(S3 & " results in " & Boolean'Image(Is_Numeric(S3)));
+end Is_Numeric_Test;
diff --git a/Task/Determine-if-a-string-is-numeric/BASIC/determine-if-a-string-is-numeric.bas b/Task/Determine-if-a-string-is-numeric/BASIC/determine-if-a-string-is-numeric.bas
new file mode 100644
index 0000000000..1c863b1109
--- /dev/null
+++ b/Task/Determine-if-a-string-is-numeric/BASIC/determine-if-a-string-is-numeric.bas
@@ -0,0 +1,6 @@
+10 INPUT "Enter a string";S$:GOSUB 1000
+20 IF R THEN PRINT "Is num" ELSE PRINT"Not num"
+99 END
+1000 T1=VAL(S$):T1$=STR$(T1)
+1010 R=T1$=S$ OR T1$=" "+S$
+1099 RETURN
diff --git a/Task/Determine-if-a-string-is-numeric/C/determine-if-a-string-is-numeric.c b/Task/Determine-if-a-string-is-numeric/C/determine-if-a-string-is-numeric.c
new file mode 100644
index 0000000000..7ec0b8449a
--- /dev/null
+++ b/Task/Determine-if-a-string-is-numeric/C/determine-if-a-string-is-numeric.c
@@ -0,0 +1,10 @@
+#include 
+#include 
+int isNumeric (const char * s)
+{
+    if (s == NULL || *s == '\0' || isspace(*s))
+      return 0;
+    char * p;
+    strtod (s, &p);
+    return *p == '\0';
+}
diff --git a/Task/Determine-if-a-string-is-numeric/Clojure/determine-if-a-string-is-numeric-1.clj b/Task/Determine-if-a-string-is-numeric/Clojure/determine-if-a-string-is-numeric-1.clj
new file mode 100644
index 0000000000..0d85782e87
--- /dev/null
+++ b/Task/Determine-if-a-string-is-numeric/Clojure/determine-if-a-string-is-numeric-1.clj
@@ -0,0 +1,7 @@
+(defn numeric? [s]
+  (if-let [s (seq s)]
+    (let [s (if (= (first s) \-) (next s) s)
+          s (drop-while #(Character/isDigit %) s)
+          s (if (= (first s) \.) (next s) s)
+          s (drop-while #(Character/isDigit %) s)]
+      (empty? s))))
diff --git a/Task/Determine-if-a-string-is-numeric/Clojure/determine-if-a-string-is-numeric-2.clj b/Task/Determine-if-a-string-is-numeric/Clojure/determine-if-a-string-is-numeric-2.clj
new file mode 100644
index 0000000000..32bbc45dd2
--- /dev/null
+++ b/Task/Determine-if-a-string-is-numeric/Clojure/determine-if-a-string-is-numeric-2.clj
@@ -0,0 +1 @@
+(numeric? [\1 \2 \3])  ;; yields logical true
diff --git a/Task/Determine-if-a-string-is-numeric/CoffeeScript/determine-if-a-string-is-numeric.coffee b/Task/Determine-if-a-string-is-numeric/CoffeeScript/determine-if-a-string-is-numeric.coffee
new file mode 100644
index 0000000000..0fce93feca
--- /dev/null
+++ b/Task/Determine-if-a-string-is-numeric/CoffeeScript/determine-if-a-string-is-numeric.coffee
@@ -0,0 +1,2 @@
+console.log (isFinite(s) for s in [5, "5", "-5", "5", "5e5", 0]) # all true
+console.log (isFinite(s) for s in [NaN, "fred", "###"]) # all false
diff --git a/Task/Determine-if-a-string-is-numeric/Erlang/determine-if-a-string-is-numeric.erl b/Task/Determine-if-a-string-is-numeric/Erlang/determine-if-a-string-is-numeric.erl
new file mode 100644
index 0000000000..df612e0d9a
--- /dev/null
+++ b/Task/Determine-if-a-string-is-numeric/Erlang/determine-if-a-string-is-numeric.erl
@@ -0,0 +1,4 @@
+is_numeric(L) ->
+    Float = (catch erlang:list_to_float(L)),
+    Int = (catch erlang:list_to_integer(L)),
+    is_number(Float) orelse is_number(Int).
diff --git a/Task/Determine-if-a-string-is-numeric/Forth/determine-if-a-string-is-numeric.fth b/Task/Determine-if-a-string-is-numeric/Forth/determine-if-a-string-is-numeric.fth
new file mode 100644
index 0000000000..c01b4f31c1
--- /dev/null
+++ b/Task/Determine-if-a-string-is-numeric/Forth/determine-if-a-string-is-numeric.fth
@@ -0,0 +1,22 @@
+: is-numeric ( addr len -- )
+  2dup snumber? ?dup if      \ not standard, but >number is more cumbersome to use
+   0< if
+     -rot type ."  as integer = " .
+   else
+     2swap type ."  as double = " <# #s #> type
+   then
+  else 2dup >float if
+    type ."  as float = " f.
+  else
+    type ."  isn't numeric in base " base @ dec.
+  then then ;
+
+s" 1234" is-numeric    \ 1234 as integer = 1234
+s" 1234." is-numeric    \ 1234. as double = 1234
+s" 1234e" is-numeric    \ 1234e as float = 1234.
+s" $1234" is-numeric    \ $1234 as integer = 4660  ( hex literal )
+s" %1010" is-numeric    \ %1010 as integer = 10  ( binary literal )
+s" beef" is-numeric    \ beef isn't numeric in base 10
+hex
+s" beef" is-numeric    \ beef as integer = BEEF
+s" &1234" is-numeric    \ &1234 as integer = 4D2 ( decimal literal )
diff --git a/Task/Determine-if-a-string-is-numeric/Fortran/determine-if-a-string-is-numeric.f b/Task/Determine-if-a-string-is-numeric/Fortran/determine-if-a-string-is-numeric.f
new file mode 100644
index 0000000000..a956a95df3
--- /dev/null
+++ b/Task/Determine-if-a-string-is-numeric/Fortran/determine-if-a-string-is-numeric.f
@@ -0,0 +1,9 @@
+FUNCTION is_numeric(string)
+  IMPLICIT NONE
+  CHARACTER(len=*), INTENT(IN) :: string
+  LOGICAL :: is_numeric
+  REAL :: x
+  INTEGER :: e
+  READ(string,*,IOSTAT=e) x
+  is_numeric = e == 0
+END FUNCTION is_numeric
diff --git a/Task/Determine-if-a-string-is-numeric/Go/determine-if-a-string-is-numeric.go b/Task/Determine-if-a-string-is-numeric/Go/determine-if-a-string-is-numeric.go
new file mode 100644
index 0000000000..115429d82d
--- /dev/null
+++ b/Task/Determine-if-a-string-is-numeric/Go/determine-if-a-string-is-numeric.go
@@ -0,0 +1,6 @@
+import "strconv"
+
+func IsNumeric(s string) bool {
+    _, err := strconv.ParseFloat(s, 64)
+    return err == nil
+}
diff --git a/Task/Determine-if-a-string-is-numeric/Haskell/determine-if-a-string-is-numeric-1.hs b/Task/Determine-if-a-string-is-numeric/Haskell/determine-if-a-string-is-numeric-1.hs
new file mode 100644
index 0000000000..86ef1d224f
--- /dev/null
+++ b/Task/Determine-if-a-string-is-numeric/Haskell/determine-if-a-string-is-numeric-1.hs
@@ -0,0 +1,10 @@
+isInteger s = case reads s :: [(Integer, String)] of
+  [(_, "")] -> True
+  _         -> False
+
+isDouble s = case reads s :: [(Double, String)] of
+  [(_, "")] -> True
+  _         -> False
+
+isNumeric :: String -> Bool
+isNumeric s = isInteger s || isDouble s
diff --git a/Task/Determine-if-a-string-is-numeric/Haskell/determine-if-a-string-is-numeric-2.hs b/Task/Determine-if-a-string-is-numeric/Haskell/determine-if-a-string-is-numeric-2.hs
new file mode 100644
index 0000000000..36d173667a
--- /dev/null
+++ b/Task/Determine-if-a-string-is-numeric/Haskell/determine-if-a-string-is-numeric-2.hs
@@ -0,0 +1,4 @@
+areDigits = all isDigit
+isDigit  selects ASCII digits i.e. '0'..'9'
+isOctDigit selects '0'..'7'
+isHexDigit selects '0'..'9','A'..'F','a'..'f'
diff --git a/Task/Determine-if-a-string-is-numeric/Java/determine-if-a-string-is-numeric-1.java b/Task/Determine-if-a-string-is-numeric/Java/determine-if-a-string-is-numeric-1.java
new file mode 100644
index 0000000000..f7c808b613
--- /dev/null
+++ b/Task/Determine-if-a-string-is-numeric/Java/determine-if-a-string-is-numeric-1.java
@@ -0,0 +1,10 @@
+public boolean isNumeric(String input) {
+  try {
+    Integer.parseInt(input);
+    return true;
+  }
+  catch (NumberFormatException e) {
+    // s is not numeric
+    return false;
+  }
+}
diff --git a/Task/Determine-if-a-string-is-numeric/Java/determine-if-a-string-is-numeric-2.java b/Task/Determine-if-a-string-is-numeric/Java/determine-if-a-string-is-numeric-2.java
new file mode 100644
index 0000000000..2be40bb892
--- /dev/null
+++ b/Task/Determine-if-a-string-is-numeric/Java/determine-if-a-string-is-numeric-2.java
@@ -0,0 +1,10 @@
+private static final boolean isNumeric(final String s) {
+  if (s == null || s.isEmpty()) return false;
+  for (int x = 0; x < s.length(); x++) {
+    final char c = s.charAt(x);
+    if (x == 0 && (c == '-')) continue;  // negative
+    if ((c >= '0') && (c <= '9')) continue;  // 0 - 9
+    return false; // invalid
+  }
+  return true; // valid
+}
diff --git a/Task/Determine-if-a-string-is-numeric/Java/determine-if-a-string-is-numeric-3.java b/Task/Determine-if-a-string-is-numeric/Java/determine-if-a-string-is-numeric-3.java
new file mode 100644
index 0000000000..2ceacca357
--- /dev/null
+++ b/Task/Determine-if-a-string-is-numeric/Java/determine-if-a-string-is-numeric-3.java
@@ -0,0 +1,3 @@
+public static boolean isNumeric(String inputData) {
+  return inputData.matches("[-+]?\\d+(\\.\\d+)?");
+}
diff --git a/Task/Determine-if-a-string-is-numeric/Java/determine-if-a-string-is-numeric-4.java b/Task/Determine-if-a-string-is-numeric/Java/determine-if-a-string-is-numeric-4.java
new file mode 100644
index 0000000000..bb1b6ca838
--- /dev/null
+++ b/Task/Determine-if-a-string-is-numeric/Java/determine-if-a-string-is-numeric-4.java
@@ -0,0 +1,6 @@
+public static boolean isNumeric(String inputData) {
+  NumberFormat formatter = NumberFormat.getInstance();
+  ParsePosition pos = new ParsePosition(0);
+  formatter.parse(inputData, pos);
+  return inputData.length() == pos.getIndex();
+}
diff --git a/Task/Determine-if-a-string-is-numeric/Java/determine-if-a-string-is-numeric-5.java b/Task/Determine-if-a-string-is-numeric/Java/determine-if-a-string-is-numeric-5.java
new file mode 100644
index 0000000000..f8924ca9eb
--- /dev/null
+++ b/Task/Determine-if-a-string-is-numeric/Java/determine-if-a-string-is-numeric-5.java
@@ -0,0 +1,4 @@
+public static boolean isNumeric(String inputData) {
+  Scanner sc = new Scanner(inputData);
+  return sc.hasNextInt();
+}
diff --git a/Task/Determine-if-a-string-is-numeric/JavaScript/determine-if-a-string-is-numeric.js b/Task/Determine-if-a-string-is-numeric/JavaScript/determine-if-a-string-is-numeric.js
new file mode 100644
index 0000000000..599da9c56f
--- /dev/null
+++ b/Task/Determine-if-a-string-is-numeric/JavaScript/determine-if-a-string-is-numeric.js
@@ -0,0 +1,6 @@
+var value = "123.45e7"; // Assign string literal to value
+if (isFinite(value)) {
+  // value is a number
+}
+//Or, in web browser in address field:
+//  javascript:value="123.45e4"; if(isFinite(value)) {alert('numeric')} else {alert('non-numeric')}
diff --git a/Task/Determine-if-a-string-is-numeric/Lua/determine-if-a-string-is-numeric.lua b/Task/Determine-if-a-string-is-numeric/Lua/determine-if-a-string-is-numeric.lua
new file mode 100644
index 0000000000..1735b733c2
--- /dev/null
+++ b/Task/Determine-if-a-string-is-numeric/Lua/determine-if-a-string-is-numeric.lua
@@ -0,0 +1,3 @@
+if tonumber(a) ~= nil then
+   --it's a number
+end;
diff --git a/Task/Determine-if-a-string-is-numeric/PHP/determine-if-a-string-is-numeric.php b/Task/Determine-if-a-string-is-numeric/PHP/determine-if-a-string-is-numeric.php
new file mode 100644
index 0000000000..c9028764ac
--- /dev/null
+++ b/Task/Determine-if-a-string-is-numeric/PHP/determine-if-a-string-is-numeric.php
@@ -0,0 +1,5 @@
+
diff --git a/Task/Determine-if-a-string-is-numeric/Perl/determine-if-a-string-is-numeric-1.pl b/Task/Determine-if-a-string-is-numeric/Perl/determine-if-a-string-is-numeric-1.pl
new file mode 100644
index 0000000000..efc2b13e9b
--- /dev/null
+++ b/Task/Determine-if-a-string-is-numeric/Perl/determine-if-a-string-is-numeric-1.pl
@@ -0,0 +1,2 @@
+use Scalar::Util qw(looks_like_number);
+print looks_like_number($str) ? "numeric" : "not numeric\n";
diff --git a/Task/Determine-if-a-string-is-numeric/Perl/determine-if-a-string-is-numeric-2.pl b/Task/Determine-if-a-string-is-numeric/Perl/determine-if-a-string-is-numeric-2.pl
new file mode 100644
index 0000000000..9b4d9a511e
--- /dev/null
+++ b/Task/Determine-if-a-string-is-numeric/Perl/determine-if-a-string-is-numeric-2.pl
@@ -0,0 +1,8 @@
+if (/\D/)            { print "has nondigits\n" }
+if (/^\d+\z/)         { print "is a whole number\n" }
+if (/^-?\d+\z/)       { print "is an integer\n" }
+if (/^[+-]?\d+\z/)    { print "is a +/- integer\n" }
+if (/^-?\d+\.?\d*\z/) { print "is a real number\n" }
+if (/^-?(?:\d+(?:\.\d*)?&\.\d+)\z/) { print "is a decimal number\n" }
+if (/^([+-]?)(?=\d&\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?\z/)
+                     { print "a C float\n" }
diff --git a/Task/Determine-if-a-string-is-numeric/Perl/determine-if-a-string-is-numeric-3.pl b/Task/Determine-if-a-string-is-numeric/Perl/determine-if-a-string-is-numeric-3.pl
new file mode 100644
index 0000000000..a68ed0186e
--- /dev/null
+++ b/Task/Determine-if-a-string-is-numeric/Perl/determine-if-a-string-is-numeric-3.pl
@@ -0,0 +1,15 @@
+sub getnum {
+    use POSIX;
+    my $str = shift;
+    $str =~ s/^\s+//;
+    $str =~ s/\s+$//;
+    $! = 0;
+    my($num, $unparsed) = strtod($str);
+    if (($str eq '') && ($unparsed != 0) && $!) {
+        return undef;
+    } else {
+        return $num;
+    }
+}
+
+sub is_numeric { defined getnum($_[0]) }
diff --git a/Task/Determine-if-a-string-is-numeric/PicoLisp/determine-if-a-string-is-numeric.l b/Task/Determine-if-a-string-is-numeric/PicoLisp/determine-if-a-string-is-numeric.l
new file mode 100644
index 0000000000..46ad108cfe
--- /dev/null
+++ b/Task/Determine-if-a-string-is-numeric/PicoLisp/determine-if-a-string-is-numeric.l
@@ -0,0 +1,8 @@
+: (format "123")
+-> 123
+
+: (format "123a45")
+-> NIL
+
+: (format "-123.45" 4)
+-> 1234500
diff --git a/Task/Determine-if-a-string-is-numeric/Python/determine-if-a-string-is-numeric-1.py b/Task/Determine-if-a-string-is-numeric/Python/determine-if-a-string-is-numeric-1.py
new file mode 100644
index 0000000000..66c76bcf88
--- /dev/null
+++ b/Task/Determine-if-a-string-is-numeric/Python/determine-if-a-string-is-numeric-1.py
@@ -0,0 +1,5 @@
+s = '123'
+try:
+    i = float(s)
+except ValueError, TypeError:
+    print 'not numeric'
diff --git a/Task/Determine-if-a-string-is-numeric/Python/determine-if-a-string-is-numeric-2.py b/Task/Determine-if-a-string-is-numeric/Python/determine-if-a-string-is-numeric-2.py
new file mode 100644
index 0000000000..b7d100d015
--- /dev/null
+++ b/Task/Determine-if-a-string-is-numeric/Python/determine-if-a-string-is-numeric-2.py
@@ -0,0 +1,3 @@
+s = '123'
+if s.isdigit():
+    # numeric
diff --git a/Task/Determine-if-a-string-is-numeric/Python/determine-if-a-string-is-numeric-3.py b/Task/Determine-if-a-string-is-numeric/Python/determine-if-a-string-is-numeric-3.py
new file mode 100644
index 0000000000..ac9c8d2aa3
--- /dev/null
+++ b/Task/Determine-if-a-string-is-numeric/Python/determine-if-a-string-is-numeric-3.py
@@ -0,0 +1,28 @@
+def is_numeric(lit):
+    'Return value of numeric literal string or ValueError exception'
+
+    # Handle '0'
+    if lit == '0': return 0
+    # Hex/Binary
+    litneg = lit[1:] if lit[0] == '-' else lit
+    if litneg[0] == '0':
+        if litneg[1] in 'xX':
+            return int(lit,16)
+        elif litneg[1] in 'bB':
+            return int(lit,2)
+        else:
+            try:
+                return int(lit,8)
+            except ValueError:
+                pass
+
+    # Int/Float/Complex
+    try:
+        return int(lit)
+    except ValueError:
+        pass
+    try:
+        return float(lit)
+    except ValueError:
+        pass
+    return complex(lit)
diff --git a/Task/Determine-if-a-string-is-numeric/Python/determine-if-a-string-is-numeric-4.py b/Task/Determine-if-a-string-is-numeric/Python/determine-if-a-string-is-numeric-4.py
new file mode 100644
index 0000000000..589d643611
--- /dev/null
+++ b/Task/Determine-if-a-string-is-numeric/Python/determine-if-a-string-is-numeric-4.py
@@ -0,0 +1,16 @@
+>>> for s in ['0', '00', '123', '-123.', '-123e-4', '0123', '0x1a1', '-123+4.5j', '0b0101', '0.123', '-0xabc', '-0b101']:
+    print "%14s -> %-14s %s" % ('"'+s+'"', is_numeric(s), type(is_numeric(s)))
+
+           "0" -> 0              
+          "00" -> 0              
+         "123" -> 123            
+       "-123." -> -123.0         
+     "-123e-4" -> -0.0123        
+        "0123" -> 83             
+       "0x1a1" -> 417            
+   "-123+4.5j" -> (-123+4.5j)    
+      "0b0101" -> 5              
+       "0.123" -> 0.123          
+      "-0xabc" -> -2748          
+      "-0b101" -> -5             
+>>>
diff --git a/Task/Determine-if-a-string-is-numeric/R/determine-if-a-string-is-numeric.r b/Task/Determine-if-a-string-is-numeric/R/determine-if-a-string-is-numeric.r
new file mode 100644
index 0000000000..1ed5030650
--- /dev/null
+++ b/Task/Determine-if-a-string-is-numeric/R/determine-if-a-string-is-numeric.r
@@ -0,0 +1,3 @@
+> strings <- c("152", "-3.1415926", "Foo123")
+> suppressWarnings(!is.na(as.numeric(strings)))
+[1]  TRUE  TRUE FALSE
diff --git a/Task/Determine-if-a-string-is-numeric/REXX/determine-if-a-string-is-numeric.rexx b/Task/Determine-if-a-string-is-numeric/REXX/determine-if-a-string-is-numeric.rexx
new file mode 100644
index 0000000000..56e29ea45a
--- /dev/null
+++ b/Task/Determine-if-a-string-is-numeric/REXX/determine-if-a-string-is-numeric.rexx
@@ -0,0 +1,46 @@
+/*REXX program to determine if a string is numeric. */
+yyy=' -123.78'               /*or some such.*/
+
+                             /*strings below are all numeric (REXX).*/
+zzz=' -123.78 '
+zzz='-123.78'
+zzz='2'
+zzz="2"
+zzz=2
+zzz='000000000004'
+zzz='+5'
+zzz=' +6 '
+zzz=' + 7 '
+zzz=' - 8 '
+zzz=' - .9'
+zzz='- 19.'
+zzz='.7'
+zzz='2e3'
+zzz=47e567
+zzz='2e-3'
+zzz='1.2e1'
+zzz=' .2E6'
+zzz=' 2.e5 '
+zzz='       +1.2E0002 '
+zzz='       +1.2e+002 '
+zzz=' +0000001.200e+002 '
+zzz=' - 000001.200e+002 '
+zzz=' - 000008.201e-00000000000000002 '
+
+/*Note:  some REXX interpreters allow use of tab chars as blanks.  */
+
+                             /*all statements below are equivalent.*/
+
+if \datatype(yyy,'n')       then say 'oops, not numeric:' yyy
+if \datatype(yyy,'N')       then say 'oops, not numeric:' yyy
+if ¬datatype(yyy,'N')       then say 'oops, not numeric:' yyy
+if ¬datatype(yyy,'numeric') then say 'oops, not numeric:' yyy
+if ¬datatype(yyy,'nimrod.') then say 'oops, not numeric:' yyy
+if  datatype(yyy)\=='NUM'   then say 'oops, not numeric:' yyy
+if  datatype(yyy)/=='NUM'   then say 'oops, not numeric:' yyy
+if  datatype(yyy)¬=='NUM'   then say 'oops, not numeric:' yyy
+if  datatype(yyy)¬= 'NUM'   then say 'oops, not numeric:' yyy
+
+/*note: REXX only looks at the first char for DATATYPE's  2nd arg. */
+
+/*note: some REXX interpreters don't support the ¬ (not) character.*/
diff --git a/Task/Determine-if-a-string-is-numeric/Racket/determine-if-a-string-is-numeric.rkt b/Task/Determine-if-a-string-is-numeric/Racket/determine-if-a-string-is-numeric.rkt
new file mode 100644
index 0000000000..1940c6d912
--- /dev/null
+++ b/Task/Determine-if-a-string-is-numeric/Racket/determine-if-a-string-is-numeric.rkt
@@ -0,0 +1 @@
+(define (string-numeric? s) (number? (string->number s)))
diff --git a/Task/Determine-if-a-string-is-numeric/Ruby/determine-if-a-string-is-numeric-1.rb b/Task/Determine-if-a-string-is-numeric/Ruby/determine-if-a-string-is-numeric-1.rb
new file mode 100644
index 0000000000..d9681f1b6e
--- /dev/null
+++ b/Task/Determine-if-a-string-is-numeric/Ruby/determine-if-a-string-is-numeric-1.rb
@@ -0,0 +1,9 @@
+def is_numeric?(s)
+  begin
+    Float(s)
+  rescue
+    false # not numeric
+  else
+    true # numeric
+  end
+end
diff --git a/Task/Determine-if-a-string-is-numeric/Ruby/determine-if-a-string-is-numeric-2.rb b/Task/Determine-if-a-string-is-numeric/Ruby/determine-if-a-string-is-numeric-2.rb
new file mode 100644
index 0000000000..b05066de1d
--- /dev/null
+++ b/Task/Determine-if-a-string-is-numeric/Ruby/determine-if-a-string-is-numeric-2.rb
@@ -0,0 +1,3 @@
+def is_numeric?(s)
+    !!Float(s) rescue false
+end
diff --git a/Task/Determine-if-a-string-is-numeric/Scala/determine-if-a-string-is-numeric.scala b/Task/Determine-if-a-string-is-numeric/Scala/determine-if-a-string-is-numeric.scala
new file mode 100644
index 0000000000..a32c095f6e
--- /dev/null
+++ b/Task/Determine-if-a-string-is-numeric/Scala/determine-if-a-string-is-numeric.scala
@@ -0,0 +1 @@
+def isNumeric(input: String): Boolean = input.forall(_.isDigit)
diff --git a/Task/Determine-if-a-string-is-numeric/Scheme/determine-if-a-string-is-numeric.ss b/Task/Determine-if-a-string-is-numeric/Scheme/determine-if-a-string-is-numeric.ss
new file mode 100644
index 0000000000..025008579f
--- /dev/null
+++ b/Task/Determine-if-a-string-is-numeric/Scheme/determine-if-a-string-is-numeric.ss
@@ -0,0 +1 @@
+(define (numeric? s) (string->number s))
diff --git a/Task/Determine-if-a-string-is-numeric/Smalltalk/determine-if-a-string-is-numeric-1.st b/Task/Determine-if-a-string-is-numeric/Smalltalk/determine-if-a-string-is-numeric-1.st
new file mode 100644
index 0000000000..bf875f30cc
--- /dev/null
+++ b/Task/Determine-if-a-string-is-numeric/Smalltalk/determine-if-a-string-is-numeric-1.st
@@ -0,0 +1,20 @@
+String extend [
+  realIsNumeric [
+     (self first = $+) |
+     (self first = $-)
+        ifTrue: [
+           ^ (self allButFirst) isNumeric
+        ]
+        ifFalse: [
+           ^ self isNumeric
+        ]
+  ]
+]
+
+{ '1234'.            "true"
+  '3.14'. '+3.8111'. "true"
+  '+45'.             "true"
+  '-3.78'.           "true"
+  '-3.78.23'. "false"
+  '123e3'     "false: the notation is not recognized"
+} do: [ :a | a realIsNumeric printNl ]
diff --git a/Task/Determine-if-a-string-is-numeric/Smalltalk/determine-if-a-string-is-numeric-2.st b/Task/Determine-if-a-string-is-numeric/Smalltalk/determine-if-a-string-is-numeric-2.st
new file mode 100644
index 0000000000..13baef25c6
--- /dev/null
+++ b/Task/Determine-if-a-string-is-numeric/Smalltalk/determine-if-a-string-is-numeric-2.st
@@ -0,0 +1 @@
+(Number readFrom:(aString readStream) onError:[nil]) notNil
diff --git a/Task/Determine-if-a-string-is-numeric/Smalltalk/determine-if-a-string-is-numeric-3.st b/Task/Determine-if-a-string-is-numeric/Smalltalk/determine-if-a-string-is-numeric-3.st
new file mode 100644
index 0000000000..5341c38c2b
--- /dev/null
+++ b/Task/Determine-if-a-string-is-numeric/Smalltalk/determine-if-a-string-is-numeric-3.st
@@ -0,0 +1 @@
+(Scanner scanNumberFrom:(aString readStream)) notNil
diff --git a/Task/Determine-if-a-string-is-numeric/Tcl/determine-if-a-string-is-numeric.tcl b/Task/Determine-if-a-string-is-numeric/Tcl/determine-if-a-string-is-numeric.tcl
new file mode 100644
index 0000000000..7963affc2c
--- /dev/null
+++ b/Task/Determine-if-a-string-is-numeric/Tcl/determine-if-a-string-is-numeric.tcl
@@ -0,0 +1,3 @@
+if {
+    [string is double -strict $varname]
+} then {  ... }
diff --git a/Task/Entropy/Ada/entropy.ada b/Task/Entropy/Ada/entropy.ada
new file mode 100644
index 0000000000..f6bdc9aa67
--- /dev/null
+++ b/Task/Entropy/Ada/entropy.ada
@@ -0,0 +1,28 @@
+with Ada.Text_IO, Ada.Float_Text_IO, Ada.Numerics.Elementary_Functions;
+
+procedure Count_Entropy is
+
+   package TIO renames Ada.Text_IO;
+
+   Count: array(Character) of Natural := (others => 0);
+   Sum:   Natural := 0;
+   Line: String := "1223334444";
+
+begin
+   for I in Line'Range loop   -- count the characters
+      Count(Line(I)) := Count(Line(I))+1;
+      Sum := Sum + 1;
+   end loop;
+
+   declare   -- compute the entropy and print it
+      function P(C: Character) return Float is (Float(Count(C)) / Float(Sum));
+      use Ada.Numerics.Elementary_Functions, Ada.Float_Text_IO;
+      Result: Float := 0.0;
+   begin
+      for Ch in Character loop
+         Result := Result -
+          (if P(Ch)=0.0 then 0.0 else P(Ch) * Log(P(Ch), Base => 2.0));
+      end loop;
+      Put(Result, Fore => 1, Aft => 5, Exp => 0);
+   end;
+end Count_Entropy;
diff --git a/Task/Entropy/REXX/entropy-1.rexx b/Task/Entropy/REXX/entropy-1.rexx
new file mode 100644
index 0000000000..41984d2ef0
--- /dev/null
+++ b/Task/Entropy/REXX/entropy-1.rexx
@@ -0,0 +1,84 @@
+/* Rexx ***************************************************************
+* 28.02.2013 Walter Pachl
+* 12.03.2013 Walter Pachl  typo in log corrected. thanx for testing
+**********************************************************************/
+s="1223334444"
+occ.=0
+n=0
+Do i=1 To length(s)
+  c=substr(s,i,1)
+  occ.c=occ.c+1
+  n=n+1
+  End
+do c=1 To 4
+  p.c=occ.c/n
+  say c p.c
+  End
+e=0
+Do c=1 To 4
+  e=e+p.c*log(p.c,,2)
+  End
+Say 'Entropy of' s 'is' (-e)
+Exit
+
+log: Procedure
+/***********************************************************************
+* Return log(x) -- with specified precision and a specified base
+* Three different series are used for the ranges  0 to 0.5
+*                                                 0.5 to 1.5
+*                                                 1.5 to infinity
+* 03.09.1992 Walter Pachl
+***********************************************************************/
+  Parse Arg x,prec,b
+  If prec='' Then prec=9
+  Numeric Digits (2*prec)
+  Numeric Fuzz   3
+  Select
+    When x<=0 Then r='*** invalid argument ***'
+    When x<0.5 Then Do
+      z=(x-1)/(x+1)
+      o=z
+      r=z
+      k=1
+      Do i=3 By 2
+        ra=r
+        k=k+1
+        o=o*z*z
+        r=r+o/i
+        If r=ra Then Leave
+        End
+      r=2*r
+      End
+    When x<1.5 Then Do
+      z=(x-1)
+      o=z
+      r=z
+      k=1
+      Do i=2 By 1
+        ra=r
+        k=k+1
+        o=-o*z
+        r=r+o/i
+        If r=ra Then Leave
+        End
+      End
+    Otherwise /* 1.5<=x */ Do
+      z=(x+1)/(x-1)
+      o=1/z
+      r=o
+      k=1
+      Do i=3 By 2
+        ra=r
+        k=k+1
+        o=o/(z*z)
+        r=r+o/i
+        If r=ra Then Leave
+        End
+      r=2*r
+      End
+    End
+  If b<>'' Then
+    r=r/log(b)
+  Numeric Digits (prec)
+  r=r+0
+  Return r
diff --git a/Task/Entropy/Ruby/entropy-1.rb b/Task/Entropy/Ruby/entropy-1.rb
new file mode 100644
index 0000000000..91cf2a7a3c
--- /dev/null
+++ b/Task/Entropy/Ruby/entropy-1.rb
@@ -0,0 +1,9 @@
+def entropy(s)
+  counts = Hash.new(0)
+  s.each_char { |c| counts[c] += 1 }
+
+  counts.values.reduce(0) do |entropy, count|
+    freq = count / s.length.to_f
+    entropy - freq * Math.log2(freq)
+  end
+end
diff --git a/Task/Entropy/Tcl/entropy-1.tcl b/Task/Entropy/Tcl/entropy-1.tcl
new file mode 100644
index 0000000000..82c4392222
--- /dev/null
+++ b/Task/Entropy/Tcl/entropy-1.tcl
@@ -0,0 +1,10 @@
+proc entropy {str} {
+    set log2 [expr log(2)]
+    foreach char [split $str ""] {dict incr counts $char}
+    set entropy 0.0
+    foreach count [dict values $counts] {
+	set freq [expr {$count / double([string length $str])}]
+	set entropy [expr {$entropy - $freq * log($freq)/$log2}]
+    }
+    return $entropy
+}
diff --git a/Task/FizzBuzz/ACL2/fizzbuzz.acl2 b/Task/FizzBuzz/ACL2/fizzbuzz.acl2
new file mode 100644
index 0000000000..e9d339c3ab
--- /dev/null
+++ b/Task/FizzBuzz/ACL2/fizzbuzz.acl2
@@ -0,0 +1,12 @@
+(defun fizzbuzz-r (i)
+   (declare (xargs :measure (nfix (- 100 i))))
+   (prog2$
+    (cond ((= (mod i 15) 0) (cw "FizzBuzz~%"))
+          ((= (mod i 5) 0) (cw "Buzz~%"))
+          ((= (mod i 3) 0) (cw "Fizz~%"))
+          (t (cw "~x0~%" i)))
+    (if (zp (- 100 i))
+        nil
+        (fizzbuzz-r (1+ i)))))
+
+(defun fizzbuzz () (fizzbuzz-r 1))
diff --git a/Task/FizzBuzz/AWK/fizzbuzz-1.awk b/Task/FizzBuzz/AWK/fizzbuzz-1.awk
new file mode 100644
index 0000000000..47de5c3719
--- /dev/null
+++ b/Task/FizzBuzz/AWK/fizzbuzz-1.awk
@@ -0,0 +1,11 @@
+BEGIN {
+   for (NUM=1; NUM<=100; NUM++)
+       if (NUM % 15 == 0)
+           {print "FizzBuzz"}
+       else if (NUM % 3 == 0)
+           {print "Fizz"}
+       else if (NUM % 5 == 0)
+           {print "Buzz"}
+       else
+           {print NUM}
+}
diff --git a/Task/FizzBuzz/Ada/fizzbuzz.ada b/Task/FizzBuzz/Ada/fizzbuzz.ada
new file mode 100644
index 0000000000..f33609d70d
--- /dev/null
+++ b/Task/FizzBuzz/Ada/fizzbuzz.ada
@@ -0,0 +1,16 @@
+with Ada.Text_IO; use Ada.Text_IO;
+
+procedure Fizzbuzz is
+begin
+   for I in 1..100 loop
+      if I mod 15 = 0 then
+         Put_Line("FizzBuzz");
+      elsif I mod 5 = 0 then
+         Put_Line("Buzz");
+      elsif I mod 3 = 0 then
+         Put_Line("Fizz");
+      else
+         Put_Line(Integer'Image(I));
+      end if;
+   end loop;
+end Fizzbuzz;
diff --git a/Task/FizzBuzz/BASIC/fizzbuzz-1.bas b/Task/FizzBuzz/BASIC/fizzbuzz-1.bas
new file mode 100644
index 0000000000..5706ae5dcc
--- /dev/null
+++ b/Task/FizzBuzz/BASIC/fizzbuzz-1.bas
@@ -0,0 +1,11 @@
+FOR A = 1 TO 100
+   IF A MOD 15 = 0 THEN
+      PRINT "FizzBuzz"
+   ELSE IF A MOD 3 = 0 THEN
+      PRINT "Fizz"
+   ELSE IF A MOD 5 = 0 THEN
+      PRINT "Buzz"
+   ELSE
+      PRINT A
+   END IF
+NEXT A
diff --git a/Task/FizzBuzz/C/fizzbuzz-1.c b/Task/FizzBuzz/C/fizzbuzz-1.c
new file mode 100644
index 0000000000..b6e087e7ae
--- /dev/null
+++ b/Task/FizzBuzz/C/fizzbuzz-1.c
@@ -0,0 +1,20 @@
+#include
+
+int main (void)
+{
+    int i;
+    for (i = 1; i <= 100; i++)
+    {
+        if (!(i % 15))
+            printf ("FizzBuzz");
+        else if (!(i % 3))
+            printf ("Fizz");
+        else if (!(i % 5))
+            printf ("Buzz");
+        else
+            printf ("%d", i);
+
+        printf("\n");
+    }
+    return 0;
+}
diff --git a/Task/FizzBuzz/Clojure/fizzbuzz-1.clj b/Task/FizzBuzz/Clojure/fizzbuzz-1.clj
new file mode 100644
index 0000000000..086b301e3c
--- /dev/null
+++ b/Task/FizzBuzz/Clojure/fizzbuzz-1.clj
@@ -0,0 +1,5 @@
+(map (fn [x] (cond (zero? (mod x 15)) "FizzBuzz"
+                   (zero? (mod x 5)) "Buzz"
+                   (zero? (mod x 3)) "Fizz"
+		     :else x))
+     (range 1 101))
diff --git a/Task/FizzBuzz/CoffeeScript/fizzbuzz-1.coffee b/Task/FizzBuzz/CoffeeScript/fizzbuzz-1.coffee
new file mode 100644
index 0000000000..a2af876510
--- /dev/null
+++ b/Task/FizzBuzz/CoffeeScript/fizzbuzz-1.coffee
@@ -0,0 +1,9 @@
+for i in [1..100]
+  if i % 15 is 0
+    console.log "FizzBuzz"
+  else if i % 3 is 0
+    console.log "Fizz"
+  else if i % 5 is 0
+    console.log "Buzz"
+  else
+    console.log i
diff --git a/Task/FizzBuzz/Forth/fizzbuzz-1.fth b/Task/FizzBuzz/Forth/fizzbuzz-1.fth
new file mode 100644
index 0000000000..a3ceeda5a5
--- /dev/null
+++ b/Task/FizzBuzz/Forth/fizzbuzz-1.fth
@@ -0,0 +1,11 @@
+: fizz ( n -- ) drop ." Fizz" ;
+: buzz ( n -- ) drop ." Buzz" ;
+: fb   ( n -- ) drop ." FizzBuzz" ;
+: vector create does> ( n -- )
+  over 15 mod cells + @ execute ;
+vector .fizzbuzz
+  ' fb   , ' . ,    ' . ,
+  ' fizz , ' . ,    ' buzz ,
+  ' fizz , ' . ,    ' . ,
+  ' fizz , ' buzz , ' . ,
+  ' fizz , ' . ,    ' . ,
diff --git a/Task/FizzBuzz/Fortran/fizzbuzz-1.f b/Task/FizzBuzz/Fortran/fizzbuzz-1.f
new file mode 100644
index 0000000000..30939c9336
--- /dev/null
+++ b/Task/FizzBuzz/Fortran/fizzbuzz-1.f
@@ -0,0 +1,11 @@
+program fizzbuzz_if
+   integer :: i
+
+   do i = 1, 100
+      if     (mod(i,15) == 0) then; print *, 'FizzBuzz'
+      else if (mod(i,3) == 0) then; print *, 'Fizz'
+      else if (mod(i,5) == 0) then; print *, 'Buzz'
+      else;                         print *, i
+      end if
+   end do
+end program fizzbuzz_if
diff --git a/Task/FizzBuzz/Haskell/fizzbuzz-1.hs b/Task/FizzBuzz/Haskell/fizzbuzz-1.hs
new file mode 100644
index 0000000000..6930938df1
--- /dev/null
+++ b/Task/FizzBuzz/Haskell/fizzbuzz-1.hs
@@ -0,0 +1,7 @@
+main = mapM_ (putStrLn . fizzbuzz) [1..100]
+
+fizzbuzz x
+    | x `mod` 15 == 0 = "FizzBuzz"
+    | x `mod`  3 == 0 = "Fizz"
+    | x `mod`  5 == 0 = "Buzz"
+    | otherwise = show x
diff --git a/Task/FizzBuzz/Java/fizzbuzz-1.java b/Task/FizzBuzz/Java/fizzbuzz-1.java
new file mode 100644
index 0000000000..96990a8f58
--- /dev/null
+++ b/Task/FizzBuzz/Java/fizzbuzz-1.java
@@ -0,0 +1,15 @@
+public class FizzBuzz{
+	public static void main(String[] args){
+		for(int i= 1; i <= 100; i++){
+			if(i % 15 == 0){
+				System.out.println("FizzBuzz");
+			}else if(i % 3 == 0){
+				System.out.println("Fizz");
+			}else if(i % 5 == 0){
+				System.out.println("Buzz");
+			}else{
+				System.out.println(i);
+			}
+		}
+	}
+}
diff --git a/Task/FizzBuzz/JavaScript/fizzbuzz-1.js b/Task/FizzBuzz/JavaScript/fizzbuzz-1.js
new file mode 100644
index 0000000000..be188cff9c
--- /dev/null
+++ b/Task/FizzBuzz/JavaScript/fizzbuzz-1.js
@@ -0,0 +1,32 @@
+for (var i = 1; i <= 100; i++) {
+  if (i % 15 == 0) {
+    console.log("FizzBuzz");
+  } else if (i % 3 == 0) {
+    console.log("Fizz");
+  } else if (i % 5 == 0) {
+    console.log("Buzz");
+  } else {
+    console.log(i);
+  }
+}
+
+// ------------------
+// functional version
+// ------------------
+(function (n) {
+     var r = [];
+
+     while (n--) {
+         r.push(n + 1);
+     }
+
+     return r.reverse();
+ })(100).map(function (n) {
+     return !(n % 15) ?
+         'FizzBuzz' :
+         !(n % 3) ?
+             'Fizz' :
+             !(n % 5) ?
+                 'Buzz' :
+                 n;
+ }).join('\r\n');
diff --git a/Task/FizzBuzz/Lua/fizzbuzz-1.lua b/Task/FizzBuzz/Lua/fizzbuzz-1.lua
new file mode 100644
index 0000000000..e7414f1fc4
--- /dev/null
+++ b/Task/FizzBuzz/Lua/fizzbuzz-1.lua
@@ -0,0 +1,11 @@
+for i = 1, 100 do
+	if i % 15 == 0 then
+		print("FizzBuzz")
+	elseif i % 3 == 0 then
+		print("Fizz")
+	elseif i % 5 == 0 then
+		print("Buzz")
+	else
+		print(i)
+	end
+end
diff --git a/Task/FizzBuzz/PHP/fizzbuzz-1.php b/Task/FizzBuzz/PHP/fizzbuzz-1.php
new file mode 100644
index 0000000000..39b3faacb7
--- /dev/null
+++ b/Task/FizzBuzz/PHP/fizzbuzz-1.php
@@ -0,0 +1,13 @@
+
diff --git a/Task/FizzBuzz/Perl/fizzbuzz-1.pl b/Task/FizzBuzz/Perl/fizzbuzz-1.pl
new file mode 100644
index 0000000000..3765b7e368
--- /dev/null
+++ b/Task/FizzBuzz/Perl/fizzbuzz-1.pl
@@ -0,0 +1,14 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use feature qw/say/;
+
+foreach my $i (1 .. 100) {
+    say + (0 == $i % 15) ? "FizzBuzz"
+        : (0 == $i % 3) ? "Fizz"
+        : (0 == $i % 5) ? "Buzz"
+        : $i
+        ;
+}
diff --git a/Task/FizzBuzz/PicoLisp/fizzbuzz-1.l b/Task/FizzBuzz/PicoLisp/fizzbuzz-1.l
new file mode 100644
index 0000000000..a2981ec674
--- /dev/null
+++ b/Task/FizzBuzz/PicoLisp/fizzbuzz-1.l
@@ -0,0 +1,3 @@
+(for N 100
+   (prinl
+      (or (pack (at (0 . 3) "Fizz") (at (0 . 5) "Buzz")) N) ) )
diff --git a/Task/FizzBuzz/Prolog/fizzbuzz-1.pro b/Task/FizzBuzz/Prolog/fizzbuzz-1.pro
new file mode 100644
index 0000000000..077c1b4121
--- /dev/null
+++ b/Task/FizzBuzz/Prolog/fizzbuzz-1.pro
@@ -0,0 +1,13 @@
+fizzbuzz :-
+        foreach(between(1, 100, X), print_item(X)).
+
+print_item(X) :-
+        (  0 is X mod 15
+        -> print('FizzBuzz')
+        ;  0 is X mod 3
+        -> print('Fizz')
+        ;  0 is X mod 5
+        -> print('Buzz')
+        ;  print(X)
+        ),
+        nl.
diff --git a/Task/FizzBuzz/Python/fizzbuzz-1.py b/Task/FizzBuzz/Python/fizzbuzz-1.py
new file mode 100644
index 0000000000..c36adf9ec8
--- /dev/null
+++ b/Task/FizzBuzz/Python/fizzbuzz-1.py
@@ -0,0 +1,9 @@
+for i in xrange(1, 101):
+    if i % 15 == 0:
+        print "FizzBuzz"
+    elif i % 3 == 0:
+        print "Fizz"
+    elif i % 5 == 0:
+        print "Buzz"
+    else:
+        print i
diff --git a/Task/FizzBuzz/R/fizzbuzz-1.r b/Task/FizzBuzz/R/fizzbuzz-1.r
new file mode 100644
index 0000000000..ae7832a4ac
--- /dev/null
+++ b/Task/FizzBuzz/R/fizzbuzz-1.r
@@ -0,0 +1,6 @@
+x <- 1:100
+xx <- as.character(x)
+xx[x%%3==0] <- "Fizz"
+xx[x%%5==0] <- "Buzz"
+xx[x%%15==0] <- "FizzBuzz"
+xx
diff --git a/Task/FizzBuzz/REXX/fizzbuzz-1.rexx b/Task/FizzBuzz/REXX/fizzbuzz-1.rexx
new file mode 100644
index 0000000000..719cf5d17e
--- /dev/null
+++ b/Task/FizzBuzz/REXX/fizzbuzz-1.rexx
@@ -0,0 +1,9 @@
+/*REXX program displays numbers  1 ──► 100  for the  FizzBuzz  problem. */
+
+  do j=1  to 100;      z=j
+  if j//3    ==0  then z='Fizz'
+  if j//5    ==0  then z='Buzz'
+  if j//(3*5)==0  then z='FizzBuzz'
+  say right(z,8)
+  end   /*j*/
+                                       /*stick a fork in it, we're done.*/
diff --git a/Task/FizzBuzz/Ruby/fizzbuzz-1.rb b/Task/FizzBuzz/Ruby/fizzbuzz-1.rb
new file mode 100644
index 0000000000..86a1e61158
--- /dev/null
+++ b/Task/FizzBuzz/Ruby/fizzbuzz-1.rb
@@ -0,0 +1,6 @@
+1.upto(100) do |n|
+  print "Fizz" if a = (n % 3).zero?
+  print "Buzz" if b = (n % 5).zero?
+  print n unless (a || b)
+  print "\n"
+end
diff --git a/Task/FizzBuzz/Scala/fizzbuzz-1.scala b/Task/FizzBuzz/Scala/fizzbuzz-1.scala
new file mode 100644
index 0000000000..b4e2b69952
--- /dev/null
+++ b/Task/FizzBuzz/Scala/fizzbuzz-1.scala
@@ -0,0 +1,6 @@
+(1 to 100) foreach {
+    case x if (x % 15 == 0) => println("FizzBuzz")
+    case x if (x % 3 == 0) => println("Fizz")
+    case x if (x % 5 == 0) => println("Buzz")
+    case x => println(x)
+}
diff --git a/Task/FizzBuzz/Smalltalk/fizzbuzz-1.st b/Task/FizzBuzz/Smalltalk/fizzbuzz-1.st
new file mode 100644
index 0000000000..713b13961e
--- /dev/null
+++ b/Task/FizzBuzz/Smalltalk/fizzbuzz-1.st
@@ -0,0 +1,9 @@
+Integer extend [
+    fizzbuzz [
+        | fb |
+        fb := '%1%2' % {
+            self \\ 3 == 0.  self \\ 5 == 0 }.
+        ^fb isEmpty ifTrue: [ self ] ifFalse: [ fb ]
+    ]
+]
+1 to: 100 do: [ :i | i fizzbuzz displayNl ]
diff --git a/Task/FizzBuzz/Tcl/fizzbuzz-1.tcl b/Task/FizzBuzz/Tcl/fizzbuzz-1.tcl
new file mode 100644
index 0000000000..0572449b66
--- /dev/null
+++ b/Task/FizzBuzz/Tcl/fizzbuzz-1.tcl
@@ -0,0 +1,9 @@
+proc fizzbuzz {n {m1 3} {m2 5}} {
+    for {set i 1} {$i <= $n} {incr i} {
+        set ans ""
+        if {$i % $m1 == 0} {append ans Fizz}
+        if {$i % $m2 == 0} {append ans Buzz}
+        puts [expr {$ans eq "" ? $i : $ans}]
+    }
+}
+fizzbuzz 100
diff --git a/Task/Forest-fire/0DESCRIPTION b/Task/Forest-fire/0DESCRIPTION
new file mode 100644
index 0000000000..5386b19475
--- /dev/null
+++ b/Task/Forest-fire/0DESCRIPTION
@@ -0,0 +1,17 @@
+{{wikipedia|Forest-fire model}}[[Category:Cellular automata]]
+Implement the Drossel and Schwabl definition of the [[wp:Forest-fire model|forest-fire model]].
+
+It is basically a 2D [[wp:Cellular automaton|cellular automaton]] where each cell can be in three distinct states (''empty'', ''tree'' and ''burning'') and evolves according to the following rules (as given by Wikipedia)
+
+# A burning cell turns into an empty cell
+# A tree will burn if at least one neighbor is burning
+# A tree ignites with probability ''f'' even if no neighbor is burning
+# An empty space fills with a tree with probability ''p''
+
+Neighborhood is the [[wp:Moore neighborhood|Moore neighborhood]]; boundary conditions are so that on the boundary the cells are always empty ("fixed" boundary condition).
+
+At the beginning, populate the lattice with empty and tree cells according to a specific probability (e.g. a cell has the probability 0.5 to be a tree). Then, let the system evolve.
+
+Task's requirements do not include graphical display or the ability to change parameters (probabilities ''p'' and ''f'') through a graphical or command line interface.
+
+'''See also''' [[Conway's Game of Life]] and [[Wireworld]].
diff --git a/Task/Forest-fire/1META.yaml b/Task/Forest-fire/1META.yaml
new file mode 100644
index 0000000000..a2413d963b
--- /dev/null
+++ b/Task/Forest-fire/1META.yaml
@@ -0,0 +1,2 @@
+---
+note: Games
diff --git a/Task/Forest-fire/Ada/forest-fire.ada b/Task/Forest-fire/Ada/forest-fire.ada
new file mode 100644
index 0000000000..dbb5ff3f43
--- /dev/null
+++ b/Task/Forest-fire/Ada/forest-fire.ada
@@ -0,0 +1,69 @@
+with Ada.Numerics.Float_Random;  use Ada.Numerics.Float_Random;
+with Ada.Text_IO;                use Ada.Text_IO;
+
+procedure Forest_Fire is
+   type Cell is (Empty, Tree, Fire);
+   type Board is array (Positive range <>, Positive range <>) of Cell;
+   procedure Step (S : in out Board; P, F : Float; Dice : Generator) is
+      function "+" (Left : Boolean; Right : Cell) return Boolean is
+      begin
+         return Left or else Right = Fire;
+      end "+";
+      function "+" (Left, Right : Cell) return Boolean is
+      begin
+         return Left = Fire or else Right = Fire;
+      end "+";
+      Above : array (S'Range (2)) of Cell := (others => Empty);
+      Left_Up, Up, Left : Cell;
+   begin
+      for Row in S'First (1) + 1..S'Last (1) - 1 loop
+         Left_Up := Empty;
+         Up      := Empty;
+         Left    := Empty;
+         for Column in S'First (2) + 1..S'Last (2) - 1 loop
+            Left_Up := Up;
+            Up      := Above (Column);
+            Above (Column) := S (Row, Column);
+            case S (Row, Column) is
+               when Empty =>
+                  if Random (Dice) < P then
+                     S (Row, Column) := Tree;
+                  end if;
+               when Tree =>
+                  if Left_Up                 + Up                  +      Above (Column + 1) +
+                     Left                    + S (Row,     Column) + S (Row,     Column + 1) +
+                     S (Row + 1, Column - 1) + S (Row + 1, Column) + S (Row + 1, Column + 1)
+                  or else Random (Dice) < F then
+                     S (Row, Column) := Fire;
+                  end if;
+               when Fire =>
+                  S (Row, Column) := Empty;
+            end case;
+            Left := Above (Column);
+         end loop;
+      end loop;
+   end Step;
+   procedure Put (S : Board) is
+   begin
+      for Row in S'First (1) + 1..S'Last (1) - 1 loop
+         for Column in S'First (2) + 1..S'Last (2) - 1 loop
+            case S (Row, Column) is
+               when Empty => Put (' ');
+               when Tree  => Put ('Y');
+               when Fire  => Put ('#');
+            end case;
+         end loop;
+         New_Line;
+      end loop;
+   end Put;
+
+   Dice   : Generator;
+   Forest : Board := (1..10 => (1..40 => Empty));
+begin
+   Reset (Dice);
+   for I in 1..10 loop
+      Step (Forest, 0.3, 0.1, Dice);
+      Put_Line ("-------------" & Integer'Image (I) & " -------------");
+      Put (Forest);
+   end loop;
+end Forest_Fire;
diff --git a/Task/Forest-fire/C/forest-fire-1.c b/Task/Forest-fire/C/forest-fire-1.c
new file mode 100644
index 0000000000..7ae68f1dc5
--- /dev/null
+++ b/Task/Forest-fire/C/forest-fire-1.c
@@ -0,0 +1,248 @@
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+// defaults
+#define PROB_TREE 0.55
+#define PROB_F 0.00001
+#define PROB_P 0.001
+
+#define TIMERFREQ 100
+
+#ifndef WIDTH
+#  define WIDTH 640
+#endif
+#ifndef HEIGHT
+#  define HEIGHT 480
+#endif
+#ifndef BPP
+#  define BPP 32
+#endif
+
+#if BPP != 32
+  #warning This program could not work with BPP different from 32
+#endif
+
+uint8_t *field[2], swapu;
+double prob_f = PROB_F, prob_p = PROB_P, prob_tree = PROB_TREE;
+
+enum cell_state {
+  VOID, TREE, BURNING
+};
+
+// simplistic random func to give [0, 1)
+double prand()
+{
+  return (double)rand() / (RAND_MAX + 1.0);
+}
+
+// initialize the field
+void init_field(void)
+{
+  int i, j;
+  swapu = 0;
+  for(i = 0; i < WIDTH; i++)
+  {
+    for(j = 0; j < HEIGHT; j++)
+    {
+      *(field[0] + j*WIDTH + i) = prand() > prob_tree ? VOID : TREE;
+    }
+  }
+}
+
+// the "core" of the task: the "forest-fire CA"
+bool burning_neighbor(int, int);
+pthread_mutex_t synclock = PTHREAD_MUTEX_INITIALIZER;
+static uint32_t simulate(uint32_t iv, void *p)
+{
+  int i, j;
+
+  /*
+    Since this is called by SDL, "likely"(*) in a separated
+    thread, we try to avoid corrupted updating of the display
+    (done by the show() func): show needs the "right" swapu
+    i.e. the right complete field. (*) what if it is not so?
+    The following is an attempt to avoid unpleasant updates.
+   */
+  pthread_mutex_lock(&synclock);
+
+  for(i = 0; i < WIDTH; i++) {
+    for(j = 0; j < HEIGHT; j++) {
+      enum cell_state s = *(field[swapu] + j*WIDTH + i);
+      switch(s)
+      {
+      case BURNING:
+	*(field[swapu^1] + j*WIDTH + i) = VOID;
+	break;
+      case VOID:
+	*(field[swapu^1] + j*WIDTH + i) = prand() > prob_p ? VOID : TREE;
+	break;
+      case TREE:
+	if (burning_neighbor(i, j))
+	  *(field[swapu^1] + j*WIDTH + i) = BURNING;
+	else
+	  *(field[swapu^1] + j*WIDTH + i) = prand() > prob_f ? TREE : BURNING;
+	break;
+      default:
+	fprintf(stderr, "corrupted field\n");
+	break;
+      }
+    }
+  }
+  swapu ^= 1;
+  pthread_mutex_unlock(&synclock);
+  return iv;
+}
+
+// the field is a "part" of an infinite "void" region
+#define NB(I,J) (((I)=0)&&((J)=0) \
+		 ? (*(field[swapu] + (J)*WIDTH + (I)) == BURNING) : false)
+bool burning_neighbor(int i, int j)
+{
+  return NB(i-1,j-1) || NB(i-1, j) || NB(i-1, j+1) ||
+    NB(i, j-1) || NB(i, j+1) ||
+    NB(i+1, j-1) || NB(i+1, j) || NB(i+1, j+1);
+}
+
+
+// "map" the field into gfx mem
+// burning trees are red
+// trees are green
+// "voids" are black;
+void show(SDL_Surface *s)
+{
+  int i, j;
+  uint8_t *pixels = (uint8_t *)s->pixels;
+  uint32_t color;
+  SDL_PixelFormat *f = s->format;
+
+  pthread_mutex_lock(&synclock);
+  for(i = 0; i < WIDTH; i++) {
+    for(j = 0; j < HEIGHT; j++) {
+      switch(*(field[swapu] + j*WIDTH + i)) {
+      case VOID:
+	color = SDL_MapRGBA(f, 0,0,0,255);
+	break;
+      case TREE:
+	color = SDL_MapRGBA(f, 0,255,0,255);
+	break;
+      case BURNING:
+	color = SDL_MapRGBA(f, 255,0,0,255);
+	break;
+      }
+      *(uint32_t*)(pixels + j*s->pitch + i*(BPP>>3)) = color;
+    }
+  }
+  pthread_mutex_unlock(&synclock);
+}
+
+int main(int argc, char **argv)
+{
+  SDL_Surface *scr = NULL;
+  SDL_Event event[1];
+  bool quit = false, running = false;
+  SDL_TimerID tid;
+
+  // add variability to the simulation
+  srand(time(NULL));
+
+  // we can change prob_f and prob_p
+  // prob_f prob of spontaneous ignition
+  // prob_p prob of birth of a tree
+  double *p;
+  for(argv++, argc--; argc > 0; argc--, argv++)
+  {
+    if ( strcmp(*argv, "prob_f") == 0 && argc > 1 )
+    {
+      p = &prob_f;
+    } else if ( strcmp(*argv, "prob_p") == 0 && argc > 1 ) {
+      p = &prob_p;
+    } else if ( strcmp(*argv, "prob_tree") == 0 && argc > 1 ) {
+      p = &prob_tree;
+    } else  continue;
+
+
+    argv++; argc--;
+    char *s = NULL;
+    double t = strtod(*argv, &s);
+    if (s != *argv) *p = t;
+  }
+
+  printf("prob_f %lf\nprob_p %lf\nratio %lf\nprob_tree %lf\n",
+	 prob_f, prob_p, prob_p/prob_f,
+	 prob_tree);
+
+  if ( SDL_Init(SDL_INIT_VIDEO|SDL_INIT_TIMER) != 0 ) return EXIT_FAILURE;
+  atexit(SDL_Quit);
+
+  field[0] = malloc(WIDTH*HEIGHT);
+  if (field[0] == NULL) exit(EXIT_FAILURE);
+  field[1] = malloc(WIDTH*HEIGHT);
+  if (field[1] == NULL) { free(field[0]); exit(EXIT_FAILURE); }
+
+  scr = SDL_SetVideoMode(WIDTH, HEIGHT, BPP, SDL_HWSURFACE|SDL_DOUBLEBUF);
+  if (scr == NULL) {
+    fprintf(stderr, "SDL_SetVideoMode: %s\n", SDL_GetError());
+    free(field[0]); free(field[1]);
+    exit(EXIT_FAILURE);
+  }
+
+  init_field();
+
+  tid = SDL_AddTimer(TIMERFREQ, simulate, NULL); // suppose success
+  running = true;
+
+  event->type = SDL_VIDEOEXPOSE;
+  SDL_PushEvent(event);
+
+  while(SDL_WaitEvent(event) && !quit)
+  {
+    switch(event->type)
+    {
+    case SDL_VIDEOEXPOSE:
+      while(SDL_LockSurface(scr) != 0) SDL_Delay(1);
+      show(scr);
+      SDL_UnlockSurface(scr);
+      SDL_Flip(scr);
+      event->type = SDL_VIDEOEXPOSE;
+      SDL_PushEvent(event);
+      break;
+    case SDL_KEYDOWN:
+      switch(event->key.keysym.sym)
+      {
+      case SDLK_q:
+	quit = true;
+	break;
+      case SDLK_p:
+	if (running)
+	{
+	  running = false;
+	  pthread_mutex_lock(&synclock);
+	  SDL_RemoveTimer(tid); // ignore failure...
+	  pthread_mutex_unlock(&synclock);
+	} else {
+	  running = true;
+	  tid = SDL_AddTimer(TIMERFREQ, simulate, NULL);
+	  // suppose success...
+	}
+	break;
+      }
+    case SDL_QUIT:
+      quit = true;
+      break;
+    }
+  }
+
+  if (running) {
+    pthread_mutex_lock(&synclock);
+    SDL_RemoveTimer(tid);
+    pthread_mutex_unlock(&synclock);
+  }
+  free(field[0]); free(field[1]);
+  exit(EXIT_SUCCESS);
+}
diff --git a/Task/Forest-fire/C/forest-fire-2.c b/Task/Forest-fire/C/forest-fire-2.c
new file mode 100644
index 0000000000..6b9879b441
--- /dev/null
+++ b/Task/Forest-fire/C/forest-fire-2.c
@@ -0,0 +1,65 @@
+#include 
+#include 
+#include 
+
+enum { empty = 0, tree = 1, fire = 2 };
+const char *disp[] = {"  ", "\033[32m/\\\033[m", "\033[07;31m/\\\033[m"};
+double tree_prob = 0.01, burn_prob = 0.0001;
+
+#define for_x for (int x = 0; x < w; x++)
+#define for_y for (int y = 0; y < h; y++)
+#define for_yx for_y for_x
+#define chance(x) (rand() < RAND_MAX * x)
+void evolve(int w, int h)
+{
+	unsigned univ[h][w], new[h][w];
+	for_yx new[y][x] = univ[y][x] = chance(tree_prob) ? tree : empty;
+
+show:	printf("\033[H");
+	for_y {
+		for_x printf(disp[univ[y][x]]);
+		printf("\033[E");
+	}
+	fflush(stdout);
+
+	for_yx {
+		switch (univ[y][x]) {
+		case fire:	new[y][x] = empty;
+				break;
+		case empty:	if (chance(tree_prob)) new[y][x] = tree;
+				break;
+		default:
+			for (int y1 = y - 1; y1 <= y + 1; y1++) {
+				if (y1 < 0 || y1 >= h) continue;
+				for (int x1 = x - 1; x1 <= x + 1; x1++) {
+					if (x1 < 0 || x1 >= w) continue;
+					if (univ[y1][x1] != fire) continue;
+
+					new[y][x] = fire;
+					goto burn;
+				}
+			}
+
+			burn:
+			if (new[y][x] == tree && chance(burn_prob))
+				new[y][x] = fire;
+		}
+	}
+
+	for_yx { univ[y][x] = new[y][x]; }
+	//usleep(100000);
+	goto show;
+}
+
+int main(int c, char **v)
+{
+	//srand(time(0));
+	int w = 0, h = 0;
+
+	if (c > 1) w = atoi(v[1]);
+	if (c > 2) h = atoi(v[2]);
+	if (w <= 0) w = 30;
+	if (h <= 0) h = 30;
+
+	evolve(w, h);
+}
diff --git a/Task/Forest-fire/Clojure/forest-fire.clj b/Task/Forest-fire/Clojure/forest-fire.clj
new file mode 100644
index 0000000000..3889ba9b15
--- /dev/null
+++ b/Task/Forest-fire/Clojure/forest-fire.clj
@@ -0,0 +1,77 @@
+(def burn-prob 0.1)
+(def new-tree-prob 0.5)
+
+(defn grow-new-tree? [] (> new-tree-prob (rand)))
+(defn burn-tree? [] (> burn-prob (rand)))
+(defn tree-maker [] (if (grow-new-tree?) :tree :grass))
+
+(defn make-forest
+  ([] (make-forest 5))
+  ([size]
+  (take size (repeatedly #(take size (repeatedly tree-maker))))))
+
+(defn tree-at [forest row col] (try (-> forest
+                                   (nth row)
+                                   (nth col))
+                                    (catch Exception _ false)))
+
+(defn neighbores-burning? [forest row col]
+  (letfn [(burnt? [row col] (= :burnt (tree-at forest row col)))]
+    (or
+     (burnt? (inc row) col)
+     (burnt? (dec row) col)
+     (burnt? row (inc col))
+     (burnt? row (dec col)))))
+
+(defn lightning-strike [forest]
+  (map (fn [forest-row]
+         (map #(if (and (= % :tree) (burn-tree?))
+                 :fire!
+                 %)
+              forest-row)
+         )
+       forest))
+
+(defn burn-out-trees [forest]
+  (map (fn [forest-row]
+         (map #(case %
+              :burnt :grass
+              :fire! :burnt
+              %)
+              forest-row))
+       forest))
+
+(defn burn-neighbores [forest]
+  (let [forest-size (count forest)
+        indicies (partition forest-size (for [row (range forest-size) col (range forest-size)] (cons row (list col))))]
+    (map (fn [forest-row indicies-row]
+           (map #(if (and
+                       (= :tree %)
+                       (neighbores-burning? forest (first %2) (second %2)))
+                    :fire!
+                    %)
+                forest-row indicies-row))
+         forest indicies)))
+
+(defn grow-new-trees [forest] (map (fn [forest-row]
+                                     (map #(if (= % :grass)
+                                             (tree-maker)
+                                             %)
+                                          forest-row))
+                                     forest))
+
+(defn forest-fire
+  ([] (forest-fire 5))
+  ([forest-size]
+  (loop
+      [forest (make-forest forest-size)]
+    (pprint forest)
+    (Thread/sleep 300)
+    (-> forest
+        (burn-out-trees)
+        (lightning-strike)
+        (burn-neighbores)
+        (grow-new-trees)
+        (recur)))))
+
+(forest-fire)
diff --git a/Task/Forest-fire/Fortran/forest-fire-1.f b/Task/Forest-fire/Fortran/forest-fire-1.f
new file mode 100644
index 0000000000..d2c26326c7
--- /dev/null
+++ b/Task/Forest-fire/Fortran/forest-fire-1.f
@@ -0,0 +1,183 @@
+module ForestFireModel
+  implicit none
+
+  type :: forestfire
+     integer, dimension(:,:,:), allocatable :: field
+     integer :: width, height
+     integer :: swapu
+     real :: prob_tree, prob_f, prob_p
+  end type forestfire
+
+  integer, parameter :: &
+       empty = 0, &
+       tree = 1, &
+       burning = 2
+
+  private :: bcheck, set, oget, burning_neighbor ! cset, get
+
+contains
+
+  ! create and initialize the field(s)
+  function forestfire_new(w, h, pt, pf, pp) result(res)
+    type(forestfire) :: res
+    integer, intent(in) :: w, h
+    real, intent(in), optional :: pt, pf, pp
+
+    integer :: i, j
+    real :: r
+
+    allocate(res%field(2,w,h)) ! no error check
+    res%prob_tree = 0.5
+    res%prob_f = 0.00001
+    res%prob_p = 0.001
+    if ( present(pt) ) res%prob_tree = pt
+    if ( present(pf) ) res%prob_f = pf
+    if ( present(pp) ) res%prob_p = pp
+
+    res%width = w
+    res%height = h
+    res%swapu = 0
+
+    res%field = empty
+
+    do i = 1,w
+       do j = 1,h
+          call random_number(r)
+          if ( r <= res%prob_tree ) call cset(res, i, j, tree)
+       end do
+    end do
+
+  end function forestfire_new
+
+  ! destroy the field(s)
+  subroutine forestfire_destroy(f)
+    type(forestfire), intent(inout) :: f
+
+    if ( allocated(f%field) ) deallocate(f%field)
+
+  end subroutine forestfire_destroy
+
+  ! evolution
+  subroutine forestfire_evolve(f)
+    type(forestfire), intent(inout) :: f
+
+    integer :: i, j
+    real :: r
+
+    do i = 1, f%width
+       do j = 1, f%height
+          select case ( get(f, i, j) )
+          case (burning)
+             call set(f, i, j, empty)
+          case (empty)
+             call random_number(r)
+             if ( r > f%prob_p ) then
+                call set(f, i, j, empty)
+             else
+                call set(f, i, j, tree)
+             end if
+          case (tree)
+             if ( burning_neighbor(f, i, j) ) then
+                call set(f, i, j, burning)
+             else
+                call random_number(r)
+                if ( r > f%prob_f ) then
+                   call set(f, i, j, tree)
+                else
+                   call set(f, i, j, burning)
+                end if
+             end if
+          end select
+       end do
+    end do
+    f%swapu = ieor(f%swapu, 1)
+  end subroutine forestfire_evolve
+
+  ! helper funcs/subs
+  subroutine set(f, i, j, t)
+    type(forestfire), intent(inout) :: f
+    integer, intent(in) :: i, j, t
+
+    if ( bcheck(f, i, j) ) then
+       f%field(ieor(f%swapu,1), i, j) = t
+    end if
+  end subroutine set
+
+  subroutine cset(f, i, j, t)
+    type(forestfire), intent(inout) :: f
+    integer, intent(in) :: i, j, t
+
+    if ( bcheck(f, i, j) ) then
+       f%field(f%swapu, i, j) = t
+    end if
+  end subroutine cset
+
+  function bcheck(f, i, j)
+    logical :: bcheck
+    type(forestfire), intent(in) :: f
+    integer, intent(in) :: i, j
+
+    bcheck = .false.
+    if ( (i >= 1) .and. (i <= f%width) .and. &
+         (j >= 1) .and. (j <= f%height) ) bcheck = .true.
+
+  end function bcheck
+
+
+  function get(f, i, j) result(r)
+    integer :: r
+    type(forestfire), intent(in) :: f
+    integer, intent(in) :: i, j
+
+    if ( .not. bcheck(f, i, j) ) then
+       r = empty
+    else
+       r = f%field(f%swapu, i, j)
+    end if
+  end function get
+
+  function oget(f, i, j) result(r)
+    integer :: r
+    type(forestfire), intent(in) :: f
+    integer, intent(in) :: i, j
+
+    if ( .not. bcheck(f, i, j) ) then
+       r = empty
+    else
+       r = f%field(ieor(f%swapu,1), i, j)
+    end if
+  end function oget
+
+  function burning_neighbor(f, i, j) result(r)
+    logical :: r
+    type(forestfire), intent(in) :: f
+    integer, intent(in) :: i, j
+
+    integer, dimension(3,3) :: s
+
+    s = f%field(f%swapu, i-1:i+1, j-1:j+1)
+    s(2,2) = empty
+    r = any(s == burning)
+  end function burning_neighbor
+
+  subroutine forestfire_print(f)
+    type(forestfire), intent(in) :: f
+
+    integer :: i, j
+
+    do j = 1, f%height
+       do i = 1, f%width
+          select case(get(f, i, j))
+          case (empty)
+             write(*,'(A)', advance='no') '.'
+          case (tree)
+             write(*,'(A)', advance='no') 'Y'
+          case (burning)
+             write(*,'(A)', advance='no') '*'
+          end select
+       end do
+       write(*,*)
+    end do
+  end subroutine forestfire_print
+
+end module ForestFireModel
diff --git a/Task/Forest-fire/Fortran/forest-fire-2.f b/Task/Forest-fire/Fortran/forest-fire-2.f
new file mode 100644
index 0000000000..0e516235b9
--- /dev/null
+++ b/Task/Forest-fire/Fortran/forest-fire-2.f
@@ -0,0 +1,18 @@
+program ForestFireTest
+  use ForestFireModel
+  implicit none
+
+  type(forestfire) :: f
+  integer :: i
+
+  f = forestfire_new(74, 40)
+
+  do i = 1, 1001
+     write(*,'(A)', advance='no') achar(z'1b') // '[H' // achar(z'1b') // '[2J'
+     call forestfire_print(f)
+     call forestfire_evolve(f)
+  end do
+
+  call forestfire_destroy(f)
+
+end program ForestFireTest
diff --git a/Task/Forest-fire/Go/forest-fire.go b/Task/Forest-fire/Go/forest-fire.go
new file mode 100644
index 0000000000..2da80ab1d3
--- /dev/null
+++ b/Task/Forest-fire/Go/forest-fire.go
@@ -0,0 +1,84 @@
+package main
+
+import (
+    "fmt"
+    "math/rand"
+    "strings"
+)
+
+const (
+    rows = 20
+    cols = 30
+    p    = .01
+    f    = .001
+)
+
+const rx = rows + 2
+const cx = cols + 2
+
+func main() {
+    odd := make([]byte, rx*cx)
+    even := make([]byte, rx*cx)
+    for r := 1; r <= rows; r++ {
+        for c := 1; c <= cols; c++ {
+            if rand.Intn(2) == 1 {
+                odd[r*cx+c] = 'T'
+            }
+        }
+    }
+    for {
+        print(odd)
+        step(even, odd)
+        fmt.Scanln()
+
+        print(even)
+        step(odd, even)
+        fmt.Scanln()
+    }
+}
+
+func print(model []byte) {
+    fmt.Println(strings.Repeat("__", cols))
+    fmt.Println()
+    for r := 1; r <= rows; r++ {
+        for c := 1; c <= cols; c++ {
+            if model[r*cx+c] == 0 {
+                fmt.Print("  ")
+            } else {
+                fmt.Printf(" %c", model[r*cx+c])
+            }
+        }
+        fmt.Println()
+    }
+}
+
+func step(dst, src []byte) {
+    for r := 1; r <= rows; r++ {
+        for c := 1; c <= cols; c++ {
+            x := r*cx + c
+            dst[x] = src[x]
+            switch dst[x] {
+            case '#':
+                // rule 1. A burning cell turns into an empty cell
+                dst[x] = 0
+            case 'T':
+                // rule 2. A tree will burn if at least one neighbor is burning
+                if src[x-cx-1]=='#'  || src[x-cx]=='#' || src[x-cx+1]=='#' ||
+                    src[x-1] == '#'  ||                   src[x+1] == '#'  ||
+                    src[x+cx-1]=='#' || src[x+cx]=='#' || src[x+cx+1] == '#' {
+                    dst[x] = '#'
+
+                    // rule 3. A tree ignites with probability f
+                    // even if no neighbor is burning
+                } else if rand.Float64() < f {
+                    dst[x] = '#'
+                }
+            default:
+                // rule 4. An empty space fills with a tree with probability p
+                if rand.Float64() < p {
+                    dst[x] = 'T'
+                }
+            }
+        }
+    }
+}
diff --git a/Task/Forest-fire/Haskell/forest-fire-1.hs b/Task/Forest-fire/Haskell/forest-fire-1.hs
new file mode 100644
index 0000000000..af60384e6b
--- /dev/null
+++ b/Task/Forest-fire/Haskell/forest-fire-1.hs
@@ -0,0 +1,47 @@
+import Data.List
+import Control.Arrow
+import Control.Monad
+import System.Random
+
+data Cell = Empty | Tree | Fire deriving (Eq)
+
+instance Show Cell where
+  show Empty   = " "
+  show Tree    = "T"
+  show Fire    = "$"
+
+randomCell = liftM ([Empty, Tree] !!) (randomRIO (0,1) :: IO Int)
+randomChance = randomRIO (0,1.0) :: IO Double
+
+rim b = map (fb b). (fb =<< rb) where
+    fb = liftM2 (.) (:) (flip (++) . return)
+    rb = fst. unzip. zip (repeat b). head
+
+take3x3 = concatMap (transpose. map take3). take3 where
+ take3 = init. init. takeWhile (not.null). map(take 3). tails
+
+list2Mat n = takeWhile(not.null). map(take n). iterate(drop n)
+
+evolveForest :: Int -> Int -> Int -> IO ()
+evolveForest m n k = do
+  let s = m*n
+  fs <- replicateM s randomCell
+
+  let nextState xs = do
+        ts <- replicateM s randomChance
+        vs <- replicateM s randomChance
+        let rv [r1,[l,c,r],r3] newTree fire
+              | c == Fire                                      = Empty
+              | c == Tree && Fire `elem` concat [r1,[l,r],r3]  = Fire
+              | c == Tree && 0.01 >= fire                      = Fire
+              | c == Empty && 0.1 >= newTree                   = Tree
+              | otherwise                                      = c
+        return $ zipWith3 rv xs ts vs
+
+      evolve i xs = unless (i > k) $
+        do  let nfs = nextState $ take3x3 $ rim Empty $ list2Mat n xs
+            putStrLn ("\n>>>>>> " ++ show i ++ ":")
+            mapM_ (putStrLn. concatMap show) $ list2Mat n xs
+            nfs >>= evolve (i+1)
+
+  evolve 1 fs
diff --git a/Task/Forest-fire/Haskell/forest-fire-2.hs b/Task/Forest-fire/Haskell/forest-fire-2.hs
new file mode 100644
index 0000000000..2feca4a1c6
--- /dev/null
+++ b/Task/Forest-fire/Haskell/forest-fire-2.hs
@@ -0,0 +1,25 @@
+*Main> evolveForest 6 50 3
+
+>>>>>> 1:
+     T T    T TTTTTTTTT TT   TT T  T   T TT  TT
+ TTT  TT T TT TTTT T   T  TT T T T  T T T  TTTTT T
+ T  TT T TTT T  TTTTT TTTTTTTT      T TTT  TTTT TT
+   TT TT T TT T TTT T T T TTTT T TTT   TT  T    TT
+ TT  TT  TT  TT T T  T T   TT   T   T TT T T TTTTT
+ T  TT T     T T  TTTTTT T T T  T T TT       T  TT
+
+>>>>>> 2:
+     T T    T TTTTTTTTT TT   TT TT T   $ TT  TT
+ TTT  TT T TT TTTT T   T  TT T T T  T T T  TTTTT T
+ TT TTTT TT$ T TTTTTT TTTTT$TT      T T$T  TTTT TT
+   TT TT T TT T TTTTTTT T TTTT T TTT   TT  T    TT
+ TT  TT  TT  TT T T  T T   TT   T   T TT T T TTTTT
+TTT TT TT    T T  TTTTTT T T T  T T TT       TT TT
+
+>>>>>> 3:
+    TTTTT   T TTTTTTTTT TT   TT TT T     TT  TT
+ TTTT TT T $$ TTTT T   T  $$ T T T  T $ $  TTTTT T
+ TTTTTTT T$  T TTTTTT TTTT$ $T      T $ $ TTTTT TT
+   TT TT T $$ T TTTTTTT T $$$T T TTT   $$  T T TTT
+ TT  TT  TT TTT T T TT TT  TT   T   T TT T T TTTTT
+TTT TT TT T  T T  TTTTTT T T T  T T TT       TT TT
diff --git a/Task/Forest-fire/Java/forest-fire.java b/Task/Forest-fire/Java/forest-fire.java
new file mode 100644
index 0000000000..a35a4cae15
--- /dev/null
+++ b/Task/Forest-fire/Java/forest-fire.java
@@ -0,0 +1,137 @@
+import java.util.Arrays;
+import java.util.LinkedList;
+import java.util.List;
+
+public class Fire {
+	private static final char BURNING = 'w'; //w looks like fire, right?
+	private static final char TREE = 'T';
+	private static final char EMPTY = '.';
+	private static final double F = 0.2;
+	private static final double P = 0.4;
+	private static final double TREE_PROB = 0.5;
+	
+	private static List process(List land){
+		List newLand = new LinkedList();
+		for(int i = 0; i < land.size(); i++){
+			String rowAbove, thisRow = land.get(i), rowBelow;
+			if(i == 0){//first row
+				rowAbove = null;
+				rowBelow = land.get(i + 1);
+			}else if(i == land.size() - 1){//last row
+				rowBelow = null;
+				rowAbove = land.get(i - 1);
+			}else{//middle
+				rowBelow = land.get(i + 1);
+				rowAbove = land.get(i - 1);
+			}
+			newLand.add(processRows(rowAbove, thisRow, rowBelow));
+		}
+		return newLand;
+	}
+
+	private static String processRows(String rowAbove, String thisRow,
+			String rowBelow){
+		String newRow = "";
+		for(int i = 0; i < thisRow.length();i++){
+			switch(thisRow.charAt(i)){
+			case BURNING:
+				newRow+= EMPTY;
+				break;
+			case EMPTY:
+				newRow+= Math.random() < P ? TREE : EMPTY;
+				break;
+			case TREE:
+				String neighbors = "";
+				if(i == 0){//first char
+					neighbors+= rowAbove == null ? "" : rowAbove.substring(i, i + 2);
+					neighbors+= thisRow.charAt(i + 1);
+					neighbors+= rowBelow == null ? "" : rowBelow.substring(i, i + 2);
+					if(neighbors.contains(Character.toString(BURNING))){
+						newRow+= BURNING;
+						break;
+					}
+				}else if(i == thisRow.length() - 1){//last char
+					neighbors+= rowAbove == null ? "" : rowAbove.substring(i - 1, i + 1);
+					neighbors+= thisRow.charAt(i - 1);
+					neighbors+= rowBelow == null ? "" : rowBelow.substring(i - 1, i + 1);
+					if(neighbors.contains(Character.toString(BURNING))){
+						newRow+= BURNING;
+						break;
+					}
+				}else{//middle
+					neighbors+= rowAbove == null ? "" : rowAbove.substring(i - 1, i + 2);
+					neighbors+= thisRow.charAt(i + 1);
+					neighbors+= thisRow.charAt(i - 1);
+					neighbors+= rowBelow == null ? "" : rowBelow.substring(i - 1, i + 2);
+					if(neighbors.contains(Character.toString(BURNING))){
+						newRow+= BURNING;
+						break;
+					}
+				}
+				newRow+= Math.random() < F ? BURNING : TREE;
+			}
+		}
+		return newRow;
+	}
+	
+	public static List populate(int width, int height){
+		List land = new LinkedList();
+		for(;height > 0; height--){//height is just a copy anyway
+			StringBuilder line = new StringBuilder(width);
+			for(int i = width; i > 0; i--){
+				line.append((Math.random() < TREE_PROB) ? TREE : EMPTY);
+			}
+			land.add(line.toString());
+		}
+		return land;
+	}
+	
+	//process the land n times
+	public static void processN(List land, int n){
+		for(int i = 0;i < n; i++){
+			land = process(land);
+		}
+	}
+	
+	//process the land n times and print each step along the way
+	public static void processNPrint(List land, int n){
+		for(int i = 0;i < n; i++){
+			land = process(land);
+			print(land);
+		}
+	}
+	
+	//print the land
+	public static void print(List land){
+		for(String row: land){
+			System.out.println(row);
+		}
+		System.out.println();
+	}
+	
+	public static void main(String[] args){
+		List land = Arrays.asList(".TTT.T.T.TTTT.T",
+				"T.T.T.TT..T.T..",
+				"TT.TTTT...T.TT.",
+				"TTT..TTTTT.T..T",
+				".T.TTT....TT.TT",
+				"...T..TTT.TT.T.",
+				".TT.TT...TT..TT",
+				".TT.T.T..T.T.T.",
+				"..TTT.TT.T..T..",
+				".T....T.....TTT",
+				"T..TTT..T..T...",
+				"TTT....TTTTTT.T",
+				"......TwTTT...T",
+				"..T....TTTTTTTT",
+				".T.T.T....TT...");
+		print(land);
+		processNPrint(land, 10);
+		
+		System.out.println("Random land test:");
+		
+		land = populate(10, 10);
+		print(land);
+		processNPrint(land, 10);
+	}
+}
diff --git a/Task/Forest-fire/JavaScript/forest-fire-1.js b/Task/Forest-fire/JavaScript/forest-fire-1.js
new file mode 100644
index 0000000000..2c93d6cca7
--- /dev/null
+++ b/Task/Forest-fire/JavaScript/forest-fire-1.js
@@ -0,0 +1,63 @@
+var forest = {
+    X: 50,
+    Y: 50,
+    propTree: 0.5,
+    propTree2: 0.01,
+    propBurn: 0.0001,
+    t: [],
+    c: ['rgb(255,255,255)', 'rgb(0,255,0)', 'rgb(255,0,0)']
+};
+
+for(var i = 0; i < forest.Y; i++) {
+    forest.t[i] = [];
+    for(var j = 0; j < forest.Y; j++) {
+        forest.t[i][j] = Math.random() < forest.propTree ? 1 : 0;
+    }
+}
+
+function afterLoad(forest) {
+    var canvas = document.getElementById('canvas');
+    var c = canvas.getContext('2d');
+    for(var i = 0; i < forest.X; i++) {
+        for(var j = 0; j < forest.Y; j++) {
+            c.fillStyle = forest.c[forest.t[i][j]];
+            c.fillRect(10*j, 10*i, 10*j+9, 10*i+9);
+        }
+    }
+}
+
+function doStep(forest) {
+    var to = [];
+    for(var i = 0; i < forest.Y; i++) {
+        to[i] = forest.t[i].slice(0);
+    }
+
+    //indices outside the array are undefined; which converts to 0=empty on forced typecast
+    for(var i = 0; i < forest.Y; i++) {
+        for(var j = 0; j < forest.Y; j++) {
+            if(0 == to[i][j]) {
+                forest.t[i][j] = Math.random() < forest.propTree2 ? 1 : 0;
+            } else if(1 == to[i][j]) {
+                if(
+                    ((i>0) && (2 == to[i-1][j])) ||
+                    ((i0) && (2 == to[i][j-1])) ||
+                    ((j
+
+
+Forest Fire
+
+
+
+Your browser doesn't support HTML5 Canvas.
+
+
+
+
diff --git a/Task/Forest-fire/Perl/forest-fire.pl b/Task/Forest-fire/Perl/forest-fire.pl
new file mode 100644
index 0000000000..19d3a1b581
--- /dev/null
+++ b/Task/Forest-fire/Perl/forest-fire.pl
@@ -0,0 +1,63 @@
+use 5.10.0;
+
+my $w = `tput cols` - 1;
+my $h = `tput lines` - 1;
+my $r = "\033[H";
+
+my ($green, $red, $yellow, $norm) = ("\033[32m", "\033[31m", "\033[33m", "\033[m");
+
+my $tree_prob = .05;
+my $burn_prob = .0002;
+
+my @forest = map([ map((rand(1) < $tree_prob) ? 1 : 0, 1 .. $w) ], 1 .. $h);
+
+sub iterate {
+	my @new = map([ map(0, 1 .. $w) ], 1 .. $h);
+	for my $i (0 .. $h - 1) {
+	for my $j (0 .. $w - 1) {
+		$new[$i][$j] = $forest[$i][$j];
+		if ($forest[$i][$j] == 2) {
+			$new[$i][$j] = 3;
+			next;
+		} elsif ($forest[$i][$j] == 1) {
+			if (rand() < $burn_prob) {
+				$new[$i][$j] = 2;
+				next;
+			}
+			for (	[-1, -1], [-1, 0], [-1, 1],
+				[ 0, -1], 	   [ 0, 1],
+				[ 1, -1], [ 1, 0], [ 1, 1] )
+			{
+				my $y = $_->[0] + $i;
+				next if $y < 0 || $y >= $h;
+				my $x = $_->[1] + $j;
+				next if $x < 0 || $x >= $w;
+				if ($forest[$y][$x] == 2) {
+					$new[$i][$j] = 2;
+					last;
+				}
+			}
+		} elsif (rand() < $tree_prob) {
+			$new[$i][$j] = 1;
+		} elsif ($forest[$i][$j] == 3) {
+			$new[$i][$j] = 0;
+		}
+	}}
+	@forest = @new;
+}
+
+sub forest {
+	print $r;
+	for (@forest) {
+		for (@$_) {
+			when(0) { print " "; }
+			when(1) { print "${green}*"}
+			when(2) { print "${red}&" }
+			when(3) { print "${yellow}&" }
+		}
+		print "\033[E\033[1G";
+	}
+	iterate;
+}
+
+forest while (1);
diff --git a/Task/Forest-fire/PicoLisp/forest-fire.l b/Task/Forest-fire/PicoLisp/forest-fire.l
new file mode 100644
index 0000000000..fe8638cda6
--- /dev/null
+++ b/Task/Forest-fire/PicoLisp/forest-fire.l
@@ -0,0 +1,43 @@
+(load "@lib/simul.l")
+
+(scl 3)
+
+(de forestFire (Dim ProbT ProbP ProbF)
+   (let Grid (grid Dim Dim)
+      (for Col Grid
+         (for This Col
+            (=: tree (> ProbT (rand 0 1.0))) ) )
+      (loop
+         (disp Grid NIL
+            '((This)
+               (cond
+                  ((: burn) "# ")
+                  ((: tree) "T ")
+                  (T ". ") ) ) )
+         (wait 1000)
+         (for Col Grid
+            (for This Col
+               (=: next
+                  (cond
+                     ((: burn) NIL)
+                     ((: tree)
+                        (if
+                           (or
+                              (find  # Neighbor burning?
+                                 '((Dir) (get (Dir This) 'burn))
+                                 (quote
+                                    west east south north
+                                    ((X) (south (west X)))
+                                    ((X) (north (west X)))
+                                    ((X) (south (east X)))
+                                    ((X) (north (east X))) ) )
+                              (> ProbF (rand 0 1.0)) )
+                           'burn
+                           'tree ) )
+                     (T (and (> ProbP (rand 0 1.0)) 'tree)) ) ) ) )
+         (for Col Grid
+            (for This Col
+               (if (: next)
+                  (put This @ T)
+                  (=: burn)
+                  (=: tree) ) ) ) ) ) )
diff --git a/Task/Forest-fire/Python/forest-fire.py b/Task/Forest-fire/Python/forest-fire.py
new file mode 100644
index 0000000000..de04e58f96
--- /dev/null
+++ b/Task/Forest-fire/Python/forest-fire.py
@@ -0,0 +1,83 @@
+'''
+Forest-Fire Cellular automation
+ See: http://en.wikipedia.org/wiki/Forest-fire_model
+'''
+
+L = 15
+# d = 2 # Fixed
+initial_trees = 0.55
+p = 0.01
+f = 0.001
+
+try:
+    raw_input
+except:
+    raw_input = input
+
+import random
+
+
+tree, burning, space = 'TB.'
+hood = ((-1,-1), (-1,0), (-1,1),
+        (0,-1),          (0, 1),
+        (1,-1),  (1,0),  (1,1))
+
+def initialise():
+    grid = {(x,y): (tree if random.random()<= initial_trees else space)
+            for x in range(L)
+            for y in range(L) }
+    return grid
+
+def gprint(grid):
+    txt = '\n'.join(''.join(grid[(x,y)] for x in range(L))
+                    for y in range(L))
+    print(txt)
+
+def quickprint(grid):
+    t = b = 0
+    ll = L * L
+    for x in range(L):
+        for y in range(L):
+            if grid[(x,y)] in (tree, burning):
+                t += 1
+                if grid[(x,y)] == burning:
+                    b += 1
+    print(('Of %6i cells, %6i are trees of which %6i are currently burning.'
+          + ' (%6.3f%%, %6.3f%%)')
+          % (ll, t, b, 100. * t / ll, 100. * b / ll))
+
+
+def gnew(grid):
+    newgrid = {}
+    for x in range(L):
+        for y in range(L):
+            if grid[(x,y)] == burning:
+                newgrid[(x,y)] = space
+            elif grid[(x,y)] == space:
+                newgrid[(x,y)] = tree if random.random()<= p else space
+            elif grid[(x,y)] == tree:
+                newgrid[(x,y)] = (burning
+                                   if any(grid.get((x+dx,y+dy),space) == burning
+                                            for dx,dy in hood)
+                                        or random.random()<= f
+                                   else tree)
+    return newgrid
+
+if __name__ == '__main__':
+    grid = initialise()
+    iter = 0
+    while True:
+        quickprint(grid)
+        inp = raw_input('Print/Quit// %6i: ' % iter).lower().strip()
+        if inp:
+            if inp[0] == 'p':
+                gprint(grid)
+            elif inp.isdigit():
+                for i in range(int(inp)):
+                    iter +=1
+                    grid = gnew(grid)
+                    quickprint(grid)
+            elif inp[0] == 'q':
+                break
+        grid = gnew(grid)
+        iter +=1
diff --git a/Task/Forest-fire/REXX/forest-fire.rexx b/Task/Forest-fire/REXX/forest-fire.rexx
new file mode 100644
index 0000000000..206106347b
--- /dev/null
+++ b/Task/Forest-fire/REXX/forest-fire.rexx
@@ -0,0 +1,67 @@
+/*REXX program grows and displays a forest  (with growth and lightning).
+   ┌───────────────────────────elided version─────────────────────────┐
+   ├─── full version has many more options and enhanced displays. ────┤
+   └──────────────────────────────────────────────────────────────────┘ */
+signal on syntax;  signal on novalue   /*handle REXX program errors.    */
+signal on halt                         /*handle cell growth interruptus.*/
+parse arg peeps '(' generations rows cols bare! life! clearscreen every
+@abc='abcdefghijklmnopqrstuvwxyz'; @abcU=@abc; upper @abcU
+      blank = 'BLANK'
+generations = p(generations            100)
+       rows = p(rows                   3)
+       cols = p(cols                   3)
+      bare! = pickchar(bare!           blank)
+clearscreen = p(clearscreen            0)
+      every = p(every                  999999999)
+      life! = pickchar(life!           '☼')
+fents=max(79,cols)                     /*fence width shown after display*/
+$.=bare!                               /*the universe is new, and barren*/
+gens=abs(generations)                  /*use this for convenience.      */
+x=space(peeps)                         /*remove superfluous spaces.     */
+if x=='' then x='2,1 2,2 2,3'
+
+        do  while x \==''
+        parse var x p x; parse var p r ',' c .; $.r=overlay(life!,$.r,c+1)
+        end
+life=0;     !.=0;    call showCells    /*show initial state of the cells*/
+/*─────────────────────────────────────watch cell colony grow/live/die. */
+  do  life=1 for gens
+    do   r=1 for rows;     rank=bare!
+      do c=2 for cols;     ?=substr($.r,c,1);       ??=?;    n=neighbors()
+          select                       /*select da quickest choice first*/
+          when ?==bare!    then  if n==3       then ??=life!
+          otherwise              if n<2 | n>3  then ??=bare!
+          end   /*select*/
+      rank=rank || ??
+      end       /*c*/
+    @.r=rank
+    end         /*c*/
+
+       do r=1 for rows; $.r=@.r; end   /*assign alternate cells ──► real*/
+  if life//every==0 | generations>0 | life==gens then call showCells
+  end           /*life*/
+/*─────────────────────────────────────stop watching the universe (life)*/
+halt: cycles=life-1; if cycles\==gens then say 'REXX program interrupted.'
+exit                                   /*stick a fork in it, we're done.*/
+/*───────────────────────────────SHOWCELLS subroutine─-─────────────────*/
+showCells: if clearscreen then 'CLS'   /*  ◄─── change this for your OS.*/
+_=;   do r=rows  by -1  for rows       /*show the forest in proper order*/
+      z=strip(substr($.r,2),'T')       /*pick off the meat of the row.  */
+      say z;   _=_ || z                /*be neat about trailing blanks. */
+      end   /*r*/
+say right(copies('═',fents)life,fents) /*show&tell for a stand of trees.*/
+if _=='' then exit                     /*if no life, then stop the run. */
+if !._   then do;   say 'repeating ...';    exit;   end
+!._=1                                  /*assign a state & compare later.*/
+return
+/*───────────────────────────────NEIGHBORS subroutine───────────────────*/
+neighbors: rp=r+1; cp=c+1; rm=r-1; cm=c-1  /*count 8 neighbors of a cell*/
+return    (substr($.rm,cm,1)==life!)   +   (substr($.rm,c ,1)==life!)  + ,
+          (substr($.rm,cp,1)==life!)   +   (substr($.r ,cm,1)==life!)  + ,
+          (substr($.r ,cp,1)==life!)   +   (substr($.rp,cm,1)==life!)  + ,
+          (substr($.rp,c ,1)==life!)   +   (substr($.rp,cp,1)==life!)
+/*───────────────────────────────1-liner subroutines────────────────────*/
+err:      say;say;say center(' error! ',max(40,linesize()%2),"*");say;do j=1 for arg();say arg(j);say;end;say;exit 13
+novalue:  syntax: call err 'REXX program' condition('C') "error",condition('D'),'REXX source statement (line' sigl"):",sourceline(sigl)
+pickchar: _=p(arg(1));if translate(_)==blank then _=' ';if length(_) ==3 then _=d2c(_);if length(_) ==2 then _=x2c(_);return _
+p:        return word(arg(1),1)
diff --git a/Task/Forest-fire/Racket/forest-fire.rkt b/Task/Forest-fire/Racket/forest-fire.rkt
new file mode 100644
index 0000000000..2677e5f5a0
--- /dev/null
+++ b/Task/Forest-fire/Racket/forest-fire.rkt
@@ -0,0 +1,60 @@
+#lang racket
+(require 2htdp/universe)
+(require 2htdp/image)
+
+(define (initial-forest w p-tree)
+  (for/vector #:length w ((rw w))
+    (for/vector #:length w ((cl w))
+      (if (< (random) p-tree) #\T #\_))))
+
+(define (has-burning-neighbour? forest r# c# w)
+  ;; note, this will check r# c#, too but it's not
+  ;; worth checking that r=r# and c=c# each time in
+  ;; this case
+  (for*/first
+      ((r (in-range (- r# 1) (+ r# 2)))
+       #:when (< 0 r w)
+       (c (in-range (- c# 1) (+ c# 2)))
+       #:when (< 0 c w)
+       #:when (equal? #\* (vector-ref (vector-ref forest r) c)))
+    #t))
+
+(define (fire-tick forest p-sprout f-combust w)
+  (for/vector #:length w ((rw forest) (r# (in-naturals)))
+    (for/vector #:length w ((cl rw) (c# (in-naturals)))
+      (case cl
+        ((#\_) (if (< (random) p-sprout) #\T #\_))
+        ((#\*) #\_)
+        ((#\T)
+         (cond
+           [(has-burning-neighbour? forest r# c# w) #\*]
+           [(< (random) f-combust) #\*]
+           [else #\T]))))))
+
+(define (render-forest state)
+  (for/fold
+      ((scn (empty-scene
+             (* (vector-length state) 8)
+             (* (vector-length (vector-ref state 0)) 8)
+             'black)))
+
+    ((rw state) (r# (in-naturals)))
+    (for/fold
+        ((scn scn))
+      ((cl rw) (c# (in-naturals)))
+      (place-image (circle 4 'solid
+                           (case cl
+                             ((#\_) 'brown)
+                             ((#\T) 'green)
+                             ((#\*) 'red)))
+                   (+ 4 (* c# 8)) (+ 4 (* r# 8)) scn))))
+
+(define (forest-fire p-tree p-sprout f-combust w)
+  (big-bang
+   (initial-forest w p-tree) ;; initial state
+   [on-tick (lambda (state)
+              ;(displayln state)
+              (fire-tick state p-sprout f-combust w))]
+   [to-draw render-forest]))
+
+(forest-fire 0 1/8 1/1024 50)
diff --git a/Task/Forest-fire/Ruby/forest-fire.rb b/Task/Forest-fire/Ruby/forest-fire.rb
new file mode 100644
index 0000000000..bbb8134de3
--- /dev/null
+++ b/Task/Forest-fire/Ruby/forest-fire.rb
@@ -0,0 +1,60 @@
+require 'enumerator'
+
+def transition arr, tree_prob, fire_prob
+  arr.enum_with_index.map do |cell, i|
+    if i == 0 or i == arr.length - 1
+      # boundary conditions: cells are always empty here
+      :empty
+    else
+      case cell
+      when :fire
+        # burning cells become empty
+        :empty
+      when :empty
+        # empty cells grow a tree with probability tree_prob
+        rand < tree_prob ? :tree : :empty
+      when :tree
+        # check my neighbouring cells, are they on fire?
+        if arr[i - 1] == :fire or arr[i + 1] == :fire
+          :fire
+        else
+          # neighbours not on fire, but catch fire at random
+          rand < fire_prob ? :fire : :tree
+        end
+      end
+    end
+  end
+end
+
+def pretty_print arr
+  # colour the trees green, the fires red, and the empty spaces black
+  print(arr.map { |cell|
+    "\e[3" +
+      case cell
+      when :tree
+        "2mT"
+      when :fire
+        "1mF"
+      when :empty
+        "0m "
+      end + "\e[0m"
+  }.join)
+end
+
+N = 20    # 20 trees
+P = 0.5   # probability of growing a tree
+F = 0.1   # probability of catching on fire
+
+srand Time.now.to_i
+
+# each cell has a 50/50 chance of being a tree
+array = (1..N).map { rand < 0.5 ? :tree : :empty }
+array[0] = array[-1] = :empty  # boundary conditions
+pretty_print array
+puts
+
+begin
+  array = transition(array, P, F)
+
+  pretty_print array
+end while gets.chomp.downcase != "q"
diff --git a/Task/Forest-fire/Sather/forest-fire.sa b/Task/Forest-fire/Sather/forest-fire.sa
new file mode 100644
index 0000000000..d64317e39e
--- /dev/null
+++ b/Task/Forest-fire/Sather/forest-fire.sa
@@ -0,0 +1,196 @@
+class FORESTFIRE is
+  private attr fields:ARRAY{ARRAY{INT}};
+  private attr swapu:INT;
+  private attr rnd:RND;
+  private attr verbose:BOOL;
+  private attr generation:INT;
+  readonly attr width, height:INT;
+  const empty:INT := 0;
+  const tree:INT := 1;
+  const burning:INT := 2;
+
+  attr prob_tree, prob_p, prob_f :FLT;
+
+  create(w, h:INT, v:BOOL):SAME is
+    res:FORESTFIRE := new;
+    res.fields := #(2);
+    res.fields[0] := #(w*h);
+    res.fields[1] := #(w*h);
+    res.width := w; res.height := h;
+    res.swapu := 0;
+    res.prob_tree := 0.55;
+    res.prob_p := 0.001;
+    res.prob_f := 0.00001;
+    res.rnd := #RND;
+    res.verbose := v;
+    res.generation := 0;
+    res.initfield;
+    return res;
+  end;
+
+  -- to give variability
+  seed(i:INT) is
+    rnd.seed(i);
+  end;
+
+  create(w, h:INT):SAME is
+    res ::= create(w, h, false);
+    return res;
+  end;
+
+  initfield is
+    n ::= 0;
+    swapu := 0;
+    if verbose and generation > 0 then
+      #ERR + "Previous generation " + generation + "\n";
+    end;
+    generation := 0;
+    loop i ::= 0.upto!(width-1);
+      loop j ::= 0.upto!(height-1);
+        if rnd.uniform > prob_tree.fltd then
+          cset(i, j, empty);
+        else
+	  n := n + 1;
+          cset(i, j, tree);
+        end;
+      end;
+    end;
+    if verbose then
+      #ERR + #FMT("Field size is %dx%d (%d)", width, height, size) + "\n";
+      #ERR + "There are " + n + " trees (" + (100.0*n.flt/size.flt) + "%)\n";
+      #ERR + "prob_tree = " + prob_tree + "\n";
+      #ERR + "prob_f = " + prob_f + "\n";
+      #ERR + "prob_p = " + prob_p + "\n";
+      #ERR + "ratio = " + prob_p/prob_f + "\n";
+    end;
+  end;
+
+  field:ARRAY{INT} is
+    return fields[swapu];
+  end;
+
+  ofield:ARRAY{INT} is
+    return fields[swapu.bxor(1)];
+  end;
+
+  size:INT is
+    return width*height;
+  end;
+
+  set(i, j, t:INT)
+    pre bcheck(i, j)
+  is
+    ofield[j*width + i] := t;
+  end;
+
+  cset(i, j, t:INT)
+    pre bcheck(i, j)
+  is
+    field[j*width + i] := t;
+  end;
+
+  private bcheck(i, j:INT):BOOL is
+    if i.is_between(0, width-1) and j.is_between(0, height-1) then
+      return true; -- is inside
+    else
+      return false; -- is outside
+    end;
+  end;
+
+  get(i, j:INT):INT is
+    if ~bcheck(i, j) then
+      return empty;
+    end;
+    return field[j*width + i];
+  end;
+
+  oget(i, j:INT):INT is
+    if ~bcheck(i, j) then
+      return empty;
+    end;
+    return ofield[j*width + i];
+  end;
+
+  burning_neighbor(i, j:INT):BOOL is
+    loop x ::= (-1).upto!(1);
+      loop y ::= (-1).upto!(1);
+        if x /= y then
+          if get(i+x, j+y) = burning then return true; end;
+        end;
+      end;
+    end;
+    return false;
+  end;
+
+  evolve is
+    bp ::= 0;
+    loop i ::= 0.upto!(width-1);
+      loop j ::= 0.upto!(height-1);
+	case get(i, j)
+        when burning then set(i, j, empty); bp := bp + 1;
+        when empty then
+          if rnd.uniform > prob_p.fltd then
+            set(i, j, empty);
+          else
+            set(i, j, tree);
+          end;
+        when tree then
+          if burning_neighbor(i, j) then
+            set(i, j, burning);
+          else
+            if rnd.uniform > prob_f.fltd then
+              set(i, j, tree);
+            else
+              set(i, j, burning);
+            end;
+          end;
+        else
+          #ERR + "corrupted field\n";
+        end;
+      end;
+    end;
+    generation := generation + 1;
+    if verbose then
+      if bp > 0 then
+        #ERR + #FMT("Burning at gen %d: %d\n", generation-1, bp);
+      end;
+    end;
+    swapu := swapu.bxor(1);
+  end;
+
+  str:STR is
+    s ::= "";
+    loop j ::= 0.upto!(height -1);
+      loop i ::= 0.upto!(width -1);
+        case get(i, j)
+          when empty then s := s + ".";
+          when tree then s := s + "Y";
+          when burning then s := s + "*";
+        end;
+      end;
+      s := s + "\n";
+    end;
+    s := s + "\n";
+    return s;
+  end;
+
+end;
+
+class MAIN is
+
+  main is
+    forestfire ::= #FORESTFIRE(74, 40);
+    -- #FORESTFIRE(74, 40, true) to have some extra info
+    -- (redirecting stderr to a file is a good idea!)
+
+    #OUT + forestfire.str;
+    -- evolve 1000 times
+    loop i ::= 1000.times!;
+      forestfire.evolve;
+      -- ANSI clear screen sequence
+      #OUT + 0x1b.char + "[H" + 0x1b.char + "[2J";
+      #OUT + forestfire.str;
+    end;
+  end;
+
+end;
diff --git a/Task/Forest-fire/Scala/forest-fire-1.scala b/Task/Forest-fire/Scala/forest-fire-1.scala
new file mode 100644
index 0000000000..4b6a9b5cb4
--- /dev/null
+++ b/Task/Forest-fire/Scala/forest-fire-1.scala
@@ -0,0 +1,28 @@
+import scala.util.Random
+
+class Forest(matrix:Array[Array[Char]]){
+  import Forest._
+  val f=0.01;	 // auto combustion probability
+  val p=0.1;	 // tree creation probability
+  val rows=matrix.size
+  val cols=matrix(0).size
+
+  def evolve():Forest=new Forest(Array.tabulate(rows, cols){(y,x)=>
+    matrix(y)(x) match {
+      case EMPTY => if (Random.nextDouble EMPTY
+      case TREE => if (neighbours(x, y).exists(_==BURNING)) BURNING
+                  else if (Random.nextDouble if (Random.nextDouble<0.5) TREE else EMPTY))
+}
diff --git a/Task/Forest-fire/Scala/forest-fire-2.scala b/Task/Forest-fire/Scala/forest-fire-2.scala
new file mode 100644
index 0000000000..fd2a25f4ef
--- /dev/null
+++ b/Task/Forest-fire/Scala/forest-fire-2.scala
@@ -0,0 +1,9 @@
+object ForestFire{
+  def main(args: Array[String]): Unit = {
+    var l=Forest()
+    for(i <- 0 until 20){
+      println(l+"\n-----------------------")
+      l=l.evolve
+    }
+  }
+}
diff --git a/Task/Forest-fire/Tcl/forest-fire.tcl b/Task/Forest-fire/Tcl/forest-fire.tcl
new file mode 100644
index 0000000000..d1f34d3dc6
--- /dev/null
+++ b/Task/Forest-fire/Tcl/forest-fire.tcl
@@ -0,0 +1,78 @@
+package require Tcl 8.5
+
+# Build a grid
+proc makeGrid {w h {treeProbability 0.5}} {
+    global grid gridW gridH
+    set gridW $w
+    set gridH $h
+    set grid [lrepeat $h [lrepeat $w " "]]
+    for {set x 0} {$x < $w} {incr x} {
+	for {set y 0} {$y < $h} {incr y} {
+	    if {rand() < $treeProbability} {
+		lset grid $y $x "#"
+	    }
+	}
+    }
+}
+
+# Evolve the grid (builds a copy, then overwrites)
+proc evolveGrid {{fireProbability 0.01} {plantProbability 0.05}} {
+    global grid gridW gridH
+    set newGrid {}
+    for {set y 0} {$y < $gridH} {incr y} {
+	set row {}
+	for {set x 0} {$x < $gridW} {incr x} {
+	    switch -exact -- [set s [lindex $grid $y $x]] {
+		" " {
+		    if {rand() < $plantProbability} {
+			set s "#"
+		    }
+		}
+		"#" {
+		    if {[burningNeighbour? $x $y] || rand() < $fireProbability} {
+			set s "o"
+		    }
+		}
+		"o" {
+		    set s " "
+		}
+	    }
+	    lappend row $s
+	}
+	lappend newGrid $row
+    }
+    set grid $newGrid
+}
+
+# We supply the neighbourhood model as an optional parameter (not used...)
+proc burningNeighbour? {
+    x y
+    {neighbourhoodModel {-1 -1  -1 0  -1 1  0 -1  0 1  1 -1  1 0  1 1}}
+} {
+    global grid gridW gridH
+    foreach {dx dy} $neighbourhoodModel {
+	set i [expr {$x + $dx}]
+	if {$i < 0 || $i >= $gridW} continue
+	set j [expr {$y + $dy}]
+	if {$j < 0 || $j >= $gridH} continue
+	if {[lindex $grid $j $i] eq "o"} {
+	    return 1
+	}
+    }
+    return 0
+}
+
+proc printGrid {} {
+    global grid
+    foreach row $grid {
+	puts [join $row ""]
+    }
+}
+
+# Simple main loop; press Return for the next step or send an EOF to stop
+makeGrid 70 8
+while 1 {
+    evolveGrid
+    printGrid
+    if {[gets stdin line] < 0} break
+}
diff --git a/Task/Go-Fish/0DESCRIPTION b/Task/Go-Fish/0DESCRIPTION
new file mode 100644
index 0000000000..80273bb73b
--- /dev/null
+++ b/Task/Go-Fish/0DESCRIPTION
@@ -0,0 +1,13 @@
+Write a program to let the user play [[wp:Go Fish|Go Fish]] against a computer opponent. Use the following rules:
+
+* Each player is dealt nine cards to start with.
+* On their turn, a player asks their opponent for a given rank (such as threes or kings). A player must already have at least one card of a given rank to ask for more.
+** If the opponent has any cards of the named rank, they must hand over all such cards, and the requester can ask again.
+** If the opponent has no cards of the named rank, the requester draws a card and ends their turn.
+* A ''book'' is a collection of every card of a given rank. Whenever a player completes a book, they may remove it from their hand.
+* If at any time a player's hand is empty, they may immediately draw a new card, so long as any new cards remain in the deck.
+* The game ends when every book is complete. The player with the most books wins.
+
+The game's AI need not be terribly smart, but it should use at least some strategy. That is, it shouldn't choose legal moves entirely at random.
+
+You may want to use code from [[Playing Cards]].
diff --git a/Task/Go-Fish/1META.yaml b/Task/Go-Fish/1META.yaml
new file mode 100644
index 0000000000..a2413d963b
--- /dev/null
+++ b/Task/Go-Fish/1META.yaml
@@ -0,0 +1,2 @@
+---
+note: Games
diff --git a/Task/Infinity/Ada/infinity-1.ada b/Task/Infinity/Ada/infinity-1.ada
new file mode 100644
index 0000000000..105abeb318
--- /dev/null
+++ b/Task/Infinity/Ada/infinity-1.ada
@@ -0,0 +1,24 @@
+with Ada.Text_IO; use Ada.Text_IO;
+
+procedure Infinities is
+   function Sup return Float is -- Only for predefined types
+      Result : Float := Float'Last;
+   begin
+      if not Float'Machine_Overflows then
+         Result := Float'Succ (Result);
+      end if;
+      return Result;
+   end Sup;
+
+   function Inf return Float is -- Only for predefined types
+      Result : Float := Float'First;
+   begin
+      if not Float'Machine_Overflows then
+         Result := Float'Pred (Result);
+      end if;
+      return Result;
+   end Inf;
+begin
+   Put_Line ("Supremum" & Float'Image (Sup));
+   Put_Line ("Infimum " & Float'Image (Inf));
+end Infinities;
diff --git a/Task/Infinity/Ada/infinity-2.ada b/Task/Infinity/Ada/infinity-2.ada
new file mode 100644
index 0000000000..ce99eb0f21
--- /dev/null
+++ b/Task/Infinity/Ada/infinity-2.ada
@@ -0,0 +1,26 @@
+with Ada.Text_IO; use Ada.Text_IO;
+
+procedure Infinities is
+   type Real is digits 5 range -10.0..10.0;
+
+   function Sup return Real is
+      Result : Real := Real'Last;
+   begin
+      return Real'Succ (Result);
+   exception
+      when Constraint_Error =>
+         return Result;
+   end Sup;
+
+   function Inf return Real is
+      Result : Real := Real'First;
+   begin
+      return Real'Pred (Result);
+   exception
+      when Constraint_Error =>
+         return Result;
+   end Inf;
+begin
+   Put_Line ("Supremum" & Real'Image (Sup));
+   Put_Line ("Infimum " & Real'Image (Inf));
+end Infinities;
diff --git a/Task/Infinity/Ada/infinity-3.ada b/Task/Infinity/Ada/infinity-3.ada
new file mode 100644
index 0000000000..2bc029a55d
--- /dev/null
+++ b/Task/Infinity/Ada/infinity-3.ada
@@ -0,0 +1 @@
+subtype Safe_Float is Float range Float'Range;
diff --git a/Task/Infinity/C/infinity-1.c b/Task/Infinity/C/infinity-1.c
new file mode 100644
index 0000000000..e556a1c5e3
--- /dev/null
+++ b/Task/Infinity/C/infinity-1.c
@@ -0,0 +1,11 @@
+#include 	/* HUGE_VAL */
+#include 	/* printf() */
+
+double inf(void) {
+  return HUGE_VAL;
+}
+
+int main() {
+  printf("%g\n", inf());
+  return 0;
+}
diff --git a/Task/Infinity/CoffeeScript/infinity-1.coffee b/Task/Infinity/CoffeeScript/infinity-1.coffee
new file mode 100644
index 0000000000..3c62151db7
--- /dev/null
+++ b/Task/Infinity/CoffeeScript/infinity-1.coffee
@@ -0,0 +1 @@
+Infinity
diff --git a/Task/Infinity/Fortran/infinity-1.f b/Task/Infinity/Fortran/infinity-1.f
new file mode 100644
index 0000000000..49e41b8bcf
--- /dev/null
+++ b/Task/Infinity/Fortran/infinity-1.f
@@ -0,0 +1,18 @@
+program to_f_the_ineffable
+   use, intrinsic :: ieee_arithmetic
+   integer :: i
+   real dimension(2) :: y, x = (/ 30, ieee_value(y,ieee_positive_inf) /)
+
+   do i = 1, 2
+      if (ieee_support_datatype(x(i))) then
+         if (ieee_is_finite(x(i))) then
+            print *, 'x(',i,') is finite'
+         else
+            print *, 'x(',i,') is infinite'
+         end if
+
+      else
+         print *, 'x(',i,') is not in an IEEE-supported format'
+      end if
+   end do
+end program to_f_the_ineffable
diff --git a/Task/Infinity/Haskell/infinity-1.hs b/Task/Infinity/Haskell/infinity-1.hs
new file mode 100644
index 0000000000..bf790bf3a6
--- /dev/null
+++ b/Task/Infinity/Haskell/infinity-1.hs
@@ -0,0 +1,8 @@
+maxRealFloat :: RealFloat a => a -> a
+maxRealFloat x = encodeFloat b (e-1) `asTypeOf` x where
+  b     = floatRadix x - 1
+  (_,e) = floatRange x
+
+infinity :: RealFloat a => a
+infinity = if isInfinite inf then inf else maxRealFloat 1.0 where
+  inf = 1/0
diff --git a/Task/Infinity/Java/infinity-1.java b/Task/Infinity/Java/infinity-1.java
new file mode 100644
index 0000000000..95bf97fd15
--- /dev/null
+++ b/Task/Infinity/Java/infinity-1.java
@@ -0,0 +1,2 @@
+double infinity = Double.POSITIVE_INFINITY; //defined as 1.0/0.0
+Double.isInfinite(infinity); //true
diff --git a/Task/Infinity/JavaScript/infinity-1.js b/Task/Infinity/JavaScript/infinity-1.js
new file mode 100644
index 0000000000..3c62151db7
--- /dev/null
+++ b/Task/Infinity/JavaScript/infinity-1.js
@@ -0,0 +1 @@
+Infinity
diff --git a/Task/Infinity/Perl/infinity-1.pl b/Task/Infinity/Perl/infinity-1.pl
new file mode 100644
index 0000000000..0717c7c76a
--- /dev/null
+++ b/Task/Infinity/Perl/infinity-1.pl
@@ -0,0 +1,2 @@
+my $x = 0 + "inf";
+my $y = 0 + "+inf";
diff --git a/Task/Infinity/Python/infinity-1.py b/Task/Infinity/Python/infinity-1.py
new file mode 100644
index 0000000000..474264f5ce
--- /dev/null
+++ b/Task/Infinity/Python/infinity-1.py
@@ -0,0 +1,2 @@
+>>> float('infinity')
+inf
diff --git a/Task/Infinity/Ruby/infinity-1.rb b/Task/Infinity/Ruby/infinity-1.rb
new file mode 100644
index 0000000000..45f1534eb8
--- /dev/null
+++ b/Task/Infinity/Ruby/infinity-1.rb
@@ -0,0 +1,10 @@
+a = 1.0/0       # => Infinity
+a.finite?       # => false
+a.infinite?     # => 1
+
+a = -1/0.0      # => -Infinity
+a.infinite?     # => -1
+
+a = Float::MAX  # => 1.79769313486232e+308
+a.finite?       # => true
+a.infinite?     # => nil
diff --git a/Task/Infinity/Smalltalk/infinity-1.st b/Task/Infinity/Smalltalk/infinity-1.st
new file mode 100644
index 0000000000..e9a05863cd
--- /dev/null
+++ b/Task/Infinity/Smalltalk/infinity-1.st
@@ -0,0 +1,2 @@
+Float infinity -> INF
+1.0 / 0.0 -> "ZeroDivide exception"
diff --git a/Task/Infinity/Tcl/infinity-1.tcl b/Task/Infinity/Tcl/infinity-1.tcl
new file mode 100644
index 0000000000..a9f41d7b13
--- /dev/null
+++ b/Task/Infinity/Tcl/infinity-1.tcl
@@ -0,0 +1,6 @@
+package require Tcl 8.5
+
+expr {1.0 / 0}  ;# ==> Inf
+expr {-1.0 / 0} ;# ==> -Inf
+expr {inf}      ;# ==> Inf
+expr {1 / 0}    ;# ==> "divide by zero" error; Inf not part of range of integer division
diff --git a/Task/JSON/Ada/json.ada b/Task/JSON/Ada/json.ada
new file mode 100644
index 0000000000..6f268bd379
--- /dev/null
+++ b/Task/JSON/Ada/json.ada
@@ -0,0 +1,41 @@
+with Ada.Text_IO;
+with GNATCOLL.JSON;
+
+procedure JSON_Test is
+   use Ada.Text_IO;
+   use GNATCOLL.JSON;
+
+   JSON_String : constant String := "{""name"":""Pingu"",""born"":1986}";
+
+   Penguin : JSON_Value := Create_Object;
+   Parents : JSON_Array;
+begin
+   Penguin.Set_Field (Field_Name => "name",
+                      Field      => "Linux");
+
+   Penguin.Set_Field (Field_Name => "born",
+                      Field      => 1992);
+
+   Append (Parents, Create ("Linus Torvalds"));
+   Append (Parents, Create ("Alan Cox"));
+   Append (Parents, Create ("Greg Kroah-Hartman"));
+
+   Penguin.Set_Field (Field_Name => "parents",
+                      Field      => Parents);
+
+   Put_Line (Penguin.Write);
+
+   Penguin := Read (JSON_String, "json.errors");
+
+   Penguin.Set_Field (Field_Name => "born",
+                      Field      => 1986);
+
+   Parents := Empty_Array;
+   Append (Parents, Create ("Otmar Gutmann"));
+   Append (Parents, Create ("Silvio Mazzola"));
+
+   Penguin.Set_Field (Field_Name => "parents",
+                      Field      => Parents);
+
+   Put_Line (Penguin.Write);
+end JSON_Test;
diff --git a/Task/JSON/Go/json-1.go b/Task/JSON/Go/json-1.go
new file mode 100644
index 0000000000..e4133fc81c
--- /dev/null
+++ b/Task/JSON/Go/json-1.go
@@ -0,0 +1,25 @@
+package main
+
+import "encoding/json"
+import "fmt"
+
+func main() {
+    var data interface{}
+    err := json.Unmarshal([]byte(`{"foo":1, "bar":[10, "apples"]}`), &data)
+    if err == nil {
+        fmt.Println(data)
+    } else {
+        fmt.Println(err)
+    }
+
+    sample := map[string]interface{}{
+        "blue":  []interface{}{1, 2},
+        "ocean": "water",
+    }
+    json_string, err := json.Marshal(sample)
+    if err == nil {
+        fmt.Println(string(json_string))
+    } else {
+        fmt.Println(err)
+    }
+}
diff --git a/Task/JSON/JavaScript/json-1.js b/Task/JSON/JavaScript/json-1.js
new file mode 100644
index 0000000000..8f09e91936
--- /dev/null
+++ b/Task/JSON/JavaScript/json-1.js
@@ -0,0 +1,4 @@
+var data = JSON.parse('{ "foo": 1, "bar": [10, "apples"] }');
+
+var sample = { "blue": [1,2], "ocean": "water" };
+var json_string = JSON.stringify(sample);
diff --git a/Task/JSON/Python/json-1.py b/Task/JSON/Python/json-1.py
new file mode 100644
index 0000000000..59b796e40b
--- /dev/null
+++ b/Task/JSON/Python/json-1.py
@@ -0,0 +1,10 @@
+>>> import json
+>>> data = json.loads('{ "foo": 1, "bar": [10, "apples"] }')
+>>> sample = { "blue": [1,2], "ocean": "water" }
+>>> json_string = json.dumps(sample)
+>>> json_string
+'{"blue": [1, 2], "ocean": "water"}'
+>>> sample
+{'blue': [1, 2], 'ocean': 'water'}
+>>> data
+{'foo': 1, 'bar': [10, 'apples']}
diff --git a/Task/JSON/R/json-1.r b/Task/JSON/R/json-1.r
new file mode 100644
index 0000000000..b2d012fb96
--- /dev/null
+++ b/Task/JSON/R/json-1.r
@@ -0,0 +1,3 @@
+library(rjson)
+data <- fromJSON('{ "foo": 1, "bar": [10, "apples"] }')
+data
diff --git a/Task/JSON/Tcl/json-1.tcl b/Task/JSON/Tcl/json-1.tcl
new file mode 100644
index 0000000000..bc10d588e7
--- /dev/null
+++ b/Task/JSON/Tcl/json-1.tcl
@@ -0,0 +1,5 @@
+package require json
+set sample {{ "foo": 1, "bar": [10, "apples"] }}
+
+set parsed [json::json2dict $sample]
+puts $parsed
diff --git a/Task/Knuth-shuffle/0DESCRIPTION b/Task/Knuth-shuffle/0DESCRIPTION
new file mode 100644
index 0000000000..144434b6e7
--- /dev/null
+++ b/Task/Knuth-shuffle/0DESCRIPTION
@@ -0,0 +1 @@
+Implement the [[wp:Knuth shuffle|Knuth shuffle]] (a.k.a. the Fisher-Yates shuffle) for an integer array (or, if possible, an array of any type). The Knuth shuffle is used to create a random permutation of an array.
diff --git a/Task/Knuth-shuffle/1META.yaml b/Task/Knuth-shuffle/1META.yaml
new file mode 100644
index 0000000000..f407ff9d83
--- /dev/null
+++ b/Task/Knuth-shuffle/1META.yaml
@@ -0,0 +1,2 @@
+---
+note: Classic CS problems and programs
diff --git a/Task/Knuth-shuffle/ACL2/knuth-shuffle.acl2 b/Task/Knuth-shuffle/ACL2/knuth-shuffle.acl2
new file mode 100644
index 0000000000..0e619acf5f
--- /dev/null
+++ b/Task/Knuth-shuffle/ACL2/knuth-shuffle.acl2
@@ -0,0 +1,24 @@
+:set-state-ok t
+
+(defun array-swap (name array i j)
+   (let ((ai (aref1 name array i))
+         (aj (aref1 name array j)))
+      (aset1 name
+             (aset1 name array j ai)
+             i aj)))
+
+(defun shuffle-r (name array m state)
+   (if (zp m)
+       (mv array state)
+       (mv-let (i state)
+               (random$ m state)
+          (shuffle-r name
+                     (array-swap name array i m)
+                     (1- m)
+                     state))))
+
+(defun shuffle (name array state)
+   (shuffle-r name
+              array
+              (1- (first (dimensions name array)))
+              state))
diff --git a/Task/Knuth-shuffle/AWK/knuth-shuffle.awk b/Task/Knuth-shuffle/AWK/knuth-shuffle.awk
new file mode 100644
index 0000000000..f1d2564b7a
--- /dev/null
+++ b/Task/Knuth-shuffle/AWK/knuth-shuffle.awk
@@ -0,0 +1,21 @@
+# Shuffle an _array_ with indexes from 1 to _len_.
+function shuffle(array, len,    i, j, t) {
+	for (i = len; i > 1; i--) {
+		# j = random integer from 1 to i
+		j = int(i * rand()) + 1
+
+		# swap array[i], array[j]
+		t = array[i]
+		array[i] = array[j]
+		array[j] = t
+	}
+}
+
+# Test program.
+BEGIN {
+	len = split("11 22 33 44 55 66 77 88 99 110", array)
+	shuffle(array, len)
+
+	for (i = 1; i < len; i++) printf "%s ", array[i]
+	printf "%s\n", array[len]
+}
diff --git a/Task/Knuth-shuffle/Ada/knuth-shuffle-1.ada b/Task/Knuth-shuffle/Ada/knuth-shuffle-1.ada
new file mode 100644
index 0000000000..4d73a7b353
--- /dev/null
+++ b/Task/Knuth-shuffle/Ada/knuth-shuffle-1.ada
@@ -0,0 +1,5 @@
+generic
+   type Element_Type is private;
+   type Array_Type is array (Positive range <>) of Element_Type;
+
+procedure Generic_Shuffle (List : in out Array_Type);
diff --git a/Task/Knuth-shuffle/Ada/knuth-shuffle-2.ada b/Task/Knuth-shuffle/Ada/knuth-shuffle-2.ada
new file mode 100644
index 0000000000..160f769d8b
--- /dev/null
+++ b/Task/Knuth-shuffle/Ada/knuth-shuffle-2.ada
@@ -0,0 +1,17 @@
+with Ada.Numerics.Discrete_Random;
+
+procedure Generic_Shuffle (List : in out Array_Type) is
+   package Discrete_Random is new Ada.Numerics.Discrete_Random(Result_Subtype => Integer);
+   use Discrete_Random;
+   K : Integer;
+   G : Generator;
+   T : Element_Type;
+begin
+   Reset (G);
+   for I in reverse List'Range loop
+      K := (Random(G) mod I) + 1;
+      T := List(I);
+      List(I) := List(K);
+      List(K) := T;
+   end loop;
+end Generic_Shuffle;
diff --git a/Task/Knuth-shuffle/Ada/knuth-shuffle-3.ada b/Task/Knuth-shuffle/Ada/knuth-shuffle-3.ada
new file mode 100644
index 0000000000..34c556847f
--- /dev/null
+++ b/Task/Knuth-shuffle/Ada/knuth-shuffle-3.ada
@@ -0,0 +1,22 @@
+with Ada.Text_IO;
+with Generic_Shuffle;
+
+procedure Test_Shuffle is
+
+   type Integer_Array is array (Positive range <>) of Integer;
+
+   Integer_List : Integer_Array
+     := (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18);
+   procedure Integer_Shuffle is new Generic_Shuffle(Element_Type => Integer,
+                                                    Array_Type => Integer_Array);
+begin
+
+   for I in Integer_List'Range loop
+      Ada.Text_IO.Put(Integer'Image(Integer_List(I)));
+   end loop;
+   Integer_Shuffle(List => Integer_List);
+   Ada.Text_IO.New_Line;
+   for I in Integer_List'Range loop
+      Ada.Text_IO.Put(Integer'Image(Integer_List(I)));
+   end loop;
+end Test_Shuffle;
diff --git a/Task/Knuth-shuffle/BASIC/knuth-shuffle.bas b/Task/Knuth-shuffle/BASIC/knuth-shuffle.bas
new file mode 100644
index 0000000000..4349d8a606
--- /dev/null
+++ b/Task/Knuth-shuffle/BASIC/knuth-shuffle.bas
@@ -0,0 +1,21 @@
+RANDOMIZE TIMER
+
+DIM cards(51) AS INTEGER
+DIM L0 AS LONG, card AS LONG
+
+PRINT "before:"
+FOR L0 = 0 TO 51
+    cards(L0) = L0
+    PRINT LTRIM$(STR$(cards(L0))); " ";
+NEXT
+
+FOR L0 = 51 TO 0 STEP -1
+    card = INT(RND * (L0 + 1))
+    IF card <> L0 THEN SWAP cards(card), cards(L0)
+NEXT
+
+PRINT : PRINT "after:"
+FOR L0 = 0 TO 51
+    PRINT LTRIM$(STR$(cards(L0))); " ";
+NEXT
+PRINT
diff --git a/Task/Knuth-shuffle/C/knuth-shuffle-1.c b/Task/Knuth-shuffle/C/knuth-shuffle-1.c
new file mode 100644
index 0000000000..8d986e5f4f
--- /dev/null
+++ b/Task/Knuth-shuffle/C/knuth-shuffle-1.c
@@ -0,0 +1,21 @@
+#include 
+#include 
+
+int rrand(int m)
+{
+  return (int)((double)m * ( rand() / (RAND_MAX+1.0) ));
+}
+
+#define BYTE(X) ((unsigned char *)(X))
+void shuffle(void *obj, size_t nmemb, size_t size)
+{
+  void *temp = malloc(size);
+  size_t n = nmemb;
+  while ( n > 1 ) {
+    size_t k = rrand(n--);
+    memcpy(temp, BYTE(obj) + n*size, size);
+    memcpy(BYTE(obj) + n*size, BYTE(obj) + k*size, size);
+    memcpy(BYTE(obj) + k*size, temp, size);
+  }
+  free(temp);
+}
diff --git a/Task/Knuth-shuffle/C/knuth-shuffle-2.c b/Task/Knuth-shuffle/C/knuth-shuffle-2.c
new file mode 100644
index 0000000000..3b23a0297e
--- /dev/null
+++ b/Task/Knuth-shuffle/C/knuth-shuffle-2.c
@@ -0,0 +1,52 @@
+#include 
+#include 
+
+/* define a shuffle function. e.g. decl_shuffle(double).
+ * advantage: compiler is free to optimize the swap operation without
+ *            indirection with pointers, which could be much faster.
+ * disadvantage: each datatype needs a separate instance of the function.
+ *            for a small funciton like this, it's not very big a deal.
+ */
+#define decl_shuffle(type)				\
+void shuffle_##type(type *list, size_t len) {		\
+	int j;						\
+	type tmp;					\
+	while(len) {					\
+		j = irand(len);				\
+		if (j != len - 1) {			\
+			tmp = list[j];			\
+			list[j] = list[len - 1];	\
+			list[len - 1] = tmp;		\
+		}					\
+		len--;					\
+	}						\
+}							\
+
+/* random integer from 0 to n-1 */
+int irand(int n)
+{
+	int r, rand_max = RAND_MAX - (RAND_MAX % n);
+	/* reroll until r falls in a range that can be evenly
+	 * distributed in n bins.  Unless n is comparable to
+	 * to RAND_MAX, it's not *that* important really. */
+	while ((r = rand()) >= rand_max);
+	return r / (rand_max / n);
+}
+
+/* declare and define int type shuffle function from macro */
+decl_shuffle(int);
+
+int main()
+{
+	int i, x[20];
+
+	for (i = 0; i < 20; i++) x[i] = i;
+	for (printf("before:"), i = 0; i < 20 || !printf("\n"); i++)
+		printf(" %d", x[i]);
+
+	shuffle_int(x, 20);
+
+	for (printf("after: "), i = 0; i < 20 || !printf("\n"); i++)
+		printf(" %d", x[i]);
+	return 0;
+}
diff --git a/Task/Knuth-shuffle/Clojure/knuth-shuffle.clj b/Task/Knuth-shuffle/Clojure/knuth-shuffle.clj
new file mode 100644
index 0000000000..dbfa4a4c5c
--- /dev/null
+++ b/Task/Knuth-shuffle/Clojure/knuth-shuffle.clj
@@ -0,0 +1,4 @@
+(defn shuffle [vect]
+  (reduce (fn [v i] (let [r (rand-int i)]
+                      (assoc v i (v r) r (v i)))
+          vect (range (dec (count vect)) 1 -1)))
diff --git a/Task/Knuth-shuffle/CoffeeScript/knuth-shuffle.coffee b/Task/Knuth-shuffle/CoffeeScript/knuth-shuffle.coffee
new file mode 100644
index 0000000000..77ff7de9b8
--- /dev/null
+++ b/Task/Knuth-shuffle/CoffeeScript/knuth-shuffle.coffee
@@ -0,0 +1,21 @@
+knuth_shuffle = (a) ->
+  n = a.length
+  while n > 1
+    r = Math.floor(n * Math.random())
+    n -= 1
+    [a[n], a[r]] = [a[r], a[n]]
+  a
+
+counts =
+  "1,2,3": 0
+  "1,3,2": 0
+  "2,1,3": 0
+  "2,3,1": 0
+  "3,1,2": 0
+  "3,2,1": 0
+
+for i in [1..100000]
+  counts[knuth_shuffle([ 1, 2, 3 ]).join(",")] += 1
+
+for key, val of counts
+  console.log "#{key}: #{val}"
diff --git a/Task/Knuth-shuffle/Forth/knuth-shuffle.fth b/Task/Knuth-shuffle/Forth/knuth-shuffle.fth
new file mode 100644
index 0000000000..2afa0c3047
--- /dev/null
+++ b/Task/Knuth-shuffle/Forth/knuth-shuffle.fth
@@ -0,0 +1,15 @@
+include random.fs
+
+: shuffle ( deck size -- )
+  2 swap do
+    dup i random cells +
+    over @ over @  swap
+    rot  ! over !
+    cell+
+  -1 +loop drop ;
+
+: .array   0 do dup @ . cell+ loop drop ;
+
+create deck 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 ,
+
+deck 10 2dup shuffle .array
diff --git a/Task/Knuth-shuffle/Fortran/knuth-shuffle.f b/Task/Knuth-shuffle/Fortran/knuth-shuffle.f
new file mode 100644
index 0000000000..cd937ffba0
--- /dev/null
+++ b/Task/Knuth-shuffle/Fortran/knuth-shuffle.f
@@ -0,0 +1,33 @@
+program Knuth_Shuffle
+  implicit none
+
+  integer, parameter :: reps = 1000000
+  integer :: i, n
+  integer, dimension(10) :: a, bins = 0, initial = (/ (n, n=1,10) /)
+
+  do i = 1, reps
+    a = initial
+ 	call Shuffle(a)
+    where (a == initial) bins = bins + 1  ! skew tester
+  end do
+  write(*, "(10(i8))") bins
+! prints  100382  100007   99783  100231  100507   99921   99941  100270  100290  100442
+
+contains
+
+subroutine Shuffle(a)
+  integer, intent(inout) :: a(:)
+  integer :: i, randpos, temp
+  real :: r
+
+  do i = size(a), 2, -1
+    call random_number(r)
+    randpos = int(r * i) + 1
+    temp = a(randpos)
+    a(randpos) = a(i)
+    a(i) = temp
+  end do
+
+end subroutine Shuffle
+
+end program Knuth_Shuffle
diff --git a/Task/Knuth-shuffle/Go/knuth-shuffle-1.go b/Task/Knuth-shuffle/Go/knuth-shuffle-1.go
new file mode 100644
index 0000000000..d254e4dc75
--- /dev/null
+++ b/Task/Knuth-shuffle/Go/knuth-shuffle-1.go
@@ -0,0 +1,22 @@
+package main
+
+import (
+    "fmt"
+    "math/rand"
+    "time"
+)
+
+func main() {
+    var a [20]int
+    for i := range a {
+        a[i] = i
+    }
+    fmt.Println(a)
+
+    rand.Seed(time.Now().UnixNano())
+    for i := len(a) - 1; i >= 1; i-- {
+        j := rand.Intn(i + 1)
+        a[i], a[j] = a[j], a[i]
+    }
+    fmt.Println(a)
+}
diff --git a/Task/Knuth-shuffle/Go/knuth-shuffle-2.go b/Task/Knuth-shuffle/Go/knuth-shuffle-2.go
new file mode 100644
index 0000000000..23dbef3916
--- /dev/null
+++ b/Task/Knuth-shuffle/Go/knuth-shuffle-2.go
@@ -0,0 +1,48 @@
+package main
+
+import (
+    "fmt"
+    "math/rand"
+    "time"
+)
+
+// Generic Knuth Shuffle algorithm.  In Go, this is done with interface
+// types.  The parameter s of function shuffle is an interface type.
+// Any type satisfying the interface "shuffler" can be shuffled with
+// this function.  Since the shuffle function uses the random number
+// generator, it's nice to seed the generator at program load time.
+func init() {
+    rand.Seed(time.Now().UnixNano())
+}
+func shuffle(s shuffler) {
+    for i := s.Len() - 1; i >= 1; i-- {
+        j := rand.Intn(i + 1)
+        s.Swap(i, j)
+    }
+}
+
+// Conceptually, a shuffler is an indexed collection of things.
+// It requires just two simple methods.
+type shuffler interface {
+    Len() int      // number of things in the collection
+    Swap(i, j int) // swap the two things indexed by i and j
+}
+
+// ints is an example of a concrete type implementing the shuffler
+// interface.
+type ints []int
+
+func (s ints) Len() int      { return len(s) }
+func (s ints) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
+
+// Example program.  Make an ints collection, fill with sequential numbers,
+// print, shuffle, print.
+func main() {
+    a := make(ints, 20)
+    for i := range a {
+        a[i] = i
+    }
+    fmt.Println(a)
+    shuffle(a)
+    fmt.Println(a)
+}
diff --git a/Task/Knuth-shuffle/Haskell/knuth-shuffle-1.hs b/Task/Knuth-shuffle/Haskell/knuth-shuffle-1.hs
new file mode 100644
index 0000000000..b2a80bc637
--- /dev/null
+++ b/Task/Knuth-shuffle/Haskell/knuth-shuffle-1.hs
@@ -0,0 +1,17 @@
+import System.Random
+import Data.List
+import Control.Monad
+import Control.Arrow
+
+mkRands = mapM (randomRIO.(,)0 ). enumFromTo 1. pred
+
+replaceAt :: Int -> a -> [a] -> [a]
+replaceAt i c = let (a,b) = splitAt i l in a++x:(drop 1 b)
+
+swapElems :: (Int, Int) -> [a] -> [a]
+swapElems (i,j) xs | i==j = xs
+                   | otherwise = replaceAt j (xs!!i) $ replaceAt i (xs!!j) xs
+
+knuthShuffle :: [a] -> IO [a]
+knuthShuffle xs =
+  liftM (foldr swapElems xs. zip [1..]) (mkRands (length xs))
diff --git a/Task/Knuth-shuffle/Haskell/knuth-shuffle-2.hs b/Task/Knuth-shuffle/Haskell/knuth-shuffle-2.hs
new file mode 100644
index 0000000000..bd14b8fb3a
--- /dev/null
+++ b/Task/Knuth-shuffle/Haskell/knuth-shuffle-2.hs
@@ -0,0 +1,3 @@
+knuthShuffleProcess :: (Show a) => [a] -> IO ()
+knuthShuffleProcess =
+   (mapM_ print. reverse =<<). ap (fmap. (. zip [1..]). scanr swapElems) (mkRands. length)
diff --git a/Task/Knuth-shuffle/Haskell/knuth-shuffle-3.hs b/Task/Knuth-shuffle/Haskell/knuth-shuffle-3.hs
new file mode 100644
index 0000000000..5576690d2a
--- /dev/null
+++ b/Task/Knuth-shuffle/Haskell/knuth-shuffle-3.hs
@@ -0,0 +1,21 @@
+import Data.Array.ST
+import Data.STRef
+import Control.Monad
+import Control.Monad.ST
+import Control.Arrow
+import System.Random
+
+shuffle :: RandomGen g => [a] -> g -> ([a], g)
+shuffle list g = runST $ do
+    r <- newSTRef g
+    let rand range = liftM (randomR range) (readSTRef r) >>=
+            runKleisli (second (Kleisli $ writeSTRef r) >>> arr fst)
+    a <- newAry (1, len) list
+    forM_ [len, len - 1 .. 2] $ \n -> do
+        k <- rand (1, n)
+        liftM2 (,) (readArray a k) (readArray a n) >>=
+           runKleisli (Kleisli (writeArray a n) *** Kleisli (writeArray a k))
+    liftM2 (,) (getElems a) (readSTRef r)
+  where len = length list
+        newAry :: (Int, Int) -> [a] -> ST s (STArray s Int a)
+        newAry = newListArray
diff --git a/Task/Knuth-shuffle/Java/knuth-shuffle.java b/Task/Knuth-shuffle/Java/knuth-shuffle.java
new file mode 100644
index 0000000000..390a6936a1
--- /dev/null
+++ b/Task/Knuth-shuffle/Java/knuth-shuffle.java
@@ -0,0 +1,24 @@
+import java.util.Random;
+
+public static final Random gen = new Random();
+
+// version for array of ints
+public static void shuffle (int[] array) {
+    int n = array.length;
+    while (n > 1) {
+        int k = gen.nextInt(n--); //decrements after using the value
+        int temp = array[n];
+        array[n] = array[k];
+        array[k] = temp;
+    }
+}
+// version for array of references
+public static void shuffle (Object[] array) {
+    int n = array.length;
+    while (n > 1) {
+        int k = gen.nextInt(n--); //decrements after using the value
+        Object temp = array[n];
+        array[n] = array[k];
+        array[k] = temp;
+    }
+}
diff --git a/Task/Knuth-shuffle/JavaScript/knuth-shuffle.js b/Task/Knuth-shuffle/JavaScript/knuth-shuffle.js
new file mode 100644
index 0000000000..7de9e0b8cc
--- /dev/null
+++ b/Task/Knuth-shuffle/JavaScript/knuth-shuffle.js
@@ -0,0 +1,28 @@
+function knuth_shuffle(a) {
+    var n = a.length,
+        r,
+        temp;
+    while (n > 1) {
+        r = Math.floor(n * Math.random());
+        n -= 1;
+        temp = a[n];
+        a[n] = a[r];
+        a[r] = temp;
+    }
+    return a;
+}
+
+var res, i, key;
+
+res = {
+    '1,2,3': 0, '1,3,2': 0,
+    '2,1,3': 0, '2,3,1': 0,
+    '3,1,2': 0, '3,2,1': 0
+};
+
+for (i = 0; i < 100000; i++) {
+    res[knuth_shuffle([1,2,3]).join(',')] += 1;
+}
+for (key in res) {
+    print(key + "\t" + res[key]);
+}
diff --git a/Task/Knuth-shuffle/Lua/knuth-shuffle.lua b/Task/Knuth-shuffle/Lua/knuth-shuffle.lua
new file mode 100644
index 0000000000..4e0b7324aa
--- /dev/null
+++ b/Task/Knuth-shuffle/Lua/knuth-shuffle.lua
@@ -0,0 +1,14 @@
+function table.shuffle(t)
+  local n = #t
+  while n > 1 do
+    local k = math.random(n)
+    t[n], t[k] = t[k], t[n]
+    n = n - 1
+  end
+
+  return t
+end
+math.randomseed( os.time() )
+a = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
+table.shuffle(a)
+for i,v in ipairs(a) do print(i,v) end
diff --git a/Task/Knuth-shuffle/PHP/knuth-shuffle.php b/Task/Knuth-shuffle/PHP/knuth-shuffle.php
new file mode 100644
index 0000000000..53e15245f8
--- /dev/null
+++ b/Task/Knuth-shuffle/PHP/knuth-shuffle.php
@@ -0,0 +1,18 @@
+//The Fisher-Yates original Method
+function yates_shuffle($arr){
+	$shuffled = Array();
+	while($arr){
+		$rnd = array_rand($arr);
+		$shuffled[] = $arr[$rnd];
+		array_splice($arr, $rnd, 1);
+	}
+	return $shuffled;
+}
+
+//The modern Durstenfeld-Knuth algorithm
+function knuth_shuffle(&$arr){
+	for($i=count($arr)-1;$i>0;$i--){
+		$rnd = mt_rand(0,$i);
+		list($arr[$i], $arr[$rnd]) = array($arr[$rnd], $arr[$i]);
+	}
+}
diff --git a/Task/Knuth-shuffle/Perl/knuth-shuffle.pl b/Task/Knuth-shuffle/Perl/knuth-shuffle.pl
new file mode 100644
index 0000000000..d01495e01a
--- /dev/null
+++ b/Task/Knuth-shuffle/Perl/knuth-shuffle.pl
@@ -0,0 +1,8 @@
+sub shuffle {
+  my @a = @_;
+  foreach my $n (1 .. $#a) {
+    my $k = int rand $n + 1;
+    $k == $n or @a[$k, $n] = @a[$n, $k];
+  }
+  return @a;
+}
diff --git a/Task/Knuth-shuffle/PicoLisp/knuth-shuffle.l b/Task/Knuth-shuffle/PicoLisp/knuth-shuffle.l
new file mode 100644
index 0000000000..9ee26eb142
--- /dev/null
+++ b/Task/Knuth-shuffle/PicoLisp/knuth-shuffle.l
@@ -0,0 +1,7 @@
+(de shuffle (Lst)
+   (make
+      (for (N (length Lst) (gt0 N))
+         (setq Lst
+            (conc
+               (cut (rand 0 (dec 'N)) 'Lst)
+               (prog (link (car Lst)) (cdr Lst)) ) ) ) ) )
diff --git a/Task/Knuth-shuffle/Python/knuth-shuffle.py b/Task/Knuth-shuffle/Python/knuth-shuffle.py
new file mode 100644
index 0000000000..35b6ed0943
--- /dev/null
+++ b/Task/Knuth-shuffle/Python/knuth-shuffle.py
@@ -0,0 +1,10 @@
+from random import randrange
+
+def knuth_shuffle(x):
+    for i in range(len(x)-1, 0, -1):
+        j = randrange(i + 1)
+        x[i], x[j] = x[j], x[i]
+
+x = list(range(10))
+knuth_shuffle(x)
+print("shuffled:", x)
diff --git a/Task/Knuth-shuffle/R/knuth-shuffle-1.r b/Task/Knuth-shuffle/R/knuth-shuffle-1.r
new file mode 100644
index 0000000000..926bd2f164
--- /dev/null
+++ b/Task/Knuth-shuffle/R/knuth-shuffle-1.r
@@ -0,0 +1,12 @@
+fisheryatesshuffle <- function(n)
+{
+  pool <- seq_len(n)
+  a <- c()
+  while(length(pool) > 0)
+  {
+     k <- sample.int(length(pool), 1)
+     a <- c(a, pool[k])
+     pool <- pool[-k]
+  }
+  a
+}
diff --git a/Task/Knuth-shuffle/R/knuth-shuffle-2.r b/Task/Knuth-shuffle/R/knuth-shuffle-2.r
new file mode 100644
index 0000000000..dafbc5b68b
--- /dev/null
+++ b/Task/Knuth-shuffle/R/knuth-shuffle-2.r
@@ -0,0 +1,21 @@
+fisheryatesknuthshuffle <- function(n)
+{
+   a <- seq_len(n)
+   while(n >=2)
+   {
+      k <- sample.int(n, 1)
+      if(k != n)
+      {
+         temp <- a[k]
+         a[k] <- a[n]
+         a[n] <- temp
+      }
+      n <- n - 1
+   }
+   a
+}
+
+#Example usage:
+fisheryatesshuffle(6)                # e.g. 1 3 6 2 4 5
+x <- c("foo", "bar", "baz", "quux")
+x[fisheryatesknuthshuffle(4)]        # e.g. "bar"  "baz"  "quux" "foo"
diff --git a/Task/Knuth-shuffle/REXX/knuth-shuffle.rexx b/Task/Knuth-shuffle/REXX/knuth-shuffle.rexx
new file mode 100644
index 0000000000..03c39933d7
--- /dev/null
+++ b/Task/Knuth-shuffle/REXX/knuth-shuffle.rexx
@@ -0,0 +1,37 @@
+/*REXX program shuffles a deck of playing cards using the Knuth shuffle.*/
+rank='ace duece trey 4 5 6 7 8 9 10 jack queen king'
+suit='club spade diamond heart'
+say '────────────────── getting a new deck out of the box...'
+deck.1='  color joker'                 /*good decks have a color joker, */
+deck.2='    b&w joker'                 /*∙∙∙ and a black & white joker. */
+cards=2                                /*now, two cards are in the deck.*/
+           do j     =1  for words(suit)
+                do k=1  for words(rank)
+                cards=cards+1
+                deck.cards=right(word(suit,j),7)  word(rank,k)
+                end  /*k*/
+           end       /*j*/
+
+call showDeck 'ace'                    /*inserts blank when ACE is found*/
+say '────────────────── shuffling' cards "cards..."
+
+   do s=cards  by -1  to 1;            rand=random(1,s)
+   if rand\==s  then do                /*swap two cards in the card deck*/
+                     _=deck.rand
+                     deck.rand=deck.s
+                     deck.s=_
+                     end
+   end   /*s*/
+
+call showDeck
+say '────────────────── ready to play schafkopf  (take out jokers first).'
+exit                                   /*stick a fork in it, we're done.*/
+
+/*──────────────────────────────────SHOWDECK subroutine─────────────────*/
+showDeck: parse arg break;    say
+      do m=1  for cards
+      if pos(break,deck.m)\==0  then say   /*blank, easier to read cards*/
+      say 'card' right(m,2) '───►' deck.m
+      end   /*m*/
+say
+return
diff --git a/Task/Knuth-shuffle/Ruby/knuth-shuffle-1.rb b/Task/Knuth-shuffle/Ruby/knuth-shuffle-1.rb
new file mode 100644
index 0000000000..31d09263c2
--- /dev/null
+++ b/Task/Knuth-shuffle/Ruby/knuth-shuffle-1.rb
@@ -0,0 +1,21 @@
+class Array
+  def knuth_shuffle!
+    j = length
+    i = 0
+    while j > 1
+      r = i + rand(j)
+      self[i], self[r] = self[r], self[i]
+      i += 1
+      j -= 1
+    end
+    self
+  end
+end
+
+r = Hash.new(0)
+100_000.times do |i|
+  a = [1,2,3].knuth_shuffle!
+  r[a] += 1
+end
+
+r.keys.sort.each {|a| puts "#{a.inspect} => #{r[a]}"}
diff --git a/Task/Knuth-shuffle/Ruby/knuth-shuffle-2.rb b/Task/Knuth-shuffle/Ruby/knuth-shuffle-2.rb
new file mode 100644
index 0000000000..00744e0383
--- /dev/null
+++ b/Task/Knuth-shuffle/Ruby/knuth-shuffle-2.rb
@@ -0,0 +1,9 @@
+class Array
+  def knuth_shuffle!
+    (length - 1).downto(1) do |i|
+      j = rand(i + 1)
+      self[i], self[j] = self[j], self[i]
+    end
+    self
+  end
+end
diff --git a/Task/Knuth-shuffle/Scala/knuth-shuffle.scala b/Task/Knuth-shuffle/Scala/knuth-shuffle.scala
new file mode 100644
index 0000000000..f3c1202bf6
--- /dev/null
+++ b/Task/Knuth-shuffle/Scala/knuth-shuffle.scala
@@ -0,0 +1,9 @@
+def shuffle[T](a: Array[T]) = {
+  for (i <- 1 until a.size reverse) {
+    val j = util.Random nextInt (i + 1)
+    val t = a(i)
+    a(i) = a(j)
+    a(j) = t
+  }
+  a
+}
diff --git a/Task/Knuth-shuffle/Scheme/knuth-shuffle.ss b/Task/Knuth-shuffle/Scheme/knuth-shuffle.ss
new file mode 100644
index 0000000000..5982c3f245
--- /dev/null
+++ b/Task/Knuth-shuffle/Scheme/knuth-shuffle.ss
@@ -0,0 +1,10 @@
+(define (swap vec i j)
+  (let ([tmp (vector-ref vec i)])
+    (vector-set! vec i (vector-ref vec j))
+    (vector-set! vec j tmp)))
+
+(define (shuffle vec)
+  (for ((i (in-range (- (vector-length vec) 1) 0 -1)))
+    (let ((r (random i)))
+      (swap vec i r)))
+  vec)
diff --git a/Task/Knuth-shuffle/Smalltalk/knuth-shuffle-1.st b/Task/Knuth-shuffle/Smalltalk/knuth-shuffle-1.st
new file mode 100644
index 0000000000..90db1d2515
--- /dev/null
+++ b/Task/Knuth-shuffle/Smalltalk/knuth-shuffle-1.st
@@ -0,0 +1,22 @@
+"The selector swap:with: is documented, but it seems not
+ implemented (GNU Smalltalk version 3.0.4); so here it is an implementation"
+SequenceableCollection extend [
+  swap: i with: j [
+    |t|
+    t := self at: i.
+    self at: i put: (self at: j).
+    self at: j put: t.
+  ]
+].
+
+Object subclass: Shuffler [
+  Shuffler class >> Knuth: aSequenceableCollection [
+    |n k|
+    n := aSequenceableCollection size.
+    [ n > 1 ] whileTrue: [
+      k := Random between: 1 and: n.
+      aSequenceableCollection swap: n with: k.
+      n := n - 1
+    ]
+  ]
+].
diff --git a/Task/Knuth-shuffle/Smalltalk/knuth-shuffle-2.st b/Task/Knuth-shuffle/Smalltalk/knuth-shuffle-2.st
new file mode 100644
index 0000000000..ae51be6879
--- /dev/null
+++ b/Task/Knuth-shuffle/Smalltalk/knuth-shuffle-2.st
@@ -0,0 +1,6 @@
+"Test"
+|c|
+c := OrderedCollection new.
+c addAll: #( 1 2 3 4 5 6 7 8 9 ).
+Shuffler Knuth: c.
+c display.
diff --git a/Task/Knuth-shuffle/Tcl/knuth-shuffle-1.tcl b/Task/Knuth-shuffle/Tcl/knuth-shuffle-1.tcl
new file mode 100644
index 0000000000..7e208bb012
--- /dev/null
+++ b/Task/Knuth-shuffle/Tcl/knuth-shuffle-1.tcl
@@ -0,0 +1,17 @@
+proc knuth_shuffle lst {
+   set j [llength $lst]
+   for {set i 0} {$j > 1} {incr i;incr j -1} {
+       set r [expr {$i+int(rand()*$j)}]
+       set t [lindex $lst $i]
+       lset lst $i [lindex $lst $r]
+       lset lst $r $t
+   }
+   return $lst
+}
+
+% knuth_shuffle {1 2 3 4 5}
+2 1 3 5 4
+% knuth_shuffle {1 2 3 4 5}
+5 2 1 4 3
+% knuth_shuffle {tom dick harry peter paul mary}
+tom paul mary harry peter dick
diff --git a/Task/Knuth-shuffle/Tcl/knuth-shuffle-2.tcl b/Task/Knuth-shuffle/Tcl/knuth-shuffle-2.tcl
new file mode 100644
index 0000000000..82da48c54f
--- /dev/null
+++ b/Task/Knuth-shuffle/Tcl/knuth-shuffle-2.tcl
@@ -0,0 +1,11 @@
+% for {set i 0} {$i<100000} {incr i} {
+    foreach val [knuth_shuffle {1 2 3 4 5}] pos {pos0 pos1 pos2 pos3 pos4} {
+        incr tots($pos) $val
+    }
+}
+% parray tots
+tots(pos0) = 300006
+tots(pos1) = 300223
+tots(pos2) = 299701
+tots(pos3) = 299830
+tots(pos4) = 300240
diff --git a/Task/Narcissist/Ada/narcissist.ada b/Task/Narcissist/Ada/narcissist.ada
new file mode 100644
index 0000000000..7f71169c62
--- /dev/null
+++ b/Task/Narcissist/Ada/narcissist.ada
@@ -0,0 +1 @@
+with Ada.Text_IO;procedure Self is Q:Character:='"';A:String:="with Ada.Text_IO;procedure Self is Q:Character:='';A:String:=;B:String:=A(1..49)&Q&A(50..61)&Q&A&Q&A(62..A'Last);C:String:=Ada.Text_IO.Get_Line;begin Ada.Text_IO.Put_Line(Boolean'Image(B=C));end Self;";B:String:=A(1..49)&Q&A(50..61)&Q&A&Q&A(62..A'Last);C:String:=Ada.Text_IO.Get_Line;begin Ada.Text_IO.Put_Line(Boolean'Image(B=C));end Self;
diff --git a/Task/Narcissist/Go/narcissist-1.go b/Task/Narcissist/Go/narcissist-1.go
new file mode 100644
index 0000000000..6ecbd85927
--- /dev/null
+++ b/Task/Narcissist/Go/narcissist-1.go
@@ -0,0 +1 @@
+package main; import "os"; import "fmt"; import "bytes"; import "io/ioutil"; func main() {ios := "os"; ifmt := "fmt"; ibytes := "bytes"; iioutil := "io/ioutil"; zero := "Reject"; one := "Accept"; x := "package main; import %q; import %q; import %q; import %q; func main() {ios := %q; ifmt := %q; ibytes := %q; iioutil := %q; zero := %q; one := %q; x := %q; s := fmt.Sprintf(x, ios, ifmt, ibytes, iioutil, ios, ifmt, ibytes, iioutil, zero, one, x); in, _ := ioutil.ReadAll(os.Stdin); if bytes.Equal(in, []byte(s)) {fmt.Println(one);} else {fmt.Println(zero);};}\n"; s := fmt.Sprintf(x, ios, ifmt, ibytes, iioutil, ios, ifmt, ibytes, iioutil, zero, one, x); in, _ := ioutil.ReadAll(os.Stdin); if bytes.Equal(in, []byte(s)) {fmt.Println(one);} else {fmt.Println(zero);};}
diff --git a/Task/Narcissist/Perl/narcissist-1.pl b/Task/Narcissist/Perl/narcissist-1.pl
new file mode 100644
index 0000000000..d984aa5c2b
--- /dev/null
+++ b/Task/Narcissist/Perl/narcissist-1.pl
@@ -0,0 +1,2 @@
+# this is file narc.pl
+print do { local $/; open 0, $0 or die $!; <0> } eq <> ? "accept" : "reject"
diff --git a/Task/Narcissist/REXX/narcissist-1.rexx b/Task/Narcissist/REXX/narcissist-1.rexx
new file mode 100644
index 0000000000..1fa0b6365f
--- /dev/null
+++ b/Task/Narcissist/REXX/narcissist-1.rexx
@@ -0,0 +1 @@
+/*REXX*/ say arg(1)=sourceline(1)
diff --git a/Task/Narcissist/Tcl/narcissist-1.tcl b/Task/Narcissist/Tcl/narcissist-1.tcl
new file mode 100644
index 0000000000..cd947c8c50
--- /dev/null
+++ b/Task/Narcissist/Tcl/narcissist-1.tcl
@@ -0,0 +1 @@
+apply {{} {puts [expr {[gets stdin] eq [info level 0]}]}}
diff --git a/Task/Ordered-words/0DESCRIPTION b/Task/Ordered-words/0DESCRIPTION
new file mode 100644
index 0000000000..47f3b6df13
--- /dev/null
+++ b/Task/Ordered-words/0DESCRIPTION
@@ -0,0 +1,3 @@
+Define an ordered word as a word in which the letters of the word appear in alphabetic order. Examples include 'abbey' and 'dirt'.
+
+The task is to find ''and display'' all the ordered words in this [http://www.puzzlers.org/pub/wordlists/unixdict.txt dictionary] that have the longest  word length. (Examples that access the dictionary file locally assume that you have downloaded this file yourself.)  The display needs to be shown on this page.
diff --git a/Task/Ordered-words/1META.yaml b/Task/Ordered-words/1META.yaml
new file mode 100644
index 0000000000..35429e6214
--- /dev/null
+++ b/Task/Ordered-words/1META.yaml
@@ -0,0 +1,2 @@
+---
+note: text processing
diff --git a/Task/Ordered-words/AWK/ordered-words.awk b/Task/Ordered-words/AWK/ordered-words.awk
new file mode 100644
index 0000000000..fc25ce217e
--- /dev/null
+++ b/Task/Ordered-words/AWK/ordered-words.awk
@@ -0,0 +1,36 @@
+BEGIN {
+	abc = "abcdefghijklmnopqrstuvwxyz"
+}
+
+{
+	# Check if this line is an ordered word.
+	ordered = 1  # true
+	left = -1
+	for (i = 1; i <= length($0); i++) {
+		right = index(abc, substr($0, i, 1))
+		if (right == 0 || left > right) {
+			ordered = 0  # false
+			break
+		}
+		left = right
+	}
+
+	if (ordered) {
+		score = length($0)
+		if (score > best["score"]) {
+			# Reset the list of best ordered words.
+			best["score"] = score
+			best["count"] = 1
+			best[1] = $0
+		} else if (score == best["score"]) {
+			# Add this word to the list.
+			best[++best["count"]] = $0
+		}
+	}
+}
+
+END {
+	# Print the list of best ordered words.
+	for (i = 1; i <= best["count"]; i++)
+		print best[i]
+}
diff --git a/Task/Ordered-words/Ada/ordered-words.ada b/Task/Ordered-words/Ada/ordered-words.ada
new file mode 100644
index 0000000000..18daf458d0
--- /dev/null
+++ b/Task/Ordered-words/Ada/ordered-words.ada
@@ -0,0 +1,48 @@
+with Ada.Containers.Indefinite_Vectors;
+with Ada.Text_IO;
+procedure Ordered_Words is
+   package Word_Vectors is new Ada.Containers.Indefinite_Vectors
+      (Index_Type => Positive, Element_Type => String);
+
+   function Is_Ordered (The_Word : String) return Boolean is
+      Highest_Character : Character := 'a';
+   begin
+      for I in The_Word'Range loop
+         if The_Word(I) not in 'a' .. 'z' then
+            return False;
+         end if;
+         if The_Word(I) < Highest_Character then
+            return False;
+         end if;
+         Highest_Character := The_Word(I);
+      end loop;
+      return True;
+   end Is_Ordered;
+
+   procedure Print_Word (Position : Word_Vectors.Cursor) is
+   begin
+      Ada.Text_IO.Put_Line (Word_Vectors.Element (Position));
+   end Print_Word;
+
+   File : Ada.Text_IO.File_Type;
+   Ordered_Words : Word_Vectors.Vector;
+   Max_Length : Positive := 1;
+begin
+   Ada.Text_IO.Open (File, Ada.Text_IO.In_File, "unixdict.txt");
+   while not Ada.Text_IO.End_Of_File (File) loop
+      declare
+         Next_Word : String := Ada.Text_IO.Get_Line (File);
+      begin
+         if Is_Ordered (Next_Word) then
+            if Next_Word'Length > Max_Length then
+               Max_Length := Next_Word'Length;
+               Word_Vectors.Clear (Ordered_Words);
+               Word_Vectors.Append (Ordered_Words, Next_Word);
+            elsif Next_Word'Length = Max_Length then
+               Word_Vectors.Append (Ordered_Words, Next_Word);
+            end if;
+         end if;
+      end;
+   end loop;
+   Word_Vectors.Iterate (Ordered_Words, Print_Word'Access);
+end Ordered_Words;
diff --git a/Task/Ordered-words/C/ordered-words-1.c b/Task/Ordered-words/C/ordered-words-1.c
new file mode 100644
index 0000000000..81693068d7
--- /dev/null
+++ b/Task/Ordered-words/C/ordered-words-1.c
@@ -0,0 +1,83 @@
+#include 
+#include 
+#include 
+#include 
+
+
+#define MAXLEN 100
+typedef char TWord[MAXLEN];
+
+
+typedef struct Node {
+    TWord word;
+    struct Node *next;
+} Node;
+
+
+int is_ordered_word(const TWord word) {
+    assert(word != NULL);
+    int i;
+
+    for (i = 0; word[i] != '\0'; i++)
+        if (word[i] > word[i + 1] && word[i + 1] != '\0')
+            return 0;
+
+    return 1;
+}
+
+
+Node* list_prepend(Node* words_list, const TWord new_word) {
+    assert(new_word != NULL);
+    Node *new_node = malloc(sizeof(Node));
+    if (new_node == NULL)
+        exit(EXIT_FAILURE);
+
+    strcpy(new_node->word, new_word);
+    new_node->next = words_list;
+    return new_node;
+}
+
+
+Node* list_destroy(Node *words_list) {
+    while (words_list != NULL) {
+        Node *temp = words_list;
+        words_list = words_list->next;
+        free(temp);
+    }
+
+    return words_list;
+}
+
+
+void list_print(Node *words_list) {
+    while (words_list != NULL) {
+        printf("\n%s", words_list->word);
+        words_list = words_list->next;
+    }
+}
+
+
+int main() {
+    FILE *fp = fopen("unixdict.txt", "r");
+    if (fp == NULL)
+        return EXIT_FAILURE;
+
+    Node *words = NULL;
+    TWord line;
+    unsigned int max_len = 0;
+
+    while (fscanf(fp, "%99s\n", line) != EOF) {
+        if (strlen(line) > max_len && is_ordered_word(line)) {
+            max_len = strlen(line);
+            words = list_destroy(words);
+            words = list_prepend(words, line);
+        } else if (strlen(line) == max_len && is_ordered_word(line)) {
+            words = list_prepend(words, line);
+        }
+    }
+
+    fclose(fp);
+    list_print(words);
+
+    return EXIT_SUCCESS;
+}
diff --git a/Task/Ordered-words/C/ordered-words-2.c b/Task/Ordered-words/C/ordered-words-2.c
new file mode 100644
index 0000000000..e81142d230
--- /dev/null
+++ b/Task/Ordered-words/C/ordered-words-2.c
@@ -0,0 +1,87 @@
+#include 
+#include 
+#include 
+#include 
+
+
+#define MAXLEN 100
+typedef char TWord[MAXLEN];
+
+
+typedef struct WordsArray {
+    TWord *words;
+    size_t len;
+} WordsArray;
+
+
+int is_ordered_word(const TWord word) {
+    assert(word != NULL);
+    int i;
+
+    for (i = 0; word[i] != '\0'; i++)
+        if (word[i] > word[i + 1] && word[i + 1] != '\0')
+            return 0;
+
+    return 1;
+}
+
+
+void array_append(WordsArray *words_array, const TWord new_word) {
+    assert(words_array != NULL);
+    assert(new_word != NULL);
+    assert((words_array->len == 0) == (words_array->words == NULL));
+
+    words_array->len++;
+    words_array->words = realloc(words_array->words,
+                                 words_array->len * sizeof(words_array->words[0]));
+    if (words_array->words == NULL)
+        exit(EXIT_FAILURE);
+    strcpy(words_array->words[words_array->len-1], new_word);
+}
+
+
+void array_free(WordsArray *words_array) {
+    assert(words_array != NULL);
+    free(words_array->words);
+    words_array->words = NULL;
+    words_array->len = 0;
+}
+
+
+void list_print(WordsArray *words_array) {
+    assert(words_array != NULL);
+    size_t i;
+    for (i = 0; i < words_array->len; i++)
+        printf("\n%s", words_array->words[i]);
+}
+
+
+int main() {
+    FILE *fp = fopen("unixdict.txt", "r");
+    if (fp == NULL)
+        return EXIT_FAILURE;
+
+    WordsArray words;
+    words.len = 0;
+    words.words = NULL;
+
+    TWord line;
+    line[0] = '\0';
+    unsigned int max_len = 0;
+
+    while (fscanf(fp, "%99s\n", line) != EOF) { // 99 = MAXLEN - 1
+        if (strlen(line) > max_len && is_ordered_word(line)) {
+            max_len = strlen(line);
+            array_free(&words);
+            array_append(&words, line);
+        } else if (strlen(line) == max_len && is_ordered_word(line)) {
+            array_append(&words, line);
+        }
+    }
+
+    fclose(fp);
+    list_print(&words);
+    array_free(&words);
+
+    return EXIT_SUCCESS;
+}
diff --git a/Task/Ordered-words/C/ordered-words-3.c b/Task/Ordered-words/C/ordered-words-3.c
new file mode 100644
index 0000000000..9c44cd507c
--- /dev/null
+++ b/Task/Ordered-words/C/ordered-words-3.c
@@ -0,0 +1,54 @@
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+int ordered(char *s, char **end)
+{
+	int r = 1;
+	while (*++s != '\n' && *s != '\r' && *s != '\0')
+		if (s[0] < s[-1]) r = 0;
+
+	*end = s;
+	return r;
+}
+
+int main()
+{
+	char *buf, *word, *end, *tail;
+	struct stat st;
+	int longest = 0, len, fd;
+
+	if ((fd = open("unixdict.txt", O_RDONLY)) == -1) err(1, "read error");
+
+	fstat(fd, &st);
+	if (!(buf = mmap(0, st.st_size, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0)))
+		err(1, "mmap");
+
+	for (word = end = buf; end < buf + st.st_size; word = end) {
+		while (*word == '\r' || *word == '\n') word++;
+		if (!ordered(word, &end)) continue;
+		if ((len = end - word + 1) < longest) continue;
+		if (len > longest) {
+			tail = buf;  /* longer words found; reset out buffer */
+			longest = len;
+		}
+		/* use the same mmap'd region to store output.  because of MAP_PRIVATE,
+		 * change will not go back to file.  mmap is copy on write, and we are using
+		 * only the head space to store output, so kernel doesn't need to copy more
+		 * than the words we saved--in this case, one page tops.
+		 */
+		memcpy(tail, word, len);
+		tail += len;
+		*tail = '\0';
+	}
+	printf(buf);
+
+	munmap(buf, st.st_size);
+	close(fd);
+	return 0;
+}
diff --git a/Task/Ordered-words/CoffeeScript/ordered-words-1.coffee b/Task/Ordered-words/CoffeeScript/ordered-words-1.coffee
new file mode 100644
index 0000000000..206918f1cc
--- /dev/null
+++ b/Task/Ordered-words/CoffeeScript/ordered-words-1.coffee
@@ -0,0 +1,21 @@
+ordered_word = (word) ->
+  for i in [0...word.length - 1]
+    return false unless word[i] <= word[i+1]
+  true
+
+show_longest_ordered_words = (candidates, dict_file_name) ->
+  words = ['']
+  for word in candidates
+    continue if word.length < words[0].length
+    if ordered_word word
+      words = [] if word.length > words[0].length
+      words.push word
+  return if words[0] == '' # we came up empty
+  console.log "Longest Ordered Words (source=#{dict_file_name}):"
+  for word in words
+    console.log word
+
+dict_file_name = 'unixdict.txt'
+file_content = require('fs').readFileSync dict_file_name
+dict_words = file_content.toString().split '\n'
+show_longest_ordered_words dict_words, dict_file_name
diff --git a/Task/Ordered-words/CoffeeScript/ordered-words-2.coffee b/Task/Ordered-words/CoffeeScript/ordered-words-2.coffee
new file mode 100644
index 0000000000..a1cc9c0a1e
--- /dev/null
+++ b/Task/Ordered-words/CoffeeScript/ordered-words-2.coffee
@@ -0,0 +1,18 @@
+> coffee ordered_words.coffee
+Longest Ordered Words (source=unixdict.txt):
+abbott
+accent
+accept
+access
+accost
+almost
+bellow
+billow
+biopsy
+chilly
+choosy
+choppy
+effort
+floppy
+glossy
+knotty
diff --git a/Task/Ordered-words/Forth/ordered-words.fth b/Task/Ordered-words/Forth/ordered-words.fth
new file mode 100644
index 0000000000..dd604eae20
--- /dev/null
+++ b/Task/Ordered-words/Forth/ordered-words.fth
@@ -0,0 +1,44 @@
+include lib/stmstack.4th               \ include string stack library
+
+: check-word                           ( a n -- a n f)
+  2dup bl >r                           \ start off with a space
+  begin
+    dup                                \ when not end of word
+  while
+    over c@ r@ >=                      \ check character
+  while
+    r> drop over c@ >r chop            \ chop character off
+  repeat r> drop nip 0=                \ cleanup and set flag
+;
+
+: open-file                            ( -- h)
+  1 dup argn = abort" Usage: ordered infile"
+  args input open error? abort" Cannot open file"
+  dup use                              \ return and use the handle
+;
+
+: read-file                            ( --)
+  0 >r                                 \ begin with zero length
+  begin
+    refill                             \ EOF detected?
+  while
+    0 parse dup r@ >=                  \ equal or longer string length?
+    if                                 \ check the word and adjust length
+      check-word if r> drop dup >r >s else 2drop then
+    else                               \ if it checks out, put on the stack
+      2drop                            \ otherwise drop the word
+    then
+  repeat r> drop                       \ clean it up
+;
+
+: read-back                            ( --)
+  s> dup >r type cr                    \ longest string is on top of stack
+  begin s> dup r@ >= while type cr repeat
+  2drop r> drop                        \ keep printing until shorter word
+;                                      \ has been found
+
+: ordered                              ( --)
+  open-file s.clear read-file read-back close
+;                                      \ open file, clear the stack, read file
+                                       \ read it back and close the file
+ordered
diff --git a/Task/Ordered-words/Fortran/ordered-words.f b/Task/Ordered-words/Fortran/ordered-words.f
new file mode 100644
index 0000000000..ff6255335c
--- /dev/null
+++ b/Task/Ordered-words/Fortran/ordered-words.f
@@ -0,0 +1,113 @@
+!***************************************************************************************
+ module ordered_module
+!***************************************************************************************
+ implicit none
+
+	!the dictionary file:
+	integer,parameter :: file_unit = 1000
+	character(len=*),parameter :: filename = 'unixdict.txt'
+
+	!maximum number of characters in a word:
+	integer,parameter :: max_chars = 50
+
+	type word
+	  character(len=max_chars) :: str    !the word from the dictionary
+	  integer	:: n = 0    !length of this word
+	  logical	:: ordered = .false.    !if it is an ordered word
+	end type word
+
+	!the dictionary structure:
+	type(word),dimension(:),allocatable :: dict
+
+	contains
+!***************************************************************************************
+
+	!******************************************************************************
+		function count_lines_in_file(fid) result(n_lines)
+	!******************************************************************************
+		implicit none
+
+		integer             :: n_lines
+		integer,intent(in)  :: fid		
+		character(len=1)    :: tmp
+		integer             :: i
+		integer             :: ios
+
+		!the file is assumed to be open already.
+
+		rewind(fid)	  !rewind to beginning of the file
+
+		n_lines = 0
+		do !read each line until the end of the file.
+			read(fid,'(A1)',iostat=ios) tmp
+			if (ios < 0) exit      !End of file
+			n_lines = n_lines + 1  !row counter
+		end do
+
+		rewind(fid)   !rewind to beginning of the file	
+
+	!******************************************************************************
+		end function count_lines_in_file
+	!******************************************************************************
+
+	!******************************************************************************
+	 pure elemental function ordered_word(word) result(yn)
+	!******************************************************************************
+	! turns true if word is an ordered word, false if it is not.
+	!******************************************************************************
+	
+	 implicit none
+	 character(len=*),intent(in) :: word
+	 logical :: yn
+	
+	 integer :: i
+	
+	 yn = .true.
+	 do i=1,len_trim(word)-1
+	 	if (ichar(word(i+1:i+1)) longest {
+                    longest = len(bs)
+                    list = list[:0]
+                }
+                list = append(list, bs)
+                break
+            }
+            // check next letter
+            b := bs[i]
+            if b < 'a' || b > 'z' {
+                continue // not a letter.  ignore.
+            }
+            if b < lastLetter {
+                break // word not ordered.
+            }
+            // letter passes test
+            lastLetter = b
+        }
+    }
+    // print result
+    for _, bs := range list {
+        fmt.Println(string(bs))
+    }
+}
diff --git a/Task/Ordered-words/Haskell/ordered-words-1.hs b/Task/Ordered-words/Haskell/ordered-words-1.hs
new file mode 100644
index 0000000000..9ea03dc4b4
--- /dev/null
+++ b/Task/Ordered-words/Haskell/ordered-words-1.hs
@@ -0,0 +1,21 @@
+-- Words are read from the standard input.  We keep in memory only the current
+-- set of longest, ordered words.
+--
+-- Limitation: the locale's collation order is not take into consideration.
+
+isOrdered wws@(_:ws) = and $ zipWith (<=) wws ws
+
+keepLongest _ acc [] = acc
+keepLongest max acc (w:ws) =
+  let len = length w in
+  case compare len max of
+    LT -> keepLongest max acc ws
+    EQ -> keepLongest max (w:acc) ws
+    GT -> keepLongest len [w] ws
+
+longestOrderedWords = reverse . keepLongest 0 [] . filter isOrdered
+
+main = do
+  str <- getContents
+  let ws = longestOrderedWords $ words str
+  mapM_ putStrLn ws
diff --git a/Task/Ordered-words/Haskell/ordered-words-2.hs b/Task/Ordered-words/Haskell/ordered-words-2.hs
new file mode 100644
index 0000000000..4b73a7d5ab
--- /dev/null
+++ b/Task/Ordered-words/Haskell/ordered-words-2.hs
@@ -0,0 +1,16 @@
+abbott
+accent
+accept
+access
+accost
+almost
+bellow
+billow
+biopsy
+chilly
+choosy
+choppy
+effort
+floppy
+glossy
+knotty
diff --git a/Task/Ordered-words/Haskell/ordered-words-3.hs b/Task/Ordered-words/Haskell/ordered-words-3.hs
new file mode 100644
index 0000000000..34b066a1e7
--- /dev/null
+++ b/Task/Ordered-words/Haskell/ordered-words-3.hs
@@ -0,0 +1,11 @@
+import Control.Monad (liftM)
+
+isSorted wws@(_ : ws) = and $ zipWith (<=) wws ws
+
+getLines = liftM lines . readFile
+
+main = do
+    ls <- getLines "unixdict.txt"
+    let ow = filter isSorted ls
+    let maxl = foldr max 0 (map length ow)
+    print $ filter (\w -> (length w) == maxl) ow
diff --git a/Task/Ordered-words/Java/ordered-words.java b/Task/Ordered-words/Java/ordered-words.java
new file mode 100644
index 0000000000..a96c558398
--- /dev/null
+++ b/Task/Ordered-words/Java/ordered-words.java
@@ -0,0 +1,43 @@
+import java.io.BufferedReader;
+import java.io.FileReader;
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.LinkedList;
+import java.util.List;
+
+public class Ordered {
+
+	private static boolean isOrderedWord(String word){
+		char[] sortedWord = word.toCharArray();
+		Arrays.sort(sortedWord);
+		return word.equals(new String(sortedWord));
+	}
+	
+	public static void main(String[] args) throws IOException{
+		List orderedWords = new LinkedList();
+		BufferedReader in = new BufferedReader(new FileReader(args[0]));
+		while(in.ready()){
+			String word = in.readLine();
+			if(isOrderedWord(word)) orderedWords.add(word);
+		}
+		in.close();
+		
+		Collections.sort(orderedWords, new Comparator() {
+			@Override
+			public int compare(String o1, String o2) {
+				return new Integer(o2.length()).compareTo(o1.length());
+			}
+		});
+		
+		int maxLen = orderedWords.get(0).length();
+		for(String word: orderedWords){
+			if(word.length() == maxLen){
+				System.out.println(word);
+			}else{
+				break;
+			}
+		}
+	}
+}
diff --git a/Task/Ordered-words/JavaScript/ordered-words-1.js b/Task/Ordered-words/JavaScript/ordered-words-1.js
new file mode 100644
index 0000000000..7a8d268edd
--- /dev/null
+++ b/Task/Ordered-words/JavaScript/ordered-words-1.js
@@ -0,0 +1,11 @@
+var fs = require('fs'), print = require('sys').print;
+fs.readFile('./unixdict.txt', 'ascii', function (err, data) {
+    var is_ordered = function(word){return word.split('').sort().join('') === word;},
+        ordered_words = data.split('\n').filter(is_ordered).sort(function(a, b){return a.length - b.length}).reverse(),
+        longest = [], curr = len = ordered_words[0].length, lcv = 0;
+    while (curr === len){
+        longest.push(ordered_words[lcv]);
+        curr = ordered_words[++lcv].length;
+    };
+    print(longest.sort().join(', ') + '\n');
+});
diff --git a/Task/Ordered-words/JavaScript/ordered-words-2.js b/Task/Ordered-words/JavaScript/ordered-words-2.js
new file mode 100644
index 0000000000..828dfcdc00
--- /dev/null
+++ b/Task/Ordered-words/JavaScript/ordered-words-2.js
@@ -0,0 +1,26 @@
+var http = require('http');
+
+http.get({
+  host: 'www.puzzlers.org',
+  path: '/pub/wordlists/unixdict.txt'
+}, function(res) {
+  var data = '';
+  res.on('data', function(chunk) {
+    data += chunk;
+  });
+  res.on('end', function() {
+    var words = data.split('\n');
+    var max = 0;
+    var ordered = [];
+    words.forEach(function(word) {
+      if (word.split('').sort().join('') != word) return;
+      if (word.length == max) {
+        ordered.push(word);
+      } else if (word.length > max) {
+        ordered = [word];
+        max = word.length;
+      }
+    });
+    console.log(ordered.join(', '));
+  });
+});
diff --git a/Task/Ordered-words/Lua/ordered-words.lua b/Task/Ordered-words/Lua/ordered-words.lua
new file mode 100644
index 0000000000..c8dec7cadd
--- /dev/null
+++ b/Task/Ordered-words/Lua/ordered-words.lua
@@ -0,0 +1,29 @@
+fp = io.open( "dictionary.txt" )
+
+maxlen = 0
+list = {}
+
+for w in fp:lines() do
+    ordered = true
+    for l = 2, string.len(w) do
+	if string.byte( w, l-1 ) > string.byte( w, l ) then
+	    ordered = false
+  	    break
+	end
+    end
+    if ordered then
+	if string.len(w) > maxlen then
+	    list = {}
+	    list[1] = w
+	    maxlen = string.len(w)
+	elseif string.len(w) == maxlen then
+	    list[#list+1] = w
+	end
+    end
+end
+
+for _, w in pairs(list) do
+    print( w )
+end
+
+fp:close()
diff --git a/Task/Ordered-words/Perl/ordered-words.pl b/Task/Ordered-words/Perl/ordered-words.pl
new file mode 100644
index 0000000000..e435f0bbfa
--- /dev/null
+++ b/Task/Ordered-words/Perl/ordered-words.pl
@@ -0,0 +1,12 @@
+#!/usr/bin/perl
+use strict;
+use warnings;
+
+open(FH, "<", "unixdict.txt") or die "Can't open file!\n";
+my @words;
+while () {
+   chomp;
+   push @{$words[length]}, $_ if $_ eq join("", sort split(//));
+}
+close FH;
+print "@{$words[-1]}\n";
diff --git a/Task/Ordered-words/PicoLisp/ordered-words.l b/Task/Ordered-words/PicoLisp/ordered-words.l
new file mode 100644
index 0000000000..01cb6c201d
--- /dev/null
+++ b/Task/Ordered-words/PicoLisp/ordered-words.l
@@ -0,0 +1,6 @@
+(in "unixdict.txt"
+   (mapc prinl
+      (maxi '((L) (length (car L)))
+         (by length group
+            (filter '((S) (apply <= S))
+               (make (while (line) (link @))) ) ) ) ) )
diff --git a/Task/Ordered-words/Prolog/ordered-words.pro b/Task/Ordered-words/Prolog/ordered-words.pro
new file mode 100644
index 0000000000..3eb95461b4
--- /dev/null
+++ b/Task/Ordered-words/Prolog/ordered-words.pro
@@ -0,0 +1,44 @@
+:- use_module(library( http/http_open )).
+
+ordered_words :-
+        % we read the URL of the words
+	http_open('http://www.puzzlers.org/pub/wordlists/unixdict.txt',	In, []),
+	read_file(In, [], Out),
+	close(In),
+
+        % we get a list of pairs key-value where key = Length and value = 
+        % this list must be sorted
+	msort(Out, MOut),
+
+	group_pairs_by_key(MOut, POut),
+
+       % we sorted this list in decreasing order of the length of values
+	predsort(my_compare, POut, [_N-V | _OutSort]),
+	maplist(mwritef, V).
+
+
+mwritef(V) :-
+	writef('%s\n', [V]).
+
+read_file(In, L, L1) :-
+	read_line_to_codes(In, W),
+	(   W == end_of_file ->
+               % the file is read
+	       L1 = L
+	       ;
+               % we sort the list of codes of the line
+	       % and keep only the "goods word"
+	       (   msort(W, W) ->
+	           length(W, N), L2 = [N-W | L], (len = 6 -> writef('%s\n', [W]); true)
+	       ;
+	           L2 = L
+	       ),
+
+               % and we have the pair Key-Value in the result list
+	       read_file(In, L2, L1)).
+
+% predicate for sorting list of pairs Key-Values
+% if the lentgh of values is the same
+% we sort the keys in alhabetic order
+my_compare(R, K1-_V1, K2-_V2) :-
+	(   K1 < K2 -> R = >; K1 > K2 -> R = <; =).
diff --git a/Task/Ordered-words/Python/ordered-words-1.py b/Task/Ordered-words/Python/ordered-words-1.py
new file mode 100644
index 0000000000..b2254189d9
--- /dev/null
+++ b/Task/Ordered-words/Python/ordered-words-1.py
@@ -0,0 +1,8 @@
+import urllib.request
+
+url = 'http://www.puzzlers.org/pub/wordlists/unixdict.txt'
+words = urllib.request.urlopen(url).read().decode("utf-8").split()
+ordered = [word for word in words if word==''.join(sorted(word))]
+maxlen = len(max(ordered, key=len))
+maxorderedwords = [word for word in ordered if len(word) == maxlen]
+print(' '.join(maxorderedwords))
diff --git a/Task/Ordered-words/Python/ordered-words-2.py b/Task/Ordered-words/Python/ordered-words-2.py
new file mode 100644
index 0000000000..0897f419b4
--- /dev/null
+++ b/Task/Ordered-words/Python/ordered-words-2.py
@@ -0,0 +1,11 @@
+import urllib.request
+
+mx, url = 0, 'http://www.puzzlers.org/pub/wordlists/unixdict.txt'
+
+for word in urllib.request.urlopen(url).read().decode("utf-8").split():
+    lenword = len(word)
+    if lenword >= mx and word==''.join(sorted(word)):
+        if lenword > mx:
+            words, mx = [], lenword
+        words.append(word)
+print(' '.join(words))
diff --git a/Task/Ordered-words/Python/ordered-words-3.py b/Task/Ordered-words/Python/ordered-words-3.py
new file mode 100644
index 0000000000..a018f09879
--- /dev/null
+++ b/Task/Ordered-words/Python/ordered-words-3.py
@@ -0,0 +1,3 @@
+from itertools import groupby
+o = (w for w in map(str.strip, open("unixdict.txt")) if sorted(w)==list(w))
+print list(next(groupby(sorted(o, key=len, reverse=True), key=len))[1])
diff --git a/Task/Ordered-words/REXX/ordered-words.rexx b/Task/Ordered-words/REXX/ordered-words.rexx
new file mode 100644
index 0000000000..2bf8f90954
--- /dev/null
+++ b/Task/Ordered-words/REXX/ordered-words.rexx
@@ -0,0 +1,28 @@
+/*REXX program lists (longest) ordered words from a supplied dictionary.*/
+ifid = 'UNIXDICT.TXT'                  /*filename of the word dictionary*/
+@.=                                    /*placeholder for list of words. */
+mL=0                                   /*maximum length of ordered words*/
+call linein ifid,1,0                   /*point to the first word in dict*/
+                                       /*(above)───in case file is open.*/
+  do j=1  while lines(ifid)\==0        /*keep reading until exhausted.  */
+  x=linein(ifid);     w=length(x)      /*get a word and also its length.*/
+  if w=? word))) result)
+		 ((> word-length best-length) (list (reverse word)))
+		 (else (cons (reverse word) result))))))
+       (else (loop (read-char port) (cons char word) result))))))
+
+(map (lambda (x)
+       (begin
+	 (display x)
+	 (newline)))
+     sorted-words)
diff --git a/Task/Ordered-words/Smalltalk/ordered-words.st b/Task/Ordered-words/Smalltalk/ordered-words.st
new file mode 100644
index 0000000000..146f44c19d
--- /dev/null
+++ b/Task/Ordered-words/Smalltalk/ordered-words.st
@@ -0,0 +1,17 @@
+|file dict r t|
+file := FileStream open: 'unixdict.txt' mode: FileStream read.
+dict := Set new.
+
+"load the whole dict into the set before, 'filter' later"
+[ file atEnd ] whileFalse: [
+  dict add: (file upTo: Character nl) ].
+
+"find those with the sorted letters, and sort them by length"
+r := ((dict
+       select: [ :w | (w asOrderedCollection sort) = (w asOrderedCollection) ] )
+     asSortedCollection: [:a :b| (a size) > (b size) ] ).
+
+"get those that have length = to the max length, and sort alphabetically"
+r := (r select: [:w| (w size) = ((r at: 1) size)]) asSortedCollection.
+
+r do: [:e| e displayNl].
diff --git a/Task/Ordered-words/Tcl/ordered-words.tcl b/Task/Ordered-words/Tcl/ordered-words.tcl
new file mode 100644
index 0000000000..1a5bc0ab06
--- /dev/null
+++ b/Task/Ordered-words/Tcl/ordered-words.tcl
@@ -0,0 +1,25 @@
+package require http
+
+# Pick the ordered words (of maximal length) from a list
+proc chooseOrderedWords list {
+    set len 0
+    foreach word $list {
+	# Condition to determine whether a word is ordered; are its characters
+	# in sorted order?
+	if {$word eq [join [lsort [split $word ""]] ""]} {
+	    if {[string length $word] > $len} {
+		set len [string length $word]
+		set orderedOfMaxLen {}
+	    }
+	    if {[string length $word] == $len} {
+		lappend orderedOfMaxLen $word
+	    }
+	}
+    }
+    return $orderedOfMaxLen
+}
+
+# Get the dictionary and print the ordered words from it
+set t [http::geturl "http://www.puzzlers.org/pub/wordlists/unixdict.txt"]
+puts [chooseOrderedWords [http::data $t]]
+http::cleanup $t
diff --git a/Task/Pi/Ada/pi.ada b/Task/Pi/Ada/pi.ada
new file mode 100644
index 0000000000..e256cd25b7
--- /dev/null
+++ b/Task/Pi/Ada/pi.ada
@@ -0,0 +1,112 @@
+with Ada.Command_Line;
+with Ada.Text_IO;
+with GNU_Multiple_Precision.Big_Integers;
+with GNU_Multiple_Precision.Big_Rationals;
+use GNU_Multiple_Precision;
+
+procedure Pi_Digits is
+   type Int is mod 2 ** 64;
+   package Int_To_Big is new Big_Integers.Modular_Conversions (Int);
+
+   -- constants
+   Zero : constant Big_Integer := Int_To_Big.To_Big_Integer (0);
+   One : constant Big_Integer := Int_To_Big.To_Big_Integer (1);
+   Two : constant Big_Integer := Int_To_Big.To_Big_Integer (2);
+   Three : constant Big_Integer := Int_To_Big.To_Big_Integer (3);
+   Four : constant Big_Integer := Int_To_Big.To_Big_Integer (4);
+   Ten : constant Big_Integer := Int_To_Big.To_Big_Integer (10);
+
+   -- type LFT = (Integer, Integer, Integer, Integer
+   type LFT is record
+      Q, R, S, T : Big_Integer;
+   end record;
+
+   -- extr :: LFT -> Integer -> Rational
+   function Extr (T : LFT; X : Big_Integer) return Big_Rational is
+      use Big_Integers;
+      Result : Big_Rational;
+   begin
+      -- extr (q,r,s,t) x = ((fromInteger q) * x + (fromInteger r)) /
+      --                    ((fromInteger s) * x + (fromInteger t))
+      Big_Rationals.Set_Numerator (Item         => Result,
+                                   New_Value    => T.Q * X + T.R,
+                                   Canonicalize => False);
+      Big_Rationals.Set_Denominator (Item      => Result,
+                                     New_Value => T.S * X + T.T);
+      return Result;
+   end Extr;
+
+   -- unit :: LFT
+   function Unit return LFT is
+   begin
+      -- unit = (1,0,0,1)
+      return LFT'(Q => One, R => Zero, S => Zero, T => One);
+   end Unit;
+
+   -- comp :: LFT -> LFT -> LFT
+   function Comp (T1, T2 : LFT) return LFT is
+      use Big_Integers;
+   begin
+      -- comp (q,r,s,t) (u,v,w,x) = (q*u+r*w,q*v+r*x,s*u+t*w,s*v+t*x)
+      return LFT'(Q => T1.Q * T2.Q + T1.R * T2.S,
+                  R => T1.Q * T2.R + T1.R * T2.T,
+                  S => T1.S * T2.Q + T1.T * T2.S,
+                  T => T1.S * T2.R + T1.T * T2.T);
+   end Comp;
+
+   -- lfts = [(k, 4*k+2, 0, 2*k+1) | k<-[1..]
+   K : Big_Integer := Zero;
+   function LFTS return LFT is
+      use Big_Integers;
+   begin
+      K := K + One;
+      return LFT'(Q => K,
+                  R => Four * K + Two,
+                  S => Zero,
+                  T => Two * K + One);
+   end LFTS;
+
+   -- next z = floor (extr z 3)
+   function Next (T : LFT) return Big_Integer is
+   begin
+      return Big_Rationals.To_Big_Integer (Extr (T, Three));
+   end Next;
+
+   -- safe z n = (n == floor (extr z 4)
+   function Safe (T : LFT; N : Big_Integer) return Boolean is
+   begin
+      return N = Big_Rationals.To_Big_Integer (Extr (T, Four));
+   end Safe;
+
+   -- prod z n = comp (10, -10*n, 0, 1)
+   function Prod (T : LFT; N : Big_Integer) return LFT is
+      use Big_Integers;
+   begin
+      return Comp (LFT'(Q => Ten, R => -Ten * N, S => Zero, T => One), T);
+   end Prod;
+
+   procedure Print_Pi (Digit_Count : Positive) is
+      Z : LFT := Unit;
+      Y : Big_Integer;
+      Count : Natural := 0;
+   begin
+      loop
+         Y := Next (Z);
+         if Safe (Z, Y) then
+            Count := Count + 1;
+            Ada.Text_IO.Put (Big_Integers.Image (Y));
+            exit when Count >= Digit_Count;
+            Z := Prod (Z, Y);
+         else
+            Z := Comp (Z, LFTS);
+         end if;
+      end loop;
+   end Print_Pi;
+
+   N : Positive := 250;
+begin
+   if Ada.Command_Line.Argument_Count = 1 then
+      N := Positive'Value (Ada.Command_Line.Argument (1));
+   end if;
+   Print_Pi (N);
+end Pi_Digits;
diff --git a/Task/Pi/Ruby/pi-1.rb b/Task/Pi/Ruby/pi-1.rb
new file mode 100644
index 0000000000..ae9e30ba4c
--- /dev/null
+++ b/Task/Pi/Ruby/pi-1.rb
@@ -0,0 +1,20 @@
+# Calculate Pi using the Arithmetic Geometric Mean of 1 and 1/sqrt(2)
+#
+#
+#  Nigel_Galloway
+#  March 8th., 2012.
+#
+require 'flt'
+Flt::BinNum.Context.precision = 8192
+a = n = 1
+g = 1 / Flt::BinNum(2).sqrt
+z = 0.25
+(0..17).each{
+  x = [(a + g) * 0.5, (a * g).sqrt]
+  var = x[0] - a
+  z -= var * var * n
+  n += n
+  a = x[0]
+  g = x[1]
+}
+puts a * a / z
diff --git a/Task/Pi/Tcl/pi-1.tcl b/Task/Pi/Tcl/pi-1.tcl
new file mode 100644
index 0000000000..f0e67d89bb
--- /dev/null
+++ b/Task/Pi/Tcl/pi-1.tcl
@@ -0,0 +1,31 @@
+package require Tcl 8.6
+
+# http://www.cut-the-knot.org/Curriculum/Algorithms/SpigotForPi.shtml
+# http://www.mathpropress.com/stan/bibliography/spigot.pdf
+proc piDigitsBySpigot n {
+    yield [info coroutine]
+    set A [lrepeat [expr {int(floor(10*$n/3.)+1)}] 2]
+    set Alen [llength $A]
+    set predigits {}
+    while 1 {
+	set carry 0
+	for {set i $Alen} {[incr i -1] > 0} {} {
+	    lset A $i [expr {
+		[set val [expr {[lindex $A $i] * 10 + $carry}]]
+		% [set modulo [expr {2*$i + 1}]]
+	    }]
+	    set carry [expr {$val / $modulo * $i}]
+	}
+	lset A 0 [expr {[set val [expr {[lindex $A 0]*10 + $carry}]] % 10}]
+	set predigit [expr {$val / 10}]
+	if {$predigit < 9} {
+	    foreach p $predigits {yield $p}
+	    set predigits [list $predigit]
+	} elseif {$predigit == 9} {
+	    lappend predigits $predigit
+	} else {
+	    foreach p $predigits {yield [incr p]}
+	    set predigits [list 0]
+	}
+    }
+}
diff --git a/Task/Quine/ABAP/quine-1.abap b/Task/Quine/ABAP/quine-1.abap
new file mode 100644
index 0000000000..63876e594f
--- /dev/null
+++ b/Task/Quine/ABAP/quine-1.abap
@@ -0,0 +1,35 @@
+REPORT R NO STANDARD PAGE HEADING LINE-SIZE 67.
+DATA:A(440),B,C,N(3) TYPE N,I TYPE I,S.
+A+000 = 'REPORT R NO STANDARD PAGE HEADING LINE-SIZE 6\7.1DATA:A'.
+A+055 = '(440),B,C,N(\3) TYPE N,I TYPE I,S.?1DO 440 TIMES.3C = A'.
+A+110 = '+I.3IF B = S.5IF C CA `\\\?\1\3\5\7`.7B = C.5ELSEIF C ='.
+A+165 = ' `\``.7WRITE ```` NO-GAP.5ELSE.7WRITE C NO-GAP.5ENDIF.3'.
+A+220 = 'ELSEIF B = `\\`.5WRITE C NO-GAP.5B = S.3ELSEIF B = `\?`'.
+A+275 = '.5DO 8 TIMES.7WRITE:/ `A+` NO-GAP,N,`= ``` NO-GAP,A+N(\'.
+A+330 = '5\5) NO-GAP,```.`.7N = N + \5\5.5ENDDO.5B = C.3ELSE.5WR'.
+A+385 = 'ITE AT /B C NO-GAP.5B = S.3ENDIF.3I = I + \1.1ENDDO.   '.
+DO 440 TIMES.
+  C = A+I.
+  IF B = S.
+    IF C CA '\?1357'.
+      B = C.
+    ELSEIF C = '`'.
+      WRITE '''' NO-GAP.
+    ELSE.
+      WRITE C NO-GAP.
+    ENDIF.
+  ELSEIF B = '\'.
+    WRITE C NO-GAP.
+    B = S.
+  ELSEIF B = '?'.
+    DO 8 TIMES.
+      WRITE:/ 'A+' NO-GAP,N,'= ''' NO-GAP,A+N(55) NO-GAP,'''.'.
+      N = N + 55.
+    ENDDO.
+    B = C.
+  ELSE.
+    WRITE AT /B C NO-GAP.
+    B = S.
+  ENDIF.
+  I = I + 1.
+ENDDO.
diff --git a/Task/Quine/ABAP/quine-2.abap b/Task/Quine/ABAP/quine-2.abap
new file mode 100644
index 0000000000..3e22051548
--- /dev/null
+++ b/Task/Quine/ABAP/quine-2.abap
@@ -0,0 +1,7 @@
+REPORT R NO STANDARD PAGE HEADING.DATA:A TYPE TABLE OF STRING,B(8).APPEND:
+`REPORT.FORM F TABLES T.NEW-PAGE LINE-SIZE 78.WRITE:'REPORT R NO',` TO A,
+`'STANDARD PAGE HEADING.DATA:A TYPE TABLE OF STRING,B(8).APPEND:'.LOOP` TO A,
+`AT T.REPLACE ALL OCCURENCES OF'``' IN T WITH'````'.WRITE:/'``'` TO A,
+`NO-GAP,T NO-GAP,'`` TO A,'.ENDLOOP.WRITE:AT 78'.','GENERATE',` TO A,
+`'SUBROUTINE POOL A NAME B.PERFORM F IN PROGRAM (B) TABLES A.'.ENDFORM.` TO A.
+GENERATE SUBROUTINE POOL A NAME B.PERFORM F IN PROGRAM (B) TABLES A.
diff --git a/Task/Quine/ABAP/quine-3.abap b/Task/Quine/ABAP/quine-3.abap
new file mode 100644
index 0000000000..fdfeef81d3
--- /dev/null
+++ b/Task/Quine/ABAP/quine-3.abap
@@ -0,0 +1,31 @@
+REPORT A NO STANDARD
+PAGE HEADING
+LINE-SIZE
+72.DATA:C(33),A LIKE
+TABLE OF C,X(3333)
+TYPE X,Y TYPE
+XSTRING.DEFINE A.X+C
+='&1'.C = C + 33.
+END-OF-DEFINITION.
+DEFINE B.LOOP AT A
+INTO C &1 &2.WRITE
+/ C.ENDLOOP.
+END-OF-DEFINITION.
+A FF060201020280003431303300000000AC030000121F9D02BB522ADA69108AA1C7 .
+A E8B32FFEC07DD21907936962B28407983089732C8811FC4413FD02A7BFE6690B03 .
+A 262F72B38EF69EB6A7A71C9F82CF44CC11469E081F86785777F269DE372CE9EC4B .
+A 5E0A24D8224781128E290E1B7A0ECFF423BEDFD316B43B456FE9AD98E1F0401B31 .
+A 9E11B3A23F3C865EEB6D028FD532BC69DED831F41DE6F0B59F745E604996373C97 .
+A 982A2FA9F6C81A86164CCC98D4CC91D22E89AB9A1CCBEB6A97A839A5602BA26AFE .
+A 7791BF4C2A9DBE6866134E093BD82CA291CF2A57EC67E81017384740EB33E6102A .
+A 174784531EFEA076A29A7ACAD9EB55CED8316374D3E00D3DEC1CF36E4D4C4EE64E .
+A 75B28DB568C195BA3DE92F9CC48AAAAF3A4DD9CC6BE899E27C18A3B66ECBF65093 .
+A FFF1168545878AD10C4F075F588821EF947739516EBF7D99F5851D52F629E8D5AC .
+A 13EF77291306AA6CABF7B56EC9E273F47997DA3FE146FB2A2C30E3BE22FEA603B4 .
+A EDB5FBEE64A7637B35B46DD79491EEC2D1A19B26C0ADAAB2FB39F9050000000000 .
+Y = X.IMPORT A = A
+FROM DATA BUFFER Y.B
+TO 13.C = 0.DO 12
+TIMES.WRITE:/'A',
+X+C(33),'.'.C = C +
+33.ENDDO.B FROM 14.
diff --git a/Task/Quine/ABAP/quine-4.abap b/Task/Quine/ABAP/quine-4.abap
new file mode 100644
index 0000000000..a5b16beb40
--- /dev/null
+++ b/Task/Quine/ABAP/quine-4.abap
@@ -0,0 +1,25 @@
+.REPORT Q NO STANDARD PAGE HEADING LINE-SIZE 72
+.DATA QQ(69) OCCURS 0
+.DATA Q LIKE QQ WITH HEADER LINE
+.APPEND 'SYNTAX-TRACE ON.INCLUDE' TO QQ
+.APPEND SY-REPID TO QQ
+.APPEND '.' TO QQ
+.SYNTAX-CHECK FOR QQ MESSAGE Q LINE Q WORD Q TRACE-TABLE Q
+.LOOP AT Q
+.CHECK Q(1) = '#'
+.Q = Q+5
+.IF Q < Q OR SY-SAPRL > '5'
+.SPLIT Q AT '' INTO Q Q
+.ENDIF
+.IF Q < Q OR SY-LINNO < 22
+.CHECK Q CA 'Q.' OR Q+4 = 'F'
+.ENDIF
+.IF Q < Q OR SY-LINNO > 23
+.CHECK Q CA '.'
+.ENDIF
+.CHECK Q(1) NA 'IT+' OR Q+1(1) = 'F'
+.WRITE / '.' NO-GAP
+.WRITE Q
+.ENDLOOP
+.WRITE / '.'
+.
diff --git a/Task/Quine/ACL2/quine-1.acl2 b/Task/Quine/ACL2/quine-1.acl2
new file mode 100644
index 0000000000..d5c1c09a13
--- /dev/null
+++ b/Task/Quine/ACL2/quine-1.acl2
@@ -0,0 +1,6 @@
+(defun print-quine (quine)
+   (cw quine quine))
+(print-quine
+"(defun print-quine (quine)
+  (cw quine quine))
+(print-quine ~x0)~%")
diff --git a/Task/Quine/ACL2/quine-2.acl2 b/Task/Quine/ACL2/quine-2.acl2
new file mode 100644
index 0000000000..c2811b25db
--- /dev/null
+++ b/Task/Quine/ACL2/quine-2.acl2
@@ -0,0 +1 @@
+(let((q"(let((q~x0))(cw q q))"))(cw q q))
diff --git a/Task/Quine/Ada/quine.ada b/Task/Quine/Ada/quine.ada
new file mode 100644
index 0000000000..200cbcbdad
--- /dev/null
+++ b/Task/Quine/Ada/quine.ada
@@ -0,0 +1 @@
+with Ada.Text_IO;procedure Self is Q:Character:='"';A:String:="with Ada.Text_IO;procedure Self is Q:Character:='';A:String:=;begin Ada.Text_IO.Put_Line(A(1..49)&Q&A(50..61)&Q&A&Q&A(62..A'Last));end Self;";begin Ada.Text_IO.Put_Line(A(1..49)&Q&A(50..61)&Q&A&Q&A(62..A'Last));end Self;
diff --git a/Task/Quine/BASIC/quine-1.bas b/Task/Quine/BASIC/quine-1.bas
new file mode 100644
index 0000000000..1b05437302
--- /dev/null
+++ b/Task/Quine/BASIC/quine-1.bas
@@ -0,0 +1 @@
+10 LIST
diff --git a/Task/Quine/Haskell/quine-1.hs b/Task/Quine/Haskell/quine-1.hs
new file mode 100644
index 0000000000..dfbb4500c3
--- /dev/null
+++ b/Task/Quine/Haskell/quine-1.hs
@@ -0,0 +1 @@
+let q s = putStrLn (s ++ show s) in q "let q s = putStrLn (s ++ show s) in q "
diff --git a/Task/Quine/Java/quine-1.java b/Task/Quine/Java/quine-1.java
new file mode 100644
index 0000000000..d2d5f0ab57
--- /dev/null
+++ b/Task/Quine/Java/quine-1.java
@@ -0,0 +1 @@
+class S{public static void main(String[]a){String s="class S{public static void main(String[]a){String s=;char c=34;System.out.println(s.substring(0,52)+c+s+c+s.substring(52));}}";char c=34;System.out.println(s.substring(0,52)+c+s+c+s.substring(52));}}
diff --git a/Task/Quine/JavaScript/quine-1.js b/Task/Quine/JavaScript/quine-1.js
new file mode 100644
index 0000000000..c9044923a0
--- /dev/null
+++ b/Task/Quine/JavaScript/quine-1.js
@@ -0,0 +1 @@
+(function(){print("("+arguments.callee.toString().replace(/\s/g,'')+")()");})()
diff --git a/Task/Quine/Perl/quine-1.pl b/Task/Quine/Perl/quine-1.pl
new file mode 100644
index 0000000000..687d077471
--- /dev/null
+++ b/Task/Quine/Perl/quine-1.pl
@@ -0,0 +1,2 @@
+$s = q($s = q(%s); printf($s, $s);
+); printf($s, $s);
diff --git a/Task/Quine/PicoLisp/quine-1.l b/Task/Quine/PicoLisp/quine-1.l
new file mode 100644
index 0000000000..1d42df25fb
--- /dev/null
+++ b/Task/Quine/PicoLisp/quine-1.l
@@ -0,0 +1 @@
+('((X) (list (lit X) (lit X))) '((X) (list (lit X) (lit X))))
diff --git a/Task/Quine/Python/quine-1.py b/Task/Quine/Python/quine-1.py
new file mode 100644
index 0000000000..bac879bf30
--- /dev/null
+++ b/Task/Quine/Python/quine-1.py
@@ -0,0 +1,2 @@
+x = 'x = %r\nprint(x %% x)'
+print(x % x)
diff --git a/Task/Quine/REXX/quine-1.rexx b/Task/Quine/REXX/quine-1.rexx
new file mode 100644
index 0000000000..05c9814cc6
--- /dev/null
+++ b/Task/Quine/REXX/quine-1.rexx
@@ -0,0 +1 @@
+/*REXX program outputs itself.*/ do j=1 for sourceline(); say sourceline(j); end
diff --git a/Task/Quine/Ruby/quine-1.rb b/Task/Quine/Ruby/quine-1.rb
new file mode 100644
index 0000000000..d1e13d0e7d
--- /dev/null
+++ b/Task/Quine/Ruby/quine-1.rb
@@ -0,0 +1 @@
+x = "x = %p; puts x %% x"; puts x % x
diff --git a/Task/Quine/Scala/quine-1.scala b/Task/Quine/Scala/quine-1.scala
new file mode 100644
index 0000000000..db108e8ff6
--- /dev/null
+++ b/Task/Quine/Scala/quine-1.scala
@@ -0,0 +1,6 @@
+val q = "\"" * 3
+val c = """val q = "\"" * 3
+val c = %s%s%s
+println(c format (q, c, q))
+"""
+println(c format (q, c, q))
diff --git a/Task/Quine/Scheme/quine-1.ss b/Task/Quine/Scheme/quine-1.ss
new file mode 100644
index 0000000000..0ed3deb3a6
--- /dev/null
+++ b/Task/Quine/Scheme/quine-1.ss
@@ -0,0 +1 @@
+((lambda (s) (display (list s (list (quote quote) s)))) (quote (lambda (s) (display (list s (list (quote quote) s))))))
diff --git a/Task/Quine/Smalltalk/quine-1.st b/Task/Quine/Smalltalk/quine-1.st
new file mode 100644
index 0000000000..33e86512da
--- /dev/null
+++ b/Task/Quine/Smalltalk/quine-1.st
@@ -0,0 +1 @@
+[:s| Transcript show: s, s printString; cr ] value: '[:s| Transcript show: s, s printString; cr ] value: '
diff --git a/Task/Quine/Tcl/quine-1.tcl b/Task/Quine/Tcl/quine-1.tcl
new file mode 100644
index 0000000000..62191e47c8
--- /dev/null
+++ b/Task/Quine/Tcl/quine-1.tcl
@@ -0,0 +1,2 @@
+join { {} A B  } any_string
+=> any_stringAany_stringB
diff --git a/Task/Search-a-list/0DESCRIPTION b/Task/Search-a-list/0DESCRIPTION
new file mode 100644
index 0000000000..cdb83ba451
--- /dev/null
+++ b/Task/Search-a-list/0DESCRIPTION
@@ -0,0 +1,4 @@
+Find the index of a string (needle) in an indexable, ordered collection of strings (haystack). Raise an exception if the needle is missing.
+If there is more than one occurrence then return the smallest index to the needle.
+
+As an extra task, return the largest index to a needle that has multiple occurrences in the haystack.
diff --git a/Task/Search-a-list/1META.yaml b/Task/Search-a-list/1META.yaml
new file mode 100644
index 0000000000..88eb5468ca
--- /dev/null
+++ b/Task/Search-a-list/1META.yaml
@@ -0,0 +1,2 @@
+---
+note: Text processing
diff --git a/Task/Search-a-list/ACL2/search-a-list.acl2 b/Task/Search-a-list/ACL2/search-a-list.acl2
new file mode 100644
index 0000000000..654ad8f86b
--- /dev/null
+++ b/Task/Search-a-list/ACL2/search-a-list.acl2
@@ -0,0 +1,7 @@
+(defun index-of-r (e xs i)
+   (cond ((endp xs) nil)
+         ((equal e (first xs)) i)
+         (t (index-of-r e (rest xs) (1+ i)))))
+
+(defun index-of (e xs)
+   (index-of-r e xs 0))
diff --git a/Task/Search-a-list/AWK/search-a-list.awk b/Task/Search-a-list/AWK/search-a-list.awk
new file mode 100644
index 0000000000..00f26b39cc
--- /dev/null
+++ b/Task/Search-a-list/AWK/search-a-list.awk
@@ -0,0 +1,21 @@
+#! /usr/bin/awk -f
+BEGIN {
+    # create the array, using the word as index...
+    words="Zig Zag Wally Ronald Bush Krusty Charlie Bush Bozo";
+    split(words, haystack_byorder, " ");
+    j=0;
+    for(idx in haystack_byorder) {
+	haystack[haystack_byorder[idx]] = j;
+	j++;
+    }
+    # now check for needle (we know it is there, so no "else")...
+    if ( "Bush" in haystack ) {
+	print "Bush is at " haystack["Bush"];
+    }
+    # check for unexisting needle
+    if ( "Washington" in haystack ) {
+	print "impossible";
+    } else {
+	print "Washington is not here";
+    }
+}
diff --git a/Task/Search-a-list/ActionScript/search-a-list-1.as b/Task/Search-a-list/ActionScript/search-a-list-1.as
new file mode 100644
index 0000000000..a72aac1e46
--- /dev/null
+++ b/Task/Search-a-list/ActionScript/search-a-list-1.as
@@ -0,0 +1,16 @@
+var list:Vector. = Vector.(["Zig", "Zag", "Wally", "Ronald", "Bush", "Krusty", "Charlie", "Bush", "Boz", "Zag"]);
+function lowIndex(listToSearch:Vector., searchString:String):int
+{
+	var index:int = listToSearch.indexOf(searchString);
+	if(index == -1)
+		throw new Error("String not found: " + searchString);
+	return index;
+}
+
+function highIndex(listToSearch:Vector., searchString:String):int
+{
+	var index:int = listToSearch.lastIndexOf(searchString);
+	if(index == -1)
+		throw new Error("String not found: " + searchString);
+	return index;
+}
diff --git a/Task/Search-a-list/ActionScript/search-a-list-2.as b/Task/Search-a-list/ActionScript/search-a-list-2.as
new file mode 100644
index 0000000000..32bad083b8
--- /dev/null
+++ b/Task/Search-a-list/ActionScript/search-a-list-2.as
@@ -0,0 +1,7 @@
+package {
+	public class StringNotFoundError extends Error {
+		public function StringNotFoundError(message:String) {
+			super(message);
+		}
+	}
+}
diff --git a/Task/Search-a-list/ActionScript/search-a-list-3.as b/Task/Search-a-list/ActionScript/search-a-list-3.as
new file mode 100644
index 0000000000..ab5d519025
--- /dev/null
+++ b/Task/Search-a-list/ActionScript/search-a-list-3.as
@@ -0,0 +1,17 @@
+import StringNotFoundError;
+var list:Vector. = Vector.(["Zig", "Zag", "Wally", "Ronald", "Bush", "Krusty", "Charlie", "Bush", "Boz", "Zag"]);
+function lowIndex(listToSearch:Vector., searchString:String):int
+{
+	var index:int = listToSearch.indexOf(searchString);
+	if(index == -1)
+		throw new StringNotFoundError("String not found: " + searchString);
+	return index;
+}
+
+function highIndex(listToSearch:Vector., searchString:String):int
+{
+	var index:int = listToSearch.lastIndexOf(searchString);
+	if(index == -1)
+		throw new StringNotFoundError("String not found: " + searchString);
+	return index;
+}
diff --git a/Task/Search-a-list/Ada/search-a-list.ada b/Task/Search-a-list/Ada/search-a-list.ada
new file mode 100644
index 0000000000..3f7d478a19
--- /dev/null
+++ b/Task/Search-a-list/Ada/search-a-list.ada
@@ -0,0 +1,42 @@
+with Ada.Strings.Unbounded;  use Ada.Strings.Unbounded;
+with Ada.Text_IO;            use Ada.Text_IO;
+
+procedure Test_List_Index is
+   Not_In : exception;
+
+   type List is array (Positive range <>) of Unbounded_String;
+
+   function Index (Haystack : List; Needle : String) return Positive is
+   begin
+      for Index in Haystack'Range loop
+         if Haystack (Index) = Needle then
+            return Index;
+         end if;
+      end loop;
+      raise Not_In;
+   end Index;
+
+      -- Functions to create lists
+   function "+" (X, Y : String) return List is
+   begin
+      return (1 => To_Unbounded_String (X), 2 => To_Unbounded_String (Y));
+   end "+";
+
+   function "+" (X : List; Y : String) return List is
+   begin
+      return X & (1 => To_Unbounded_String (Y));
+   end "+";
+
+   Haystack : List := "Zig"+"Zag"+"Wally"+"Ronald"+"Bush"+"Krusty"+"Charlie"+"Bush"+"Bozo";
+
+   procedure Check (Needle : String) is
+   begin
+      Put (Needle);
+      Put_Line ("at" & Positive'Image (Index (Haystack, Needle)));
+   exception
+      when Not_In => Put_Line (" is not in");
+   end Check;
+begin
+   Check ("Washington");
+   Check ("Bush");
+end Test_List_Index;
diff --git a/Task/Search-a-list/BASIC/search-a-list.bas b/Task/Search-a-list/BASIC/search-a-list.bas
new file mode 100644
index 0000000000..b5035e9503
--- /dev/null
+++ b/Task/Search-a-list/BASIC/search-a-list.bas
@@ -0,0 +1,29 @@
+DATA foo, bar, baz, quux, quuux, quuuux, bazola, ztesch, foo, bar, thud, grunt
+DATA foo, bar, bletch, foo, bar, fum, fred, jim, sheila, barney, flarp, zxc
+DATA spqr, wombat, shme, foo, bar, baz, bongo, spam, eggs, snork, foo, bar
+DATA zot, blarg, wibble, toto, titi, tata, tutu, pippo, pluto, paperino, aap
+DATA noot, mies, oogle, foogle, boogle, zork, gork, bork
+
+DIM haystack(54) AS STRING
+DIM needle AS STRING, found AS INTEGER, L0 AS INTEGER
+
+FOR L0 = 0 TO 54
+    READ haystack(L0)
+NEXT
+
+DO
+    INPUT "Word to search for? (Leave blank to exit) ", needle
+    IF needle <> "" THEN
+        FOR L0 = 0 TO UBOUND(haystack)
+            IF UCASE$(haystack(L0)) = UCASE$(needle) THEN
+                found = 1
+                PRINT "Found "; CHR$(34); needle; CHR$(34); " at index "; LTRIM$(STR$(L0))
+            END IF
+        NEXT
+        IF found < 1 THEN
+            PRINT CHR$(34); needle; CHR$(34); " not found"
+        END IF
+    ELSE
+        EXIT DO
+    END IF
+LOOP
diff --git a/Task/Search-a-list/C/search-a-list.c b/Task/Search-a-list/C/search-a-list.c
new file mode 100644
index 0000000000..0bf75204f2
--- /dev/null
+++ b/Task/Search-a-list/C/search-a-list.c
@@ -0,0 +1,40 @@
+#include 
+#include 
+
+const char *haystack[] = {
+  "Zig", "Zag", "Wally", "Ronald", "Bush", "Krusty", "Charlie",
+  "Bush", "Boz", "Zag", NULL
+};
+
+int search_needle(const char *needle, const char **hs)
+{
+  int i = 0;
+  while( hs[i] != NULL ) {
+    if ( strcmp(hs[i], needle) == 0 ) return i;
+    i++;
+  }
+  return -1;
+}
+
+int search_last_needle(const char *needle, const char **hs)
+{
+  int i, last=0;
+  i = last = search_needle(needle, hs);
+  if ( last < 0 ) return -1;
+  while( hs[++i] != NULL ) {
+    if ( strcmp(needle, hs[i]) == 0 ) {
+      last = i;
+    }
+  }
+  return last;
+}
+
+int main()
+{
+  printf("Bush is at %d\n", search_needle("Bush", haystack));
+  if ( search_needle("Washington", haystack) == -1 )
+    printf("Washington is not in the haystack\n");
+  printf("First index for Zag: %d\n", search_needle("Zag", haystack));
+  printf("Last index for Zag: %d\n", search_last_needle("Zag", haystack));
+  return 0;
+}
diff --git a/Task/Search-a-list/Clojure/search-a-list.clj b/Task/Search-a-list/Clojure/search-a-list.clj
new file mode 100644
index 0000000000..4d23bffa5d
--- /dev/null
+++ b/Task/Search-a-list/Clojure/search-a-list.clj
@@ -0,0 +1,5 @@
+(let [haystack ["Zig" "Zag" "Wally" "Ronald" "Bush" "Krusty" "Charlie" "Bush" "Bozo"]]
+  (let [idx (.indexOf haystack "Zig")]
+    (if (neg? idx)
+      (throw (Error. "item not found."))
+      idx)))
diff --git a/Task/Search-a-list/Erlang/search-a-list.erl b/Task/Search-a-list/Erlang/search-a-list.erl
new file mode 100644
index 0000000000..07fbfb3417
--- /dev/null
+++ b/Task/Search-a-list/Erlang/search-a-list.erl
@@ -0,0 +1,15 @@
+-module(index).
+-export([main/0]).
+
+main() ->
+    Haystack = ["Zig","Zag","Wally","Ronald","Bush","Krusty","Charlie","Bush","Bozo"],
+    Needles = ["Washington","Bush"],
+    lists:foreach(fun ?MODULE:print/1, [{N,pos(N, Haystack)} || N <- Needles]).
+
+pos(Needle, Haystack) -> pos(Needle, Haystack, 1).
+pos(_, [], _) -> undefined;
+pos(Needle, [Needle|_], Pos) -> Pos;
+pos(Needle, [_|Haystack], Pos) -> pos(Needle, Haystack, Pos+1).
+
+print({Needle, undefined}) -> io:format("~s is not in haystack.~n",[Needle]);
+print({Needle, Pos}) -> io:format("~s at position ~p.~n",[Needle,Pos]).
diff --git a/Task/Search-a-list/Forth/search-a-list.fth b/Task/Search-a-list/Forth/search-a-list.fth
new file mode 100644
index 0000000000..2d8b3c24d8
--- /dev/null
+++ b/Task/Search-a-list/Forth/search-a-list.fth
@@ -0,0 +1,11 @@
+include lib/row.4th
+
+create haystack
+  ," Zig"  ," Zag" ," Wally" ," Ronald" ," Bush" ," Krusty" ," Charlie"
+  ," Bush" ," Boz" ," Zag" NULL ,
+does>
+  dup >r 1 string-key row 2>r type 2r> ."  is "
+  if r> - ." at " . else r> drop drop ." not found" then cr
+;
+
+s" Washington" haystack s" Bush" haystack
diff --git a/Task/Search-a-list/Fortran/search-a-list.f b/Task/Search-a-list/Fortran/search-a-list.f
new file mode 100644
index 0000000000..55e9d70e5d
--- /dev/null
+++ b/Task/Search-a-list/Fortran/search-a-list.f
@@ -0,0 +1,35 @@
+program main
+
+ implicit none
+
+ character(len=7),dimension(10) :: haystack = [  &
+  'Zig    ',&
+  'Zag    ',&
+  'Wally  ',&
+  'Ronald ',&
+  'Bush   ',&
+  'Krusty ',&
+  'Charlie',&
+  'Bush   ',&
+  'Boz    ',&
+  'Zag    ']
+
+ call find_needle('Charlie')
+ call find_needle('Bush')
+
+ contains
+
+	subroutine find_needle(needle)
+	implicit none
+	character(len=*),intent(in) :: needle
+	integer :: i
+	do i=1,size(haystack)
+		if (needle==haystack(i)) then
+			write(*,'(A,I4)') trim(needle)//' found at index:',i
+			return
+		end if
+	end do
+	write(*,'(A)') 'Error: '//trim(needle)//' not found.'
+	end subroutine find_needle
+
+ end program main
diff --git a/Task/Search-a-list/Go/search-a-list.go b/Task/Search-a-list/Go/search-a-list.go
new file mode 100644
index 0000000000..da03484dd3
--- /dev/null
+++ b/Task/Search-a-list/Go/search-a-list.go
@@ -0,0 +1,79 @@
+package main
+
+import "fmt"
+
+var haystack = []string{"Zig", "Zag", "Wally", "Ronald", "Bush", "Krusty",
+    "Charlie", "Bush", "Bozo", "Zag", "mouse", "hat", "cup", "deodorant",
+    "television", "soap", "methamphetamine", "severed cat heads", "foo",
+    "bar", "baz", "quux", "quuux", "quuuux", "bazola", "ztesch", "foo",
+    "bar", "thud", "grunt", "foo", "bar", "bletch", "foo", "bar", "fum",
+    "fred", "jim", "sheila", "barney", "flarp", "zxc", "spqr", ";wombat",
+    "shme", "foo", "bar", "baz", "bongo", "spam", "eggs", "snork", "foo",
+    "bar", "zot", "blarg", "wibble", "toto", "titi", "tata", "tutu", "pippo",
+    "pluto", "paperino", "aap", "noot", "mies", "oogle", "foogle", "boogle",
+    "zork", "gork", "bork", "sodium", "phosphorous", "californium",
+    "copernicium", "gold", "thallium", "carbon", "silver", "gold", "copper",
+    "helium", "sulfur"}
+
+func main() {
+    // first task
+    printSearchForward("soap")
+    printSearchForward("gold")
+    printSearchForward("fire")
+    // extra task
+    printSearchReverseMult("soap")
+    printSearchReverseMult("gold")
+    printSearchReverseMult("fire")
+}
+
+// First task solution uses panic as an exception-like mechanism, as requested
+// by the task.  Note however, this is not idiomatic in Go and in fact
+// is considered bad practice.
+func printSearchForward(s string) {
+    fmt.Printf("Forward search: %s: ", s)
+    defer func() {
+        if x := recover(); x != nil {
+            if err, ok := x.(string); ok && err == "no match" {
+                fmt.Println(err)
+                return
+            }
+            panic(x)
+        }
+    }()
+    fmt.Println("smallest index =", searchForwardPanic(s))
+}
+
+func searchForwardPanic(s string) int {
+    for i, h := range haystack {
+        if h == s {
+            return i
+        }
+    }
+    panic("no match")
+    return -1
+}
+
+// Extra task, a quirky search for multiple occurrences.  This is written
+// without panic, and shows more acceptable Go programming practice.
+func printSearchReverseMult(s string) {
+    fmt.Printf("Reverse search for multiples: %s: ", s)
+    if i := searchReverseMult(s); i > -1 {
+        fmt.Println("largest index =", i)
+    } else {
+        fmt.Println("no multiple occurrence")
+    }
+}
+
+func searchReverseMult(s string) int {
+    largest := -1
+    for i := len(haystack) - 1; i >= 0; i-- {
+        switch {
+        case haystack[i] != s:
+        case largest == -1:
+            largest = i
+        default:
+            return largest
+        }
+    }
+    return -1
+}
diff --git a/Task/Search-a-list/Haskell/search-a-list-1.hs b/Task/Search-a-list/Haskell/search-a-list-1.hs
new file mode 100644
index 0000000000..d61b7621af
--- /dev/null
+++ b/Task/Search-a-list/Haskell/search-a-list-1.hs
@@ -0,0 +1,4 @@
+import Data.List
+
+haystack=["Zig","Zag","Wally","Ronald","Bush","Krusty","Charlie","Bush","Bozo"]
+needles = ["Washington","Bush"]
diff --git a/Task/Search-a-list/Haskell/search-a-list-2.hs b/Task/Search-a-list/Haskell/search-a-list-2.hs
new file mode 100644
index 0000000000..8dd1f2f7b0
--- /dev/null
+++ b/Task/Search-a-list/Haskell/search-a-list-2.hs
@@ -0,0 +1,2 @@
+*Main> map (\x -> (x,elemIndex x haystack)) needles
+[("Washington",Nothing),("Bush",Just 4)]
diff --git a/Task/Search-a-list/Haskell/search-a-list-3.hs b/Task/Search-a-list/Haskell/search-a-list-3.hs
new file mode 100644
index 0000000000..dba8d8d848
--- /dev/null
+++ b/Task/Search-a-list/Haskell/search-a-list-3.hs
@@ -0,0 +1,2 @@
+*Main> map (\x -> (x,elemIndices x haystack)) needles
+[("Washington",[]),("Bush",[4,7])]
diff --git a/Task/Search-a-list/Haskell/search-a-list-4.hs b/Task/Search-a-list/Haskell/search-a-list-4.hs
new file mode 100644
index 0000000000..5ff5965709
--- /dev/null
+++ b/Task/Search-a-list/Haskell/search-a-list-4.hs
@@ -0,0 +1,5 @@
+import Control.Monad
+import Control.Arrow
+
+*Main> map (ap (,) (flip elemIndex haystack)) needles
+[("Washington",Nothing),("Bush",Just 4)]
diff --git a/Task/Search-a-list/Java/search-a-list-1.java b/Task/Search-a-list/Java/search-a-list-1.java
new file mode 100644
index 0000000000..4e2ef52b3f
--- /dev/null
+++ b/Task/Search-a-list/Java/search-a-list-1.java
@@ -0,0 +1,12 @@
+import java.util.List;
+import java.util.Arrays;
+
+List haystack = Arrays.asList("Zig","Zag","Wally","Ronald","Bush","Krusty","Charlie","Bush","Bozo");
+
+for (String needle : new String[]{"Washington","Bush"}) {
+    int index = haystack.indexOf(needle);
+    if (index < 0)
+        System.out.println(needle + " is not in haystack");
+    else
+        System.out.println(index + " " + needle);
+}
diff --git a/Task/Search-a-list/Java/search-a-list-2.java b/Task/Search-a-list/Java/search-a-list-2.java
new file mode 100644
index 0000000000..1b4601f367
--- /dev/null
+++ b/Task/Search-a-list/Java/search-a-list-2.java
@@ -0,0 +1,11 @@
+String[] haystack = {"Zig","Zag","Wally","Ronald","Bush","Krusty","Charlie","Bush","Bozo"};
+
+OUTERLOOP:
+for (String needle : new String[]{"Washington","Bush"}) {
+    for (int i = 0; i < haystack.length; i++)
+        if (needle.equals(haystack[i])) {
+            System.out.println(i + " " + needle);
+            continue OUTERLOOP;
+        }
+    System.out.println(needle + " is not in haystack");
+}
diff --git a/Task/Search-a-list/JavaScript/search-a-list-1.js b/Task/Search-a-list/JavaScript/search-a-list-1.js
new file mode 100644
index 0000000000..f94a7b0447
--- /dev/null
+++ b/Task/Search-a-list/JavaScript/search-a-list-1.js
@@ -0,0 +1,16 @@
+var haystack = ['Zig', 'Zag', 'Wally', 'Ronald', 'Bush', 'Krusty', 'Charlie', 'Bush', 'Bozo']
+var needles = ['Bush', 'Washington']
+
+for (var i in needles) {
+    var found = false;
+    for (var j in haystack) {
+        if (haystack[j] == needles[i]) {
+            found = true;
+            break;
+        }
+    }
+    if (found)
+        print(needles[i] + " appears at index " + j + " in the haystack");
+    else
+        throw needles[i] + " does not appear in the haystack"
+}
diff --git a/Task/Search-a-list/JavaScript/search-a-list-2.js b/Task/Search-a-list/JavaScript/search-a-list-2.js
new file mode 100644
index 0000000000..6837e36dc7
--- /dev/null
+++ b/Task/Search-a-list/JavaScript/search-a-list-2.js
@@ -0,0 +1,18 @@
+for each (var needle in needles) {
+    var idx = haystack.indexOf(needle);
+    if (idx == -1)
+        throw needle + " does not appear in the haystack"
+    else
+        print(needle + " appears at index " + idx + " in the haystack");
+}
+
+// extra credit
+
+for each (var elem in haystack) {
+    var first_idx = haystack.indexOf(elem);
+    var last_idx  = haystack.lastIndexOf(elem);
+    if (last_idx > first_idx) {
+        print(elem + " last appears at index " + last_idx + " in the haystack");
+        break
+    }
+}
diff --git a/Task/Search-a-list/Lua/search-a-list.lua b/Task/Search-a-list/Lua/search-a-list.lua
new file mode 100644
index 0000000000..fe0144811e
--- /dev/null
+++ b/Task/Search-a-list/Lua/search-a-list.lua
@@ -0,0 +1,7 @@
+list = {"mouse", "hat", "cup", "deodorant", "television", "soap", "methamphetamine", "severed cat heads"} --contents of my desk
+
+item = io.read()
+
+for i,v in ipairs(list)
+  if v == item then print(i) end
+end
diff --git a/Task/Search-a-list/PHP/search-a-list.php b/Task/Search-a-list/PHP/search-a-list.php
new file mode 100644
index 0000000000..866a08d1bd
--- /dev/null
+++ b/Task/Search-a-list/PHP/search-a-list.php
@@ -0,0 +1,9 @@
+$haystack = array("Zig","Zag","Wally","Ronald","Bush","Krusty","Charlie","Bush","Bozo");
+
+foreach (array("Washington","Bush") as $needle) {
+  $i = array_search($needle, $haystack);
+  if ($i === FALSE) // note: 0 is also considered false in PHP, so you need to specifically check for FALSE
+    echo "$needle is not in haystack\n";
+  else
+    echo "$i $needle\n";
+}
diff --git a/Task/Search-a-list/Perl/search-a-list-1.pl b/Task/Search-a-list/Perl/search-a-list-1.pl
new file mode 100644
index 0000000000..3e890999b5
--- /dev/null
+++ b/Task/Search-a-list/Perl/search-a-list-1.pl
@@ -0,0 +1,13 @@
+use List::Util qw(first);
+
+my @haystack = qw(Zig Zag Wally Ronald Bush Krusty Charlie Bush Bozo);
+
+foreach my $needle (qw(Washington Bush)) {
+  my $index = first { $haystack[$_] eq $needle } (0 .. $#haystack); # note that "eq" was used because we are comparing strings
+                                                                    # you would use "==" for numbers
+  if (defined $index) {
+    print "$index $needle\n";
+  } else {
+    print "$needle is not in haystack\n";
+  }
+}
diff --git a/Task/Search-a-list/Perl/search-a-list-2.pl b/Task/Search-a-list/Perl/search-a-list-2.pl
new file mode 100644
index 0000000000..9950308283
--- /dev/null
+++ b/Task/Search-a-list/Perl/search-a-list-2.pl
@@ -0,0 +1,13 @@
+use List::MoreUtils qw(first_index);
+
+my @haystack = qw(Zig Zag Wally Ronald Bush Krusty Charlie Bush Bozo);
+
+foreach my $needle (qw(Washington Bush)) {
+  my $index = first_index { $_ eq $needle } @haystack; # note that "eq" was used because we are comparing strings
+                                                       # you would use "==" for numbers
+  if (defined $index) {
+    print "$index $needle\n";
+  } else {
+    print "$needle is not in haystack\n";
+  }
+}
diff --git a/Task/Search-a-list/Perl/search-a-list-3.pl b/Task/Search-a-list/Perl/search-a-list-3.pl
new file mode 100644
index 0000000000..a7be3d255d
--- /dev/null
+++ b/Task/Search-a-list/Perl/search-a-list-3.pl
@@ -0,0 +1,13 @@
+my @haystack = qw(Zig Zag Wally Ronald Bush Krusty Charlie Bush Bozo);
+
+my %haystack_indices;
+@haystack_indices{ @haystack } = (0 .. $#haystack); # Caution: this finds the largest index, not the smallest
+
+foreach my $needle (qw(Washington Bush)) {
+  my $index = $haystack_indices{$needle};
+  if (defined $index) {
+    print "$index $needle\n";
+  } else {
+    print "$needle is not in haystack\n";
+  }
+}
diff --git a/Task/Search-a-list/PicoLisp/search-a-list.l b/Task/Search-a-list/PicoLisp/search-a-list.l
new file mode 100644
index 0000000000..3108496e63
--- /dev/null
+++ b/Task/Search-a-list/PicoLisp/search-a-list.l
@@ -0,0 +1,10 @@
+(de lastIndex (Item Lst)
+   (- (length Lst) (index Item (reverse Lst)) -1) )
+
+(de findNeedle (Fun Sym Lst)
+   (prinl Sym " " (or (Fun Sym Lst) "not found")) )
+
+(let Lst '(Zig Zag Wally Ronald Bush Krusty Charlie Bush Bozo)
+   (findNeedle index 'Washington Lst)
+   (findNeedle index 'Bush Lst)
+   (findNeedle lastIndex 'Bush Lst) )
diff --git a/Task/Search-a-list/Prolog/search-a-list.pro b/Task/Search-a-list/Prolog/search-a-list.pro
new file mode 100644
index 0000000000..65b7b42bfa
--- /dev/null
+++ b/Task/Search-a-list/Prolog/search-a-list.pro
@@ -0,0 +1,23 @@
+search_a_list(N1, N2) :-
+	L = ["Zig", "Zag", "Wally", "Ronald", "Bush", "Krusty", "Charlie", "Bush", "Boz", "Zag"],
+
+	write('List is :'), maplist(my_write, L), nl, nl,
+
+	(   nth1(Ind1, L, N1) ->
+	    format('~s is in position ~w~n', [N1, Ind1])
+	;   format('~s is not present~n', [N1])),
+	(   nth1(Ind2, L, N2) ->
+	    format('~s is in position ~w~n', [N2, Ind2])
+	;   format('~s is not present~n', [N2])),
+	(   reverse_nth1(Ind3, L, N1) ->
+	    format('~s last position is ~w~n', [N1, Ind3])
+	;   format('~s is not present~n', [N1])).
+
+reverse_nth1(Ind, L, N) :-
+	reverse(L, RL),
+	length(L, Len),
+	nth1(Ind1, RL, N),
+	Ind is Len - Ind1 + 1.
+
+my_write(Name) :-
+	writef(' %s', [Name]).
diff --git a/Task/Search-a-list/Python/search-a-list-1.py b/Task/Search-a-list/Python/search-a-list-1.py
new file mode 100644
index 0000000000..62fb0069b5
--- /dev/null
+++ b/Task/Search-a-list/Python/search-a-list-1.py
@@ -0,0 +1,7 @@
+haystack=["Zig","Zag","Wally","Ronald","Bush","Krusty","Charlie","Bush","Bozo"]
+
+for needle in ("Washington","Bush"):
+  try:
+    print haystack.index(needle), needle
+  except ValueError, value_error:
+    print needle,"is not in haystack"
diff --git a/Task/Search-a-list/Python/search-a-list-2.py b/Task/Search-a-list/Python/search-a-list-2.py
new file mode 100644
index 0000000000..9f76c78f07
--- /dev/null
+++ b/Task/Search-a-list/Python/search-a-list-2.py
@@ -0,0 +1,9 @@
+>>> haystack=["Zig","Zag","Wally","Ronald","Bush","Krusty","Charlie","Bush","Bozo"]
+>>> haystack.index('Bush')
+4
+>>> haystack.index('Washington')
+Traceback (most recent call last):
+  File "", line 1, in 
+    haystack.index('Washington')
+ValueError: list.index(x): x not in list
+>>>
diff --git a/Task/Search-a-list/Python/search-a-list-3.py b/Task/Search-a-list/Python/search-a-list-3.py
new file mode 100644
index 0000000000..d6b8f52d37
--- /dev/null
+++ b/Task/Search-a-list/Python/search-a-list-3.py
@@ -0,0 +1,13 @@
+>>> def hi_index(needle, haystack):
+	return len(haystack)-1 - haystack[::-1].index(needle)
+
+>>> # Lets do some checks
+>>> for n in haystack:
+	hi = hi_index(n, haystack)
+	assert haystack[hi] == n, "Hi index is of needle"
+	assert n not in haystack[hi+1:], "No higher index exists"
+	if haystack.count(n) == 1:
+		assert hi == haystack.index(n), "index == hi_index if needle occurs only once"
+
+		
+>>>
diff --git a/Task/Search-a-list/R/search-a-list-1.r b/Task/Search-a-list/R/search-a-list-1.r
new file mode 100644
index 0000000000..90e77bd75c
--- /dev/null
+++ b/Task/Search-a-list/R/search-a-list-1.r
@@ -0,0 +1,6 @@
+find.needle <- function(haystack, needle="needle", return.last.index.too=FALSE)
+{
+   indices <- which(haystack %in% needle)
+   if(length(indices)==0) stop("no needles in the haystack")
+   if(return.last.index.too) range(indices) else min(indices)
+}
diff --git a/Task/Search-a-list/R/search-a-list-2.r b/Task/Search-a-list/R/search-a-list-2.r
new file mode 100644
index 0000000000..48e87ad1e0
--- /dev/null
+++ b/Task/Search-a-list/R/search-a-list-2.r
@@ -0,0 +1,8 @@
+haystack1 <- c("where", "is", "the", "needle", "I", "wonder")
+haystack2 <- c("no", "sewing", "equipment", "in", "here")
+haystack3 <- c("oodles", "of", "needles", "needles", "needles", "in", "here")
+
+find.needle(haystack1)                              # 4
+find.needle(haystack2)                              # error
+find.needle(haystack3)                              # 3
+find.needle(haystack3, needle="needles", ret=TRUE)  # 3 5
diff --git a/Task/Search-a-list/REXX/search-a-list-1.rexx b/Task/Search-a-list/REXX/search-a-list-1.rexx
new file mode 100644
index 0000000000..56cb3c73d5
--- /dev/null
+++ b/Task/Search-a-list/REXX/search-a-list-1.rexx
@@ -0,0 +1,30 @@
+/*REXX program searches a collection of strings.                        */
+hay.=                                  /*initialize haystack collection.*/
+hay.1  = 'sodium'
+hay.2  = 'phosphorous'
+hay.3  = 'californium'
+hay.4  = 'copernicium'
+hay.5  = 'gold'
+hay.6  = 'thallium'
+hay.7  = 'carbon'
+hay.8  = 'silver'
+hay.9  = 'curium'
+hay.10 = 'copper'
+hay.11 = 'helium'
+hay.12 = 'sulfur'
+
+needle='gold'                          /*we'll be looking for the gold. */
+upper needle                           /*in case some people capitalize.*/
+found=0                                /*assume needle isn't found yet. */
+
+          do j=1  while hay.j\==''     /*keep looking in haystack.      */
+          _=hay.j;     upper _         /*make it uppercase to be safe.  */
+          if _=needle  then do         /*we've found needle in haystack.*/
+                            found=1    /*indicate that needle was found,*/
+                            leave      /*  and stop looking, of course. */
+                            end
+          end   /*j*/
+
+if found  then return j                /*return haystack index number.  */
+          else say  needle  "wasn't found in the haystack!"
+return 0                               /*indicates needle wasn't found. */
diff --git a/Task/Search-a-list/REXX/search-a-list-2.rexx b/Task/Search-a-list/REXX/search-a-list-2.rexx
new file mode 100644
index 0000000000..3796ba7bcb
--- /dev/null
+++ b/Task/Search-a-list/REXX/search-a-list-2.rexx
@@ -0,0 +1,44 @@
+/*REXX program searches a collection of strings.                        */
+hay.0=1000                             /*safely indicate highest item #.*/
+hay.200 = 'binilnilium'
+hay.98  = 'californium'
+hay.6   = 'carbon'
+hay.112 = 'copernicium'
+hay.29  = 'copper'
+hay.114 = 'flerovium'
+hay.79  = 'gold'
+hay.2   = 'helium'
+hay.1   = 'hydrogen'
+hay.82  = 'lead'
+hay.116 = 'livermorium'
+hay.15  = 'phosphorous'
+hay.47  = 'silver'
+hay.11  = 'sodium'
+hay.16  = 'sulfur'
+hay.81  = 'thallium'
+hay.92  = 'uranium'
+
+needle  = 'gold'                       /*we'll be looking for the gold. */
+upper needle                           /*in case some people capitalize.*/
+found=0                                /*assume needle isn't found, yet.*/
+
+          do j=1  for hay.0            /*start looking in haystack item1*/
+          _=hay.j;     upper _         /*make it uppercase to be safe.  */
+          if _=needle  then do         /*we've found needle in haystack.*/
+                            found=1    /*indicate that needle was found,*/
+                            leave      /*  and stop looking, of course. */
+                            end
+          end   /*j*/
+
+if found  then return j                /*return haystack index number.  */
+          else say  needle  "wasn't found in the haystack!"
+return 0                               /*indicates needle wasn't found. */
+
+/*─────────────────────────────────────────────── incidentally, to find */
+                                       /* the number of haystack items: */
+hayItems=0
+
+  do k=1  for hay.0                    /*find item  AFTER the last item.*/
+  if hay.k\==''  then hayItems=hayItems+1       /*bump the item counter.*/
+  end   /*k*/
+                                       /*stick a fork in it, we're done.*/
diff --git a/Task/Search-a-list/REXX/search-a-list-3.rexx b/Task/Search-a-list/REXX/search-a-list-3.rexx
new file mode 100644
index 0000000000..6ac0973e04
--- /dev/null
+++ b/Task/Search-a-list/REXX/search-a-list-3.rexx
@@ -0,0 +1,29 @@
+/*REXX program searches a collection of strings.                        */
+hay.=0                                 /*initialize haystack collection.*/
+hay._sodium         = 1
+hay._phosphorous    = 1
+hay._califonium     = 1
+hay._copernicium    = 1
+hay._gold           = 1
+hay._thallium       = 1
+hay._carbon         = 1
+hay._silver         = 1
+hay._copper         = 1
+hay._helium         = 1
+hay._sulfur         = 1
+                                       /*underscores (_) are used to NOT*/
+                                       /*  conflict with variable names.*/
+
+needle  = 'gold'                       /*we'll be looking for the gold. */
+
+Xneedle = '_'needle                    /*prefix an underscore (_) char. */
+upper Xneedle                          /*uppercase: how REXX stores 'em.*/
+
+                                       /*alternative version of above,  */
+                                       /*   Xneedle=translate('_'needle)*/
+
+found=hay.Xneedle                      /*this is it,  it's found or not.*/
+
+if found  then return j                /*return haystack index number.  */
+          else say  needle  "wasn't found in the haystack!"
+return 0                               /*indicates needle wasn't found. */
diff --git a/Task/Search-a-list/REXX/search-a-list-4.rexx b/Task/Search-a-list/REXX/search-a-list-4.rexx
new file mode 100644
index 0000000000..b805f349e0
--- /dev/null
+++ b/Task/Search-a-list/REXX/search-a-list-4.rexx
@@ -0,0 +1,24 @@
+/*REXX program searches a collection of strings.                        */
+
+haystack=,       /*names of the first 200 elements of the periodic table*/
+          'hydrogen helium lithium berylliumbon nitrogen oxygen fluorine neon sodium magnesium aluminum silicon phosphorous sulfur chlorine argon potassium calcium scandium titanium',
+          'vanadium chromium manganese iron kel copper zinc gallium germanium arsenic selenium bromine krypton rubidium strontium yttrium zirconium niobium molybdenum technetium ruthenium',
+          'rhodium palladium silver cadmium  antimony tellurium iodine xenon cesium barium lanthanum cerium praseodymium neodymium promethium samarium europium gadolinium terbium dysprosium',
+          'holmium erbium thulium ytterbium afnium tantalum tungsten rhenium osmium irdium platinum gold mercury thallium lead bismuth polonium astatine radon francium radium actinium',
+          'thorium protactinium uranium neptonium americium curium berkelium californium einsteinum fermium mendelevium nobelium lawrencium rutherfordium dubnium seaborgium bohrium hassium',
+          'meitnerium darmstadtium roentgenicium ununtrium flerovium ununpentium livermorium ununseptium ununoctium ununennium unbinilium unbiunium unbibium unbitrium unbiquadium',
+          'unbipentium unbihexium unbiseptiuum unbiennium untrinilium untriunium untribium untritrium untriquadium untripentium untrihexium untriseptium untrioctium untriennium unquadnilium',
+          'unquadunium unquadbium unquadtriuadium unquadpentium unquadhexium unquadseptium unquadoctium unquadennium unpentnilium unpentunium unpentbium unpenttrium unpentquadium',
+          'unpentpentium unpenthexium unpentpentoctium unpentennium unhexnilium unhexunium unhexbium unhextrium unhexquadium unhexpentium unhexhexium unhexseptium unhexoctium unhexennium',
+          'unseptnilium unseptunium unseptbirium unseptquadium unseptpentium unsepthexium unseptseptium unseptoctium unseptennium unoctnilium unoctunium unoctbium unocttrium unoctquadium',
+          'unoctpentium unocthexium unoctsepoctium unoctennium unennilium unennunium unennbium unenntrium unennquadium unennpentium unennhexium unennseptium unennoctium unennennium binilnilium'
+
+needle  = 'gold'                       /*we'll be looking for the gold. */
+
+upper needle haystack                  /*in case some people capitalize.*/
+
+idx=wordpos(needle,haystack)           /*use REXX's bif:  WORDPOS       */
+                                       /*       bif:  built-in function.*/
+if idx\==0  then return idx            /*return haystack index number.  */
+            else say  needle  "wasn't found in the haystack!"
+return 0                               /*indicates needle wasn't found. */
diff --git a/Task/Search-a-list/Racket/search-a-list-1.rkt b/Task/Search-a-list/Racket/search-a-list-1.rkt
new file mode 100644
index 0000000000..b82d048cd0
--- /dev/null
+++ b/Task/Search-a-list/Racket/search-a-list-1.rkt
@@ -0,0 +1,4 @@
+(define (index xs y)
+  (for/first ([(x i) (in-indexed xs)]
+              #:when (equal? x y))
+    i))
diff --git a/Task/Search-a-list/Racket/search-a-list-2.rkt b/Task/Search-a-list/Racket/search-a-list-2.rkt
new file mode 100644
index 0000000000..564fd3948a
--- /dev/null
+++ b/Task/Search-a-list/Racket/search-a-list-2.rkt
@@ -0,0 +1,4 @@
+(define (index-last xs y)
+  (for/last ([(x i) (in-indexed xs)]
+             #:when (equal? x y))
+    i))
diff --git a/Task/Search-a-list/Racket/search-a-list-3.rkt b/Task/Search-a-list/Racket/search-a-list-3.rkt
new file mode 100644
index 0000000000..0c1106c2db
--- /dev/null
+++ b/Task/Search-a-list/Racket/search-a-list-3.rkt
@@ -0,0 +1,7 @@
+(define haystack '("Zig" "Zag" "Wally" "Ronald" "Bush" "Krusty" "Charlie" "Bush" "Bozo"))
+
+(for/list ([needle '("Bender" "Bush")])
+    (index haystack needle))
+
+(for/list ([needle '("Bender" "Bush")])
+    (index-last haystack needle))
diff --git a/Task/Search-a-list/Ruby/search-a-list-1.rb b/Task/Search-a-list/Ruby/search-a-list-1.rb
new file mode 100644
index 0000000000..24bfd0d5b7
--- /dev/null
+++ b/Task/Search-a-list/Ruby/search-a-list-1.rb
@@ -0,0 +1,9 @@
+haystack = %w(Zig Zag Wally Ronald Bush Krusty Charlie Bush Bozo)
+
+%w(Bush Washington).each do |needle|
+  if (i = haystack.index(needle))
+    print i, " ", needle, "\n"
+  else
+    raise "#{needle} is not in haystack\n"
+  end
+end
diff --git a/Task/Search-a-list/Ruby/search-a-list-2.rb b/Task/Search-a-list/Ruby/search-a-list-2.rb
new file mode 100644
index 0000000000..99ecb018af
--- /dev/null
+++ b/Task/Search-a-list/Ruby/search-a-list-2.rb
@@ -0,0 +1,7 @@
+haystack.each do |item|
+  last = haystack.rindex(item)
+  if last > haystack.index(item)
+    puts "#{item} last appears at index #{last}"
+    break
+  end
+end
diff --git a/Task/Search-a-list/Ruby/search-a-list-3.rb b/Task/Search-a-list/Ruby/search-a-list-3.rb
new file mode 100644
index 0000000000..67ff7a12e0
--- /dev/null
+++ b/Task/Search-a-list/Ruby/search-a-list-3.rb
@@ -0,0 +1,3 @@
+multi_item = haystack .each_with_index .group_by {|elem, idx| elem} .find {|key, val| val.length > 1}
+# multi_item is => ["Bush", [["Bush", 4], ["Bush", 7]]]
+puts "#{multi_item[0]} last appears at index #{multi_item[1][-1][1]}" unless multi_item.nil?
diff --git a/Task/Search-a-list/Sather/search-a-list.sa b/Task/Search-a-list/Sather/search-a-list.sa
new file mode 100644
index 0000000000..782d3bf787
--- /dev/null
+++ b/Task/Search-a-list/Sather/search-a-list.sa
@@ -0,0 +1,14 @@
+class MAIN is
+   main is
+      haystack :ARRAY{STR} := |"Zig", "Zag", "Wally", "Ronald", "Bush", "Krusty", "Charlie", "Bush", "Bozo"|;
+      needles :ARRAY{STR} := | "Washington", "Bush" |;
+      loop needle ::= needles.elt!;
+	 index ::= haystack.index_of(needle);
+	 if index < 0 then
+	    #OUT + needle + " is not in the haystack\n";
+	 else
+	    #OUT + index + " " + needle + "\n";
+	 end;
+      end;
+   end;
+end;
diff --git a/Task/Search-a-list/Scala/search-a-list.scala b/Task/Search-a-list/Scala/search-a-list.scala
new file mode 100644
index 0000000000..affd82fad5
--- /dev/null
+++ b/Task/Search-a-list/Scala/search-a-list.scala
@@ -0,0 +1,3 @@
+def findNeedles(needle: String, haystack: Seq[String]) = haystack.zipWithIndex.filter(_._1 == needle).map(_._2)
+def firstNeedle(needle: String, haystack: Seq[String]) = findNeedles(needle, haystack).head
+def lastNeedle(needle: String, haystack: Seq[String]) = findNeedles(needle, haystack).last
diff --git a/Task/Search-a-list/Scheme/search-a-list.ss b/Task/Search-a-list/Scheme/search-a-list.ss
new file mode 100644
index 0000000000..bd55aba697
--- /dev/null
+++ b/Task/Search-a-list/Scheme/search-a-list.ss
@@ -0,0 +1,16 @@
+(define haystack
+  '("Zig" "Zag" "Wally" "Ronald" "Bush" "Krusty" "Charlie" "Bush" "Bozo"))
+
+(define index-of
+  (lambda (needle hackstack)
+    (let ((tail (member needle haystack)))
+      (if tail
+          (- (length haystack) (length tail))
+          (throw 'needle-missing)))))
+
+(define last-index-of
+  (lambda (needle hackstack)
+    (let ((tail (member needle (reverse haystack))))
+      (if tail
+          (- (length tail) 1)
+          (throw 'needle-missing)))))
diff --git a/Task/Search-a-list/Smalltalk/search-a-list.st b/Task/Search-a-list/Smalltalk/search-a-list.st
new file mode 100644
index 0000000000..740f398242
--- /dev/null
+++ b/Task/Search-a-list/Smalltalk/search-a-list.st
@@ -0,0 +1,14 @@
+| haystack |
+haystack :=
+   'Zig,Zag,Wally,Ronald,Bush,Krusty,Charlie,Bush,Bozo' subStrings: $,.
+{ 'Washington' . 'Bush'  } do: [:i|
+  |t l|
+  t := (haystack indexOf: i).
+  (t = 0) ifTrue: [ ('%1 is not in the haystack' % { i }) displayNl ]
+          ifFalse: [ ('%1 is at index %2' % { i . t }) displayNl.
+                     l := ( (haystack size) - (haystack reverse indexOf: i) + 1 ).
+                     ( t = l ) ifFalse: [
+                       ('last occurence of %1 is at index %2' %
+                             { i . l }) displayNl ]
+                   ]
+].
diff --git a/Task/Search-a-list/Tcl/search-a-list-1.tcl b/Task/Search-a-list/Tcl/search-a-list-1.tcl
new file mode 100644
index 0000000000..66b8f02d71
--- /dev/null
+++ b/Task/Search-a-list/Tcl/search-a-list-1.tcl
@@ -0,0 +1,8 @@
+set haystack {Zig Zag Wally Ronald Bush Krusty Charlie Bush Bozo}
+foreach needle {Bush Washington} {
+    if {[set idx [lsearch -exact $haystack $needle]] == -1} {
+        error "$needle does not appear in the haystack"
+    } else {
+        puts "$needle appears at index $idx in the haystack"
+    }
+}
diff --git a/Task/Search-a-list/Tcl/search-a-list-2.tcl b/Task/Search-a-list/Tcl/search-a-list-2.tcl
new file mode 100644
index 0000000000..2fdafb3750
--- /dev/null
+++ b/Task/Search-a-list/Tcl/search-a-list-2.tcl
@@ -0,0 +1,9 @@
+set haystack {Zig Zag Wally Ronald Bush Krusty Charlie Bush Bozo}
+foreach needle {Bush Washington} {
+    set indices [lsearch -all -exact $haystack $needle]
+    if {[llength $indices] == 0} {
+        error "$needle does not appear in the haystack"
+    } else {
+        puts "$needle appears first at index [lindex $indices 0] and last at [lindex $indices end]"
+    }
+}