-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathsuperfight.rb
More file actions
59 lines (46 loc) · 1.16 KB
/
superfight.rb
File metadata and controls
59 lines (46 loc) · 1.16 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
Dir["./lib/*.rb"].each {|file| require file }
puts "What is your first fighter's name?"
@fighter_a = $stdin.gets
puts "What is your second fighter's name?"
@fighter_b = $stdin.gets
match = Match.new(Fighter.new(@fighter_a), Fighter.new(@fighter_b)).tap do
13.times.map do
match = Match.new
if @fighter_a.strike == turn.winner
puts "Fighter A -- #{@fighter_a.name} -- won"
else
puts "Fighter B -- #{@fighter_b.name} -- won"
end
end
end
puts "The winner of match is ....... #{match.winner.name}"
# Moving away from random winners
class Move
attr_reader :strike, :block, :leg_sweep
def initialize
@strike = strike
@block = block
@leg_sweep = leg_sweep
end
def values
strike = 50
block = 40
leg_sweep = 60
end
def moves
move = Move.new
# test
move.values{strike: 50, block: 40, leg_sweep: 60}
puts moves.values.to_i
end
end
match = Match.new(Fighter.new(@fighter_a), Fighter.new(@fighter_b)) do
13.times.map do
match = Match.new
if @fighter_a.moves > @fighter_b.moves
puts "Fighter A -- #{@fighter_a.name} -- won"
else
puts "Fighter B -- #{@fighter_b.name} -- won"
end
end
end