birdbrain 0.9.1 → 0.9.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +54 -1
  3. data/lib/birdbrain/version.rb +1 -1
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ebef39d5adda74362cc84dcc0e11402873b063e0b73e97ef365098d2705d1dc8
4
- data.tar.gz: 4fa86ffb6e3805942a2ba173034043225767c94600a10341dc083d740ec225a3
3
+ metadata.gz: 57430481a0680c019369bcb21d0964dbe9b29da6ed5c30b2c7b85e44c872602a
4
+ data.tar.gz: cdd7f4fde44394b07885fd10ad9d655e4a7fe6fe83d02d36faec8e6068069825
5
5
  SHA512:
6
- metadata.gz: 2a17c59a131790c6cd95332e292815b1768123bc9b444d478f347ecea123b911405a0c0216859f4af4e256fc661cfc93a4714640792038a2c8a0bd04d4af72da
7
- data.tar.gz: c1653974c3353f0e6b8bc696302c5afe5a46c91b912dd59492d2d4c0aadabd78bd8e2f03dd9715dca1b495966c8f3ecde716079eee296a5a808ba1cf4c157af3
6
+ metadata.gz: 7a74a4bb565cbb1f1c52bcc84cec3e58f51a69f7dfa2f5dee2580521356852e815d2b944bbc9f570d79a9f7dfcf63a7d7514c90439e23f13f35f0db0a0411e9c
7
+ data.tar.gz: 1663ed637c26fa02dd6eff6f8d8533fc3cfbaea209e885ede6e9447a14f52f11080e111a99f33cdac20b33ae152b6c1a2afef00f1a35e1579a92ea1fc57c0f54
data/README.md CHANGED
@@ -28,7 +28,60 @@ The library is distributed through https://rubygems.org/gems/birdbrain/
28
28
 
29
29
  ## Usage
30
30
 
31
- TODO: Write usage instructions here
31
+ Below are two examples causing a Finch 2 to move in the path of a box. The first example is the long way to do it:
32
+
33
+ ```ruby
34
+ require 'birdbrain'
35
+
36
+ finch = BirdbrainFinch.connect('A')
37
+
38
+ finch.beak(0, 50, 0)
39
+
40
+ finch.tail(1, 0, 50, 0)
41
+ finch.move(BirdbrainFinch::FORWARD, 2, 20)
42
+ finch.turn(BirdbrainFinch::LEFT, 90, 50)
43
+
44
+ finch.tail(2, 0, 50, 0)
45
+ finch.move(BirdbrainFinch::FORWARD, 2, 20)
46
+ finch.turn(BirdbrainFinch::RIGHT, 90, 50)
47
+ finch.tail(3, 0, 50, 0)
48
+
49
+ finch.move(BirdbrainFinch::BACKWARD, 2, 20)
50
+ finch.turn(BirdbrainFinch::RIGHT, 90, 50)
51
+ finch.tail(4, 0, 50, 0)
52
+
53
+ finch.move(BirdbrainFinch::FORWARD, 2, 20)
54
+ finch.turn(BirdbrainFinch::LEFT, 90, 50)
55
+ sleep(1)
56
+
57
+ finch.disconnect
58
+ ```
59
+
60
+ The second way has the same result, but is more concise:
61
+
62
+ ```ruby
63
+ require 'birdbrain'
64
+
65
+ def draw(finch, step, move_direction, turn_direction)
66
+ finch.tail(step, 0, 50, 0)
67
+ finch.move(move_direction, 2, 20)
68
+ finch.turn(turn_direction, 90, 50)
69
+ end
70
+
71
+ finch = BirdbrainFinch.connect('A')
72
+
73
+ finch.beak(0, 50, 0)
74
+
75
+ draw(finch, 1, BirdbrainFinch::FORWARD, BirdbrainFinch::LEFT)
76
+ draw(finch, 2, BirdbrainFinch::FORWARD, BirdbrainFinch::RIGHT)
77
+ draw(finch, 3, BirdbrainFinch::BACKWARD, BirdbrainFinch::RIGHT)
78
+ draw(finch, 4, BirdbrainFinch::FORWARD, BirdbrainFinch::LEFT)
79
+ sleep(1)
80
+
81
+ finch.disconnect
82
+ ```
83
+
84
+ Rdoc files are available at https://rdoc.info/github/fmorton/BirdBrain-Ruby-Library/
32
85
 
33
86
  ## Development
34
87
 
@@ -4,5 +4,5 @@
4
4
  # frozen_string_literal: true
5
5
 
6
6
  module Birdbrain
7
- VERSION = '0.9.1'
7
+ VERSION = '0.9.2'
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: birdbrain
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.1
4
+ version: 0.9.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - fmorton