making client output more useful/accurate

This commit is contained in:
Dan Buch 2012-06-17 09:56:47 -04:00
parent 5a30febc65
commit 0b509b19f0

View File

@ -52,11 +52,13 @@ def run_client(options)
when :read
sock.send("marco #{client_name}\n", 0)
location = sock.recv(100).to_s.split[2,4].map(&:to_i)
puts "#{location.first} #{location.last}"
puts "marco #{client_name} -> #{location.first} #{location.last}"
when :write
sock.send("polo #{client_name} #{nextloc.first} #{nextloc.last}\n", 0)
nextloc = sock.recv(100).to_s.split.map(&:to_i)
puts "sent location '#{nextloc.first} #{nextloc.last}'"
recv_loc = sock.recv(100).to_s.split.map(&:to_i)
puts "polo #{client_name} #{nextloc.first} #{nextloc.last} " <<
"-> #{recv_loc.first} #{recv_loc.last}"
nextloc = recv_loc
end
sock.close
end