working pong-bot
This commit is contained in:
parent
5bcd7260d3
commit
16045afb21
5 changed files with 237 additions and 149 deletions
|
@ -3,14 +3,13 @@ require 'socket'
|
||||||
class GGSNetwork
|
class GGSNetwork
|
||||||
|
|
||||||
SERVER = "Server"
|
SERVER = "Server"
|
||||||
CLIENT = "Client"
|
CLIENT = "Game"
|
||||||
|
|
||||||
public
|
public
|
||||||
|
|
||||||
attr_accessor :delegate
|
attr_accessor :delegate
|
||||||
|
|
||||||
def initialize(delegate, host='localhost', port=9000)
|
def initialize(delegate)
|
||||||
connect(host, port)
|
|
||||||
@delegate = delegate
|
@delegate = delegate
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -22,15 +21,16 @@ class GGSNetwork
|
||||||
write( makeMessage(CLIENT, command, args) )
|
write( makeMessage(CLIENT, command, args) )
|
||||||
end
|
end
|
||||||
|
|
||||||
protected
|
def connect(host='localhost', port=9000)
|
||||||
|
|
||||||
def connect(host, port)
|
|
||||||
@socket = TCPSocket.new(host, port)
|
@socket = TCPSocket.new(host, port)
|
||||||
read
|
read
|
||||||
end
|
end
|
||||||
|
|
||||||
|
protected
|
||||||
|
|
||||||
def write(message)
|
def write(message)
|
||||||
@socket.write(message)
|
@socket.write(message)
|
||||||
|
puts message
|
||||||
end
|
end
|
||||||
|
|
||||||
def read
|
def read
|
||||||
|
@ -39,15 +39,17 @@ class GGSNetwork
|
||||||
size = 0
|
size = 0
|
||||||
args = ""
|
args = ""
|
||||||
|
|
||||||
|
select([@socket], nil, nil)
|
||||||
|
|
||||||
while (line = @socket.gets) != "\n"
|
while (line = @socket.gets) != "\n"
|
||||||
|
break if line.nil?
|
||||||
|
|
||||||
key, value = line.split(": ")
|
key, value = line.split(": ")
|
||||||
headers[key] = value
|
headers[key] = value.strip
|
||||||
end
|
end
|
||||||
|
|
||||||
if headers.has_key?("Content-Size")
|
if headers.has_key?("Content-Size")
|
||||||
headers["Content-Size"].to_i.times do
|
args = @socket.read(headers["Content-Size"].to_i)
|
||||||
args << @socket.recv
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
receivedCommand(headers, args)
|
receivedCommand(headers, args)
|
||||||
|
@ -55,10 +57,13 @@ class GGSNetwork
|
||||||
end
|
end
|
||||||
|
|
||||||
def receivedCommand(headers, data)
|
def receivedCommand(headers, data)
|
||||||
|
puts [headers, data].inspect
|
||||||
|
|
||||||
if headers.has_key? "Client-Command"
|
if headers.has_key? "Client-Command"
|
||||||
command = headers["Client-Command"]
|
command = headers["Client-Command"]
|
||||||
case command
|
case command
|
||||||
when "hello"
|
when "hello"
|
||||||
|
@game_token = data
|
||||||
@delegate.ggsNetworkReady(self, true)
|
@delegate.ggsNetworkReady(self, true)
|
||||||
when "defined"
|
when "defined"
|
||||||
@delegate.ggsNetworkDefined(self, true)
|
@delegate.ggsNetworkDefined(self, true)
|
||||||
|
@ -69,13 +74,12 @@ class GGSNetwork
|
||||||
end
|
end
|
||||||
|
|
||||||
def makeMessage(serverOrGame, command, args)
|
def makeMessage(serverOrGame, command, args)
|
||||||
message =<<MESSAGE
|
message = "Token: #{@game_token}\n" +
|
||||||
Token: #{@game_token}
|
"#{serverOrGame}-Command: #{command}\n" +
|
||||||
#{serverOrGame}-Command: #{command}
|
"Content-Length: #{args.length}\n\n"
|
||||||
Content-Length: #{args.length}
|
|
||||||
|
message += args if args.length > 0
|
||||||
|
|
||||||
#{args}
|
|
||||||
MESSAGE
|
|
||||||
message
|
message
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -9,11 +9,26 @@ class PongBot
|
||||||
include GGSDelegate
|
include GGSDelegate
|
||||||
|
|
||||||
def initialize
|
def initialize
|
||||||
|
@me = nil
|
||||||
|
@player1 = Pos.new
|
||||||
|
@player2 = Pos.new
|
||||||
|
@ball = Pos.new
|
||||||
|
@game_paused = true
|
||||||
|
@send_start = false
|
||||||
|
|
||||||
@ggs_network = GGSNetwork.new(self)
|
@ggs_network = GGSNetwork.new(self)
|
||||||
|
@ggs_network.connect()
|
||||||
end
|
end
|
||||||
|
|
||||||
def ggsNetworkReady(ggs_network, ready)
|
def ggsNetworkReady(ggs_network, ready)
|
||||||
@ggs_network.sendCommand("ready")
|
@ggs_network.sendCommand("ready")
|
||||||
|
|
||||||
|
t = Thread.new {
|
||||||
|
loop do
|
||||||
|
gameTick()
|
||||||
|
sleep 0.3
|
||||||
|
end
|
||||||
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
def ggsNetworkDefined(ggs_network, defined)
|
def ggsNetworkDefined(ggs_network, defined)
|
||||||
|
@ -21,7 +36,76 @@ class PongBot
|
||||||
end
|
end
|
||||||
|
|
||||||
def ggsNetworkReceivedCommandWithArgs(ggs_network, command, args)
|
def ggsNetworkReceivedCommandWithArgs(ggs_network, command, args)
|
||||||
|
case command
|
||||||
|
when "welcome" then welcome(args)
|
||||||
|
when "ball" then ball(args)
|
||||||
|
when "player1_y" then player1_y(args)
|
||||||
|
when "player2_y" then player2_y(args)
|
||||||
|
when "game" then game(args)
|
||||||
|
when "player1_points" then new_round()
|
||||||
|
when "player2_points" then new_round()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
protected
|
||||||
|
|
||||||
|
def gameTick()
|
||||||
|
if @game_paused
|
||||||
|
unless @send_start
|
||||||
|
@ggs_network.sendCommand("start")
|
||||||
|
@send_start = true
|
||||||
|
end
|
||||||
|
else
|
||||||
|
puts "#{@ball.y}:#{@me.y}"
|
||||||
|
if @ball.y < @me.y - 5
|
||||||
|
@ggs_network.sendCommand("up")
|
||||||
|
elsif @ball.y > @me.y - 5
|
||||||
|
@ggs_network.sendCommand("down")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def welcome(who_am_i)
|
||||||
|
if who_am_i == 1
|
||||||
|
@me = @player1
|
||||||
|
else
|
||||||
|
@me = @player2
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def ball(pos_s)
|
||||||
|
x, y = pos_s.split(",")
|
||||||
|
@ball.x, @ball.y = x.to_i, y.to_i
|
||||||
|
end
|
||||||
|
|
||||||
|
def player1_y(y)
|
||||||
|
@player1.y = y.to_i
|
||||||
|
end
|
||||||
|
|
||||||
|
def player2_y(y)
|
||||||
|
@player2.y = y.to_i
|
||||||
|
end
|
||||||
|
|
||||||
|
def game(wait_or_start)
|
||||||
|
if wait_or_start == "wait"
|
||||||
|
puts "Other ready"
|
||||||
|
else
|
||||||
|
@game_paused = false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def new_round
|
||||||
|
@game_paused = true
|
||||||
|
@send_start = false
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
class Pos
|
||||||
|
attr_accessor :x, :y
|
||||||
|
def initialize
|
||||||
|
@x = 0
|
||||||
|
@y = 0
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -209,11 +209,11 @@
|
||||||
</dict>
|
</dict>
|
||||||
<dict>
|
<dict>
|
||||||
<key>CF$UID</key>
|
<key>CF$UID</key>
|
||||||
<integer>50</integer>
|
<integer>46</integer>
|
||||||
</dict>
|
</dict>
|
||||||
<dict>
|
<dict>
|
||||||
<key>CF$UID</key>
|
<key>CF$UID</key>
|
||||||
<integer>54</integer>
|
<integer>50</integer>
|
||||||
</dict>
|
</dict>
|
||||||
<dict>
|
<dict>
|
||||||
<key>CF$UID</key>
|
<key>CF$UID</key>
|
||||||
|
@ -449,7 +449,7 @@
|
||||||
<string>PrimaryDocumentVisibleCharacterRange</string>
|
<string>PrimaryDocumentVisibleCharacterRange</string>
|
||||||
<string>HideAllIssues</string>
|
<string>HideAllIssues</string>
|
||||||
<string>PrimaryDocumentSelectedCharacterRange</string>
|
<string>PrimaryDocumentSelectedCharacterRange</string>
|
||||||
<real>324249006.22126502</real>
|
<real>324349224.47908998</real>
|
||||||
<string>{0, 910}</string>
|
<string>{0, 910}</string>
|
||||||
<string>{797, 0}</string>
|
<string>{797, 0}</string>
|
||||||
<dict>
|
<dict>
|
||||||
|
@ -462,106 +462,6 @@
|
||||||
<key>$classname</key>
|
<key>$classname</key>
|
||||||
<string>NSMutableDictionary</string>
|
<string>NSMutableDictionary</string>
|
||||||
</dict>
|
</dict>
|
||||||
<dict>
|
|
||||||
<key>$class</key>
|
|
||||||
<dict>
|
|
||||||
<key>CF$UID</key>
|
|
||||||
<integer>41</integer>
|
|
||||||
</dict>
|
|
||||||
<key>NS.keys</key>
|
|
||||||
<array>
|
|
||||||
<dict>
|
|
||||||
<key>CF$UID</key>
|
|
||||||
<integer>43</integer>
|
|
||||||
</dict>
|
|
||||||
<dict>
|
|
||||||
<key>CF$UID</key>
|
|
||||||
<integer>44</integer>
|
|
||||||
</dict>
|
|
||||||
<dict>
|
|
||||||
<key>CF$UID</key>
|
|
||||||
<integer>45</integer>
|
|
||||||
</dict>
|
|
||||||
<dict>
|
|
||||||
<key>CF$UID</key>
|
|
||||||
<integer>46</integer>
|
|
||||||
</dict>
|
|
||||||
</array>
|
|
||||||
<key>NS.objects</key>
|
|
||||||
<array>
|
|
||||||
<dict>
|
|
||||||
<key>CF$UID</key>
|
|
||||||
<integer>47</integer>
|
|
||||||
</dict>
|
|
||||||
<dict>
|
|
||||||
<key>CF$UID</key>
|
|
||||||
<integer>48</integer>
|
|
||||||
</dict>
|
|
||||||
<dict>
|
|
||||||
<key>CF$UID</key>
|
|
||||||
<integer>15</integer>
|
|
||||||
</dict>
|
|
||||||
<dict>
|
|
||||||
<key>CF$UID</key>
|
|
||||||
<integer>49</integer>
|
|
||||||
</dict>
|
|
||||||
</array>
|
|
||||||
</dict>
|
|
||||||
<string>PrimaryDocumentTimestamp</string>
|
|
||||||
<string>PrimaryDocumentVisibleCharacterRange</string>
|
|
||||||
<string>HideAllIssues</string>
|
|
||||||
<string>PrimaryDocumentSelectedCharacterRange</string>
|
|
||||||
<real>324253828.95541298</real>
|
|
||||||
<string>{2248, 1438}</string>
|
|
||||||
<string>{953, 0}</string>
|
|
||||||
<dict>
|
|
||||||
<key>$class</key>
|
|
||||||
<dict>
|
|
||||||
<key>CF$UID</key>
|
|
||||||
<integer>41</integer>
|
|
||||||
</dict>
|
|
||||||
<key>NS.keys</key>
|
|
||||||
<array>
|
|
||||||
<dict>
|
|
||||||
<key>CF$UID</key>
|
|
||||||
<integer>43</integer>
|
|
||||||
</dict>
|
|
||||||
<dict>
|
|
||||||
<key>CF$UID</key>
|
|
||||||
<integer>44</integer>
|
|
||||||
</dict>
|
|
||||||
<dict>
|
|
||||||
<key>CF$UID</key>
|
|
||||||
<integer>45</integer>
|
|
||||||
</dict>
|
|
||||||
<dict>
|
|
||||||
<key>CF$UID</key>
|
|
||||||
<integer>46</integer>
|
|
||||||
</dict>
|
|
||||||
</array>
|
|
||||||
<key>NS.objects</key>
|
|
||||||
<array>
|
|
||||||
<dict>
|
|
||||||
<key>CF$UID</key>
|
|
||||||
<integer>51</integer>
|
|
||||||
</dict>
|
|
||||||
<dict>
|
|
||||||
<key>CF$UID</key>
|
|
||||||
<integer>52</integer>
|
|
||||||
</dict>
|
|
||||||
<dict>
|
|
||||||
<key>CF$UID</key>
|
|
||||||
<integer>15</integer>
|
|
||||||
</dict>
|
|
||||||
<dict>
|
|
||||||
<key>CF$UID</key>
|
|
||||||
<integer>53</integer>
|
|
||||||
</dict>
|
|
||||||
</array>
|
|
||||||
</dict>
|
|
||||||
<real>324255376.074705</real>
|
|
||||||
<string>{351, 2071}</string>
|
|
||||||
<string>{2942, 0}</string>
|
|
||||||
<dict>
|
<dict>
|
||||||
<key>$class</key>
|
<key>$class</key>
|
||||||
<dict>
|
<dict>
|
||||||
|
@ -588,6 +488,102 @@
|
||||||
</dict>
|
</dict>
|
||||||
</array>
|
</array>
|
||||||
<key>NS.objects</key>
|
<key>NS.objects</key>
|
||||||
|
<array>
|
||||||
|
<dict>
|
||||||
|
<key>CF$UID</key>
|
||||||
|
<integer>43</integer>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>CF$UID</key>
|
||||||
|
<integer>44</integer>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>CF$UID</key>
|
||||||
|
<integer>15</integer>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>CF$UID</key>
|
||||||
|
<integer>45</integer>
|
||||||
|
</dict>
|
||||||
|
</array>
|
||||||
|
</dict>
|
||||||
|
<real>324351348.42624801</real>
|
||||||
|
<string>{1190, 1757}</string>
|
||||||
|
<string>{953, 0}</string>
|
||||||
|
<dict>
|
||||||
|
<key>$class</key>
|
||||||
|
<dict>
|
||||||
|
<key>CF$UID</key>
|
||||||
|
<integer>41</integer>
|
||||||
|
</dict>
|
||||||
|
<key>NS.keys</key>
|
||||||
|
<array>
|
||||||
|
<dict>
|
||||||
|
<key>CF$UID</key>
|
||||||
|
<integer>34</integer>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>CF$UID</key>
|
||||||
|
<integer>35</integer>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>CF$UID</key>
|
||||||
|
<integer>36</integer>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>CF$UID</key>
|
||||||
|
<integer>37</integer>
|
||||||
|
</dict>
|
||||||
|
</array>
|
||||||
|
<key>NS.objects</key>
|
||||||
|
<array>
|
||||||
|
<dict>
|
||||||
|
<key>CF$UID</key>
|
||||||
|
<integer>47</integer>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>CF$UID</key>
|
||||||
|
<integer>48</integer>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>CF$UID</key>
|
||||||
|
<integer>15</integer>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>CF$UID</key>
|
||||||
|
<integer>49</integer>
|
||||||
|
</dict>
|
||||||
|
</array>
|
||||||
|
</dict>
|
||||||
|
<real>324349919.87820297</real>
|
||||||
|
<string>{1453, 2127}</string>
|
||||||
|
<string>{2942, 0}</string>
|
||||||
|
<dict>
|
||||||
|
<key>$class</key>
|
||||||
|
<dict>
|
||||||
|
<key>CF$UID</key>
|
||||||
|
<integer>41</integer>
|
||||||
|
</dict>
|
||||||
|
<key>NS.keys</key>
|
||||||
|
<array>
|
||||||
|
<dict>
|
||||||
|
<key>CF$UID</key>
|
||||||
|
<integer>51</integer>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>CF$UID</key>
|
||||||
|
<integer>52</integer>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>CF$UID</key>
|
||||||
|
<integer>53</integer>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>CF$UID</key>
|
||||||
|
<integer>54</integer>
|
||||||
|
</dict>
|
||||||
|
</array>
|
||||||
|
<key>NS.objects</key>
|
||||||
<array>
|
<array>
|
||||||
<dict>
|
<dict>
|
||||||
<key>CF$UID</key>
|
<key>CF$UID</key>
|
||||||
|
@ -607,6 +603,10 @@
|
||||||
</dict>
|
</dict>
|
||||||
</array>
|
</array>
|
||||||
</dict>
|
</dict>
|
||||||
|
<string>PrimaryDocumentTimestamp</string>
|
||||||
|
<string>PrimaryDocumentVisibleCharacterRange</string>
|
||||||
|
<string>HideAllIssues</string>
|
||||||
|
<string>PrimaryDocumentSelectedCharacterRange</string>
|
||||||
<real>324248959.37454498</real>
|
<real>324248959.37454498</real>
|
||||||
<string>{0, 531}</string>
|
<string>{0, 531}</string>
|
||||||
<string>{0, 0}</string>
|
<string>{0, 0}</string>
|
||||||
|
@ -655,8 +655,8 @@
|
||||||
</dict>
|
</dict>
|
||||||
</array>
|
</array>
|
||||||
</dict>
|
</dict>
|
||||||
<real>324248237.36148798</real>
|
<real>324347076.57831001</real>
|
||||||
<string>{423, 2314}</string>
|
<string>{328, 2297}</string>
|
||||||
<dict>
|
<dict>
|
||||||
<key>$class</key>
|
<key>$class</key>
|
||||||
<dict>
|
<dict>
|
||||||
|
@ -667,19 +667,19 @@
|
||||||
<array>
|
<array>
|
||||||
<dict>
|
<dict>
|
||||||
<key>CF$UID</key>
|
<key>CF$UID</key>
|
||||||
<integer>34</integer>
|
<integer>51</integer>
|
||||||
</dict>
|
</dict>
|
||||||
<dict>
|
<dict>
|
||||||
<key>CF$UID</key>
|
<key>CF$UID</key>
|
||||||
<integer>35</integer>
|
<integer>52</integer>
|
||||||
</dict>
|
</dict>
|
||||||
<dict>
|
<dict>
|
||||||
<key>CF$UID</key>
|
<key>CF$UID</key>
|
||||||
<integer>36</integer>
|
<integer>53</integer>
|
||||||
</dict>
|
</dict>
|
||||||
<dict>
|
<dict>
|
||||||
<key>CF$UID</key>
|
<key>CF$UID</key>
|
||||||
<integer>37</integer>
|
<integer>54</integer>
|
||||||
</dict>
|
</dict>
|
||||||
</array>
|
</array>
|
||||||
<key>NS.objects</key>
|
<key>NS.objects</key>
|
||||||
|
@ -1059,7 +1059,7 @@
|
||||||
<integer>102</integer>
|
<integer>102</integer>
|
||||||
</dict>
|
</dict>
|
||||||
<key>NS.time</key>
|
<key>NS.time</key>
|
||||||
<real>324255371.33403099</real>
|
<real>324351343.54201001</real>
|
||||||
</dict>
|
</dict>
|
||||||
<dict>
|
<dict>
|
||||||
<key>$classes</key>
|
<key>$classes</key>
|
||||||
|
@ -1070,7 +1070,7 @@
|
||||||
<key>$classname</key>
|
<key>$classname</key>
|
||||||
<string>NSDate</string>
|
<string>NSDate</string>
|
||||||
</dict>
|
</dict>
|
||||||
<string>Today at 00:56</string>
|
<string>Today at 03:35</string>
|
||||||
<dict>
|
<dict>
|
||||||
<key>$classes</key>
|
<key>$classes</key>
|
||||||
<array>
|
<array>
|
||||||
|
@ -1147,7 +1147,7 @@
|
||||||
<integer>109</integer>
|
<integer>109</integer>
|
||||||
</dict>
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
<string>file://localhost/Users/jeena/Student/GGS/games/Pong/Classes/GGSNetwork.m</string>
|
<string>file://localhost/Users/jeena/Student/GGS/games/Pong/Classes/PongViewController.m</string>
|
||||||
<dict>
|
<dict>
|
||||||
<key>$class</key>
|
<key>$class</key>
|
||||||
<dict>
|
<dict>
|
||||||
|
@ -1165,7 +1165,7 @@
|
||||||
<integer>111</integer>
|
<integer>111</integer>
|
||||||
</dict>
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
<string>file://localhost/Users/jeena/Student/GGS/games/Pong/Classes/PongViewController.m</string>
|
<string>file://localhost/Users/jeena/Student/GGS/games/Pong/Classes/GGSNetwork.m</string>
|
||||||
<dict>
|
<dict>
|
||||||
<key>$class</key>
|
<key>$class</key>
|
||||||
<dict>
|
<dict>
|
||||||
|
@ -1201,7 +1201,7 @@
|
||||||
<integer>115</integer>
|
<integer>115</integer>
|
||||||
</dict>
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
<string>file://localhost/Users/jeena/Student/GGS/games/Pong/Classes/GGSDelegate.h</string>
|
<string>file://localhost/Users/jeena/Student/GGS/games/Pong/Classes/PongAppDelegate.m</string>
|
||||||
<dict>
|
<dict>
|
||||||
<key>$class</key>
|
<key>$class</key>
|
||||||
<dict>
|
<dict>
|
||||||
|
@ -1219,7 +1219,7 @@
|
||||||
<integer>117</integer>
|
<integer>117</integer>
|
||||||
</dict>
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
<string>file://localhost/Users/jeena/Student/GGS/games/Pong/Classes/PongAppDelegate.m</string>
|
<string>file://localhost/Users/jeena/Student/GGS/games/Pong/Classes/GGSDelegate.h</string>
|
||||||
<dict>
|
<dict>
|
||||||
<key>$class</key>
|
<key>$class</key>
|
||||||
<dict>
|
<dict>
|
||||||
|
@ -1390,7 +1390,7 @@
|
||||||
<string>IDEWorkspaceTabControllerDesignAreaSplitView</string>
|
<string>IDEWorkspaceTabControllerDesignAreaSplitView</string>
|
||||||
<string>IDEShowUtilities</string>
|
<string>IDEShowUtilities</string>
|
||||||
<string>AssistantEditorsLayout</string>
|
<string>AssistantEditorsLayout</string>
|
||||||
<string>GGSNetwork.m</string>
|
<string>PongViewController.m</string>
|
||||||
<true/>
|
<true/>
|
||||||
<dict>
|
<dict>
|
||||||
<key>$class</key>
|
<key>$class</key>
|
||||||
|
@ -1587,7 +1587,7 @@
|
||||||
<integer>153</integer>
|
<integer>153</integer>
|
||||||
</dict>
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
<string>GGSNetwork.m</string>
|
<string>PongViewController.m</string>
|
||||||
<dict>
|
<dict>
|
||||||
<key>$classes</key>
|
<key>$classes</key>
|
||||||
<array>
|
<array>
|
||||||
|
@ -1641,7 +1641,7 @@
|
||||||
<key>documentURL</key>
|
<key>documentURL</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>CF$UID</key>
|
<key>CF$UID</key>
|
||||||
<integer>26</integer>
|
<integer>24</integer>
|
||||||
</dict>
|
</dict>
|
||||||
<key>timestamp</key>
|
<key>timestamp</key>
|
||||||
<dict>
|
<dict>
|
||||||
|
@ -1996,19 +1996,19 @@
|
||||||
<array>
|
<array>
|
||||||
<dict>
|
<dict>
|
||||||
<key>CF$UID</key>
|
<key>CF$UID</key>
|
||||||
<integer>43</integer>
|
<integer>34</integer>
|
||||||
</dict>
|
</dict>
|
||||||
<dict>
|
<dict>
|
||||||
<key>CF$UID</key>
|
<key>CF$UID</key>
|
||||||
<integer>44</integer>
|
<integer>35</integer>
|
||||||
</dict>
|
</dict>
|
||||||
<dict>
|
<dict>
|
||||||
<key>CF$UID</key>
|
<key>CF$UID</key>
|
||||||
<integer>45</integer>
|
<integer>36</integer>
|
||||||
</dict>
|
</dict>
|
||||||
<dict>
|
<dict>
|
||||||
<key>CF$UID</key>
|
<key>CF$UID</key>
|
||||||
<integer>46</integer>
|
<integer>37</integer>
|
||||||
</dict>
|
</dict>
|
||||||
</array>
|
</array>
|
||||||
<key>NS.objects</key>
|
<key>NS.objects</key>
|
||||||
|
@ -2031,9 +2031,9 @@
|
||||||
</dict>
|
</dict>
|
||||||
</array>
|
</array>
|
||||||
</dict>
|
</dict>
|
||||||
<real>324255376.07524002</real>
|
<real>324351348.42674202</real>
|
||||||
<string>{351, 2071}</string>
|
<string>{1190, 1757}</string>
|
||||||
<string>{2942, 0}</string>
|
<string>{953, 0}</string>
|
||||||
<dict>
|
<dict>
|
||||||
<key>$classes</key>
|
<key>$classes</key>
|
||||||
<array>
|
<array>
|
||||||
|
@ -2043,7 +2043,7 @@
|
||||||
<key>$classname</key>
|
<key>$classname</key>
|
||||||
<string>NSDictionary</string>
|
<string>NSDictionary</string>
|
||||||
</dict>
|
</dict>
|
||||||
<string>-onSocket:didReadData:withTag:</string>
|
<string>@implementation PongViewController</string>
|
||||||
<string>Xcode.IDEKit.EditorDocument.SourceCode</string>
|
<string>Xcode.IDEKit.EditorDocument.SourceCode</string>
|
||||||
<dict>
|
<dict>
|
||||||
<key>$class</key>
|
<key>$class</key>
|
||||||
|
@ -2062,7 +2062,7 @@
|
||||||
<integer>199</integer>
|
<integer>199</integer>
|
||||||
</dict>
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
<string>file://localhost/Users/jeena/Student/GGS/games/Pong/Classes/GGSNetwork.m</string>
|
<string>file://localhost/Users/jeena/Student/GGS/games/Pong/Classes/PongViewController.m</string>
|
||||||
<dict>
|
<dict>
|
||||||
<key>$class</key>
|
<key>$class</key>
|
||||||
<dict>
|
<dict>
|
||||||
|
|
|
@ -102,7 +102,7 @@ handle_cast({game_cmd, Command, _Headers, Data}, #state { table = Table } = Stat
|
||||||
ggs_table:notify(Table, self(), {game, Command, Data}),
|
ggs_table:notify(Table, self(), {game, Command, Data}),
|
||||||
{noreply, State};
|
{noreply, State};
|
||||||
|
|
||||||
handle_cast(_Request, St) ->
|
handle_cast(Request, St) ->
|
||||||
{stop, unimplemented1, St}.
|
{stop, unimplemented1, St}.
|
||||||
|
|
||||||
handle_info({tcp, _Socket, Data}, #state { protocol = Protocol } = State) ->
|
handle_info({tcp, _Socket, Data}, #state { protocol = Protocol } = State) ->
|
||||||
|
|
|
@ -116,7 +116,7 @@ prettify(Args, Data) ->
|
||||||
case lists:keyfind("Game-Command", 1, Args) of
|
case lists:keyfind("Game-Command", 1, Args) of
|
||||||
{_, Value} ->
|
{_, Value} ->
|
||||||
{game_cmd, Value, Args, Data};
|
{game_cmd, Value, Args, Data};
|
||||||
_ ->
|
Other ->
|
||||||
ok
|
ok
|
||||||
end
|
end
|
||||||
end.
|
end.
|
||||||
|
|
Reference in a new issue