Example #1
0
    def parseCommand(self, usr, msg, chan):

        plgname = msg.split()[0].replace("!", "")
        plugins = Loader()
        for plugin in plugins.load():
            plg = plugins.get(plugin)

            if msg.startswith(("!" + plugin["name"])):
                args = msg.replace(("!" + plugin["name"]), "")
                self.current_chan = chan
                result = plg.do(args, coriolis=self)
                if result:
                    self.msg(chan, result)
Example #2
0
    def parseCommand(self, usr, msg, chan):

        plgname = msg.split()[0].replace("!", "")
        plugins = Loader()
        for plugin in plugins.load():
            plg = plugins.get(plugin)

            if msg.startswith(("!" + plugin["name"])):
                args = msg.replace(("!" + plugin["name"]), "")
                self.current_chan = chan
                result = plg.do(args, coriolis=self)
                if result:
                    self.msg(chan, result)
Example #3
0
    def create(self):

        self.player = Player(self.width / 2, self.height - 2)
        self.player.offset_x = -16
        self.player.offset_y = -32

        self.maze = Maze(self.width, self.height, self.tile_size)
        self.maze.create()

        self.music = Loader.get('music')
        self.music.play(-1)

        if self.enable_sound:
            self.music.set_volume(0.2)

        else:
            self.music.set_volume(0)

        # black screen fade out
        self.fade_timer = Timer(2000)

        self.castle = Sprite(0, -16, 'castle')

        self.torches = []
        self.torches.append(Sprite(336, 80, 'torch'))
        self.torches.append(Sprite(480, 80, 'torch'))
        self.torches.append(Sprite(83, 140, 'flame'))

        self.lights = []
        self.lights.append(Sprite(240, 0, 'light'))
        self.lights.append(Sprite(384, 0, 'light'))
        self.lights.append(Sprite(-13, 58, 'light'))

        for t in self.torches:
            t.play('default', loop=True)

        for l in self.lights:
            l.play('default', loop=True)

        self.sound = Sprite(common.GAME_WIDTH - 80, 10, 'sound')
        self.nosound = Sprite(common.GAME_WIDTH - 80, 14, 'nosound')
        self.restart = Sprite(common.GAME_WIDTH - 70, 15, 'restart')

        self.fog = pygame.Surface(
            (self.maze.image.get_width(), self.maze.image.get_height()))
        self.fog.set_colorkey((255, 0, 255))
Example #4
0
	def create (self):
		
		self.player = Player(self.width/2, self.height - 2)
		self.player.offset_x = - 16
		self.player.offset_y = - 32
		
		self.maze = Maze(self.width, self.height, self.tile_size)
		self.maze.create()
		
		self.music = Loader.get('music')
		self.music.play(-1)
		
		if self.enable_sound:
			self.music.set_volume(0.2)
			
		else:
			self.music.set_volume(0)

		# black screen fade out
		self.fade_timer = Timer(2000)
		
		self.castle = Sprite(0, -16, 'castle')
		
		self.torches = []
		self.torches.append(Sprite(336, 80, 'torch'))
		self.torches.append(Sprite(480, 80, 'torch'))
		self.torches.append(Sprite(83, 140, 'flame'))
		
		self.lights = []
		self.lights.append(Sprite(240, 0, 'light'))
		self.lights.append(Sprite(384, 0, 'light'))
		self.lights.append(Sprite(-13, 58, 'light'))
		
		for t in self.torches:
			t.play('default', loop=True)
			
		for l in self.lights:
			l.play('default', loop=True)
		
		self.sound = Sprite(common.GAME_WIDTH - 80, 10, 'sound')
		self.nosound = Sprite(common.GAME_WIDTH - 80, 14, 'nosound')
		self.restart = Sprite(common.GAME_WIDTH - 70, 15, 'restart')
		
		self.fog = pygame.Surface((self.maze.image.get_width(), self.maze.image.get_height()))
		self.fog.set_colorkey((255, 0, 255))
Example #5
0
    def __init__(self, x, y, key):

        pygame.sprite.Sprite.__init__(self)

        self.x = x
        self.y = y

        self.offset_x = 0
        self.offset_y = 0

        self.key = key
        self.frames = Loader.get(key)
        self.anims = {}
        self.current_anim = 'default'
        self.anims['default'] = Animation(1000, self.frames)
        self.image = self.anims[self.current_anim].get_image()

        self.rect = self.image.get_rect()
        self.rect.x = x
        self.rect.y = y
Example #6
0
	def __init__ (self, x, y, key):
	
		pygame.sprite.Sprite.__init__(self)
		
		self.x = x
		self.y = y
		
		self.offset_x = 0
		self.offset_y = 0
		
		self.key = key
		self.frames = Loader.get(key)
		self.anims = {}
		self.current_anim = 'default'
		self.anims['default'] = Animation(1000, self.frames)
		self.image = self.anims[self.current_anim].get_image()	
		
		self.rect = self.image.get_rect() 
		self.rect.x = x
		self.rect.y = y
Example #7
0
from handlers.lol import LolHandler
from handlers.start import StartHandler
from handlers.test import TestHandler
from loader import Loader
from store import GLOBAL_STORE


loader = Loader([StartHandler, LolHandler, TestHandler, 2])


# print(GLOBAL_STORE.fetch('start').command_handler())
# print(GLOBAL_STORE.fetch('lol').command_handler())
# print(GLOBAL_STORE.fetch('test').command_handler())

