def test_deve_imprimir_lista(self): pp = PingPong() resultado = [1,2,'ping',4,'pong','ping',7,8,'ping','pong', 11,'ping',13,14,'ping pong'] resposta = pp.gerar_lista(15) self.assertEqual(resposta,resultado)
def test_deve_imprimir_lista(self): pp = PingPong() resultado = [ 1, 2, 'ping', 4, 'pong', 'ping', 7, 8, 'ping', 'pong', 11, 'ping', 13, 14, 'ping pong' ] resposta = pp.gerar_lista(15) self.assertEqual(resposta, resultado)
def __init__(self, questions, search_engines, storage, maxlength, paste): super(Core, self).__init__(name="core") self.storage = Storage(storage, parent=self) self.messages = MessageDatabase(questions, parent=self) self.search = Search(search_engines, parent=self) self.pingpong = PingPong(parent=self) self.flooding = Flooding(maxlength, paste, parent=self) self.cli = CLI(parent=self) self.log.info("load complete")
jid = config.get("xmpp", "jid") password = config.get("xmpp", "password") room = config.get("xmpp", "room") nick = config.get("xmpp", "nick") logging.basicConfig(level=logging.INFO, format='%(levelname)-8s %(message)s') storage = Storage(config.get("db", "storage")) status = Status() conf = Configuration(storage, config) questions = load_database(config.get("db", "questions")) msgdb = MessageDatabase(questions) pingpong = PingPong() alphabet = Alphabet(storage, conf) count = Count(storage, conf) greet = Greet( [x.strip() for x in config.get("modules", "greetings").split(",")], nick) flooding = Flooding(conf) search_engines = load_database(config.get("db", "searchengines")) search = Search(search_engines) #expression = Expression() actions = Actions(storage) choice = Choice(conf) scripting = Scripting(storage, search_engines=search_engines) fatfox = FatFox() burgi = Burgi()
from pingpong import PingPong PingPong()
from pingpong import ping, pong, PingPong addr = ("", 8000) peer = ("", 5000) server = PingPong(addr) server.run()
# -*- coding: utf-8 -*- """ Run Pipng pong threads game from console """ import argparse from pingpong import PingPong if __name__ == '__main__': parser = argparse.ArgumentParser(description='Play ping pong with threads') parser.add_argument('-i', default=10, help='iterations to perform, defaults to 10', type=int, dest='iters') parser.add_argument('-s', default='CON', help='strategy to use, defaults to console', choices=['CON', 'WIN'], dest='strg') parser.add_argument('-m', default='SEMA', choices=['SEMA', 'COND'], help='sync mechanism, defaults to semaphores', dest='sync') parser.add_argument('-t', default=5, help='number of turns if sync mechanism is COND, defaults to 5', type=int, dest='turns') pp = PingPong(**vars(parser.parse_args())) pp.play()
print("set height = ", cap.set(cv2.CAP_PROP_FRAME_HEIGHT, 480)) _, frame = cap.read() windowH, windowW, channels = frame.shape windowW = cap.get(cv2.CAP_PROP_FRAME_WIDTH) windowH = cap.get(cv2.CAP_PROP_FRAME_HEIGHT) #print ("width = ", cap.get(cv2.CAP_PROP_FRAME_WIDTH)); #print ("height = ", cap.get(cv2.CAP_PROP_FRAME_HEIGHT)); #print (windowH, windowW) game = None if gameMode == "PingPong": game = PingPong(windowH, windowW) game.initBalls(numOfBalls, radius) print("PingPong") fps = FPSCounter() while True: ret, frame = cap.read() out = game.run(frame) out = cv2.flip(out, 1) fps.got_frame() # print ("fps = ", fps.fps()) cv2.imshow(gameMode, out) # cv2.waitKey(1)
def handle(self): print "New Connection from: {}".format(self.request.getpeername()) pp = PingPong(self.request) pp.process() # blocking call print "Done Processing"
def test_deve_imprimir_ping(self): pp = PingPong() self.assertEqual(pp.imprime_saida(3), 'ping')
def test_deve_imprimir_um_numero(self): pp = PingPong() self.assertEqual(pp.imprime_saida(7), 7)
Run Pipng pong threads game from console """ import argparse from pingpong import PingPong if __name__ == '__main__': parser = argparse.ArgumentParser(description='Play ping pong with threads') parser.add_argument('-i', default=10, help='iterations to perform, defaults to 10', type=int, dest='iters') parser.add_argument('-s', default='CON', help='strategy to use, defaults to console', choices=['CON', 'WIN'], dest='strg') parser.add_argument('-m', default='SEMA', choices=['SEMA', 'COND'], help='sync mechanism, defaults to semaphores', dest='sync') parser.add_argument( '-t', default=5, help='number of turns if sync mechanism is COND, defaults to 5', type=int, dest='turns') pp = PingPong(**vars(parser.parse_args())) pp.play()
def test_deve_imprimir_ping(self): pp = PingPong() self.assertEqual(pp.imprime_saida(3),'ping')
def test_deve_imprimir_um_numero(self): pp = PingPong() self.assertEqual(pp.imprime_saida(7),7)
import tasks from pingpong import ping, PingPong addr = ("", 5000) peer = ("", 8000) client = PingPong(addr) client.workload.append(tasks.simple(ping, addr, peer)) client.run()