Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

two bugs - chomp when empty and removed the name

  • Loading branch information...
commit ed456fc755e91933744c67a99edfa83e116c5d87 1 parent 63963fe
@kastner authored
Showing with 2 additions and 1 deletion.
  1. +2 −1  tori_replay.rb
View
3  tori_replay.rb
@@ -50,7 +50,7 @@ def state_of_joint(state, joint)
raise "usage #{$0} <path to replay file> [<player to show>]" unless ARGV[0]
replay = open(ARGV[0]).read
-only_player = ARGV[1].chomp
+only_player = (ARGV[1] && ARGV[1].chomp)
@players = {}
replay.each_line do |line|
@@ -61,6 +61,7 @@ def state_of_joint(state, joint)
puts "\nFrame: #{$1.to_i}\n"
when /^JOINT (0|1); (.*)$/
next if only_player && only_player != @players[$1.to_i]
+ puts "\n\tPlayer: #{@players[$1.to_i] || $1.to_i}"
$2.scan(/\d+\s+\d+/).map {|p| p.split(/\s+/)}.each do |(joint, state)|
puts "\t\t#{state_of_joint(state.to_i, joint.to_i)} #{@joint_list[joint.to_i]}\n"
end
Please sign in to comment.
Something went wrong with that request. Please try again.