luiscobo

Mundo_Parcial_02e

Oct 18th, 2019
272
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JSON 2.39 KB | None | 0 0
  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.       "possible_initial_positions": [
  17.         [
  18.           1,
  19.           1
  20.         ]
  21.       ]
  22.     }
  23.   ],
  24.   "walls": {},
  25.   "description": [
  26.     "<h1>Reeborg de Cacería</h1>",
  27.     "<p>",
  28.     "    Reeborg decidió pasar todo el día practicando sus habilidades de arquería. En algún lugar",
  29.     "    de su mundo se encuentra un objeto. Escriba un programa que le permita a Reeborg encontrar",
  30.     "    este objeto y crear una línea horizontal en la misma posición en donde se encuentra el ",
  31.     "    objeto dado, de un extremo al otro del mundo. El tamaño del mundo varía de una ejecución ",
  32.     "    a otra y la posición del objeto tampoco es la misma. ",
  33.     "</p>",
  34.     "<p>",
  35.     "    Les aconsejo construir una función <code>encontrar_objeto()</code> que busque por todo el mundo",
  36.     "    el objeto dado, y posicione el robot sobre el objeto, y luego llene la línea dada con el objeto",
  37.     "    dado. Ya Reeborg posee dentro de si una cantidad bastante grande de ese objeto, para que esto",
  38.     "    no sea una preocupación.",
  39.     "</p>    ",
  40.     "DIFFICULTY4",
  41.     ""
  42.   ],
  43.   "small_tiles": false,
  44.   "rows": 16,
  45.   "cols": 16,
  46.   "onload": [
  47.     "#python onload",
  48.     "import random",
  49.     "width = random.randint(10, 16)",
  50.     "height = random.randint(10, 16)",
  51.     "",
  52.     "objeto = \"star\"",      
  53.     "RUR.set_world_size(width, height)",
  54.     "RUR.fill_background(\"grass\")",
  55.     "RUR.give_object_to_robot(objeto, 99)",
  56.     "RUR.give_object_to_robot(\"triangle\",99)",
  57.     "",
  58.     "#Find Target Location",
  59.     "",
  60.     "target_x = random.randint(1, width)",
  61.     "target_y = random.randint(1, height)",
  62.     "",
  63.     "options = {'goal' : True}",
  64.     "RUR.add_object(objeto, target_x, target_y)",
  65.     "#RUR.add_object(\"triangle\", target_x, target_y, options)",
  66.     "",
  67.     "# La línea horizontal a llenar",
  68.     "for x in range(width):",
  69.     "\tRUR.add_object(objeto, x+1, target_y, options)",
  70.     "",
  71.     "#for y in range(height):",
  72.     "#\tif( y+1 != target_y):",
  73.     "#\t\tRUR.add_object(\"triangle\", target_x, y+1, options)\t",
  74.     "",
  75.     ""
  76.   ]
  77. }
Advertisement
Add Comment
Please, Sign In to add comment