| ### Las Reliquias de Tolti Aph ### An interactive fiction by Graham Nelson (2005) - the Inform 7 source text
Home page Contents Previous Next Complete text | Section E(e) - Habitaciones del Laberinto A labyrinth room is a kind of room. A labyrinth room has a labyrinth shape called shape. A labyrinth room has a text called map legend. A labyrinth room usually has map legend "-+-". A labyrinth room has a number called minimum level. A labyrinth room usually has minimum level 1. A labyrinth room can be grovelike or ungrovelike. A labyrinth room is usually ungrovelike. Definition: A labyrinth room is unplaced if its grid position is <0,0,0>. Definition: A labyrinth room is unshaped if its shape is L0/0-0-0-0-0-0. Definition: A labyrinth room is ascending if the U part of its shape is 1 and the maze level part of its grid position is not 1. Definition: A labyrinth room is descending if the D part of its shape is 1 and the maze level part of its grid position is not 9. Definition: A labyrinth room is non-ascending if it is not ascending. Definition: A labyrinth room is non-descending if it is not descending.[1] After printing the name of an ascending labyrinth room, say ", con una escalera ascendente". After printing the name of an descending labyrinth room, say ", con una escalera descendente". [Al comienzo, el juego contiene un gran stock de habitaciones del laberinto que no están obligadas a tener una forma o posición, pero que están esperando a unirse al laberinto. La tabla de la sección anterior es usada para asignar formas a las habitaciones, pero respetando su frecuencia relativa.] To calculate how many labyrinth rooms should have each shape: let total space be the number of unshaped labyrinth rooms; let total allocated be 0; let total frequency be 0%; if the total space is 0, stop; repeat through the Table of Shape Frequencies begin; change the shape count entry to 0; end repeat; repeat through the Table of Shape Frequencies begin; let N be the parts per hundred part of the frequency entry; let N be N multiplied by the total space; change the shape count entry to N divided by 100; change the total allocated to the total allocated plus the shape count entry; let total frequency be total frequency plus the frequency entry; end repeat; if the total frequency is not 100%, say "Oops: los totales de la tabla de frecuencias ya llegan al límite de [total frequency]."; [No obstante, si la extensión de la cueva no es un múltiplo de 50 habremos asignado espacio de menos debido errores de redondeo. Así que haremos tiradas aleatorias para corregir esto.] while the total allocated is less than the total space begin; let total frequency be 0%; let R be a random number from 1 to 100; let the weighted percentage be the percentage with parts per hundred part R; repeat through the Table of Shape Frequencies begin; let total frequency be total frequency plus the frequency entry; if the weighted percentage > 0% and the weighted percentage <= the total frequency begin; change the shape count entry to the shape count entry plus 1; change the total allocated to the total allocated plus 1; change the weighted percentage to 0%; end if; end repeat; end while. To give shape to the shapeless labyrinth rooms: [ Ahora cambiamos el conteo de entradas de forma que el conteo de entrada de X signifique que la habitación X es la primera en tener las carateristicas de la presente fila. En particular, esto garantiza que cada fila tenga un conteo de entradas de 1.] let total allocated be 0; repeat through the Table of Shape Frequencies begin; if the shape count entry is not 0 begin; let new value be the total allocated plus 1; let total allocated be total allocated plus shape count entry; change the shape count entry to the new value; end if; end repeat; [Ahora recorremos todas las habitaciones, usando la fila actual para inicializar cada una de ellas, y moviéndonos a la columna apropiada cuando uno de los conteos iniciales es alcanzado. Como está garantizado que haya un conteo de entrada de 1 en algún sitio, los cambios sólo pueden ser alcanzados cuando una fila ha sido elegida.] let total allocated be 0; repeat with blank room running through unshaped labyrinth rooms begin; let total allocated be total allocated plus 1; if there is a shape count of total allocated in the Table of Shape Frequencies then choose row with a shape count of total allocated in the Table of Shape Frequencies; change the shape of the blank room to the shape entry; change the map legend of the blank room to the legend entry; change the printed name of the blank room to the shape name entry; end repeat. Before casting hacer santuario at: if the location is a labyrinth room or the location is the Arboleda Seca, say "Escuchas en tu mente las carcajadas de los niños perdidos, y te das cuenta de que deberías andarte con cuidado a fin de preservar tu fuerza." instead. Before listing nondescript items when the location is a labyrinth room: now all hazards are unmarked for listing; if a hostile monster is marked for listing, say "[if the current maze level is 1]El claro está custodiado[otherwise]La caverna está custodiada[end if] por [a list of hostile monsters which are marked for listing]."; now all hostile monsters are unmarked for listing. Note [1]. La cuestión aquí es que si una cueva con una escalera ascendente se encuentra en el nivel superior, la escalera sea ignorada: de forma similar se haría con una escalera descendente.