aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAbigail <abigail@abigail.be>2021-03-15 19:59:33 +0100
committerAbigail <abigail@abigail.be>2021-03-15 20:21:51 +0100
commit64cf972ccf933eda4f85a3b46a2b63820cf0ba9f (patch)
tree2268058ec8da6e8ab7361d70aa62cfa4d5b73880
parent590665388f884353cc6761854c38e5fd65a6a442 (diff)
downloadperlweeklychallenge-club-64cf972ccf933eda4f85a3b46a2b63820cf0ba9f.tar.gz
perlweeklychallenge-club-64cf972ccf933eda4f85a3b46a2b63820cf0ba9f.tar.bz2
perlweeklychallenge-club-64cf972ccf933eda4f85a3b46a2b63820cf0ba9f.zip
Tcl solution for week 104, part 1
-rw-r--r--challenge-104/abigail/README.md8
-rw-r--r--challenge-104/abigail/tcl/ch-1.tcl10
2 files changed, 15 insertions, 3 deletions
diff --git a/challenge-104/abigail/README.md b/challenge-104/abigail/README.md
index 334db86471..60c8082a76 100644
--- a/challenge-104/abigail/README.md
+++ b/challenge-104/abigail/README.md
@@ -35,6 +35,7 @@ even handle a single if statement. A single print statement is enough.
* [Pascal](perl/ch-1.p)
* [Perl](perl/ch-1.pl)
* [Python](python/ch-1.py)
+* [Tcl](tcl/ch-1.tcl)
* [Ruby](ruby/ch-1.rb)
* [SQL](sql/ch-1.sql)
@@ -55,13 +56,14 @@ c) The player who picks the last token wins the game
~~~~
### Notes
-This is *not* the NIM game. In the NIM game, you have multiple sets
+This is *not* the well known NIM game. In the NIM game, you have multiple sets
of tokens, and on each turn, a player picks a set, and removes any
non-zero number of of tokens from the set. Typically, the player
picking the last token loses.
-The game as given is a win for the second player, who will win on
-the third move.
+The game as given is sometimes also known as the NIM game, but it better
+known as the subtraction game. With the given parameters and perfect
+play, the second player always wins on the third move.
### Solutions
* [Perl](perl/ch-2.pl)
diff --git a/challenge-104/abigail/tcl/ch-1.tcl b/challenge-104/abigail/tcl/ch-1.tcl
new file mode 100644
index 0000000000..76a790716c
--- /dev/null
+++ b/challenge-104/abigail/tcl/ch-1.tcl
@@ -0,0 +1,10 @@
+#
+# See ../README.md
+#
+
+#
+# Run as: tclsh ch-1.tcl
+#
+
+puts -nonewline "0 1 1 2 1 3 2 3 1 4 3 5 2 5 3 4 1 5 4 7 3 8 5 7 2 7 "
+puts "5 8 3 7 4 5 1 6 5 9 4 11 7 10 3 11 8 13 5 12 7 9 2 9"