trackler 1.0.0 → 1.0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (288) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +7 -0
  3. data/CHANGELOG.md +9 -1
  4. data/README.md +10 -0
  5. data/common/CONTRIBUTING.md +50 -2
  6. data/common/exercises/alphametics/canonical-data.json +10 -10
  7. data/common/exercises/markdown/canonical-data.json +4 -4
  8. data/common/exercises/pov/canonical-data.json +356 -0
  9. data/lib/trackler/version.rb +1 -1
  10. data/trackler.gemspec +1 -2
  11. data/tracks/c/config.json +11 -1
  12. data/tracks/c/exercises/binary-search/makefile +16 -0
  13. data/tracks/c/exercises/binary-search/src/example.c +21 -0
  14. data/tracks/c/exercises/binary-search/src/example.h +8 -0
  15. data/tracks/c/exercises/binary-search/test/test_binary_search.c +99 -0
  16. data/tracks/c/exercises/binary-search/test/vendor/unity.c +1300 -0
  17. data/tracks/c/exercises/binary-search/test/vendor/unity.h +274 -0
  18. data/tracks/c/exercises/binary-search/test/vendor/unity_internals.h +701 -0
  19. data/tracks/clojure/config.json +3 -2
  20. data/tracks/clojure/exercises/bank-account/project.clj +4 -0
  21. data/tracks/clojure/exercises/bank-account/src/example.clj +17 -0
  22. data/tracks/clojure/exercises/bank-account/test/bank_account_test.clj +44 -0
  23. data/tracks/clojure/exercises/isogram/project.clj +4 -0
  24. data/tracks/clojure/exercises/isogram/src/example.clj +5 -0
  25. data/tracks/clojure/exercises/isogram/test/isogram_test.clj +17 -0
  26. data/tracks/csharp/config.json +27 -87
  27. data/tracks/csharp/exercises/exercises.csproj +265 -1
  28. data/tracks/csharp/exercises/grep/Example.cs +114 -0
  29. data/tracks/csharp/exercises/grep/GrepTest.cs +376 -0
  30. data/tracks/csharp/exercises/paket.references +2 -1
  31. data/tracks/csharp/exercises/poker/Example.cs +96 -0
  32. data/tracks/csharp/exercises/poker/PokerTest.cs +171 -0
  33. data/tracks/csharp/exercises/sgf-parsing/Example.cs +61 -0
  34. data/tracks/csharp/exercises/sgf-parsing/SgfParsing.cs +13 -0
  35. data/tracks/csharp/exercises/sgf-parsing/SgfParsingTest.cs +158 -0
  36. data/tracks/csharp/paket.dependencies +2 -1
  37. data/tracks/csharp/paket.lock +72 -0
  38. data/tracks/ecmascript/exercises/simple-cipher/simple-cipher.spec.js +1 -1
  39. data/tracks/elisp/config.json +6 -1
  40. data/tracks/elisp/exercises/etl/etl-test.el +90 -0
  41. data/tracks/elisp/exercises/etl/etl.el +9 -0
  42. data/tracks/elisp/exercises/etl/example.el +22 -0
  43. data/tracks/elisp/exercises/nucleotide-count/example.el +19 -0
  44. data/tracks/elisp/exercises/nucleotide-count/nucleotide-count-test.el +34 -0
  45. data/tracks/elisp/exercises/nucleotide-count/nucleotide-count.el +9 -0
  46. data/tracks/elisp/exercises/perfect-numbers/example.el +28 -0
  47. data/tracks/elisp/exercises/perfect-numbers/perfect-numbers-test.el +24 -0
  48. data/tracks/elisp/exercises/perfect-numbers/perfect-numbers.el +10 -0
  49. data/tracks/elisp/exercises/roman-numerals/example.el +36 -0
  50. data/tracks/elisp/exercises/roman-numerals/roman-numerals-test.el +30 -0
  51. data/tracks/elisp/exercises/roman-numerals/roman-numerals.el +10 -0
  52. data/tracks/elisp/exercises/word-count/example.el +18 -0
  53. data/tracks/elisp/exercises/word-count/word-count-test.el +64 -0
  54. data/tracks/elisp/exercises/word-count/word-count.el +9 -0
  55. data/tracks/elixir/README.md +4 -4
  56. data/tracks/elixir/SETUP.md +3 -3
  57. data/tracks/elixir/docs/TESTS.md +3 -3
  58. data/tracks/elixir/exercises/accumulate/accumulate_test.exs +7 -7
  59. data/tracks/elixir/exercises/acronym/acronym_test.exs +5 -5
  60. data/tracks/elixir/exercises/allergies/allergies_test.exs +13 -13
  61. data/tracks/elixir/exercises/anagram/anagram_test.exs +12 -12
  62. data/tracks/elixir/exercises/atbash-cipher/atbash_cipher_test.exs +9 -9
  63. data/tracks/elixir/exercises/bank-account/bank_account_test.exs +5 -5
  64. data/tracks/elixir/exercises/beer-song/beer_song_test.exs +6 -6
  65. data/tracks/elixir/exercises/binary-search/binary_search_test.exs +7 -7
  66. data/tracks/elixir/exercises/binary/binary_test.exs +13 -13
  67. data/tracks/elixir/exercises/bob/bob_test.exs +15 -15
  68. data/tracks/elixir/exercises/bowling/bowling_test.exs +18 -18
  69. data/tracks/elixir/exercises/bracket-push/bracket_push_test.exs +12 -12
  70. data/tracks/elixir/exercises/change/change_test.exs +7 -7
  71. data/tracks/elixir/exercises/connect/connect_test.exs +9 -9
  72. data/tracks/elixir/exercises/crypto-square/crypto_square_test.exs +7 -7
  73. data/tracks/elixir/exercises/custom-set/custom_set_test.exs +11 -11
  74. data/tracks/elixir/exercises/diamond/diamond_test.exs +4 -4
  75. data/tracks/elixir/exercises/difference-of-squares/difference_of_squares_test.exs +10 -10
  76. data/tracks/elixir/exercises/dot-dsl/dot_dsl_test.exs +17 -17
  77. data/tracks/elixir/exercises/etl/etl_test.exs +5 -5
  78. data/tracks/elixir/exercises/flatten-array/flatten_array_test.exs +6 -6
  79. data/tracks/elixir/exercises/forth/forth_test.exs +16 -16
  80. data/tracks/elixir/exercises/gigasecond/gigasecond_test.exs +5 -5
  81. data/tracks/elixir/exercises/grade-school/grade_school_test.exs +6 -6
  82. data/tracks/elixir/exercises/grains/grains_test.exs +9 -9
  83. data/tracks/elixir/exercises/hamming/hamming_test.exs +6 -6
  84. data/tracks/elixir/exercises/hello-world/hello_world_test.exs +3 -3
  85. data/tracks/elixir/exercises/hexadecimal/hexadecimal_test.exs +11 -11
  86. data/tracks/elixir/exercises/isogram/isogram_test.exs +10 -10
  87. data/tracks/elixir/exercises/kindergarten-garden/garden_test.exs +7 -7
  88. data/tracks/elixir/exercises/largest-series-product/largest_series_product_test.exs +17 -17
  89. data/tracks/elixir/exercises/leap/leap_test.exs +5 -5
  90. data/tracks/elixir/exercises/list-ops/list_ops_test.exs +26 -26
  91. data/tracks/elixir/exercises/luhn/luhn_test.exs +7 -7
  92. data/tracks/elixir/exercises/markdown/markdown_test.exs +10 -10
  93. data/tracks/elixir/exercises/meetup/meetup_test.exs +92 -92
  94. data/tracks/elixir/exercises/minesweeper/minesweeper_test.exs +8 -8
  95. data/tracks/elixir/exercises/nth-prime/nth_prime_test.exs +6 -6
  96. data/tracks/elixir/exercises/nucleotide-count/example.exs +0 -5
  97. data/tracks/elixir/exercises/nucleotide-count/nucleotide_count_test.exs +7 -7
  98. data/tracks/elixir/exercises/palindrome-products/palindrome_products_test.exs +6 -6
  99. data/tracks/elixir/exercises/pangram/pangram_test.exs +11 -11
  100. data/tracks/elixir/exercises/parallel-letter-frequency/parallel_letter_frequency_test.exs +10 -10
  101. data/tracks/elixir/exercises/pascals-triangle/pascals_triangle_test.exs +7 -7
  102. data/tracks/elixir/exercises/phone-number/phone_number_test.exs +10 -10
  103. data/tracks/elixir/exercises/prime-factors/prime_factors_test.exs +13 -13
  104. data/tracks/elixir/exercises/pythagorean-triplet/pythagorean_triplet_test.exs +8 -8
  105. data/tracks/elixir/exercises/queen-attack/queen_attack_test.exs +16 -16
  106. data/tracks/elixir/exercises/rail-fence-cipher/rail_fence_cipher_test.exs +13 -13
  107. data/tracks/elixir/exercises/raindrops/raindrops_test.exs +17 -17
  108. data/tracks/elixir/exercises/rna-transcription/rna_transcription_test.exs +6 -6
  109. data/tracks/elixir/exercises/robot-simulator/robot_simulator_test.exs +6 -6
  110. data/tracks/elixir/exercises/roman-numerals/roman_numerals_test.exs +19 -19
  111. data/tracks/elixir/exercises/run-length-encoding/rle_test.exs +6 -6
  112. data/tracks/elixir/exercises/saddle-points/saddle_points_test.exs +11 -11
  113. data/tracks/elixir/exercises/scrabble-score/scrabble_score_test.exs +9 -9
  114. data/tracks/elixir/exercises/sieve/sieve_test.exs +3 -3
  115. data/tracks/elixir/exercises/space-age/space_age_test.exs +9 -9
  116. data/tracks/elixir/exercises/sublist/sublist_test.exs +20 -20
  117. data/tracks/elixir/exercises/sum-of-multiples/sum_of_multiples_test.exs +11 -11
  118. data/tracks/elixir/exercises/test_helper.exs +1 -1
  119. data/tracks/elixir/exercises/triangle/triangle_test.exs +16 -16
  120. data/tracks/elixir/exercises/word-count/word_count_test.exs +9 -9
  121. data/tracks/elixir/exercises/wordy/wordy_test.exs +16 -16
  122. data/tracks/elixir/exercises/zipper/zipper_test.exs +13 -13
  123. data/tracks/fsharp/build.fsx +2 -7
  124. data/tracks/fsharp/config.json +0 -104
  125. data/tracks/fsharp/exercises/grep/GrepTest.fs +7 -1
  126. data/tracks/go/config.json +1 -0
  127. data/tracks/go/exercises/acronym/acronym_test.go +36 -0
  128. data/tracks/go/exercises/acronym/example.go +21 -0
  129. data/tracks/go/exercises/palindrome-products/example.go +2 -0
  130. data/tracks/go/exercises/palindrome-products/palindrome_products_test.go +10 -0
  131. data/tracks/go/exercises/phone-number/example.go +2 -0
  132. data/tracks/go/exercises/phone-number/phone_number_test.go +44 -27
  133. data/tracks/go/exercises/robot-simulator/defs.go +6 -6
  134. data/tracks/go/exercises/robot-simulator/example.go +22 -22
  135. data/tracks/go/exercises/robot-simulator/robot_simulator_step2_test.go +28 -28
  136. data/tracks/go/exercises/robot-simulator/robot_simulator_step3_test.go +75 -76
  137. data/tracks/go/exercises/robot-simulator/robot_simulator_test.go +10 -4
  138. data/tracks/haskell/exercises/anagram/HINTS.md +22 -0
  139. data/tracks/haskell/exercises/anagram/package.yaml +3 -0
  140. data/tracks/haskell/exercises/anagram/src/Example.hs +10 -7
  141. data/tracks/haskell/exercises/anagram/test/Tests.hs +9 -3
  142. data/tracks/haskell/exercises/beer-song/HINTS.md +18 -0
  143. data/tracks/haskell/exercises/beer-song/src/Beer.hs +301 -3
  144. data/tracks/haskell/exercises/beer-song/src/Example.hs +5 -3
  145. data/tracks/haskell/exercises/beer-song/test/Tests.hs +332 -23
  146. data/tracks/haskell/exercises/crypto-square/src/CryptoSquare.hs +3 -17
  147. data/tracks/haskell/exercises/crypto-square/src/Example.hs +12 -20
  148. data/tracks/haskell/exercises/crypto-square/test/Tests.hs +46 -86
  149. data/tracks/haskell/exercises/leap/HINTS.md +11 -0
  150. data/tracks/haskell/exercises/leap/src/LeapYear.hs +1 -0
  151. data/tracks/java/exercises/pangram/src/test/java/PangramTest.java +34 -4
  152. data/tracks/lua/exercises/pov/pov_spec.lua +0 -13
  153. data/tracks/mips/docs/ABOUT.md +1 -1
  154. data/tracks/objective-c/config.json +225 -0
  155. data/tracks/objective-c/exercises/largest-series-product/LargestSeriesProductExample.h +8 -0
  156. data/tracks/objective-c/exercises/largest-series-product/LargestSeriesProductExample.m +63 -0
  157. data/tracks/objective-c/exercises/largest-series-product/LargestSeriesProductTest.m +84 -0
  158. data/tracks/objective-c/xcodeProject/ObjectiveC.xcodeproj/project.pbxproj +18 -0
  159. data/tracks/ocaml/.travis-ci.sh +23 -0
  160. data/tracks/ocaml/.travis.yml +5 -1
  161. data/tracks/ocaml/Makefile +41 -0
  162. data/tracks/ocaml/config.json +18 -0
  163. data/tracks/ocaml/exercises/anagram/Makefile +1 -0
  164. data/tracks/ocaml/exercises/beer-song/Makefile +1 -0
  165. data/tracks/ocaml/exercises/beer-song/{beer.mli → beer_song.mli} +0 -0
  166. data/tracks/ocaml/exercises/beer-song/example.ml +1 -1
  167. data/tracks/ocaml/exercises/beer-song/test.ml +7 -6
  168. data/tracks/ocaml/exercises/bob/Makefile +1 -0
  169. data/tracks/ocaml/exercises/bowling/Makefile +1 -0
  170. data/tracks/ocaml/exercises/custom-set/Makefile +1 -0
  171. data/tracks/ocaml/exercises/difference-of-squares/.merlin +5 -0
  172. data/tracks/ocaml/exercises/difference-of-squares/Makefile +11 -0
  173. data/tracks/ocaml/exercises/difference-of-squares/difference_of_squares.mli +8 -0
  174. data/tracks/ocaml/exercises/difference-of-squares/example.ml +21 -0
  175. data/tracks/ocaml/exercises/difference-of-squares/test.ml +32 -0
  176. data/tracks/ocaml/exercises/grade-school/Makefile +1 -0
  177. data/tracks/ocaml/exercises/grade-school/{school.mli → grade_school.mli} +0 -0
  178. data/tracks/ocaml/exercises/grade-school/test.ml +27 -27
  179. data/tracks/ocaml/exercises/hamming/Makefile +1 -0
  180. data/tracks/ocaml/exercises/hangman/Makefile +1 -0
  181. data/tracks/ocaml/exercises/hello-world/Makefile +1 -1
  182. data/tracks/ocaml/exercises/hello-world/{hello.ml → hello_world.ml} +0 -0
  183. data/tracks/ocaml/exercises/hello-world/{hello.mli → hello_world.mli} +0 -0
  184. data/tracks/ocaml/exercises/hello-world/test.ml +1 -1
  185. data/tracks/ocaml/exercises/hexadecimal/Makefile +1 -0
  186. data/tracks/ocaml/exercises/leap/Makefile +1 -1
  187. data/tracks/ocaml/exercises/list-ops/Makefile +1 -0
  188. data/tracks/ocaml/exercises/luhn/Makefile +1 -0
  189. data/tracks/ocaml/exercises/minesweeper/Makefile +1 -0
  190. data/tracks/ocaml/exercises/nucleotide-count/Makefile +1 -0
  191. data/tracks/ocaml/exercises/nucleotide-count/{dna.mli → nucleotide_count.mli} +0 -0
  192. data/tracks/ocaml/exercises/nucleotide-count/test.ml +7 -7
  193. data/tracks/ocaml/exercises/phone-number/Makefile +1 -0
  194. data/tracks/ocaml/exercises/phone-number/{phone.mli → phone_number.mli} +0 -0
  195. data/tracks/ocaml/exercises/phone-number/test.ml +10 -10
  196. data/tracks/ocaml/exercises/point-mutations/Makefile +8 -0
  197. data/tracks/ocaml/exercises/point-mutations/example.ml +0 -0
  198. data/tracks/ocaml/exercises/prime-factors/Makefile +1 -0
  199. data/tracks/ocaml/exercises/raindrops/.merlin +5 -0
  200. data/tracks/ocaml/exercises/raindrops/Makefile +11 -0
  201. data/tracks/ocaml/exercises/raindrops/example.ml +11 -0
  202. data/tracks/ocaml/exercises/raindrops/raindrops.mli +7 -0
  203. data/tracks/ocaml/exercises/raindrops/test.ml +48 -0
  204. data/tracks/ocaml/exercises/rna-transcription/Makefile +1 -0
  205. data/tracks/ocaml/exercises/rna-transcription/{dna.mli → rna_transcription.mli} +0 -0
  206. data/tracks/ocaml/exercises/rna-transcription/test.ml +6 -6
  207. data/tracks/ocaml/exercises/roman-numerals/Makefile +1 -0
  208. data/tracks/ocaml/exercises/say/.gitignore +1 -0
  209. data/tracks/ocaml/exercises/say/.merlin +5 -0
  210. data/tracks/ocaml/exercises/say/Makefile +11 -0
  211. data/tracks/ocaml/exercises/say/example.ml +52 -0
  212. data/tracks/ocaml/exercises/say/say.mli +8 -0
  213. data/tracks/ocaml/exercises/say/test.ml +65 -0
  214. data/tracks/ocaml/exercises/space-age/Makefile +1 -0
  215. data/tracks/ocaml/exercises/word-count/Makefile +1 -0
  216. data/tracks/ocaml/exercises/word-count/example.ml +1 -1
  217. data/tracks/ocaml/exercises/zipper/HINT.md +5 -6
  218. data/tracks/ocaml/exercises/zipper/Makefile +1 -0
  219. data/tracks/ocaml/exercises/zipper/example.ml +2 -2
  220. data/tracks/ocaml/exercises/zipper/tree.ml +1 -1
  221. data/tracks/php/config.json +7 -1
  222. data/tracks/php/exercises/variable-length-quantity/example.php +56 -0
  223. data/tracks/php/exercises/variable-length-quantity/variable-length-quantity_test.php +149 -0
  224. data/tracks/python/config.json +1 -1
  225. data/tracks/ruby/.rubocop.yml +1915 -26
  226. data/tracks/ruby/bin/generate-acronym +7 -0
  227. data/tracks/ruby/bin/generate-nth-prime +7 -0
  228. data/tracks/ruby/config.json +482 -0
  229. data/tracks/ruby/exercises/acronym/.version +1 -0
  230. data/tracks/ruby/exercises/acronym/acronym_test.rb +45 -21
  231. data/tracks/ruby/exercises/acronym/example.rb +1 -1
  232. data/tracks/ruby/exercises/acronym/example.tt +19 -0
  233. data/tracks/ruby/exercises/anagram/anagram_test.rb +1 -1
  234. data/tracks/ruby/exercises/nth-prime/.version +1 -0
  235. data/tracks/ruby/exercises/nth-prime/example.rb +4 -0
  236. data/tracks/ruby/exercises/nth-prime/example.tt +23 -0
  237. data/tracks/ruby/exercises/nth-prime/nth_prime_test.rb +33 -10
  238. data/tracks/ruby/exercises/raindrops/.version +1 -1
  239. data/tracks/ruby/exercises/raindrops/example.rb +1 -1
  240. data/tracks/ruby/exercises/raindrops/raindrops_test.rb +20 -5
  241. data/tracks/ruby/lib/acronym_cases.rb +19 -0
  242. data/tracks/ruby/lib/generator.rb +3 -2
  243. data/tracks/ruby/lib/nth_prime_cases.rb +23 -0
  244. data/tracks/ruby/lib/raindrop_cases.rb +1 -1
  245. data/tracks/rust/README.md +1 -1
  246. data/tracks/scala/exercises/leap/src/test/scala/leap_test.scala +10 -0
  247. data/tracks/scala/exercises/prime-factors/example.scala +2 -5
  248. data/tracks/scala/exercises/prime-factors/src/test/scala/primefactors_test.scala +11 -13
  249. data/tracks/scheme/{anagram → exercises/anagram}/anagram-test.scm +0 -0
  250. data/tracks/scheme/{anagram → exercises/anagram}/anagram.scm +0 -0
  251. data/tracks/scheme/{anagram → exercises/anagram}/example.scm +0 -0
  252. data/tracks/scheme/{bob → exercises/bob}/bob-test.scm +0 -0
  253. data/tracks/scheme/{bob → exercises/bob}/bob.scm +0 -0
  254. data/tracks/scheme/{bob → exercises/bob}/example.scm +0 -0
  255. data/tracks/scheme/{difference-of-squares → exercises/difference-of-squares}/difference-of-squares-test.scm +0 -0
  256. data/tracks/scheme/{difference-of-squares → exercises/difference-of-squares}/example.scm +0 -0
  257. data/tracks/scheme/{difference-of-squares → exercises/difference-of-squares}/squares.scm +0 -0
  258. data/tracks/scheme/{grains → exercises/grains}/example.scm +0 -0
  259. data/tracks/scheme/{grains → exercises/grains}/grains-test.scm +0 -0
  260. data/tracks/scheme/{grains → exercises/grains}/grains.scm +0 -0
  261. data/tracks/scheme/{hamming → exercises/hamming}/example.scm +0 -0
  262. data/tracks/scheme/{hamming → exercises/hamming}/hamming-test.scm +0 -0
  263. data/tracks/scheme/{hamming → exercises/hamming}/hamming.scm +0 -0
  264. data/tracks/scheme/{hello-world → exercises/hello-world}/example.scm +0 -0
  265. data/tracks/scheme/{hello-world → exercises/hello-world}/hello-world-test.scm +0 -0
  266. data/tracks/scheme/{hello-world → exercises/hello-world}/hello-world.scm +0 -0
  267. data/tracks/scheme/{leap → exercises/leap}/example.scm +0 -0
  268. data/tracks/scheme/{leap → exercises/leap}/leap-test.scm +0 -0
  269. data/tracks/scheme/{leap → exercises/leap}/leap-year.scm +0 -0
  270. data/tracks/scheme/{list-ops → exercises/list-ops}/example.scm +0 -0
  271. data/tracks/scheme/{list-ops → exercises/list-ops}/list-ops-test.scm +0 -0
  272. data/tracks/scheme/{list-ops → exercises/list-ops}/list-ops.scm +0 -0
  273. data/tracks/scheme/{nucleotide-count → exercises/nucleotide-count}/example.scm +0 -0
  274. data/tracks/scheme/{nucleotide-count → exercises/nucleotide-count}/nucleotide-count-test.scm +0 -0
  275. data/tracks/scheme/{nucleotide-count → exercises/nucleotide-count}/nucleotide-count.scm +0 -0
  276. data/tracks/scheme/{phone-number → exercises/phone-number}/example.scm +0 -0
  277. data/tracks/scheme/{phone-number → exercises/phone-number}/phone-number-test.scm +0 -0
  278. data/tracks/scheme/{phone-number → exercises/phone-number}/phone-number.scm +0 -0
  279. data/tracks/scheme/{raindrops → exercises/raindrops}/example.scm +0 -0
  280. data/tracks/scheme/{raindrops → exercises/raindrops}/raindrops-test.scm +0 -0
  281. data/tracks/scheme/{raindrops → exercises/raindrops}/raindrops.scm +0 -0
  282. data/tracks/scheme/{rna-transcription → exercises/rna-transcription}/dna.scm +0 -0
  283. data/tracks/scheme/{rna-transcription → exercises/rna-transcription}/example.scm +0 -0
  284. data/tracks/scheme/{rna-transcription → exercises/rna-transcription}/rna-transcription-test.scm +0 -0
  285. data/tracks/scheme/{robot-name → exercises/robot-name}/example.scm +0 -0
  286. data/tracks/scheme/{robot-name → exercises/robot-name}/robot-name-test.scm +0 -0
  287. data/tracks/scheme/{robot-name → exercises/robot-name}/robot.scm +0 -0
  288. metadata +125 -64
