luiscobo

Taller_11_Mundo_01

Nov 4th, 2019
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JSON 2.06 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.       "objects": {},
  10.       "_orientation": 0,
  11.       "possible_initial_positions": [
  12.         [
  13.           1,
  14.           1
  15.         ]
  16.       ],
  17.       "_is_leaky": true,
  18.       "_trace_history": [],
  19.       "_trace_style": "default",
  20.       "_trace_color": "seagreen",
  21.       "__id": 7,
  22.       "model": "light blue"
  23.     }
  24.   ],
  25.   "walls": {},
  26.   "description": [
  27.     "<h1>Tablero de Damas: el reto</h1>",
  28.     "<p> Hay que ayudar a Reeborg a armar un tablero de damas en el patio donde vive.",
  29.     "    Lo bueno es que tiene suficientes «tokens» en su bolsa para colocarlos en el",
  30.     "    patio en los lugares que corresponda. Tenga en cuenta que la dificultad más ",
  31.     "    grande que se deriva de este problema tiene que ver con el tamaño variable ",
  32.     "    del mundo. El número de filas y el número de columnas del patio cambia, y así ",
  33.     "    también el número de tokens que hay que colocar en los lugares correspondientes.</p>",
  34.     "DIFFICULTY9",
  35.     "    "
  36.   ],
  37.   "small_tiles": false,
  38.   "rows": 10,
  39.   "cols": 10,
  40.   "onload": [
  41.     "var width, height, x, y, nb_object;",
  42.     "RUR.MAX_STEPS = 3000;",
  43.     "width = RUR.randint(3, 14);",
  44.     "height = RUR.randint(3, 14);",
  45.     "",
  46.     "RUR.set_model('light blue');",
  47.     "RUR.set_world_size(width, height);",
  48.     "",
  49.     "",
  50.     "for (x=1; x<= width; x++) {",
  51.     "    for (y=1; y<=height; y++) {",
  52.     "        if ( (x+y)%2 == 0) {",
  53.     "            RUR.add_object(\"token\", x, y, {goal: true});",
  54.     "            RUR.add_colored_tile(\"black\", x, y);",
  55.     "        } else {",
  56.     "            RUR.add_colored_tile(\"beige\", x, y);",
  57.     "        }",
  58.     "    }",
  59.     "}",
  60.     "// give Reeborg more than the number of tokens required",
  61.     "// so that we cannot use the information about",
  62.     "// whether or not we still have tokens to determine if",
  63.     "// the task has been accomplished.",
  64.     "RUR.give_object_to_robot(\"token\", width*height);",
  65.     ""
  66.   ]
  67. }
Advertisement
Add Comment
Please, Sign In to add comment