MCPcopy Index your code
hub / github.com/battlecode/battlecode-2018 / message

Method message

battlecode-manager/server.py:486–507  ·  view source on GitHub ↗

Compress the current state into a message that will be sent to the client

(self, state_diff)

Source from the content-addressed store, hash-verified

484 return
485
486 def message(self, state_diff):
487 '''
488 Compress the current state into a message that will be sent to the
489 client
490 '''
491 if self.error == "":
492 error = "null"
493 else:
494 self.docker.destroy()
495
496 if state_diff == "":
497 state_diff = '""'
498 if isinstance(state_diff, bytes):
499 state_diff = state_diff.decode()
500
501 if self.logged_in:
502 logged_in = "true"
503 else:
504 logged_in = "false"
505
506 message = '{{"logged_in":{},"client_id":"{}","error":{},"message":{}}}'.format(logged_in, self.client_id, error, state_diff)
507 return message
508
509 def player_handler(self):
510 '''

Callers 1

player_handlerMethod · 0.95

Calls 2

formatMethod · 0.80
destroyMethod · 0.45

Tested by

no test coverage detected