connect_n 0.0.3 → 0.0.5

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: b9c066a9534814a11948195d47f819b9ccf4d725af8cdfe719036d3b4e801ae3
4
+ data.tar.gz: aab0c4794669f157f77baa64d72d84af77480ae02de7f01551c2ae3b3152129b
5
5
  SHA512:
6
- metadata.gz: b60c6abf3f69c08d74f79638be898f31a46519549002022b68082bbb24aa85592a058290b0c3fe31631ce7ee81ca13e716e8992c6fdf0ab07008c51b944957fd
7
- data.tar.gz: 62663742e7361bda0fbaad1c0b03f564c8e233762f8d8fd1664a4250ff08c258e7c70e1335b4e8b9e3ffba2901ff0c8fd4fcd74a3f54736035e2e562bd335dda
6
+ metadata.gz: 4d3f47001ca9bdea6dfee6970c20ba698a77527251713fbe6837dcfd5658c31ed7f8775020dba20779a36320fa572e5efa61e9932019334528c1997d7fc73517
7
+ data.tar.gz: 83cf8c9207f102b995a68663847c120fd3154e5ded67c957b9a21124428566ad8eb440e53fbf9d7fbc431e905bca40a6d303c6e7b9b5337b4db38423daa074cf
@@ -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}" }
@@ -104,7 +118,7 @@ module ConnectN
104
118
 
105
119
  def over(winner)
106
120
  phrase = board.filled? ? 'It is a tie!' : "#{winner.name} has won!"
107
- puts TTY::Box.sucess(phrase)
121
+ puts TTY::Box.success(phrase)
108
122
  end
109
123
 
110
124
  private
metadata CHANGED
@@ -1,14 +1,14 @@
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.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lhoussaine (Jee-El) Ghallou
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-01-11 00:00:00.000000000 Z
11
+ date: 2023-01-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tty-box
@@ -67,14 +67,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
67
67
  requirements:
68
68
  - - ">="
69
69
  - !ruby/object:Gem::Version
70
- version: 3.0.0
70
+ version: 2.7.0
71
71
  required_rubygems_version: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  requirements: []
77
- rubygems_version: 3.4.1
77
+ rubygems_version: 3.4.3
78
78
  signing_key:
79
79
  specification_version: 4
80
80
  summary: Connect-N!