コード例 #1
0
def main():
	global buffers, readsocks, writesocks, ids, games, rounds, timeout
	# ordering is N, E, S, W
	# list of game pairs will be a list of quadruples

	gamestate = "IDENTIFY"
	while 1:
		readables, writeables, exceptions = select(readsocks, writesocks, [])
		if gamestate == "IDENTIFY":
			sendall("IDENTIFY?")
			gamestate = "READ_IDENTIFY"
		elif gamestate == "READ_IDENTIFY":
			lines = readall()
			ids = lines[:]
			#sendall("BEGIN TOURNAMENT")
			# begin tournament now!!!
			engine(games, rounds, timeout, ids, players)
			gamestate = ""
			for s in players:
				s.close()
			sys.exit(10000)
		elif gamestate == "BAD_GAME":
			for s in players:
				s.close()
			sys.exit(0)
コード例 #2
0
ファイル: slot.py プロジェクト: shimstar/editor
	def loadFromBDD(self):
		query="SELECT star009_location_star008,star009_numero,star009_item_star006 FROM star009_slot where star009_id ='" +str(self.id) + "' "
		instanceDbConnector=shimDbConnector.getInstance()
		cursor=instanceDbConnector.getConnection().cursor()
		cursor.execute(query)
		result_set = cursor.fetchall ()
		for row in result_set:
			self.location=int(row[0])
			self.nb=int(row[1])
			idItem=int(row[2])
		cursor.close()		
		
		if idItem>0:
			query="SELECT star004_type_star003,star004_id FROM star006_item item JOIN star004_item_template itemTemplate ON item.star006_template_star004 = itemTemplate.star004_id WHERE star006_id = '" + str(idItem) + "'"
			cursor=instanceDbConnector.getConnection().cursor()
			cursor.execute(query)
			result_set = cursor.fetchall ()
			
			for row in result_set:
				typeItem=row[0]
				if self.template>0:
					idItem=row[1]
				if typeItem==C_ITEM_ENGINE:
					if self.template>0:
						self.item=engine(0,idItem)
					else:
						self.item=engine(idItem)
				elif typeItem==C_ITEM_WEAPON:
					if self.template>0:
						self.item=Weapon(0,idItem)
					else:
						self.item=Weapon(idItem,self)
			cursor.close()		
		#~ print query
		query="SELECT star021_typeitem_star003 FROM star021_slot_typeitem WHERE star021_slot_star009='" + str(self.id)+ "'"
		cursor=instanceDbConnector.getConnection().cursor()
		cursor.execute(query)
		result_set = cursor.fetchall ()
		for row in result_set:
			self.types.append(int(row[0]))
		cursor.close()		
コード例 #3
0
        
import pygame
from engine import *

game = engine()
pygame.quit()