Exemple #1
0
class myhive(commandhive):
    _hivecontext = hivemodule.appcontext(myapp)

    g = chessprocessor2()
    exc_v = except_valueerror()
    connect(g.evexc, exc_v)

    com = commandsensor()

    turn = variable("str")("White")
    t_turn = transistor("str")()
    connect(g.turn, t_turn)
    connect(t_turn, turn)

    on_next = on_next()
    connect(on_next, t_turn)
    connect(g.made_move, on_next)

    p1 = filter(("str", "chess"))()
    connect(com, p1)
    turn_p1 = equal2("str")("Black")
    connect(turn, turn_p1)
    connect(turn_p1, p1.filter)

    p2 = chessUCI("White", "glaurung")
    connect(g.turn, p2.turn)
    connect(on_next, p2.trigger_get_move)

    start = startsensor()
    connect(start, p2.trigger_get_move)

    k = chesskeeper()
    connect(k, g)
    connect(p1.true, g)
    connect(p2, g)
    connect(g, k)
    connect(g, p2.make_move)

    b = chessboard2("Black")
    connect(turn, b.turn)
    connect(b.get_move, g)
    connect(g, b.make_move)

    d = display("str")()
    connect(g, d)

    ex = exitactuator()
    connect(g.finished, ex)

    raiser = bee.raiser()
    bee.connect("evexc", raiser)
Exemple #2
0
class myhive(commandhive):
    _hivecontext = hivemodule.appcontext(myapp)

    g = chessprocessor2()
    exc_v = except_valueerror()
    connect(g.evexc, exc_v)

    com = commandsensor()

    turn = variable("str")("White")
    t_turn = transistor("str")()
    connect(g.turn, t_turn)
    connect(t_turn, turn)

    on_next = on_next_tick()
    connect(on_next, t_turn)
    connect(g.made_move, on_next)

    on_next2 = on_next_tick()
    connect(g.made_move, on_next2)

    p1 = computer2b(("White", "glaurung"))
    connect(g.turn, p1.turn)
    connect(on_next, p1.trigger_move)

    p2 = computer2b(("Black", "glaurung"))
    connect(g.turn, p2.turn)
    connect(on_next2, p2.trigger_move)

    k = chesskeeper()
    connect(k, g)
    connect(p1.move, g)
    connect(p2.move, g)
    connect(g, k)
    connect(g, p1.make_move)
    connect(g, p2.make_move)

    b = chessboard2(None)
    connect(turn, b.turn)
    connect(b.get_move, g)
    connect(g, b.make_move)

    d = display("str")()
    connect(g, d)

    ex = exitactuator()
    connect(g.finished, ex)

    raiser = bee.raiser()
    bee.connect("evexc", raiser)
Exemple #3
0
class myhive(commandhive):
    _hivecontext = hivemodule.appcontext(myapp)

    g = chessprocessor()

    com = commandsensor()

    turn = variable("str")("White")
    t_turn = transistor("str")()
    connect(g.turn, t_turn)
    connect(t_turn, turn)

    on_next = on_next()
    connect(on_next, t_turn)
    connect(g.made_move, on_next)

    p1 = filter(("str", "chess"))()
    connect(com, p1)
    turn_white = equal2("str")("White")
    connect(turn, turn_white)
    connect(turn_white, p1.filter)

    p2 = filter(("str", "chess"))()
    connect(com, p2)
    turn_black = equal2("str")("Black")
    connect(turn, turn_black)
    connect(turn_black, p2.filter)

    k = chesskeeper()
    connect(k, g)
    connect(p1.true, g)
    connect(p2.true, g)
    connect(g, k)

    b = chessboard()
    connect(turn, b.turn)
    connect(b.get_move, g)
    connect(g, b.make_move)

    d = display("str")()
    connect(g, d)

    ex = exitactuator()
    connect(g.finished, ex)

    raiser = bee.raiser()
    bee.connect("evexc", raiser)
Exemple #4
0
class myhive(commandhive):
    g = chessprocessor2()
    exc_v = except_valueerror()
    connect(g.evexc, exc_v)

    com = commandsensor()

    turn = variable("str")("White")
    t_turn = transistor("str")()
    connect(g.turn, t_turn)
    connect(t_turn, turn)

    on_next = on_next()
    connect(on_next, t_turn)
    connect(g.made_move, on_next)

    p1 = filter(("str", "chess"))()
    connect(com, p1)
    turn_white = equal2("str")("White")
    connect(turn, turn_white)
    connect(turn_white, p1.filter)

    p2 = filter(("str", "chess"))()
    connect(com, p2)
    turn_black = equal2("str")("Black")
    connect(turn, turn_black)
    connect(turn_black, p2.filter)

    k = chesskeeper()
    connect(k, g)
    connect(p1.true, g)
    connect(p2.true, g)
    connect(g, k)

    d = display("str")()
    connect(g, d)

    ex = exitactuator()
    connect(g.finished, ex)

    raiser = bee.raiser()
    bee.connect("evexc", raiser)
Exemple #5
0
        class launch(bee.frame):
            __doc__ = cls.__doc__

            subprocess = bee.parameter("bool")

            bind_worker = launch_helper(
                subprocess=bee.get_parameter("subprocess"))
            hive_binder = worker()
            id_factory = id_suffix_worker()

            # To push identifier base in id factory
            id_transistor = std.transistor(("str", "identifier"))()
            bee.connect(id_transistor.outp, id_factory.identifier_base)

            # Create some hive IO pins
            trig = bee.antenna(id_transistor.trig)
            bee.connect(id_factory.trig_out, bind_worker.trig)

            # Secondary calls
            process_class = bee.antenna(id_transistor.inp)
            bee.connect(process_class, bind_worker.process_class)

            # Secondary calls
            process_identifier = bee.output(id_factory.new_identifier)
            bee.connect(process_identifier, bind_worker.process_identifier)

            # Weaver of these two
            w_bind_ids = std.weaver(("id", "id"))()

            process_id_duck = convert.pull.duck("str", "id")()

            bee.connect(id_factory.new_identifier, process_id_duck)
            bee.connect(process_id_duck, w_bind_ids.inp1)

            process_class_duck = convert.pull.duck("str", "id")()

            bee.connect(process_class, process_class_duck)
            bee.connect(process_class_duck, w_bind_ids.inp2)

            # Connect weaver to binder
            t_bind_ids = std.transistor(("id", "id"))()
            bee.connect(w_bind_ids, t_bind_ids)
            bee.connect(t_bind_ids, hive_binder.bind)

            # This only triggers if we're a subprocess
            bee.connect(bind_worker.trig_out, t_bind_ids.trig)

            guiparams = {
                "process_class": {
                    "name": "Process class",
                    "fold": True
                },
                "trig": {
                    "name": "Trigger"
                },
                "process_identifier": {
                    "name": "Process ID"
                },
                "subprocess": {
                    "name": "Subprocess"
                },
                "memberorder": ["trig", "process_class", "process_identifier"],
            }