Esempio n. 1
0
            pass

    setattr(e, 'remove', remove)

    # Make a global variable with the right name
    #sys.modules['__main__'].__dict__[_name] = e
    #cs176.__dict__[_name] = e
    sys.modules['__builtin__'].__dict__[_name] = e

    # This is so we can find its TopoNode
    topo[e] = te
    return e


def topoOf(entity):
    """ Get TopoNode that contains entity.  Students never use this. """
    if type(entity) is TopoNode:
        # We were actually passed a topo object
        return entity
    t = topo.get(entity, None)
    return t


world = World()
events = interface.interface()


def simulate():
    """ Runs the simulator. """
    world.start()
Esempio n. 2
0
    world.do(events.send_entity_down,_name)
    try:
      del sys.modules['__builtin__'].__dict__[_name]
    except:
      pass
  setattr(e, 'remove', remove)

  # Make a global variable with the right name
  #sys.modules['__main__'].__dict__[_name] = e
  #cs176.__dict__[_name] = e
  sys.modules['__builtin__'].__dict__[_name] = e

  # This is so we can find its TopoNode
  topo[e] = te
  return e

def topoOf (entity):
  """ Get TopoNode that contains entity.  Students never use this. """
  if type(entity) is TopoNode:
    # We were actually passed a topo object
    return entity
  t = topo.get(entity, None)
  return t

world = World()
events = interface.interface()

def simulate ():
  """ Runs the simulator. """
  world.start()