oxo 0.1.0 → 0.1.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 +5 -5
- data/Gemfile +2 -0
- data/README.md +2 -2
- data/Rakefile +1 -1
- data/bin/oxo +2 -0
- data/lib/oxo/board.rb +8 -5
- data/lib/oxo/computer.rb +2 -0
- data/lib/oxo/human.rb +2 -0
- data/lib/oxo/version.rb +4 -2
- data/lib/oxo.rb +11 -8
- data/oxo.gemspec +3 -2
- data/test/test_board.rb +4 -2
- metadata +11 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 7070355c3791a12f80047265a52dcb4d19fe9f92eba9ab711721fed133271594
|
4
|
+
data.tar.gz: 5d9cc3e53ddc5857af3d945152ebcd0adeacb38c4df52b053c1aaaf9e81c8367
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6ccd3220d90823f8bdb06cac8ff754bebcf0f9cfee92f33596a539b772b40e1136e377dd20389611cb0be328be6cfcbecbe097bdd2e5612756ed2aef6452bfdc
|
7
|
+
data.tar.gz: 336385251ba981c790eae09df70ab0e831b3b35644cbe7995ba965652c609efe947ad9530ebd18704a1945ef6bd49b36325b96d32159ff615aba35a4133dac25
|
data/Gemfile
ADDED
data/README.md
CHANGED
@@ -23,7 +23,7 @@ Use `gem install oxo` to install from RubyGems.org.
|
|
23
23
|
|
24
24
|
## Requirements
|
25
25
|
|
26
|
-
- [Ruby][ruby] 2.
|
26
|
+
- [Ruby][ruby] 2.3.0 or higher
|
27
27
|
|
28
28
|
## Reporting Bugs
|
29
29
|
|
@@ -31,7 +31,7 @@ Report bugs on the `oxo` home page: <https://github.com/stomar/oxo/>
|
|
31
31
|
|
32
32
|
## License
|
33
33
|
|
34
|
-
Copyright © 2016 Marcus Stollsteimer
|
34
|
+
Copyright © 2016-2022 Marcus Stollsteimer
|
35
35
|
|
36
36
|
`oxo` is free software: you can redistribute it and/or modify it under
|
37
37
|
the terms of the GNU General Public License version 3 or later (GPLv3+),
|
data/Rakefile
CHANGED
data/bin/oxo
CHANGED
data/lib/oxo/board.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module OXO
|
2
4
|
class Board
|
3
5
|
|
@@ -13,8 +15,9 @@ module OXO
|
|
13
15
|
end
|
14
16
|
|
15
17
|
def place(color, row, col)
|
16
|
-
return unless
|
17
|
-
|
18
|
+
return unless legal_move?(row, col)
|
19
|
+
|
20
|
+
@board[row - 1][col - 1] = color
|
18
21
|
end
|
19
22
|
|
20
23
|
def legal_moves
|
@@ -43,7 +46,7 @@ module OXO
|
|
43
46
|
end
|
44
47
|
|
45
48
|
def to_s
|
46
|
-
output = "\n"
|
49
|
+
output = "\n".dup
|
47
50
|
hline = "+---" * @cols << "+\n"
|
48
51
|
|
49
52
|
characters = @board.map {|row| row.map {|pos| pos.to_s.ljust(1) } }
|
@@ -54,7 +57,7 @@ module OXO
|
|
54
57
|
output << hline
|
55
58
|
end
|
56
59
|
|
57
|
-
output
|
60
|
+
output << "\n"
|
58
61
|
end
|
59
62
|
|
60
63
|
private
|
@@ -66,7 +69,7 @@ module OXO
|
|
66
69
|
def piece_at(row, col)
|
67
70
|
return unless on_board?(row, col)
|
68
71
|
|
69
|
-
@board[row-1][col-1]
|
72
|
+
@board[row - 1][col - 1]
|
70
73
|
end
|
71
74
|
end
|
72
75
|
end
|
data/lib/oxo/computer.rb
CHANGED
data/lib/oxo/human.rb
CHANGED
data/lib/oxo/version.rb
CHANGED
data/lib/oxo.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "optparse"
|
2
4
|
|
3
5
|
require "oxo/version"
|
@@ -18,7 +20,7 @@ require "oxo/human"
|
|
18
20
|
#
|
19
21
|
# == Author
|
20
22
|
#
|
21
|
-
# Copyright (C) 2016 Marcus Stollsteimer
|
23
|
+
# Copyright (C) 2016-2022 Marcus Stollsteimer
|
22
24
|
#
|
23
25
|
# License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
|
24
26
|
#
|
@@ -26,12 +28,12 @@ module OXO
|
|
26
28
|
|
27
29
|
PROGNAME = "oxo"
|
28
30
|
|
29
|
-
COPYRIGHT =
|
30
|
-
Copyright (C) 2016 Marcus Stollsteimer.
|
31
|
+
COPYRIGHT = <<~CONTENT
|
32
|
+
Copyright (C) 2016-2022 Marcus Stollsteimer.
|
31
33
|
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
|
32
34
|
This is free software: you are free to change and redistribute it.
|
33
35
|
There is NO WARRANTY, to the extent permitted by law.
|
34
|
-
|
36
|
+
CONTENT
|
35
37
|
|
36
38
|
|
37
39
|
class Optionparser
|
@@ -46,16 +48,17 @@ module OXO
|
|
46
48
|
def self.parse!(argv)
|
47
49
|
|
48
50
|
options = {
|
49
|
-
:
|
51
|
+
delay: 0
|
50
52
|
}
|
51
53
|
|
52
54
|
opt_parser = OptionParser.new do |opt|
|
53
55
|
opt.banner = "Usage: #{PROGNAME} [options]"
|
54
|
-
opt.separator
|
56
|
+
opt.separator <<~CONTENT
|
57
|
+
|
55
58
|
oxo is a command line Tic-tac-toe game.
|
56
59
|
|
57
60
|
Options:
|
58
|
-
|
61
|
+
CONTENT
|
59
62
|
|
60
63
|
# process --version and --help first,
|
61
64
|
# exit successfully (GNU Coding Standards)
|
@@ -91,7 +94,7 @@ module OXO
|
|
91
94
|
|
92
95
|
class Application
|
93
96
|
|
94
|
-
ERRORCODE = {:
|
97
|
+
ERRORCODE = { general: 1, usage: 2 }.freeze
|
95
98
|
|
96
99
|
def initialize
|
97
100
|
begin
|
data/oxo.gemspec
CHANGED
@@ -18,10 +18,10 @@ Gem::Specification.new do |s|
|
|
18
18
|
|
19
19
|
s.license = "GPL-3.0"
|
20
20
|
|
21
|
-
s.required_ruby_version = ">= 2.
|
21
|
+
s.required_ruby_version = ">= 2.3.0"
|
22
22
|
|
23
|
-
s.add_development_dependency "rake", "~> 11.1"
|
24
23
|
s.add_development_dependency "minitest", "~> 5.8"
|
24
|
+
s.add_development_dependency "rake", "~> 13.0"
|
25
25
|
|
26
26
|
s.executables = ["oxo"]
|
27
27
|
s.bindir = "bin"
|
@@ -31,6 +31,7 @@ Gem::Specification.new do |s|
|
|
31
31
|
s.files = %w[
|
32
32
|
oxo.gemspec
|
33
33
|
README.md
|
34
|
+
Gemfile
|
34
35
|
Rakefile
|
35
36
|
] +
|
36
37
|
Dir.glob("{bin,lib,test}/**/*")
|
data/test/test_board.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "minitest/autorun"
|
2
4
|
require "oxo/board"
|
3
5
|
|
@@ -9,7 +11,7 @@ describe OXO::Board do
|
|
9
11
|
end
|
10
12
|
|
11
13
|
it "should have the correct size" do
|
12
|
-
@board.rows.must_equal 3
|
13
|
-
@board.cols.must_equal 3
|
14
|
+
_(@board.rows).must_equal 3
|
15
|
+
_(@board.cols).must_equal 3
|
14
16
|
end
|
15
17
|
end
|
metadata
CHANGED
@@ -1,43 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: oxo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marcus Stollsteimer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-01-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: minitest
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '5.8'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '5.8'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '13.0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '13.0'
|
41
41
|
description: oxo is a command line Tic-tac-toe game.
|
42
42
|
email: sto.mar@web.de
|
43
43
|
executables:
|
@@ -46,6 +46,7 @@ extensions: []
|
|
46
46
|
extra_rdoc_files:
|
47
47
|
- README.md
|
48
48
|
files:
|
49
|
+
- Gemfile
|
49
50
|
- README.md
|
50
51
|
- Rakefile
|
51
52
|
- bin/oxo
|
@@ -70,15 +71,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
70
71
|
requirements:
|
71
72
|
- - ">="
|
72
73
|
- !ruby/object:Gem::Version
|
73
|
-
version: 2.
|
74
|
+
version: 2.3.0
|
74
75
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
75
76
|
requirements:
|
76
77
|
- - ">="
|
77
78
|
- !ruby/object:Gem::Version
|
78
79
|
version: '0'
|
79
80
|
requirements: []
|
80
|
-
|
81
|
-
rubygems_version: 2.5.1
|
81
|
+
rubygems_version: 3.3.3
|
82
82
|
signing_key:
|
83
83
|
specification_version: 4
|
84
84
|
summary: oxo is a command line Tic-tac-toe game.
|