connect_n 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0d188126a2ef04bac61ad32cb71da78b8dc9f6f26ae8d3eb8be9d02db8f85fde
4
- data.tar.gz: e3756f136a23d490b14fa9b3df1af5617811eb8a9b21148adcafcd9a29787914
3
+ metadata.gz: 49265f970e5a723c6f5808206701881cd60d2dffc6057e13fcbdbeff85bd4057
4
+ data.tar.gz: 93f9b287778e2db06cadb6d59e22cd90b197cdb40c80cee668205ccf348f686b
5
5
  SHA512:
6
- metadata.gz: b60c6abf3f69c08d74f79638be898f31a46519549002022b68082bbb24aa85592a058290b0c3fe31631ce7ee81ca13e716e8992c6fdf0ab07008c51b944957fd
7
- data.tar.gz: 62663742e7361bda0fbaad1c0b03f564c8e233762f8d8fd1664a4250ff08c258e7c70e1335b4e8b9e3ffba2901ff0c8fd4fcd74a3f54736035e2e562bd335dda
6
+ metadata.gz: b9bd015765e9cd81654369ec9b39d7fec95474a6d2c63f9f614b5e74d16e78a68c66f3f6453bada7e9beb77aae77a2d19eca963a8bc0944ddff4cb7eecc3751e
7
+ data.tar.gz: 757f8514063bba9a249f71d58bd58e151ef97a55b9331417e0fa9d81dff992ad12539249e903d566a03b77ba33fe20bbb104777ea3bc760c38dad78d3e5117b5
@@ -46,9 +46,13 @@ module ConnectN
46
46
  row_at(row_num)[col_num]
47
47
  end
48
48
 
49
- def cols = table.transpose.map(&:reverse)
49
+ def cols
50
+ table.transpose.map(&:reverse)
51
+ end
50
52
 
51
- def rows = table
53
+ def rows
54
+ table
55
+ end
52
56
 
53
57
  def col_at(n)
54
58
  return unless valid_col?(n)
@@ -83,10 +87,16 @@ module ConnectN
83
87
  puts
84
88
  end
85
89
 
86
- def valid_cell?(row_num, col_num) = valid_row?(row_num) && valid_col?(col_num)
90
+ def valid_cell?(row_num, col_num)
91
+ valid_row?(row_num) && valid_col?(col_num)
92
+ end
87
93
 
88
- def valid_row?(n) = n.between?(0, rows_amount - 1)
94
+ def valid_row?(n)
95
+ n.between?(0, rows_amount - 1)
96
+ end
89
97
 
90
- def valid_col?(n) = n.between?(0, cols_amount - 1)
98
+ def valid_col?(n)
99
+ n.between?(0, cols_amount - 1)
100
+ end
91
101
  end
92
102
  end
@@ -49,17 +49,29 @@ module ConnectN
49
49
  end
50
50
  end
51
51
 
52
- def over?(board, row, col, disc) = win?(board, row, col, disc) || board.filled?
52
+ def over?(board, row, col, disc)
53
+ win?(board, row, col, disc) || board.filled?
54
+ end
53
55
 
54
- def play_again? = PROMPT.yes? 'Would you like to play again?'
56
+ def play_again?
57
+ PROMPT.yes? 'Would you like to play again?'
58
+ end
55
59
 
56
- def self.save?(input) = input == ':w'
60
+ def self.save?(input)
61
+ input == ':w'
62
+ end
57
63
 
58
- def self.resume? = PROMPT.yes? 'Do you want to resume a game?'
64
+ def self.resume?
65
+ PROMPT.yes? 'Do you want to resume a game?'
66
+ end
59
67
 
60
- def self.resume(game) = game.play
68
+ def self.resume(game)
69
+ game.play
70
+ end
61
71
 
62
- def self.load(name, yaml_fn) = games(yaml_fn)[name.to_sym]
72
+ def self.load(name, yaml_fn)
73
+ games(yaml_fn)[name.to_sym]
74
+ end
63
75
 
64
76
  def self.games(yaml_fn)
65
77
  YAML.safe_load_file(
@@ -76,7 +88,9 @@ module ConnectN
76
88
  File.write(yaml_fn, dumped_games)
77
89
  end
78
90
 
79
- def self.name_game = PROMPT.ask 'Name your game : '
91
+ def self.name_game
92
+ PROMPT.ask 'Name your game : '
93
+ end
80
94
 
81
95
  def self.select_game_name(yaml_fn)
82
96
  games = games(yaml_fn).keys.map.with_index(1) { "#{_2} -> #{_1}" }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: connect_n
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lhoussaine (Jee-El) Ghallou