Commit Graph

30 Commits (main)

Author SHA1 Message Date
Daniel Barlow fb3be522a0 remove more destructuring 2023-01-23 22:42:56 +00:00
Daniel Barlow 65e298c82c extract lateral? function 2023-01-23 22:39:06 +00:00
Daniel Barlow 1dd77f9657 remove unneeded destructuring 2023-01-23 22:37:56 +00:00
Daniel Barlow 2dfc7ac5e4 move obstacle checking down from command to drive 2023-01-23 22:34:14 +00:00
Daniel Barlow 689fb894ad report position of the obstacle when stopped 2023-01-23 22:22:12 +00:00
Daniel Barlow dc9088ffa5 implement collision detection 2023-01-23 22:17:58 +00:00
Daniel Barlow 8b638fcc18 move expect macro nearer its first use 2023-01-22 22:09:34 +00:00
Daniel Barlow 64c9fd7b88 handle north pole 2023-01-22 22:05:14 +00:00
Daniel Barlow 4b1f2ee923 add test for southern hemisphere 2023-01-22 21:39:56 +00:00
Daniel Barlow 33243ca123 mars is a sphere: account for wrapping x values and scaling when y>0 2023-01-22 21:37:53 +00:00
Daniel Barlow bcd833e26b avoid resultant lateral movement except at equator
if x and y represent lat/long, the angular distance we move
along the lines of longitude will vary depending on latitude.
2023-01-22 19:07:25 +00:00
Daniel Barlow 570fe8dadc test list for wrapping around a sphere 2023-01-22 19:05:35 +00:00
Daniel Barlow 7b68206577 make turn-left/right return mergable tables
this gives greater symmetry with `drive`
2023-01-22 18:50:38 +00:00
Daniel Barlow 13e283a2a5 extract `drive` function which can go forward and backward 2023-01-22 18:47:54 +00:00
Daniel Barlow a4ac0dfe52 oops, forgot to implement backwards 2023-01-22 18:42:38 +00:00
Daniel Barlow 67bfda490e rewrite execute usiung accumulate, add second test case 2023-01-22 18:19:04 +00:00
Daniel Barlow 574c982368 make execute a regular function not a method 2023-01-22 18:12:58 +00:00
Daniel Barlow db552b8c11 extract common call to merge 2023-01-22 18:11:43 +00:00
Daniel Barlow 94325e53a0 separate turn-left and turn-right functions 2023-01-22 18:09:39 +00:00
Daniel Barlow e746bb514e now it can turn left as well as right 2023-01-22 18:06:41 +00:00
Daniel Barlow 78484b1115 implement rotate right 2023-01-22 18:03:16 +00:00
Daniel Barlow f8a58c4a68 extract function "command" 2023-01-22 17:54:03 +00:00
Daniel Barlow 3375906dee rename command -> execute 2023-01-22 17:51:53 +00:00
Daniel Barlow 1ba4399221 reduce repetition 2023-01-22 17:50:48 +00:00
Daniel Barlow c02c0aabca test it acts on multiple commands
as opposed to accepting multiple commands and ignoring them
2023-01-22 17:31:09 +00:00
Daniel Barlow b4ade2e114 test it works with non-zero starting position 2023-01-22 17:30:56 +00:00
Daniel Barlow 6546a16ec6 move forward east and west 2023-01-22 17:21:34 +00:00
Daniel Barlow 89945064d5 moves forward southwards 2023-01-22 17:15:23 +00:00
Daniel Barlow 74fb26f293 write `expect` macro for ease of testing. first test passes 2023-01-22 17:12:18 +00:00
Daniel Barlow 459b1088c1 first failing test 2023-01-22 14:59:29 +00:00