robot_rea 0.1.4 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +15 -29
- data/lib/robot/game.rb +17 -1
- data/lib/robot/version.rb +1 -1
- metadata +1 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 73095d64460267f93eb6b7068f2d4b728acd558013dc83ccc3465e168aa10955
|
4
|
+
data.tar.gz: 9442ab1a0a426cbe65fee5500882f5230d15f55791bd5fa1d41733b3fc78a8c8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2944ec74a6eefc86a7807f32909940f63d0a62f4cb3b6452aad2903f947fa52755fbc01b407549eb92cac06c0b155d36f32997d69c2fd49730254ab0f6dec7bd
|
7
|
+
data.tar.gz: afb15ea2ec832b0ae10dac2e43f538cb59c9cf1658d9491c45b8640dee0e115bc7b8320de5a0b5098a697ec041a8db6164f46b5b121291dc2d8b9f9c2824f8a5
|
data/README.md
CHANGED
@@ -1,43 +1,29 @@
|
|
1
1
|
# Robot
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
3
|
+
Robot game simulation gem.
|
6
4
|
|
7
5
|
## Installation
|
8
6
|
|
9
|
-
Add this line to your application's Gemfile:
|
10
|
-
|
11
7
|
```ruby
|
12
|
-
gem '
|
8
|
+
gem install 'robot_rea'
|
13
9
|
```
|
14
10
|
|
15
|
-
And then execute:
|
16
|
-
|
17
|
-
$ bundle
|
18
|
-
|
19
|
-
Or install it yourself as:
|
20
|
-
|
21
|
-
$ gem install robot
|
22
|
-
|
23
11
|
## Usage
|
24
12
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
-
|
31
|
-
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
-
|
33
|
-
## Contributing
|
34
|
-
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/robot. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
13
|
+
Run the executable:
|
14
|
+
```
|
15
|
+
robot
|
16
|
+
```
|
36
17
|
|
37
|
-
|
18
|
+
Try some commands:
|
38
19
|
|
39
|
-
|
20
|
+
```
|
21
|
+
PLACE 0,0,NORTH
|
22
|
+
MOVE
|
23
|
+
REPORT
|
24
|
+
LEFT
|
25
|
+
REPORT
|
26
|
+
```
|
40
27
|
|
41
|
-
|
28
|
+
To configure the table size, update the file `config.yaml`
|
42
29
|
|
43
|
-
Everyone interacting in the Robot project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/robot/blob/master/CODE_OF_CONDUCT.md).
|
data/lib/robot/game.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
module Robot
|
2
2
|
class Game
|
3
3
|
attr_reader :input
|
4
|
+
|
4
5
|
def initialize(input: $stdin)
|
5
6
|
@input = input
|
6
7
|
end
|
@@ -8,15 +9,30 @@ module Robot
|
|
8
9
|
def simulate
|
9
10
|
while command = input.gets
|
10
11
|
command = command.chomp
|
11
|
-
|
12
12
|
@position = Robot::CommandProxy.new(command_string: command, position: @position).call
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
16
16
|
def self.call(input: $stdin)
|
17
17
|
game = new(input: input)
|
18
|
+
instruction
|
18
19
|
game.simulate
|
19
20
|
end
|
21
|
+
|
22
|
+
def self.instruction
|
23
|
+
puts <<~HEREDOC
|
24
|
+
Welcome to the Robot game
|
25
|
+
Please enter one of the following commands:
|
26
|
+
PLACE 0,0,NORTH (PLACE X,Y,DIRECTION)
|
27
|
+
MOVE
|
28
|
+
LEFT
|
29
|
+
RIGHT
|
30
|
+
REPORT
|
31
|
+
|
32
|
+
invalid commands are ignored.
|
33
|
+
You must start with a place command.
|
34
|
+
HEREDOC
|
35
|
+
end
|
20
36
|
end
|
21
37
|
end
|
22
38
|
|
data/lib/robot/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: robot_rea
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anonymous
|
@@ -105,8 +105,6 @@ files:
|
|
105
105
|
- lib/robot/position.rb
|
106
106
|
- lib/robot/table.rb
|
107
107
|
- lib/robot/version.rb
|
108
|
-
- robot-0.1.0.gem
|
109
|
-
- robot-0.1.1.gem
|
110
108
|
- robot.gemspec
|
111
109
|
homepage: http://rubygems.org/gems/robot_rea
|
112
110
|
licenses:
|