chess_vwong 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/chess_vwong-0.0.2.gem +0 -0
- data/lib/chess_vwong/board.rb +4 -12
- data/lib/chess_vwong/pawn.rb +4 -4
- data/lib/chess_vwong/version.rb +1 -1
- metadata +3 -3
- data/chess_vwong-0.0.1.gem +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 59e72ee60a254bdf61e9c3aceb8a27aae6282973
|
4
|
+
data.tar.gz: f858746d72427dc957308714023ff937d9a7adce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0af0c8e153da96a860805a172909cfde289a81549d738053e160222f253c1cf84446538a4e8476aeb01274d4d224e493ac952b400a73457c282361d143ad902c
|
7
|
+
data.tar.gz: 304cebfd4fa136bb9da53bc223021ff40ce94552646c9bbecb24730a3f6065574b65333e302ffd24db4f8499927317ce7b20457441edd29a17c664cb3a42300d
|
data/README.md
CHANGED
@@ -6,7 +6,7 @@ Although currently missing the feature that declares Check, it is completely pla
|
|
6
6
|
|
7
7
|
TODO:
|
8
8
|
1. Declare Check/Mate
|
9
|
-
2. En-Passant(first-turn)
|
9
|
+
2. En-Passant(first-turn) restriction
|
10
10
|
|
11
11
|
##Gameplay
|
12
12
|
The game is played on a standard 8x8 board as shown below.
|
@@ -30,7 +30,7 @@ If a command is invalid, the use will be alerted and prompted again until a vali
|
|
30
30
|
|
31
31
|
###Special moves
|
32
32
|
|
33
|
-
All special moves
|
33
|
+
All special moves (castling, en passant, promotion, and a pawn's double step on its first move) are recognized and allowed.
|
34
34
|
|
35
35
|
Note:
|
36
36
|
|
Binary file
|
data/lib/chess_vwong/board.rb
CHANGED
@@ -80,14 +80,10 @@ module ChessVwong
|
|
80
80
|
@node_path = []
|
81
81
|
# DOWN
|
82
82
|
if start[1] < dest[1]
|
83
|
-
(start[1]...dest[1]).each
|
84
|
-
node_path << grid[i][start[0]]
|
85
|
-
end
|
83
|
+
(start[1]...dest[1]).each {|i| node_path << grid[i][start[0]] }
|
86
84
|
# UP
|
87
85
|
elsif start[1] > dest[1]
|
88
|
-
start[1].step(dest[1] + 1, -1)
|
89
|
-
node_path << grid[i][start[0]]
|
90
|
-
end
|
86
|
+
start[1].step(dest[1] + 1, -1) {|i| node_path << grid[i][start[0]] }
|
91
87
|
end
|
92
88
|
node_path
|
93
89
|
end
|
@@ -96,14 +92,10 @@ module ChessVwong
|
|
96
92
|
@node_path = []
|
97
93
|
# RIGHT
|
98
94
|
if start[0] < dest[0]
|
99
|
-
(start[0]...dest[0]).each
|
100
|
-
node_path << grid[start[1]][i]
|
101
|
-
end
|
95
|
+
(start[0]...dest[0]).each {|i| node_path << grid[start[1]][i] }
|
102
96
|
# LEFT
|
103
97
|
elsif start[0] > dest[0]
|
104
|
-
start[0].step(dest[0] + 1, -1)
|
105
|
-
node_path << grid[start[1]][i]
|
106
|
-
end
|
98
|
+
start[0].step(dest[0] + 1, -1) {|i| node_path << grid[start[1]][i] }
|
107
99
|
end
|
108
100
|
node_path
|
109
101
|
end
|
data/lib/chess_vwong/pawn.rb
CHANGED
@@ -18,11 +18,11 @@ module ChessVwong
|
|
18
18
|
# if there is a enemy piece nearby, then give option to attack
|
19
19
|
def kill_move(node1, node2, moves)
|
20
20
|
if color == 'w'
|
21
|
-
moves << [-1, -1] if kill_conditions(node1, 'b') || ep_kill.
|
22
|
-
moves << [1, -1] if kill_conditions(node2, 'b') || ep_kill.
|
21
|
+
moves << [-1, -1] if kill_conditions(node1, 'b') || ep_kill.include?("L")
|
22
|
+
moves << [1, -1] if kill_conditions(node2, 'b') || ep_kill.include?("R")
|
23
23
|
else
|
24
|
-
moves << [-1, 1] if kill_conditions(node1, 'w') || ep_kill.
|
25
|
-
moves << [1, 1] if kill_conditions(node1, 'w') || ep_kill.
|
24
|
+
moves << [-1, 1] if kill_conditions(node1, 'w') || ep_kill.include?("L")
|
25
|
+
moves << [1, 1] if kill_conditions(node1, 'w') || ep_kill.include?("R")
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
data/lib/chess_vwong/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chess_vwong
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vincent Wong
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-05-
|
11
|
+
date: 2015-05-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -67,7 +67,7 @@ files:
|
|
67
67
|
- README.md
|
68
68
|
- Rakefile
|
69
69
|
- bin/chess_vwong
|
70
|
-
- chess_vwong-0.0.
|
70
|
+
- chess_vwong-0.0.2.gem
|
71
71
|
- chess_vwong.gemspec
|
72
72
|
- example/example_game.rb
|
73
73
|
- lib/chess_vwong.rb
|
data/chess_vwong-0.0.1.gem
DELETED
Binary file
|