Advertisement
luiscobo

Mundo_Parcial_01c

Oct 18th, 2019
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. {
  2.   "robots": [
  3.     {
  4.       "x": 1,
  5.       "y": 1,
  6.       "_prev_x": 1,
  7.       "_prev_y": 1,
  8.       "_prev_orientation": 0,
  9.       "_orientation": 0,
  10.       "_is_leaky": true,
  11.       "_trace_history": [],
  12.       "_trace_style": "default",
  13.       "_trace_color": "seagreen",
  14.       "__id": 5,
  15.       "model": "classic"
  16.     }
  17.   ],
  18.   "walls": {},
  19.   "description": [
  20.     "<h1>Torres en la Cueva</h1>",
  21.     "<p>",
  22.     "    La misión es instruir a Reeborg para que construyas unas",
  23.     "    torres de objetos dentro de una cueva. Adicionalmente, en ",
  24.     "    la cueva hay estalactitas en el techo, las cuáles pueden",
  25.     "    tener longitudes diferentes. ",
  26.     "</p>",
  27.     "<p>",
  28.     "    Reeborg quiere hacer que las torres sean tan altas que lleguen hasta",
  29.     "    una posición por debajo donde inicia la estalactita. Entre la parte",
  30.     "    mas alta de la torre y la estalactita debe quedar siempre un espacio,",
  31.     "    además las torres deben ser construidas solamente en las posiciones",
  32.     "    impares, es decir, en la columna 1, en la 3, en la 5, y así sucesivamente.",
  33.     "    El tamaño de la cueva es variable, y puede cambiar de ejecución en ejecución.",
  34.     "</p>",
  35.     "DIFFICULTY4",
  36.     ""
  37.   ],
  38.   "small_tiles": false,
  39.   "rows": 12,
  40.   "cols": 13,
  41.   "onload": [
  42.     "#python onload",
  43.     "import random",
  44.     "width = random.randint(6, 13)",
  45.     "height = 12",
  46.     "",
  47.     "RUR.set_world_size(width, height)",
  48.     "RUR.fill_background(\"grass\")",
  49.     "RUR.give_object_to_robot(\"star\",99)",
  50.     "RUR.give_object_to_robot(\"square\",99)",
  51.     "",
  52.     "#Create some stalactites",
  53.     "",
  54.     "obstacles = []",
  55.     "for i in range(width):",
  56.     "    h = random.randint(8,12)",
  57.     "    obstacles.append(h)",
  58.     "    RUR.add_wall(\"south\",i+1,h)",
  59.     "",
  60.     "#build the sides of the walls  ",
  61.     "",
  62.     "for i in range(width-1):",
  63.     "    n = obstacles[i]",
  64.     "    n2 = obstacles[i+1]",
  65.     "    if n < n2:",
  66.     "        for j in range(n,n2):",
  67.     "            RUR.add_wall(\"east\",i+1,j)    ",
  68.     "    elif n2 < n:",
  69.     "        for j in range(n2,n):",
  70.     "            RUR.add_wall(\"east\",i+1,j)  ",
  71.     "        ",
  72.     "#fill in mud",
  73.     "for i in range(width):",
  74.     "    for j in range(obstacles[i],13):",
  75.     "        RUR.add_obstacle(\"mud\",i+1,j)",
  76.     "",
  77.     "#create goals",
  78.     "options = {'goal' : True}",
  79.     "for x in range(0, width,2):",
  80.     "    for y in range(1,obstacles[x]-1):",
  81.     "        RUR.add_object(\"square\", x+1,y, options)    ",
  82.     "",
  83.     ""
  84.   ]
  85. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement