software_challenge_client 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c4074b13fd465d18b7149f6900ebc838c8339c1a
|
4
|
+
data.tar.gz: b906a5f6a650d5a166552973622da994b9939ffc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6f99030db786cba8ef7689faacae933e9b12d9f913548290a7c10f9605017eff041621773b94dbf4116a9512cc1169539c127cdafa36a6dd8f18287f34643a33
|
7
|
+
data.tar.gz: 66c02fbccbb2f00b699b83b3e8f61a3aec7a6c8cb3fd3c51048182f3d4a3b1e2c8e621243bc7615473c4e2613ee19fa673afd84ae5b85791d3e40754c2112af7
|
data/RELEASES.md
CHANGED
@@ -82,7 +82,7 @@ class Network
|
|
82
82
|
|
83
83
|
line =''
|
84
84
|
char = ''
|
85
|
-
while line != "</room>" && !(char = @socket.getc).nil?
|
85
|
+
while (line != "</room>" && line != "</protocol>") && !(char = @socket.getc).nil?
|
86
86
|
line+=char
|
87
87
|
if char=='\n' || char==' '
|
88
88
|
|
@@ -97,11 +97,12 @@ class Network
|
|
97
97
|
|
98
98
|
# Remove <protocol> tag
|
99
99
|
@receiveBuffer = @receiveBuffer.gsub('<protocol>', '')
|
100
|
+
@receiveBuffer = @receiveBuffer.gsub('</protocol>', '')
|
100
101
|
|
101
102
|
logger.debug "Received XML from server: #{@receiveBuffer}"
|
102
103
|
|
103
104
|
# Process text
|
104
|
-
@protocol.process_string(
|
105
|
+
@protocol.process_string(@receiveBuffer);
|
105
106
|
self.emptyReceiveBuffer
|
106
107
|
end
|
107
108
|
return true
|
@@ -50,9 +50,11 @@ class Protocol
|
|
50
50
|
case name
|
51
51
|
when 'board'
|
52
52
|
logger.debug @gamestate.board.to_s
|
53
|
-
when '
|
54
|
-
|
55
|
-
|
53
|
+
when 'data'
|
54
|
+
if @context[:data_class] == 'result'
|
55
|
+
logger.info 'Got game result'
|
56
|
+
@network.disconnect
|
57
|
+
end
|
56
58
|
end
|
57
59
|
end
|
58
60
|
|
@@ -69,9 +71,10 @@ class Protocol
|
|
69
71
|
logger.info 'roomId : ' + @roomId
|
70
72
|
when 'data'
|
71
73
|
logger.debug "data(class) : #{attrs['class']}"
|
74
|
+
@context[:data_class] = attrs['class']
|
72
75
|
if attrs['class'] == 'sc.framework.plugins.protocol.MoveRequest'
|
73
76
|
@client.gamestate = gamestate
|
74
|
-
move = @client.
|
77
|
+
move = @client.move_requested
|
75
78
|
sendString(move_to_xml(move))
|
76
79
|
end
|
77
80
|
if attrs['class'] == 'error'
|
@@ -122,6 +125,9 @@ class Protocol
|
|
122
125
|
@gamestate.lastMove.add_action_with_order(Push.new(Direction.find_by_key(attrs['direction'].to_sym)), attrs['order'].to_i)
|
123
126
|
when 'condition'
|
124
127
|
@gamestate.condition = Condition.new(attrs['winner'], attrs['reason'])
|
128
|
+
when 'left'
|
129
|
+
logger.debug 'got left event, terminating'
|
130
|
+
@network.disconnect
|
125
131
|
end
|
126
132
|
end
|
127
133
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: software_challenge_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- 'kwollw '
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: exe
|
12
12
|
cert_chain: []
|
13
|
-
date: 2016-10-
|
13
|
+
date: 2016-10-10 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: typesafe_enum
|
@@ -275,7 +275,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
275
275
|
version: '0'
|
276
276
|
requirements: []
|
277
277
|
rubyforge_project:
|
278
|
-
rubygems_version: 2.
|
278
|
+
rubygems_version: 2.6.6
|
279
279
|
signing_key:
|
280
280
|
specification_version: 4
|
281
281
|
summary: This gem provides functions to build a client for the coding competition
|