This commit is contained in:
Kallfaktorn 2011-04-26 16:16:20 +02:00
commit b7fc68a010
8 changed files with 94 additions and 32 deletions

View file

@ -1,5 +1,5 @@
#!/bin/sh
for (( i = 0; i < 2; i++ )); do
./pong-bot.rb &
done
ruby pong-bot.rb &
done

View file

@ -23,6 +23,7 @@ class GGSNetwork
def connect(host='localhost', port=9000)
@socket = TCPSocket.new(host, port)
sprintf(@socket)
read
end
@ -47,7 +48,7 @@ class GGSNetwork
key, value = line.split(": ")
headers[key] = value.strip
end
if headers.has_key?("Content-Size")
args = @socket.read(headers["Content-Size"].to_i)
end

View file

@ -40,9 +40,9 @@ class PongBot
when "player2_points" then new_round()
end
end
protected
def gameTick()
if @game_paused
unless @send_start