snakes_and_ladders 1.0.0 → 1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d0f2c16f3b1a14cc698be0bba9d33de259cdff5c
4
- data.tar.gz: 48566fe26a8518f5e54f393cc1bdcf6053010384
3
+ metadata.gz: a7eaed87f2482a11baebded8cfa8de59e3076328
4
+ data.tar.gz: 5760373b5278e7483c1397110bccedbc6384312a
5
5
  SHA512:
6
- metadata.gz: 7786ee623a842528548f0f3768dc8eaafdd4415b9e2fc2803648f162b6c27c5078cf0fcd201697c389ef126d7438be4728765fddb9a633ea7edc0c80ecbf507f
7
- data.tar.gz: ce2ea4b033ae9e0766723033057332354be8816d40434c18ddbccd8c70fd89b2e2cf0684d1a8fb97c041cfbb9050410ad36f470b964fe83566b0c1b4eb5b27a0
6
+ metadata.gz: a60cbaa3fbc0d9e3d1cf5f6e7c0dc662eb57f0eabf5ea88b1be976ca00e06fb5387616f7e3755cd477243e0ba6583011c6464d18509a8588c167ec79342f9741
7
+ data.tar.gz: 3b71bcb261b47259e27be87ceaa25986c85cdcba82035f92184d4e7fc26625dd5365b12e032737974279130dfd04655cde7600f3de8bf2460760283e15bf492c
@@ -19,7 +19,7 @@ module SnakesAndLadders
19
19
 
20
20
  puts "#{player} rolls #{player.last_roll}!"
21
21
 
22
- if board.move(player, player.position, player.destination_after_last_roll)
22
+ if board.move(player, player_position, player_destination_after_last_roll)
23
23
  self.winner = player if won?
24
24
  else
25
25
  self.winner = player if will_win?
@@ -43,16 +43,28 @@ module SnakesAndLadders
43
43
  end
44
44
 
45
45
  def won?
46
- player.position.equal?(board.size)
46
+ player_position.equal?(board_size)
47
47
  end
48
48
 
49
49
  def will_win?
50
- player.destination_after_last_roll >= board.size
50
+ player_destination_after_last_roll >= board_size
51
51
  end
52
52
 
53
53
  def winner=(player)
54
54
  @winner = player
55
55
  puts "Game over! #{winner} wins in #{winner.turns} turns. Congratulations!"
56
56
  end
57
+
58
+ def player_position
59
+ player.position
60
+ end
61
+
62
+ def player_destination_after_last_roll
63
+ player.destination_after_last_roll
64
+ end
65
+
66
+ def board_size
67
+ board.size
68
+ end
57
69
  end
58
70
  end
@@ -1,3 +1,3 @@
1
1
  module SnakesAndLadders
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
data/spec/spec_helper.rb CHANGED
@@ -1,6 +1,5 @@
1
1
  require "snakes_and_ladders"
2
2
  require "support/matchers"
3
- require "support/utils"
4
3
 
5
4
  # This file was generated by the `rspec --init` command. Conventionally, all
6
5
  # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: snakes_and_ladders
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mohamad El-Husseini
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-30 00:00:00.000000000 Z
11
+ date: 2014-12-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler