This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pygame | |
pygame.init() | |
win = pygame.display.set_mode((500,500)) | |
pygame.display.set_caption("My Game") | |
clock = pygame.time.Clock() | |
run = True | |
while run: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import communicate as c | |
s = c.client('localhost',int(input('port> '))) | |
while 1: | |
s.send(input('send> ')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import socket | |
### Helper functions | |
# Read n bytes from the socket | |
def read(sock, n): | |
o = "" | |
while len(o) < n: | |
o += sock.recv(n-len(o)) |