print(loader.get(StartHandler).command_handler())
Example #8
0
    # Try changing the list of datasets

    # However, please consider that the 'census' datasets takes several minutes
    # [ due to the dataset size AND to the presence of many nominal features ]

    datasets = ('arrhythmia', ('balloons', 1), ('balloons', 2), 'flare')

    # SETTING THE CLASS RATIO

    # Standard phidelta diagram: ratio = 1.
    ratio = 1.  # Try changing the class ratio to a fixed value (e.g., 2., 1/5.)

    # You may also change the class ratio randomly ... (see below)

    # from random import randint

    # The option 'crossings' is not required when ratio == 1.
    # You may not want to remove 'crossings' when ratio <> 1.

    for k, dname in enumerate(datasets):
        # ratio = float(randint(1,6))  # ratio > 1 means --> neg than pos
        # if randint(0,1): ratio = 1. / ratio # ratio < 1 --> more pos than neg
        data, labels, info = loader.get(dname)
        stats = Statistics(data=data, labels=labels, info=info)
        phi, delta, fnames, dratio = stats.make()
        view = View(phi, delta, ratio=ratio)
        view >> 'crossings'  # remove the 'crossings' option, as ratio == 1.
        view.plot(title=dname)

# -----------------------------------------------------------------------------
Example #9
0
        if type(fnames) == str: fnames = [fnames]
        if comment: print(comment)
        for feature in self.find_features(fnames):
            feature.display()


# -----------------------------------------------------------------------------
# -------------------- MAIN PROGRAM (for testing) -----------------------------
# -----------------------------------------------------------------------------

if __name__ == '__main__':

    from loader import Loader

    UCIpath = '../datasets/UCI datasets/'

    csv = Loader(path=UCIpath)

    #data, labels, info = csv.load(filename='SPECT-full.csv',index=0,sep=';')
    data, labels, info = csv.get('flare')

    stats = Statistics(data=data, labels=labels, info=info)

    phi, delta, fnames, dratio = stats.make()

    stats.display('statistics')

    stats.display('ranking')

# -----------------------------------------------------------------------------
Example #10
0
	def create (self):
		
		cement = Loader.get('maze_cement') # cement tiles
		floor = Loader.get('maze_floor')   # floor tiles
		CEMENT_BASE_WALL = 0
		CEMENT_TOP_WALL = 1
		
		self.tiles = [
			cement[13], # CEMENT_BASE_WALL
			cement[10], # CEMMENT_TOP_WALL
			floor[13],  # FLOOR
			floor[14],
			floor[17],
			floor[18],
		]
		
		self.matrix = []
		self.graphics = []
		
		for i in range (0, self.height):
			self.matrix.append([])
			self.graphics.append([])
			for j in range (0, self.width):
				self.matrix[i].append(1)
				self.graphics[i].append(randint(2, 4))
			
		posX = self.height - 3
		posY = self.width/2
		
		self.matrix[posX][posY] = 0
		moves = []
		moves.append(posY + posX * self.width)
		
		while len(moves) > 0:
		
			possibleDirections = ""
			
			if posX + 3 > 0 and posX + 3 < self.height - 1 and self.matrix[posX + 3][posY] == 1:
				possibleDirections += 'S'
				
			if posX - 3 > 0 and posX - 3 < self.height - 1 and self.matrix[posX - 3][posY] == 1:
				possibleDirections += 'N'
			
			if posY - 2 > 0 and posY - 2 < self.width - 1 and self.matrix[posX][posY - 2] == 1:
				possibleDirections += 'W'
			
			if posY + 2 > 0 and posY + 2 < self.width - 1 and self.matrix[posX][posY + 2] == 1:
				possibleDirections += 'E'
			
			if len(possibleDirections) > 0:
			
				move = randint(0, len(possibleDirections) - 1)
				
				if possibleDirections[move] == 'N':
					
					self.matrix[posX - 3][posY] = 0
					self.matrix[posX - 2][posY] = 0
					self.matrix[posX - 1][posY] = 0
					posX -= 3
				
				elif possibleDirections[move] == 'S':
				
					self.matrix[posX + 3][posY] = 0
					self.matrix[posX + 2][posY] = 0
					self.matrix[posX + 1][posY] = 0
					posX += 3
					
				elif possibleDirections[move] == 'W':

					self.matrix[posX][posY - 2] = 0
					self.matrix[posX][posY - 1] = 0
					posY -= 2
					
				elif possibleDirections[move] == 'E':
				
					self.matrix[posX][posY + 2] = 0
					self.matrix[posX][posY + 1] = 0
					posY += 2
			
				moves.append(posY + posX * self.width)
				
			else:			
				back = moves.pop(-1)
				posX = int(back / self.width)
				posY = back % self.width
		
		# erase lines (walls) in castle area and beginning area
		for i in range (0, 11):
			for j in range (1, self.width - 1):
				
				_i = min(i, 1)
				self.matrix[i][j] = 0
				self.matrix[-_i - 2][j] = 0
					
		# build graphics
		for i in range (0, self.height - 1):
			for j in range (0, self.width):
			
				if self.matrix[i][j] == 1:
					if self.matrix[i+1][j] == 1:
						self.graphics[i][j] = CEMENT_TOP_WALL
					else:
						self.graphics[i][j] = CEMENT_BASE_WALL
						
		# last line border
		for j in range (0, self.width):
			self.graphics[self.height - 1][j] = 1
			
		# upper border
		for j in range (1, self.width - 1):
			self.matrix[6][j] = 1
			
		self.matrix[6][0] = 0
		self.matrix[6][-1] = 0
		self.matrix[6][13] = 0
		
		self.__draw()
		Loader.set(self.image, 'maze')
		
		self.matrix[7][2] = 1
		self.matrix[7][3] = 1