@@ -4,10 +4,10 @@ import "fmt"
4
4
 
5
5
  // definitions used in step 1
6
6
 
7
- var (
7
+ var Step1Robot struct {
8
8
  X, Y int
9
- Facing Dir
10
- )
9
+ Dir
10
+ }
11
11
 
12
12
  type Dir int
13
13
 
@@ -19,14 +19,14 @@ type Command byte // valid values are 'R', 'L', 'A'
19
19
  type RU int
20
20
  type Pos struct{ Easting, Northing RU }
21
21
  type Rect struct{ Min, Max Pos }
22
- type DirAt struct {
22
+ type Step2Robot struct {
23
23
  Dir
24
24
  Pos
25
25
  }
26
26
 
27
27
  // additional definition used in step 3
28
28
 
29
- type Place struct {
29
+ type Step3Robot struct {
30
30
  Name string
31
- DirAt
31
+ Step2Robot
32
32
  }
@@ -3,7 +3,7 @@ package robot
3
3
  import "fmt"
4
4
 
5
5
  // ======= Step 1
6
-
6
+ const testVersion = 3
7
7
  const (
8
8
  N Dir = iota
9
9
  E
@@ -15,13 +15,13 @@ func (d Dir) String() string {
15
15
  return "NESW"[d : d+1]
16
16
  }
17
17
 
18
- func Right() { Facing = (Facing + 1) % 4 }
19
- func Left() { Facing = (Facing + 3) % 4 }
18
+ func Right() { Step1Robot.Dir = (Step1Robot.Dir + 1) % 4 }
19
+ func Left() { Step1Robot.Dir = (Step1Robot.Dir + 3) % 4 }
20
20
  func Advance() {
21
- if Facing&1 == 1 {
22
- X += 1 - int(Facing&2)
21
+ if Step1Robot.Dir&1 == 1 {
22
+ Step1Robot.X += 1 - int(Step1Robot.Dir&2)
23
23
  } else {
24
- Y += 1 - int(Facing&2)
24
+ Step1Robot.Y += 1 - int(Step1Robot.Dir&2)
25
25
  }
26
26
  }
27
27
 
@@ -29,33 +29,33 @@ func Advance() {
29
29
 
30
30
  type Action byte
31
31
 
32
- func Robot(cmd chan Command, act chan Action) {
32
+ func StartRobot(cmd chan Command, act chan Action) {
33
33
  for c := range cmd {
34
34
  act <- Action(c)
35
35
  }
36
36
  close(act)
37
37
  }
38
38
 
39
- func Room(extent Rect, place DirAt, act chan Action, report chan DirAt) {
39
+ func Room(extent Rect, robot Step2Robot, act chan Action, report chan Step2Robot) {
40
40
  for a := range act {
41
41
  switch a {
42
42
  case 'R':
43
- place.Dir = (place.Dir + 1) % 4
43
+ robot.Dir = (robot.Dir + 1) % 4
44
44
  case 'L':
45
- place.Dir = (place.Dir + 3) % 4
45
+ robot.Dir = (robot.Dir + 3) % 4
46
46
  case 'A':
47
- np := place.Pos
48
- if place.Dir&1 == 1 {
49
- np.Easting += 1 - RU(place.Dir&2)
47
+ np := robot.Pos
48
+ if robot.Dir&1 == 1 {
49
+ np.Easting += 1 - RU(robot.Dir&2)
50
50
  } else {
51
- np.Northing += 1 - RU(place.Dir&2)
51
+ np.Northing += 1 - RU(robot.Dir&2)
52
52
  }
53
53
  if in(np, extent) {
54
- place.Pos = np
54
+ robot.Pos = np
55
55
  }
56
56
  }
57
57
  }
58
- report <- place
58
+ report <- robot
59
59
  }
60
60
 
61
61
  func in(p Pos, ext Rect) bool {
@@ -72,14 +72,14 @@ type Action3 struct {
72
72
 
73
73
  const beep = 7 // robots beep to communicate that they are done
74
74
 
75
- func Robot3(name, script string, act chan Action3, log chan string) {
75
+ func StartRobot3(name, script string, act chan Action3, log chan string) {
76
76
  for i := 0; i < len(script); i++ {
77
77
  act <- Action3{name, script[i]}
78
78
  }
79
79
  act <- Action3{name, beep}
80
80
  }
81
81
 
82
- func Room3(extent Rect, robots []Place, act chan Action3, rep chan []Place, log chan string) {
82
+ func Room3(extent Rect, robots []Step3Robot, act chan Action3, rep chan []Step3Robot, log chan string) {
83
83
  // The function has multiple returns. No matter what, rep <- is how we
84
84
  // communicate to the test program that the room is terminating.
85
85
  defer func() { rep <- robots }()
@@ -96,15 +96,15 @@ func Room3(extent Rect, robots []Place, act chan Action3, rep chan []Place, log
96
96
  }
97
97
  nx[r.Name] = x
98
98
 
99
- if !in(r.DirAt.Pos, extent) {
99
+ if !in(r.Step2Robot.Pos, extent) {
100
100
  log <- "Robot placed outside room"
101
101
  return
102
102
  }
103
- if _, ok := px[r.DirAt.Pos]; ok {
103
+ if _, ok := px[r.Step2Robot.Pos]; ok {
104
104
  log <- "Position occupied"
105
105
  return
106
106
  }
107
- px[r.DirAt.Pos] = x
107
+ px[r.Step2Robot.Pos] = x
108
108
  }
109
109
  done := 0
110
110
  for a := range act {
@@ -113,7 +113,7 @@ func Room3(extent Rect, robots []Place, act chan Action3, rep chan []Place, log
113
113
  log <- "Action by unknown robot"
114
114
  return
115
115
  }
116
- da := &robots[x].DirAt
116
+ da := &robots[x].Step2Robot
117
117
  switch a.action {
118
118
  case 'R':
119
119
  da.Dir = (da.Dir + 1) % 4
@@ -12,7 +12,7 @@ import "testing"
12
12
  // Step 2 introduces a "room." It seems a small addition, but we'll make
13
13
  // big changes to clarify the rolls of "room", "robot", and "test program"
14
14
  // and begin to clarify the physics of the simulation. You will define Room
15
- // and Robot as functions which the test program "brings into existance" by
15
+ // and Robot as functions which the test program "brings into existence" by
16
16
  // launching them as goroutines. Information moves between test program,
17
17
  // robot, and room over Go channels.
18
18
  //
@@ -21,12 +21,12 @@ import "testing"
21
21
  // coordinate space of the room, the location of the robot and the walls,
22
22
  // and ensure for example that the robot doesn't walk through walls.
23
23
  // We want Robot to be an agent that performs actions, but we want Room to
24
- // maintain a coherrent truth.
24
+ // maintain a coherent truth.
25
25
  //
26
26
  // Step 2 API:
27
27
  //
28
- // Robot(chan Command, chan Action)
29
- // Room(extent Rect, place DirAt, act chan Action, rep chan DirAt)
28
+ // StartRobot(chan Command, chan Action)
29
+ // Room(extent Rect, robot Step2Robot, act chan Action, rep chan Step2Robot)
30
30
  //
31
31
  // You get to define Action; see defs.go for other definitions.
32
32
  //
@@ -41,27 +41,27 @@ import "testing"
41
41
 
42
42
  var test2 = []struct {
43
43
  Command
44
- DirAt
44
+ Step2Robot
45
45
  }{
46
- 0: {' ', DirAt{N, Pos{1, 1}}}, // no command, this is the start DirAt
47
- 1: {'A', DirAt{N, Pos{1, 2}}},
48
- 2: {'R', DirAt{E, Pos{1, 2}}},
49
- 3: {'A', DirAt{E, Pos{2, 2}}},
50
- 4: {'L', DirAt{N, Pos{2, 2}}},
51
- 5: {'L', DirAt{W, Pos{2, 2}}},
52
- 6: {'L', DirAt{S, Pos{2, 2}}},
53
- 7: {'A', DirAt{S, Pos{2, 1}}},
54
- 8: {'R', DirAt{W, Pos{2, 1}}},
55
- 9: {'A', DirAt{W, Pos{1, 1}}},
56
- 10: {'A', DirAt{W, Pos{1, 1}}}, // bump W wall
57
- 11: {'L', DirAt{S, Pos{1, 1}}},
58
- 12: {'A', DirAt{S, Pos{1, 1}}}, // bump S wall
59
- 13: {'L', DirAt{E, Pos{1, 1}}},
60
- 14: {'A', DirAt{E, Pos{2, 1}}},
61
- 15: {'A', DirAt{E, Pos{2, 1}}}, // bump E wall
62
- 16: {'L', DirAt{N, Pos{2, 1}}},
63
- 17: {'A', DirAt{N, Pos{2, 2}}},
64
- 18: {'A', DirAt{N, Pos{2, 2}}}, // bump N wall
46
+ 0: {' ', Step2Robot{N, Pos{1, 1}}}, // no command, this is the start DirAt
47
+ 1: {'A', Step2Robot{N, Pos{1, 2}}},
48
+ 2: {'R', Step2Robot{E, Pos{1, 2}}},
49
+ 3: {'A', Step2Robot{E, Pos{2, 2}}},
50
+ 4: {'L', Step2Robot{N, Pos{2, 2}}},
51
+ 5: {'L', Step2Robot{W, Pos{2, 2}}},
52
+ 6: {'L', Step2Robot{S, Pos{2, 2}}},
53
+ 7: {'A', Step2Robot{S, Pos{2, 1}}},
54
+ 8: {'R', Step2Robot{W, Pos{2, 1}}},
55
+ 9: {'A', Step2Robot{W, Pos{1, 1}}},
56
+ 10: {'A', Step2Robot{W, Pos{1, 1}}}, // bump W wall
57
+ 11: {'L', Step2Robot{S, Pos{1, 1}}},
58
+ 12: {'A', Step2Robot{S, Pos{1, 1}}}, // bump S wall
59
+ 13: {'L', Step2Robot{E, Pos{1, 1}}},
60
+ 14: {'A', Step2Robot{E, Pos{2, 1}}},
61
+ 15: {'A', Step2Robot{E, Pos{2, 1}}}, // bump E wall
62
+ 16: {'L', Step2Robot{N, Pos{2, 1}}},
63
+ 17: {'A', Step2Robot{N, Pos{2, 2}}},
64
+ 18: {'A', Step2Robot{N, Pos{2, 2}}}, // bump N wall
65
65
  }
66
66
 
67
67
  func TestStep2(t *testing.T) {
@@ -69,16 +69,16 @@ func TestStep2(t *testing.T) {
69
69
  for i := 1; i <= len(test2); i++ {
70
70
  cmd := make(chan Command)
71
71
  act := make(chan Action)
72
- rep := make(chan DirAt)
73
- go Robot(cmd, act)
74
- go Room(Rect{Pos{1, 1}, Pos{2, 2}}, test2[0].DirAt, act, rep)
72
+ rep := make(chan Step2Robot)
73
+ go StartRobot(cmd, act)
74
+ go Room(Rect{Pos{1, 1}, Pos{2, 2}}, test2[0].Step2Robot, act, rep)
75
75
  for j := 1; j < i; j++ {
76
76
  cmd <- test2[j].Command
77
77
  }
78
78
  close(cmd)
79
79
  da := <-rep
80
80
  last := i - 1
81
- want := test2[last].DirAt
81
+ want := test2[last].Step2Robot
82
82
  if da.Pos != want.Pos {
83
83
  t.Fatalf("Command #%d, Pos = %v, want %v", last, da.Pos, want.Pos)
84
84
  }
@@ -12,14 +12,13 @@ import "testing"
12
12
  //
13
13
  // Step 3 API:
14
14
  //
15
- // Robot3(name, script string, action chan Action3, log chan string)
16
- // Room3(extent Rect, robots []Place,
17
- // action chan Action3, report chan []Place, log chan string)
15
+ // StartRobot3(name, script string, action chan Action3, log chan string)
16
+ // Room3(extent Rect, robots []Step3Robot, action chan Action3, report chan []Step3Robot, log chan string)
18
17
  //
19
18
  // Again, you define Action3.
20
19
  //
21
- // For the final position report sent from Room3, you can return the same slice
22
- // recieved from the robots channel, just with updated positions and directions.
20
+ // For the final position report sent from StartRobot3, you can return the same slice
21
+ // received from the robots channel, just with updated positions and directions.
23
22
  //
24
23
  // Messages must be sent on the log channel for
25
24
  // * A robot without a name
@@ -33,29 +32,29 @@ import "testing"
33
32
 
34
33
  var testOneRobot = []struct {
35
34
  cmd byte
36
- DirAt
35
+ Step2Robot
37
36
  nMsg int
38
37
  }{
39
38
  // (test2 data with message counts added)
40
- {' ', DirAt{N, Pos{1, 1}}, 0},
41
- {'A', DirAt{N, Pos{1, 2}}, 0},
42
- {'R', DirAt{E, Pos{1, 2}}, 0},
43
- {'A', DirAt{E, Pos{2, 2}}, 0},
44
- {'L', DirAt{N, Pos{2, 2}}, 0},
45
- {'L', DirAt{W, Pos{2, 2}}, 0},
46
- {'L', DirAt{S, Pos{2, 2}}, 0},
47
- {'A', DirAt{S, Pos{2, 1}}, 0},
48
- {'R', DirAt{W, Pos{2, 1}}, 0},
49
- {'A', DirAt{W, Pos{1, 1}}, 0},
50
- {'A', DirAt{W, Pos{1, 1}}, 1}, // bump W wall
51
- {'L', DirAt{S, Pos{1, 1}}, 1},
52
- {'A', DirAt{S, Pos{1, 1}}, 2}, // bump S wall
53
- {'L', DirAt{E, Pos{1, 1}}, 2},
54
- {'A', DirAt{E, Pos{2, 1}}, 2},
55
- {'A', DirAt{E, Pos{2, 1}}, 3}, // bump E wall
56
- {'L', DirAt{N, Pos{2, 1}}, 3},
57
- {'A', DirAt{N, Pos{2, 2}}, 3},
58
- {'A', DirAt{N, Pos{2, 2}}, 4}, // bump N wall
39
+ {' ', Step2Robot{N, Pos{1, 1}}, 0},
40
+ {'A', Step2Robot{N, Pos{1, 2}}, 0},
41
+ {'R', Step2Robot{E, Pos{1, 2}}, 0},
42
+ {'A', Step2Robot{E, Pos{2, 2}}, 0},
43
+ {'L', Step2Robot{N, Pos{2, 2}}, 0},
44
+ {'L', Step2Robot{W, Pos{2, 2}}, 0},
45
+ {'L', Step2Robot{S, Pos{2, 2}}, 0},
46
+ {'A', Step2Robot{S, Pos{2, 1}}, 0},
47
+ {'R', Step2Robot{W, Pos{2, 1}}, 0},
48
+ {'A', Step2Robot{W, Pos{1, 1}}, 0},
49
+ {'A', Step2Robot{W, Pos{1, 1}}, 1}, // bump W wall
50
+ {'L', Step2Robot{S, Pos{1, 1}}, 1},
51
+ {'A', Step2Robot{S, Pos{1, 1}}, 2}, // bump S wall
52
+ {'L', Step2Robot{E, Pos{1, 1}}, 2},
53
+ {'A', Step2Robot{E, Pos{2, 1}}, 2},
54
+ {'A', Step2Robot{E, Pos{2, 1}}, 3}, // bump E wall
55
+ {'L', Step2Robot{N, Pos{2, 1}}, 3},
56
+ {'A', Step2Robot{N, Pos{2, 2}}, 3},
57
+ {'A', Step2Robot{N, Pos{2, 2}}, 4}, // bump N wall
59
58
  }
60
59
 
61
60
  func logMon(log chan string, nMsg chan int, t *testing.T) {
@@ -74,17 +73,17 @@ func TestOneStep3(t *testing.T) {
74
73
  nMsg := make(chan int)
75
74
  go logMon(log, nMsg, t)
76
75
  act := make(chan Action3)
77
- rep := make(chan []Place)
76
+ rep := make(chan []Step3Robot)
78
77
  go Room3(
79
78
  Rect{Pos{1, 1}, Pos{2, 2}},
80
- []Place{{"Robbie", testOneRobot[0].DirAt}},
79
+ []Step3Robot{{"Robbie", testOneRobot[0].Step2Robot}},
81
80
  act, rep, log)
82
81
  scr := ""
83
82
  for j := 1; j < i; j++ {
84
83
  scr += string(testOneRobot[j].cmd)
85
84
  }
86
85
  t.Logf("Script %q", scr)
87
- go Robot3("Robbie", scr, act, log)
86
+ go StartRobot3("Robbie", scr, act, log)
88
87
  pls := <-rep
89
88
  lastTest := testOneRobot[i-1]
90
89
  if len(pls) != 1 {
@@ -95,8 +94,8 @@ func TestOneStep3(t *testing.T) {
95
94
  t.Fatalf(`Got report for robot %q, want report for "Robbie".`,
96
95
  pl.Name)
97
96
  }
98
- da := pl.DirAt
99
- want := lastTest.DirAt
97
+ da := pl.Step2Robot
98
+ want := lastTest.Step2Robot
100
99
  if da.Pos != want.Pos {
101
100
  t.Fatalf("Script %q, Pos = %v, want %v", scr, da.Pos, want.Pos)
102
101
  }
@@ -115,12 +114,12 @@ func TestNoName(t *testing.T) {
115
114
  nMsg := make(chan int)
116
115
  go logMon(log, nMsg, t)
117
116
  act := make(chan Action3)
118
- rep := make(chan []Place)
117
+ rep := make(chan []Step3Robot)
119
118
  go Room3(
120
119
  Rect{Pos{1, 1}, Pos{1, 1}},
121
- []Place{{"", DirAt{N, Pos{1, 1}}}},
120
+ []Step3Robot{{"", Step2Robot{N, Pos{1, 1}}}},
122
121
  act, rep, log)
123
- go Robot3("", "", act, log)
122
+ go StartRobot3("", "", act, log)
124
123
  <-rep
125
124
  close(log)
126
125
  if n := <-nMsg; n != 1 {
@@ -133,16 +132,16 @@ func TestSameName(t *testing.T) {
133
132
  nMsg := make(chan int)
134
133
  go logMon(log, nMsg, t)
135
134
  act := make(chan Action3)
136
- rep := make(chan []Place)
135
+ rep := make(chan []Step3Robot)
137
136
  go Room3(
138
137
  Rect{Pos{1, 1}, Pos{2, 1}},
139
- []Place{
140
- {"Daryl", DirAt{N, Pos{1, 1}}},
141
- {"Daryl", DirAt{N, Pos{2, 1}}},
138
+ []Step3Robot{
139
+ {"Daryl", Step2Robot{N, Pos{1, 1}}},
140
+ {"Daryl", Step2Robot{N, Pos{2, 1}}},
142
141
  },
143
142
  act, rep, log)
144
- go Robot3("Daryl", "", act, log)
145
- go Robot3("Daryl", "", act, log)
143
+ go StartRobot3("Daryl", "", act, log)
144
+ go StartRobot3("Daryl", "", act, log)
146
145
  <-rep
147
146
  close(log)
148
147
  if n := <-nMsg; n != 1 {
@@ -155,16 +154,16 @@ func TestSamePosition(t *testing.T) {
155
154
  nMsg := make(chan int)
156
155
  go logMon(log, nMsg, t)
157
156
  act := make(chan Action3)
158
- rep := make(chan []Place)
157
+ rep := make(chan []Step3Robot)
159
158
  go Room3(
160
159
  Rect{Pos{1, 1}, Pos{100, 100}},
161
- []Place{
162
- {"Matter", DirAt{N, Pos{23, 47}}},
163
- {"Antimatter", DirAt{N, Pos{23, 47}}},
160
+ []Step3Robot{
161
+ {"Matter", Step2Robot{N, Pos{23, 47}}},
162
+ {"Antimatter", Step2Robot{N, Pos{23, 47}}},
164
163
  },
165
164
  act, rep, log)
166
- go Robot3("Matter", "", act, log)
167
- go Robot3("Animatter", "", act, log)
165
+ go StartRobot3("Matter", "", act, log)
166
+ go StartRobot3("Antimatter", "", act, log)
168
167
  <-rep
169
168
  close(log)
170
169
  if n := <-nMsg; n != 1 {
@@ -177,12 +176,12 @@ func TestOutsideRoom(t *testing.T) {
177
176
  nMsg := make(chan int)
178
177
  go logMon(log, nMsg, t)
179
178
  act := make(chan Action3)
180
- rep := make(chan []Place)
179
+ rep := make(chan []Step3Robot)
181
180
  go Room3(
182
181
  Rect{Pos{1, 1}, Pos{1, 1}},
183
- []Place{{"Elvis", DirAt{N, Pos{2, 3}}}},
182
+ []Step3Robot{{"Elvis", Step2Robot{N, Pos{2, 3}}}},
184
183
  act, rep, log)
185
- go Robot3("Elvis", "", act, log)
184
+ go StartRobot3("Elvis", "", act, log)
186
185
  <-rep
187
186
  close(log)
188
187
  if n := <-nMsg; n != 1 {
@@ -195,12 +194,12 @@ func TestBadCommand(t *testing.T) {
195
194
  nMsg := make(chan int)
196
195
  go logMon(log, nMsg, t)
197
196
  act := make(chan Action3)
198
- rep := make(chan []Place)
197
+ rep := make(chan []Step3Robot)
199
198
  go Room3(
200
199
  Rect{Pos{0, 0}, Pos{0, 99}},
201
- []Place{{"Vgr", DirAt{N, Pos{0, 99}}}},
200
+ []Step3Robot{{"Vgr", Step2Robot{N, Pos{0, 99}}}},
202
201
  act, rep, log)
203
- go Robot3("Vgr", "RET", act, log)
202
+ go StartRobot3("Vgr", "RET", act, log)
204
203
  <-rep
205
204
  close(log)
206
205
  if n := <-nMsg; n != 1 {
@@ -213,12 +212,12 @@ func TestBadRobot(t *testing.T) {
213
212
  nMsg := make(chan int)
214
213
  go logMon(log, nMsg, t)
215
214
  act := make(chan Action3)
216
- rep := make(chan []Place)
215
+ rep := make(chan []Step3Robot)
217
216
  go Room3(
218
217
  Rect{Pos{0, 0}, Pos{0, 0}},
219
- []Place{{"Data", DirAt{N, Pos{0, 0}}}},
218
+ []Step3Robot{{"Data", Step2Robot{N, Pos{0, 0}}}},
220
219
  act, rep, log)
221
- go Robot3("Lore", "A", act, log)
220
+ go StartRobot3("Lore", "A", act, log)
222
221
  <-rep
223
222
  close(log)
224
223
  if n := <-nMsg; n != 1 {
@@ -231,16 +230,16 @@ func TestThree(t *testing.T) { // no bumping
231
230
  nMsg := make(chan int)
232
231
  go logMon(log, nMsg, t)
233
232
  act := make(chan Action3)
234
- go Robot3("clutz", "LAAARALA", act, log)
235
- go Robot3("sphero", "RRAAAAALA", act, log)
236
- go Robot3("roomba", "LAAARRRALLLL", act, log)
237
- rep := make(chan []Place)
233
+ go StartRobot3("clutz", "LAAARALA", act, log)
234
+ go StartRobot3("sphero", "RRAAAAALA", act, log)
235
+ go StartRobot3("roomba", "LAAARRRALLLL", act, log)
236
+ rep := make(chan []Step3Robot)
238
237
  go Room3(
239
238
  Rect{Pos{-10, -10}, Pos{15, 10}},
240
- []Place{
241
- {"clutz", DirAt{N, Pos{0, 0}}},
242
- {"sphero", DirAt{E, Pos{2, -7}}},
243
- {"roomba", DirAt{S, Pos{8, 4}}},
239
+ []Step3Robot{
240
+ {"clutz", Step2Robot{N, Pos{0, 0}}},
241
+ {"sphero", Step2Robot{E, Pos{2, -7}}},
242
+ {"roomba", Step2Robot{S, Pos{8, 4}}},
244
243
  },
245
244
  act, rep, log)
246
245
  pls := <-rep
@@ -248,22 +247,22 @@ func TestThree(t *testing.T) { // no bumping
248
247
  t.Fatalf("Got report on %d robots, want 3.", len(pls))
249
248
  }
250
249
  exp:
251
- for _, exp := range []Place{
252
- {"clutz", DirAt{W, Pos{-4, 1}}},
253
- {"sphero", DirAt{S, Pos{-3, -8}}},
254
- {"roomba", DirAt{N, Pos{11, 5}}},
250
+ for _, exp := range []Step3Robot{
251
+ {"clutz", Step2Robot{W, Pos{-4, 1}}},
252
+ {"sphero", Step2Robot{S, Pos{-3, -8}}},
253
+ {"roomba", Step2Robot{N, Pos{11, 5}}},
255
254
  } {
256
255
  for _, pl := range pls {
257
256
  if pl.Name != exp.Name {
258
257
  continue
259
258
  }
260
- if pl.DirAt.Pos != exp.DirAt.Pos {
259
+ if pl.Step2Robot.Pos != exp.Step2Robot.Pos {
261
260
  t.Fatalf("%s at %v, want %v",
262
- pl.Name, pl.DirAt.Pos, exp.DirAt.Pos)
261
+ pl.Name, pl.Step2Robot.Pos, exp.Step2Robot.Pos)
263
262
  }
264
- if pl.DirAt.Dir != exp.DirAt.Dir {
263
+ if pl.Step2Robot.Dir != exp.Step2Robot.Dir {
265
264
  t.Fatalf("%s facing %v, want %v",
266
- pl.Name, pl.DirAt.Dir, exp.DirAt.Dir)
265
+ pl.Name, pl.Step2Robot.Dir, exp.Step2Robot.Dir)
267
266
  }
268
267
  continue exp
269
268
  }
@@ -276,14 +275,14 @@ func TestBattle(t *testing.T) {
276
275
  nMsg := make(chan int)
277
276
  go logMon(log, nMsg, t)
278
277
  act := make(chan Action3)
279
- go Robot3("Toro", "AAAAAAA", act, log)
280
- go Robot3("Phere", "AAAAAAA", act, log)
281
- rep := make(chan []Place)
278
+ go StartRobot3("Toro", "AAAAAAA", act, log)
279
+ go StartRobot3("Phere", "AAAAAAA", act, log)
280
+ rep := make(chan []Step3Robot)
282
281
  go Room3(
283
282
  Rect{Pos{1, 1}, Pos{9, 9}},
284
- []Place{
285
- {"Toro", DirAt{E, Pos{1, 5}}},
286
- {"Phere", DirAt{W, Pos{9, 5}}},
283
+ []Step3Robot{
284
+ {"Toro", Step2Robot{E, Pos{1, 5}}},
285
+ {"Phere", Step2Robot{W, Pos{9, 5}}},
287
286
  },
288
287
  act, rep, log)
289
288
  <-rep