merge
This commit is contained in:
commit
b7fc68a010
8 changed files with 94 additions and 32 deletions
|
@ -1,5 +1,5 @@
|
|||
#!/bin/sh
|
||||
|
||||
for (( i = 0; i < 2; i++ )); do
|
||||
./pong-bot.rb &
|
||||
done
|
||||
ruby pong-bot.rb &
|
||||
done
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -40,9 +40,9 @@ class PongBot
|
|||
when "player2_points" then new_round()
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
protected
|
||||
|
||||
|
||||
def gameTick()
|
||||
if @game_paused
|
||||
unless @send_start
|
||||
|
|
Reference in a new issue