software_challenge_client 1.0.0 → 1.1.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4d55ebfd85d0ed449a11437fd91481c0b7b6f2e1
4
- data.tar.gz: 027eadb37b996d8e07ad680db5aa97807d661051
3
+ metadata.gz: 1f894ec8a43e2caa45c9773bfe4f8ef966b95583
4
+ data.tar.gz: 681466cbca4293e50641de66564dbf13379a3e3c
5
5
  SHA512:
6
- metadata.gz: c78a79ba1d86132c4abb89c489a49480b2a71d14449edc83e11d2eba20ea3bc5bdce3deaddc2d685ff63673631df65c6efd9f4ffdbb3f7638a5dc2ee12736990
7
- data.tar.gz: b70311d5c10252ce0a92c78a3e0f1623d055a93d9b1a6b9bdd39fbc2b0d60a29c7c39261bd54edf41af2707b7838884a5b02331c53e23a18eff42fbf4713b248
6
+ metadata.gz: d2b6c4cb186b805758336139e4527994de33e10bcda8389c27a83da9c79abc39aedb82df96b759b26ebcad76c5ba6965d8487e982fdaa187af47bb42794074fb
7
+ data.tar.gz: 742a795eb16528f7809620c2101af4b636dfaad6b5fb81065c9b60847ad92dc9963b2ae981e2d3ab5b678c0798478a1015c3279be3a4e803ff05025efd55636f
data/RELEASES.md CHANGED
@@ -1,3 +1,7 @@
1
+ = 1.1.0
2
+
3
+ Added missing perform! methods for actions.
4
+
1
5
  = 1.0.0
2
6
 
3
7
  First version for game "Hase und Igel".
@@ -135,6 +135,10 @@ class Skip < Action
135
135
  def ==(other)
136
136
  other.type == type
137
137
  end
138
+
139
+ def perform!(_gamestate)
140
+ # does nothing
141
+ end
138
142
  end
139
143
 
140
144
  # Eine Salatessen-Aktion. Kann nur auf einem Salatfeld ausgeführt werden. Muss ausgeführt werden,
@@ -153,6 +157,21 @@ class EatSalad < Action
153
157
  def ==(other)
154
158
  other.type == type
155
159
  end
160
+
161
+ def perform!(gamestate)
162
+ valid, msg = GameRules.is_valid_to_eat(gamestate)
163
+ if valid
164
+ gamestate.current_player.salads -= 1
165
+ if gamestate.is_first(gamestate.current_player)
166
+ gamestate.current_player.carrots += 10
167
+ else
168
+ gamestate.current_player.carrots += 30
169
+ end
170
+ gamestate.set_last_action(self)
171
+ else
172
+ invalid(msg)
173
+ end
174
+ end
156
175
  end
157
176
 
158
177
  # Karottentauschaktion. Es können auf einem Karottenfeld 10 Karotten abgegeben oder aufgenommen werden.
@@ -166,7 +185,7 @@ class ExchangeCarrots < Action
166
185
 
167
186
  def perform!(gamestate)
168
187
  valid, message = GameRules.is_valid_to_exchange_carrots(gamestate, value)
169
- raise InvalidMoveException("Es können nicht #{value} Karotten aufgenommen werden. " + message) unless valid
188
+ invalid("Es können nicht #{value} Karotten aufgenommen werden. " + message) unless valid
170
189
  gamestate.current_player.carrots += value
171
190
  gamestate.set_last_action(self)
172
191
  end
@@ -49,7 +49,7 @@ class Player
49
49
  @points = 0
50
50
  @index = 0
51
51
  @carrots = 68
52
- @salads = 2
52
+ @salads = 5
53
53
  @cards = CardType.to_a
54
54
  end
55
55
 
@@ -1,4 +1,4 @@
1
1
  # encoding: UTF-8
2
2
  module SoftwareChallengeClient
3
- VERSION = "1.0.0"
3
+ VERSION = "1.1.0"
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: software_challenge_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - 'kwollw '
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
- date: 2017-08-24 00:00:00.000000000 Z
13
+ date: 2017-08-30 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: typesafe_enum
@@ -297,3 +297,4 @@ specification_version: 4
297
297
  summary: This gem provides functions to build a client for the coding competition
298
298
  Software-Challenge 2017.
299
299
  test_files: []
300
+ has_rdoc: