MeChallenge 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +8 -0
- data/lib/me_challenge.rb +19 -2
- metadata +1 -1
data/History.txt
CHANGED
data/lib/me_challenge.rb
CHANGED
@@ -3,10 +3,27 @@ $:.unshift File.join(File.dirname(__FILE__),'..','lib')
|
|
3
3
|
require 'middle_earth_challenge_simulator'
|
4
4
|
|
5
5
|
class MeChallenge
|
6
|
-
VERSION = '1.0.
|
6
|
+
VERSION = '1.0.1'
|
7
7
|
|
8
8
|
def self.run(args)
|
9
|
-
|
9
|
+
unless args.size == 5
|
10
|
+
puts "\nUSAGE:\n\tme_challenge rank1 health1 rank2 health2 rounds\n"
|
11
|
+
puts "EXAMPLE:\n\tme_challenge 50 100 30 100 10000"
|
12
|
+
return -1
|
13
|
+
end
|
14
|
+
|
15
|
+
c1 = Character.new("Character #1", args.shift.to_i, args.shift.to_i)
|
16
|
+
c2 = Character.new("Character #2", args.shift.to_i, args.shift.to_i)
|
17
|
+
rounds = args.shift.to_i
|
18
|
+
|
19
|
+
puts "Simulating #{rounds} rounds of combat between #{c1} and #{c2}\n"
|
20
|
+
|
21
|
+
mec = MiddleEarthChallengeSimulator.new(c1, c2, rounds)
|
22
|
+
mec.simulate
|
23
|
+
|
24
|
+
puts "#{mec.character1} won #{mec.character1_wins}"
|
25
|
+
puts "#{mec.character2} won #{mec.character2_wins}"
|
26
|
+
|
10
27
|
end
|
11
28
|
end
|
12
29
|
|