Beispiel #1
0
 def m_start(self):
     self.grid = bgrid(0, self.gridx - 1, 0, self.gridy - 1)
     self.trig()
Beispiel #2
0
import copy
import bee
import dragonfly.pandahive
from dragonfly.grid import bgrid
from dragonfly.canvas import box2d

import dragonfly.std, dragonfly.gen, dragonfly.random, dragonfly.logic

blocks = (
    bgrid(values=((0, 0), (1, 0), (2, 0), (3, 0))),  # I
    bgrid(values=((0, 1), (0, 0), (1, 0), (2, 0))),  #J
    bgrid(values=((0, 0), (1, 0), (2, 0), (2, 1))),  #L
    bgrid(values=((0, 1), (0, 0), (1, 1), (1, 0))),  #O
    bgrid(values=((0, 0), (1, 0), (1, 1), (2, 1))),  #S
    bgrid(values=((0, 0), (1, 0), (1, 1), (2, 0))),  #T
    bgrid(values=((0, 1), (1, 1), (1, 0), (2, 0))),  # Z
)

emptygrid = bgrid(0, 0, 0, 0)

from bee.segments import *


class tetris_init_main(bee.worker):
    gridx = variable("int")
    parameter(gridx)
    gridy = variable("int")
    parameter(gridy)

    start = antenna("push", "trigger")
    outp = output("push", ("object", "bgrid"))
Beispiel #3
0
 def m_start(self):
     self.grid = bgrid(0, self.gridx - 1, 0, self.gridy - 1)
     self.trig()
Beispiel #4
0
import copy
import bee
import dragonfly.pandahive
from dragonfly.grid import bgrid
from dragonfly.canvas import box2d

import dragonfly.std, dragonfly.gen, dragonfly.random, dragonfly.logic

blocks = (
    bgrid(values=((0, 0), (1, 0), (2, 0), (3, 0))),  # I
    bgrid(values=((0, 1), (0, 0), (1, 0), (2, 0))),  #J
    bgrid(values=((0, 0), (1, 0), (2, 0), (2, 1))),  #L
    bgrid(values=((0, 1), (0, 0), (1, 1), (1, 0))),  #O
    bgrid(values=((0, 0), (1, 0), (1, 1), (2, 1))),  #S
    bgrid(values=((0, 0), (1, 0), (1, 1), (2, 0))),  #T
    bgrid(values=((0, 1), (1, 1), (1, 0), (2, 0))),  # Z
)

emptygrid = bgrid(0, 0, 0, 0)

from bee.segments import *


class tetris_init_main(bee.worker):
    gridx = variable("int")
    parameter(gridx)
    gridy = variable("int")
    parameter(gridy)

    start = antenna("push", "trigger")
    outp = output("push", ("object", "bgrid"))
Beispiel #5
0
import dragonfly.pandahive
from dragonfly.grid import bgrid
from dragonfly.canvas import box2d
import random

# create 100x100 binary grid and randomize it
grid = bgrid(minx=1, maxx=100, miny=1, maxy=100)
for n in range(grid.minx, grid.maxx + 1):
    for nn in range(grid.miny, grid.maxy + 1):
        if random.random() < 0.5: grid.set_true(n, nn)


#create our main hive class
class myhive(dragonfly.pandahive.pandahive):
    canvas = dragonfly.pandahive.pandacanvas()


#initialize our hive
m = myhive().getinstance()
m.build("myhive")
m.place()
m.close()
m.init()


#set up drawing parameters for the grid
class parameters(object):
    pass


box = box2d(x=100, y=50, sizex=500, sizey=500)
Beispiel #6
0
import dragonfly.pandahive
from dragonfly.grid import bgrid
from dragonfly.canvas import box2d
import random

# create 100x100 binary grid and randomize it
grid = bgrid(minx=1, maxx=100, miny=1, maxy=100)


def randomize_grid():
    for n in range(grid.minx, grid.maxx + 1):
        for nn in range(grid.miny, grid.maxy + 1):
            if random.random() < 0.5:
                grid.set_true(n, nn)
            else:
                grid.set_false(n, nn)


randomize_grid()

#create our main hive class
class myhive(dragonfly.pandahive.pandahive):
    canvas = dragonfly.pandahive.pandacanvas()

#initialize our hive
m = myhive().getinstance()
m.build("myhive")
m.place()
m.close()
m.init()