-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest.rb
More file actions
63 lines (54 loc) · 1.01 KB
/
test.rb
File metadata and controls
63 lines (54 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
require 'game.rb'
require 'rubygems'
require 'ruby-debug/debugger'
class Frontend
def self.draw_board
@@g.board.grid.each do |s|
print "\n\n" if s.col == 1
if s.piece != nil
print s.piece.player.num == 0 ? "0 " : "1 "
else
print "_ "
end
end
print "\n"
puts "Player 1 pool: " + @@g.player0.pool.to_s
puts "Player 2 pool: " + @@g.player1.pool.to_s
end
def self.tryit
@@g = Game.new
@@b = @@g.board
@@g.player1.pool = 25
tro = Tro.new(@@g.player1, b[4,4])
tro.flip
# draw_board
# @@p = BlackStone.new(@@g.player0, b[4,3])
# @@g.pieces += [@@p]
# draw_board
# puts p.move(b[4,4])
# draw_board
# puts p.move(b[7,7])
# draw_board
# puts p.move(b[4,5])
draw_board
move(2,2,2,3)
move 2,3,2,4
move 2,4,2,5
move 2,5,2,6
move 4,2,4,3
move 4,3,4,4 # capture Tro
end
def self.g
@@g
end
def self.b
@@b
end
def self.p
@@p
end
def self.move(c1,r1,c2,r2)
puts self.g.move(c1,r1,c2,r2)[:message]
self.draw_board
end
end