Example #1
0
    def defeat(s):
        """Pedagogy is the art of inflicting crushing defeats"""
        s = ui.defeat(s)
        s.ui.story_text = """The wiping out of the human race
is just a temporary setback.
We can time travel back to before you killed us all and try again."""
        s.ui.obj_text = """Click on the "Retry" button"""
        s.obj_func = lambda s: False
        s.nb_resources = 0
        g.BUTTONS["retry"][-1] = lambda: g._state(step_9)
        s.ui.active["obj_text"] = True
        s.ui.active["story_text"] = True
        return s
Example #2
0
def step_9(s):
    """Back to training"""
    s.ui.defeat = ui.defeat
    s.ui.vitcory = ui.victory
    s.ui.end_text = ""
    s.ui.active["retry"] = False
    s = ui.wild(s)
    s.ui.story_text = """Let's try again. The red robot trusts Bob.
That is because they share the same reward function.
The red robot thinks that if Bob has found a near-optimal policy
for resource collection, then it can copy that policy
and save itself the trouble of exploration.
Let's go back to the lab and teach Bob how to
follow a grassy path..."""
    s.ui.obj_text = """Click on the "Lab" button."""
    s.obj_func = lambda s: s.ui.terrain == ui.get_lab
    s.next_func = step_10
    g.BUTTONS["retry"][-1] = lambda: g._state(ui.retry)
    ui.checkpoint_now(s)
    return s
Example #3
0
#!/usr/bin/env python3
import graphics
import ui

from outsmart import return_copy
import graphics as g


g.new_state()
g.STATE.ui.active.update(ui.EDITOR_ACTIVE)



@return_copy
def wild(s):
    s = ui.wild(s)
    s.ui.active.update({k: True for k in ui.EDITOR_ACTIVE
                        if ui.EDITOR_ACTIVE[k]})
    s.ui.active["lab_go_wild"] = False
    return s

@return_copy
def lab(s):
    s = ui.lab(s)
    s.ui.active = ui.EDITOR_ACTIVE.copy()
    return s

g.BUTTONS["lab_go_wild"][-1] = lambda: g._state(wild)
g.BUTTONS["wild_go_lab"][-1] = lambda: g._state(lab)