geese 0.0.0 → 0.0.1
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/.gitignore +17 -0
- data/.rspec +1 -0
- data/Gemfile.lock +1 -1
- data/README.md +5 -0
- data/features/step_definitions/geese_steps.rb +36 -0
- data/features/support/env.rb +3 -0
- data/geese.gemspec +1 -1
- data/lib/geese.rb +1 -0
- data/lib/geese/board.rb +42 -0
- data/lib/geese/version.rb +1 -1
- data/spec/geese/board_spec.rb +25 -0
- data/spec/spec_helper.rb +8 -0
- metadata +10 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 74a2d6cb0241d2ee87a4c078891a2f71f6e807f4
|
4
|
+
data.tar.gz: c9bc741cd2fe6fc519275ceb0dbf08024e047d01
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a04968f35b43189021ead3f17205304841209623917ffa620e664a4d97b865e93509f33f1950f411901466df81983c75acaae923fa542cb139010c3b3ebef151
|
7
|
+
data.tar.gz: 2e6a04f3d23a9df86abadfe9bfe53954f544f3bcbac3082539a8cf9f26500b0dc5811cff3ce214f9c07e93b309855bcfdbfd70bcae72d1f7ee9f0d4689e9799b
|
data/.gitignore
ADDED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
-c -fd
|
data/Gemfile.lock
CHANGED
data/README.md
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
Stel(/^ik heb een speelbord met (\d+) vakjes$/) do |number_of_squares|
|
2
|
+
@board = Geese::Board.create_with_number_of_squares(number_of_squares)
|
3
|
+
end
|
4
|
+
|
5
|
+
Stel(/^ik heb de volgende spelers met de klok mee:$/) do |players|
|
6
|
+
players.hashes.each do |h|
|
7
|
+
@board.add_player(
|
8
|
+
name: h["naam"],
|
9
|
+
age: h["age"].to_i,
|
10
|
+
color: h["kleur pion"],
|
11
|
+
)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
Stel(/^alle pionnen staan op het startvakje$/) do
|
16
|
+
end
|
17
|
+
|
18
|
+
Dan(/^is Piet aan de beurt om te dobbelen omdat hij de jongste speler is$/) do
|
19
|
+
pending # express the regexp above with the code you wish you had
|
20
|
+
end
|
21
|
+
|
22
|
+
Als(/^de beurt van Piet is geweest$/) do
|
23
|
+
pending # express the regexp above with the code you wish you had
|
24
|
+
end
|
25
|
+
|
26
|
+
Dan(/^is Klaas aan de beurt om te dobbelen$/) do
|
27
|
+
pending # express the regexp above with the code you wish you had
|
28
|
+
end
|
29
|
+
|
30
|
+
Als(/^de beurt van Klaas is geweest$/) do
|
31
|
+
pending # express the regexp above with the code you wish you had
|
32
|
+
end
|
33
|
+
|
34
|
+
Dan(/^is Jan aan de beurt om te dobbelen$/) do
|
35
|
+
pending # express the regexp above with the code you wish you had
|
36
|
+
end
|
data/features/support/env.rb
CHANGED
data/geese.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.email = ["andymaes@gmail.com", "ariejan@ariejan.net"]
|
11
11
|
spec.summary = %q{To be announced.}
|
12
12
|
spec.description = %q{To be announced}
|
13
|
-
spec.homepage = "
|
13
|
+
spec.homepage = "http://blackgeese.github.io/geese"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
16
16
|
spec.files = `git ls-files -z`.split("\x0")
|
data/lib/geese.rb
CHANGED
data/lib/geese/board.rb
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
module Geese
|
2
|
+
# Represents a Game of Geese board, you can create a new board with a
|
3
|
+
# number of squares. A classical Game of Geese board has 63 squares,
|
4
|
+
# exluding the 'start' square.
|
5
|
+
#
|
6
|
+
# Players can be added using `add_player`. This will add the players
|
7
|
+
# automatically to the 'start' squard
|
8
|
+
class Board
|
9
|
+
|
10
|
+
attr_reader :number_of_squares, :players
|
11
|
+
|
12
|
+
# Creates a new Board with the specified `number_of_squares`, this
|
13
|
+
# does not include the 'start' square, which is always present.
|
14
|
+
#
|
15
|
+
# The default `number_of_squares` is 63, for a classica Game of Geese.
|
16
|
+
def self.create_with_number_of_squares(number_of_squares = 63)
|
17
|
+
self.new(number_of_squares)
|
18
|
+
end
|
19
|
+
|
20
|
+
# Adds a player to the board, the following attributes need to be
|
21
|
+
# present:
|
22
|
+
#
|
23
|
+
# * name: "Gandalf" # Name of the player
|
24
|
+
# * age: 342 # Age of the player in years
|
25
|
+
# * color: "grey" # The color of the goose representing this player
|
26
|
+
#
|
27
|
+
# Example:
|
28
|
+
#
|
29
|
+
# board.add_player(name: 'Samual L. Jackson', age: 52, color: 'purple')
|
30
|
+
#
|
31
|
+
def add_player(attributes)
|
32
|
+
@players << attributes
|
33
|
+
end
|
34
|
+
|
35
|
+
private
|
36
|
+
|
37
|
+
def initialize(number_of_squares)
|
38
|
+
@number_of_squares = number_of_squares
|
39
|
+
@players = []
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
data/lib/geese/version.rb
CHANGED
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Geese::Board do
|
4
|
+
|
5
|
+
describe '.create_with_number_of_squares' do
|
6
|
+
it 'creates a board with the number of squares' do
|
7
|
+
board = Geese::Board.create_with_number_of_squares
|
8
|
+
expect(board.number_of_squares).to eq(63)
|
9
|
+
|
10
|
+
board = Geese::Board.create_with_number_of_squares(128)
|
11
|
+
expect(board.number_of_squares).to eq(128)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
|
16
|
+
describe '#add_player' do
|
17
|
+
let(:board) { Geese::Board.create_with_number_of_squares(63) }
|
18
|
+
|
19
|
+
it 'adds a player to the board' do
|
20
|
+
board.add_player(player_attributes)
|
21
|
+
expect(board).to have(1).players
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: geese
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andy Maes
|
@@ -104,21 +104,27 @@ executables:
|
|
104
104
|
extensions: []
|
105
105
|
extra_rdoc_files: []
|
106
106
|
files:
|
107
|
+
- ".gitignore"
|
108
|
+
- ".rspec"
|
107
109
|
- ".ruby-gemset"
|
108
110
|
- ".ruby-version"
|
109
111
|
- ".travis.yml"
|
110
112
|
- Gemfile
|
111
113
|
- Gemfile.lock
|
114
|
+
- README.md
|
112
115
|
- Rakefile
|
113
116
|
- bin/geese
|
114
117
|
- features/beurt_volgorde.feature
|
118
|
+
- features/step_definitions/geese_steps.rb
|
115
119
|
- features/support/env.rb
|
116
120
|
- geese.gemspec
|
117
121
|
- lib/geese.rb
|
122
|
+
- lib/geese/board.rb
|
118
123
|
- lib/geese/version.rb
|
124
|
+
- spec/geese/board_spec.rb
|
119
125
|
- spec/geese_spec.rb
|
120
126
|
- spec/spec_helper.rb
|
121
|
-
homepage:
|
127
|
+
homepage: http://blackgeese.github.io/geese
|
122
128
|
licenses:
|
123
129
|
- MIT
|
124
130
|
metadata: {}
|
@@ -144,6 +150,8 @@ specification_version: 4
|
|
144
150
|
summary: To be announced.
|
145
151
|
test_files:
|
146
152
|
- features/beurt_volgorde.feature
|
153
|
+
- features/step_definitions/geese_steps.rb
|
147
154
|
- features/support/env.rb
|
155
|
+
- spec/geese/board_spec.rb
|
148
156
|
- spec/geese_spec.rb
|
149
157
|
- spec/spec_helper.rb
|