diff --git a/ruby-sockets/marco-polo/client.rb b/ruby-sockets/marco-polo/client.rb index 52d32ca..e42102b 100644 --- a/ruby-sockets/marco-polo/client.rb +++ b/ruby-sockets/marco-polo/client.rb @@ -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