aboutsummaryrefslogtreecommitdiff
path: root/rust/robot-simulator/README.md
diff options
context:
space:
mode:
Diffstat (limited to 'rust/robot-simulator/README.md')
-rw-r--r--rust/robot-simulator/README.md108
1 files changed, 108 insertions, 0 deletions
diff --git a/rust/robot-simulator/README.md b/rust/robot-simulator/README.md
new file mode 100644
index 0000000..9d54a6a
--- /dev/null
+++ b/rust/robot-simulator/README.md
@@ -0,0 +1,108 @@
1# Robot Simulator
2
3Write a robot simulator.
4
5A robot factory's test facility needs a program to verify robot movements.
6
7The robots have three possible movements:
8
9- turn right
10- turn left
11- advance
12
13Robots are placed on a hypothetical infinite grid, facing a particular
14direction (north, east, south, or west) at a set of {x,y} coordinates,
15e.g., {3,8}, with coordinates increasing to the north and east.
16
17The robot then receives a number of instructions, at which point the
18testing facility verifies the robot's new position, and in which
19direction it is pointing.
20
21- The letter-string "RAALAL" means:
22 - Turn right
23 - Advance twice
24 - Turn left
25 - Advance once
26 - Turn left yet again
27- Say a robot starts at {7, 3} facing north. Then running this stream
28 of instructions should leave it at {9, 4} facing west.
29
30## Rust Installation
31
32Refer to the [exercism help page][help-page] for Rust installation and learning
33resources.
34
35## Writing the Code
36
37Execute the tests with:
38
39```bash
40$ cargo test
41```
42
43All but the first test have been ignored. After you get the first test to
44pass, open the tests source file which is located in the `tests` directory
45and remove the `#[ignore]` flag from the next test and get the tests to pass
46again. Each separate test is a function with `#[test]` flag above it.
47Continue, until you pass every test.
48
49If you wish to run all ignored tests without editing the tests source file, use:
50
51```bash
52$ cargo test -- --ignored
53```
54
55To run a specific test, for example `some_test`, you can use:
56
57```bash
58$ cargo test some_test
59```
60
61If the specific test is ignored use:
62
63```bash
64$ cargo test some_test -- --ignored
65```
66
67To learn more about Rust tests refer to the [online test documentation][rust-tests]
68
69Make sure to read the [Modules][modules] chapter if you
70haven't already, it will help you with organizing your files.
71
72## Further improvements
73
74After you have solved the exercise, please consider using the additional utilities, described in the [installation guide](https://exercism.io/tracks/rust/installation), to further refine your final solution.
75
76To format your solution, inside the solution directory use
77
78```bash
79cargo fmt
80```
81
82To see, if your solution contains some common ineffective use cases, inside the solution directory use
83
84```bash
85cargo clippy --all-targets
86```
87
88## Submitting the solution
89
90Generally you should submit all files in which you implemented your solution (`src/lib.rs` in most cases). If you are using any external crates, please consider submitting the `Cargo.toml` file. This will make the review process faster and clearer.
91
92## Feedback, Issues, Pull Requests
93
94The [exercism/rust](https://github.com/exercism/rust) repository on GitHub is the home for all of the Rust exercises. If you have feedback about an exercise, or want to help implement new exercises, head over there and create an issue. Members of the rust track team are happy to help!
95
96If you want to know more about Exercism, take a look at the [contribution guide](https://github.com/exercism/docs/blob/master/contributing-to-language-tracks/README.md).
97
98[help-page]: https://exercism.io/tracks/rust/learning
99[modules]: https://doc.rust-lang.org/book/ch07-02-defining-modules-to-control-scope-and-privacy.html
100[cargo]: https://doc.rust-lang.org/book/ch14-00-more-about-cargo.html
101[rust-tests]: https://doc.rust-lang.org/book/ch11-02-running-tests.html
102
103## Source
104
105Inspired by an interview question at a famous company.
106
107## Submitting Incomplete Solutions
108It's possible to submit an incomplete solution so you can see how others have completed the exercise.