CE4  Changes On Branch bas

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Changes In Branch bas Excluding Merge-Ins

This is equivalent to a diff from f485113329 to d6ebbe9717

2021-04-02
15:50
Get the simplified version of the map from the Bas version, in IFM format, and update <Makefile> to convert it to PDF. check-in: f1936cc0ae user: programandala.net tags: nextbasic
2021-03-07
19:52
Fix typo in Interlingue and exchange translations. Remove comment about possible bug of Bas, apparently solved. Leaf check-in: d6ebbe9717 user: programandala.net tags: bas
2020-07-01
17:43
Rewrite the playing/record time control. check-in: 9dc95e2ede user: programandala.net tags: bas
2019-12-27
23:57
Fix `about_this_pot`. check-in: 98c753a310 user: programandala.net tags: tbas
23:37
Start the conversion from tbas to Bas. check-in: 9341d5a29a user: programandala.net tags: bas
2019-12-21
16:39
Update README. check-in: f485113329 user: programandala.net tags: tbas
16:21
Remove Matrix Brandy library. check-in: 4056b6f7c1 user: programandala.net tags: tbas

Changes to README.adoc.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

21
22
23
24
25
26
27
28
29
..
41
42
43
44
45
46
47


= CE4
:author: Marcos Cruz (programandala.net)
:revdate: 2019-12-21

// This file is written in AsciiDoc/Asciidoctor format
// (http://asciidoctor.org).

== Description

CE4 is a text adventure in Spanish, Esperanto and Interlingue,
programmed in http://digilander.libero.it/tonibinhome/tbas/[tbas] for
GNU/Linux and Android (with https://termux.com/[Termux]).

Home page (in Spanish):
http://programandala.net/es.programa.ce4.html.

== Files

<src> contains the sources, including abandoned or dormant
implementations in other languages, each in its own subdirectory.


<src/tbas/ce4.bas> is the current main source, with UTF-8 encoding.

<map/ce4.ifm> is the source of the map, in
http://www.bitbucket.org/zondo/ifm[IFM] format. In order to convert it
to PostScript (ce4.ps) and PDF (ce4.pdf) formats, type `make map`.

== History of the project

................................................................................
  http://www.yabasic.de[Yabasic].
- 2019-10-06: Continue the development in
  https://smallbasic.github.io/[SmallBASIC].
- 2019-12-02: Continue the development in
  http://brandy.matrixnetwork.co.uk/[Matrix Brandy BASIC VI].
- 2019-12-06: Continue the development in
  http://digilander.libero.it/tonibinhome/tbas/[tbas].




|







|
|






|
|
>

|







 







>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
..
42
43
44
45
46
47
48
49
50
= CE4
:author: Marcos Cruz (programandala.net)
:revdate: 2020-05-20

// This file is written in AsciiDoc/Asciidoctor format
// (http://asciidoctor.org).

== Description

CE4 is a text adventure in Spanish, Esperanto and Interlingue,
programmed in http://www.moria.de/~michael/bas/[Bas] for GNU/Linux and
Android (with https://termux.com/[Termux]).

Home page (in Spanish):
http://programandala.net/es.programa.ce4.html.

== Files

The <variants> directory contains the sources, including abandoned or
dormant implementations in other languages, each in its own
subdirectory.

<src/bas/ce4.bas> is the current main source, with UTF-8 encoding.

<map/ce4.ifm> is the source of the map, in
http://www.bitbucket.org/zondo/ifm[IFM] format. In order to convert it
to PostScript (ce4.ps) and PDF (ce4.pdf) formats, type `make map`.

== History of the project

................................................................................
  http://www.yabasic.de[Yabasic].
- 2019-10-06: Continue the development in
  https://smallbasic.github.io/[SmallBASIC].
- 2019-12-02: Continue the development in
  http://brandy.matrixnetwork.co.uk/[Matrix Brandy BASIC VI].
- 2019-12-06: Continue the development in
  http://digilander.libero.it/tonibinhome/tbas/[tbas].
- 2019-12-28: Continue the development in
  http://www.moria.de/~michael/bas/[Bas].

Changes to TO-DO.adoc.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79

















































= CE4 TO-DO
:author: Marcos Cruz (programandala.net)
:revdate: 2019-12-02

== Old (Yabasic version)

=== 2018-08-14

- Rewrite all code about `light`.

=== 2018-08-15

- Add filters to the actions.
- Fix and improve `the_guard_moves`.

=== 2018-08-16

- Improve `debug` with a second, optional parameter: flag to overwrite
  the value of `debugging` and force the message be displayed.
- Fix the location of the walls.
- Fix `do_go`: it does not work with complements.
- Make the entity names calculated?
- Improve `parse`: recognize commas.
- Improve `parse`: recognize "y" ("and").

=== 2018-08-17

- Fix:

....
> m dentro
  Hacia dentro está el tramo central del pasillo, pero la puerta está cerrada con llave.
> m fuera
  Hacia fuera está .
....

- Improve `enter_location`: Calculate the detail parameter of
  `describe_entity`.
- Add a flag array called `unlistable`.

=== 2018-08-19

- Write `updated_exits` to improve `show_exits` and

=== 2018-09-04

- Implement `do_close` and `do_lock`. 

=== 2018-10-30

- Create door entities.

== Old (SmallBASIC version)

=== 2019-10-08

- Improve `do_take(the_all)` to display the items in a list, the way
  the inventory works.
- Fix: the door can be taken in the office.  
- Use `for x in y do` to traverse the vocabulary.

=== 2019-10-10

- Convert the `article` array into a function.

=== 2019-10-14

- Add location names to the vocabulary: secret room.
- Support location entities as complements of actions, e.g. enter.
- Support action "remember" with known things (and visited locations).

=== 2019-10-26

- Rename the secret room: cellar/kelo/céllar.

=== 2019-11-29

- Fix: some errors seem to be caused because the number of words is
  different in each language, so the arrays are different size as well.



















































|

<
<
<
<
<
<
|




<
<
<
<
<
<
<
<
<
<
|
<
<
<
<
<
<
<
<
<





<
<
<
<
|



|



<
<
<
<
<
<
<
<
<
|



|

<



|



|

|
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4






5
6
7
8
9










10









11
12
13
14
15




16
17
18
19
20
21
22
23









24
25
26
27
28
29

30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
= CE4 TO-DO
:author: Marcos Cruz (programandala.net)
:revdate: 2020-01-04







== 2018-08-15

- Add filters to the actions.
- Fix and improve `the_guard_moves`.











== 2018-08-17










- Improve `enter_location`: Calculate the detail parameter of
  `describe_entity`.
- Add a flag array called `unlistable`.





== 2018-09-04

- Implement `do_close` and `do_lock`. 

== 2018-10-30

- Create door entities.










== 2019-10-10

- Convert the `article` array into a function.

== 2019-10-14


- Support location entities as complements of actions, e.g. enter.
- Support action "remember" with known things (and visited locations).

== 2019-10-26

- Rename the secret room: cellar/kelo/céllar.

== 2019-12-28

- Move article type to `make_word()`.
- Fix: `check_entities` displays wrong articles in Spanish, though the
  data and the calculations seem right: "un maceta" (entity 16), "unas
  muro" (entity 19)
- Fix: name of entity 40 (the safe). See `check_entities`. 

== 2019-12-29

- Consult notation of the friend character's alias.

== 2019-12-30

- Improve `is_carried%` to choose the carrier.

== 2020-01-01

- Fix error in `entity_article$` after changing the languages
in certain combinations: 
+
....
  [Interlingue activat por li comandes.]
  [Español activado para los textos.]
> #es #eo
[in entity_article$( 9)] [article_type= 2] [gender= 0] [number= 0]
[output_language%= 3] Error: array index is out of range in line 1783 at:
let proper_article$=article$(article_type%(this_entity%),gender%(this_entity%,ou
tput_language%),number%(this_entity%,output_language%),output_language%)
....

== 2020-01-02

- Write the contents of the help system.  

== 2020-01-03

- Fix: Calling `wt_update_screen_size` makes `input` receive first
  "\^{[2;1R" (the cursor position info) and next times a lot of
  invisible garbage, what makes the command parsing cycle never stop.
  This happens both on an actual terminal and on terminal emulators on
  X Window (at least on QTerminal and LXTerminal; but not in XFCE4's
  Terminal, where nevertheless the delete key does not work in Bas:
  "^h" is shown instead). On Android's Termux only the cursor position
  info is displayed as part of the user input, but no invisible
  garbage is added later.
- Replace `present_entity%` and `carried_entity%` arrays with strings,
  which can be resized, and store the numbers as text at fixed
  intervals. Other option: use `mat` variables.
- In `catched_by_the_guard`, one Unicode character is rendered wrong,
  without reason. It happened first with a dash in a string, now with
  an accented vowel in another one instead. It seems the zone becomes
  corrupted because of a bug in Bas.

Added ce4.bas.





























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
5729
5730
5731
5732
5733
5734
5735
5736
5737
5738
5739
5740
5741
5742
5743
5744
5745
5746
5747
5748
5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
5769
5770
5771
5772
5773
5774
5775
5776
5777
5778
5779
5780
5781
5782
5783
5784
5785
5786
5787
5788
5789
5790
5791
5792
5793
5794
5795
5796
5797
5798
5799
5800
5801
5802
5803
5804
5805
5806
5807
5808
5809
5810
5811
5812
5813
5814
5815
5816
5817
5818
5819
5820
5821
5822
5823
5824
5825
5826
5827
5828
5829
5830
5831
5832
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
5846
5847
5848
5849
5850
5851
5852
5853
5854
5855
5856
5857
5858
5859
5860
5861
5862
5863
5864
5865
5866
5867
5868
5869
5870
5871
5872
5873
5874
5875
5876
5877
5878
5879
5880
5881
5882
5883
5884
5885
5886
5887
5888
5889
5890
5891
5892
5893
5894
5895
5896
5897
5898
5899
5900
5901
5902
5903
5904
5905
5906
5907
5908
5909
5910
5911
5912
5913
5914
5915
5916
5917
5918
5919
5920
5921
5922
5923
5924
5925
5926
5927
5928
5929
5930
5931
5932
5933
5934
5935
5936
5937
5938
5939
5940
5941
5942
5943
5944
5945
5946
5947
5948
5949
5950
#!/usr/bin/env bas
' ce4.bas

' CE4

' By Marcos Cruz (programandala.net)
' http://programandala.net/es.programa.ce4.html

' A text adventure in Spanish, Esperanto and Interlingue, programmed
' in Michael Haardt's Bas (http://www.moria.de/~michael/bas/).

' XXX UNDER DEVELOPMENT --

let version$="0.165.1+202103071925"

' ==============================================================
' Author and license {{{1

let copyright$="(C) 2014,2015,2016,2017,2018,2019,2020,2021 Marcos Cruz (programandala.net)"

' You may do whatever you want with this work, so long as you
' retain all copyright, authorship, acknowledgment and credit
' notices and this license in all redistributed copies and
' derived works.  There is no warranty.

' ==============================================================
' Config {{{1

option base 1
let debugging%=false

' ==============================================================
' Requirements {{{1

function iff$(n%,s1$,s2$)

  if n% then fnreturn s1$ else fnreturn s2$

end function

function trim$(s$)

  fnreturn ltrim$(rtrim$(s$))

end function

' ==============================================================
' wt (wrapping text) {{{1

' wt ("wrapping text") is a text output module
' for Bas and other BASIC dialects.

' Project homepage:
' <http://programandala.net/en.program.wt.html>

' Version 0.4.0+202001031401
' (after Semantic Versioning: http://semver.org)
' See change log at the end of the module

' ----------------------------------------------
' Author and license {{{2

' Author: Marcos Cruz (programandala.net), 2012, 2013, 2014,
' 2016, 2017, 2018, 2019, 2020.

' You may do whatever you want with this work, so long as you
' retain all copyright, authorship and credit notices and this
' license in all redistributed copies and derived works.  There
' is no warranty.

' ----------------------------------------------
' Main {{{2

sub wt_init

  ' Init the constants and variables of the module.

  cls

  ' Internal variables:

  let wt_ansi_esc$=chr$(27)+"["
  let wt_cols%=73
  let wt_rows%=20
  let wt_current_col%=1
  let wt_current_row%=1
  let wt_free_cols%=wt_cols%
  let wt_free_rows%=wt_rows%
  let wt_displayed_rows%=0

  let wt_blank_row$=string$(wt_cols%," ")

  ' User variables:

  let wt_reversed%=false ' flag: reverse the colors?
  let wt_foreground%=green% ' current foreground color
  let wt_background%=black% ' current background color
  let wt_indentation%=2 ' spaces before paragraph's first char
  let wt_paragraph_separation%=0 ' lines between paragraphs
  let wt_prompt$="[…]"

  wt_home

end sub

sub wt_home

  ' Set the cursor at the top left position.

  let wt_current_col%=1
  let wt_current_row%=1
  locate wt_current_row%,wt_current_col%
  let wt_free_cols%=wt_cols%
  let wt_free_rows%=wt_rows%
  let wt_displayed_rows%=0

end sub

function wt_input_delimited_number%(delimiter$)

  ' Input a decimal numeric entry delimited by the given character.
  ' Used to get information from the ANSI console.

  local digit$,number%
	do
    let digit$=inkey$
    if digit$=delimiter$ then exit do
    let number%=number%*10 + val(digit$)
	loop

  fnreturn number%

end function

sub wt_update_cursor_position

  ' Update `wt_current_col%` and `wt_current_row%` with the current
  ' cursor position.

  print wt_ansi_esc$;"6n";
	input$(2) ' ignore returned ANSI ESC ("<esc>[")
  let wt_current_row%=wt_input_delimited_number%(";")
  let wt_current_col%=wt_input_delimited_number%("R")

  ' XXX FIXME -- This does not fix the problem in
  ' `wt_update_screen_size` (see TO-DO):
  wt_empty_keyboard_buffer

end sub

sub wt_empty_keyboard_buffer

  do while len(inkey$)
  loop

end sub

sub wt_update_screen_size

  ' Update `wt_cols%` and `wt_rows%` with the current screen size.
  '
  ' XXX REMARK -- The maximum width reported by the ANSI terminal is
  ' 77.

  local col%,previous_row%,previous_col%

  ' Save the current cursor position.
  wt_update_cursor_position
  let previous_row%=wt_current_row%
  let previous_col%=wt_current_col%

  'do ' XXX INFORMER -- testing loop

  ' Calculate and update the current screen height (rows).
  locate 10000,1
  wt_update_cursor_position
  let wt_rows%=wt_current_row%

  ' Calculate and update the current screen width (columns).
  let col%=2
  do
    locate 1,col%
    wt_update_cursor_position
    if wt_current_col%<col% then
      let wt_cols%=col%-1
      exit do
    else
      inc col%
    end if
  loop

  'cls:print "cols=";wt_cols%,"rows=";wt_rows%:loop ' XXX INFORMER -- testing loop

  ' Restore the previous cursor position.
  locate previous_row%,previous_col%

end sub

sub wt_clear

  ' Clear the screen.

  cls

  ' XXX FIXME -- Calling `wt_update_screen_size` causes problems.
  ' Details in the TO-DO.
  '
  'wt_update_screen_size

  wt_home

end sub

sub wt_wipe

  ' Wipe the screen with the current color.

  local row%

  locate 1,1
  for row%=1 to wt_rows%
    wt_type_raw(wt_blank_row$)
  next row%
  wt_home

end sub

function wt_at_first_col

  ' Is the cursor at the first column?

  fnreturn (wt_free_cols%=wt_cols%)

end function

function wt_after_last_col%

  ' Is the cursor after the last column?

  fnreturn (wt_free_cols%=0)

end function

function wt_at_first_row%

  ' Is the cursor at the first row?

  fnreturn (wt_free_rows%=wt_rows%)

end function

function wt_at_home%

  ' Is the cursor at the home position?

  fnreturn (wt_at_first_row% and wt_at_first_col)

end function

sub wt_do_cr

  ' Do a carriage return.

  print
  let wt_free_cols%=wt_cols%
  dec wt_free_rows%
  inc wt_displayed_rows%
  ' debug("displayed rows="+str$(wt_displayed_rows%))
  if wt_displayed_rows%=(wt_rows%-2) then wt_pause

end sub

sub wt_cr

  ' Do a carriage return, if needed.

  if wt_at_first_col then exit sub
  if wt_after_last_col% then exit sub
  wt_do_cr

end sub

sub wt_type_raw(text$)

  ' Type raw text in the current colors, without updating any
  ' variables.

  if wt_reversed% then
    color wt_background%,wt_foreground%
  else
    color wt_foreground%,wt_background%
  end if
  print text$;

end sub

sub wt_type_line(text$)

  ' Print a text at the current cursor position; the text is
  ' not longer than the free space of the current row.

  wt_type_raw(text$)
  let wt_free_cols%=wt_free_cols%-len(text$)

end sub

sub wt_indent

  ' Do a carriage return and indent.

  wt_cr
  if not wt_at_home% then
    wt_type_line(string$(max(wt_indentation%,0)," "))
  end if

end sub

sub wt_type(text$)

  ' Print a text from the current cursor position.
  '
  ' Known issue: By design, all words of the text are supposed
  ' to be shorter than one row… In practice this is not a
  ' problem.


  local word$,word_end%

  let text$=edit$(text$,4+8+128)+" "

  do while len(text$)
    let word_end%=instr(text$," ")
    let word$=left$(text$,max(0,word_end%-1))
    let text$=right$(text$,len(text$)-word_end%)
    if word_end%<>0 and len(word$)<>0 then
      wt_type_word(word$)
    end if
  loop

end sub

sub wt_type_word(word$)

  ' Print a word from the current cursor position.
  '
  ' Known issue: By design, the word is supposed to be shorter than
  ' one row… In practice this is not a problem.

  if wt_free_cols%<len(word$) then
    wt_do_cr
  end if

  wt_type_line(word$)
  if wt_free_cols% then
    wt_type_line(" ")
    if wt_free_cols%<0 then
      let wt_free_cols%=wt_cols%+wt_free_cols%
      dec wt_free_rows%
    end if
  end if

end sub

sub wt_type_para(text$)

  ' Print a text on a new paragraph.

  local i%

  if not wt_at_home% then
    for i%=1 to wt_paragraph_separation%+1
      wt_do_cr
    next i%
    wt_indent
  end if
  wt_type(text$)

end sub

sub wt_pause

  ' Display a text pause prompt and wait for a keypress.

  local backwards%

  let backwards%=len(wt_prompt$)+1

  wt_type(wt_prompt$)
  input$(1)
  print string$(backwards%,8);space$(backwards%);string$(backwards%,8);
  let wt_free_cols%=wt_free_cols%+backwards%
  let wt_displayed_rows%=0

end sub

' ----------------------------------------------
' Change log {{{2

' 2019-12-06: Start converting to tbas the code of the current Matrix
' Brandy version of wt: 0.2.1-dev.6.
'
' 2019-12-29: Convert the code from tbas to Bas.
'
' 2020-01-02: Ask for a key press before scrolling.
'
' 2020-01-03: Add code to get the current cursor position and the
' current screen size, and update the current screen size when the
' screen is cleared.

' ==============================================================
' Constants {{{1

' Languages
let esperanto% = 1
let interlingue% = 2
let spanish% = 3
let languages% = 3

' Noun attributes
let masculine%=1
let feminine%=2
let neuter%=3
let singular%=1
let plural%=2

' Article types
let no_article%=0
let indefinite%=1
let definite%=2
let possesive%=3

' Plot
let max_carried%=3 ' maximum number of entities that can be carried XXX TMP
let safe_code_digits%=4

' Colors
let black%=0
let blue%=1
let green%=2
let cyan%=3
let red%=4
let magenta%=5
let brown%=6
let white%=7
let gray%=8
let light_blue%=9
let light_green%=10
let light_cyan%=11
let light_red%=12
let light_magenta%=13
let yellow%=14
let light_white%=15

' ==============================================================
' Action identifiers {{{1

let enumerated%=0

let no_action%=enum% ' must be zero

let to_do%=enum%
let to_drop%=enum%
let to_examine%=enum%
let to_go%=enum%
let to_go_east%=enum%
let to_go_in%=enum%
let to_go_north%=enum%
let to_go_out%=enum%
let to_go_south%=enum%
let to_go_west%=enum%
let to_hash_columns%=enum%
let to_hash_debug%=enum%
let to_hash_drop%=enum%
let to_hash_esperanto%=enum%
let to_hash_go%=enum%
let to_hash_help%=enum%
let to_hash_interlingue%=enum%
let to_hash_langs%=enum%
let to_hash_locate%=enum%
let to_hash_resize%=enum%
let to_hash_rows%=enum%
let to_hash_spanish%=enum%
let to_hash_stop%=enum%
let to_hash_take%=enum%
let to_inventory%=enum%
let to_list_exits%=enum%
let to_look%=enum%
let to_open%=enum%
let to_read%=enum%
let to_show_graphics%=enum%
let to_take%=enum%
let to_turn_off%=enum%
let to_turn_on%=enum%

let actions%=enumerated% ' count

' ==============================================================
' Entity identifiers {{{1

' The cardinal points and directions must be the first
' identifiers, and they must be in the given order (north,
' south, east, west, inside and outside).  The order of the
' rest of entities is unimportant.

let enumerated%=0

let no_entity%=enum% ' must be zero

' ----------------------------------------------
' Directions {{{2

let the_north%=enum%
let the_south%=enum%
let the_east%=enum%
let the_west%=enum%
let the_inside%=enum%
let the_outside%=enum%

let max_exits%=the_outside% ' count

let first_direction%=the_north%
let last_direction%=the_outside%
let first_cardinal_point%=the_north%
let last_cardinal_point%=the_west%

' ----------------------------------------------
' Virtual or special {{{2

let the_all%=enum%
let the_corridor_x%=enum% ' ambiguous entity
let the_esperanto_language%=enum%
let the_exit%=enum%
let the_interlingue_language%=enum%
let the_inventory%=enum%
let the_limbo%=enum%
let the_no%=enum%
let the_outside_x%=enum% ' ambiguous entity
let the_pot_x%=enum% ' ambiguous entity
let the_spanish_language%=enum%
let the_table_x%=enum% ' ambiguous entity
let the_wall_x%=enum% ' ambiguous entity
let the_yes%=enum%

' ----------------------------------------------
' Characters {{{2

let the_guard%=enum%
let me%,the_protagonist%=enum%

' ----------------------------------------------
' Things {{{2

let the_wall_0%=enum%: let first_thing_entity%=the_wall_0%
let the_wall_1%=enum%
let the_wall_2%=enum%
let the_wall_3%=enum%
let the_ballpen%=enum%
let the_book%=enum%
let the_brick%=enum%
let the_dining_room_tables%=enum%
let the_door%=enum%
let the_key%=enum%
let the_paper_piece%=enum%
let the_paper_sheet%=enum%
let the_pencil%=enum%
let the_pot_0%=enum%
let the_pot_1%=enum%
let the_pot_2%=enum%
let the_pot_3%=enum%
let the_safe%=enum%
let the_shoe%=enum%
let the_sock%=enum%
let the_tape%=enum%
let the_flashlight%=enum%: let last_thing_entity%=the_flashlight%

' ----------------------------------------------
' Locations {{{2

let the_bathroom%=enum%: let first_location%=the_bathroom%
let the_classroom%=enum%
let the_corridor_0%=enum%
let the_corridor_1%=enum%
let the_corridor_2%=enum%
let the_dining_room%=enum%
let the_junk_room%=enum%
let the_kitchen%=enum%
let the_library%=enum%
let the_office%=enum%
let the_outside_0%=enum%
let the_outside_1%=enum%
let the_outside_2%=enum%
let the_outside_3%=enum%
let the_reception%=enum%
let the_secret_room%=enum%: let last_location%=the_secret_room%

let entities%=enumerated% ' count

' ==============================================================
' Variables {{{1

let input_language%=spanish% ' current input language
let output_language%=spanish% ' current output language

let playing_time%=0

let enumerated%=0

' ==============================================================
' Arrays {{{1

' -----------------------------------------------
' Articles {{{2

dim article$(3,3,2,languages%)
' type:   indefinite, definite, possesive
' gender: masculine, feminine, neuter
' number: singular, plural

dim visits%(entities%) ' visit counters

'dim done%(actions%,entities%) ' counters ' XXX TODO -- not used yet

' -----------------------------------------------
' Entities {{{2

dim location%(entities%)
  ' The location (or holder) of all entities.

dim name_word%(entities%,languages%)
  ' Number of the vocabulary word associated with an entity, and used
  ' as name when no explicit name has been defined in `long_name$`.

dim gender%(entities%,languages%)
  ' `masculine%`, `feminine%` or `neuter%`.

dim number%(entities%,languages%)
  ' `singular%` or `plural%`.

dim article_type%(entities%)
  ' `indefinite%`, `definite%` or `possesive%`.

dim is_location%(entities%)
  ' A flag. Entities that are locations have a true flag.

dim is_portable%(entities%)
  ' A flag. Entities that are portable have a true flag.

dim examinations%(entities%)
  ' A count: times an entity has been examined in detail.
  '
  ' XXX REMARK -- This count is useless with directions, unless
  ' the counter is reset after the protagonist have entered a
  ' new location. It is pretty useless with inventory an
  ' probably others as well. Besides, `done%()` could be
  ' used instead, with all actions and entities.

dim carried_entity%(entities%-2) ' XXX TODO -- size
  ' A list of entities that are carried by the protagonist,
  ' updated by `entities_held_by%`.
  '
  ' In theory, everything could be carried at once except the
  ' protagonist himself and his current location.

dim present_entity%(entities%-2) ' XXX TODO -- size
  ' A list of entities that are in the current location,
  ' updated by `present_entities%`.
  '
  ' In theory, everything could be present in the current location
  ' except the location itself and the protagonist.

dim long_name$(entities%,languages%)

' -----------------------------------------------
' Map {{{2

dim exit_location%(entities%,max_exits%)
let nowhere%=0

' ==============================================================
' Boot {{{1

init_once

if debugging% then
  ' show_map
end if

' print entity_article$(the_pot_x%):input$(1)
' check_entities
' check_articles

main
end

' ==============================================================
' Misc functions {{{1

function between%(low%,high%)

  ' Return a random integer between _high%_ and _low%_.
  fnreturn rnd(high%-low%+1)+low%-1

end function

function random_digit$

  ' Return a random digit.
  fnreturn chr$(between%(asc("0"),asc("9")))

end function

function zero$(n%)

  fnreturn right$("00"+ltrim$(str$(n%)),2)

end function

function hour$(h%,m%,s%)

  ' Hour, minute and second as an ISO time string.

  fnreturn zero$(h%)+":"+zero$(m%)+":"+zero$(s%)

end function

function time_$(centiseconds%)

  ' Convert centiseconds to an ISO time string.

  local hours%,minutes%,seconds%

  let seconds%=centiseconds%/100
  let hours%=seconds%/3600
  let seconds%=seconds% mod 3600
  let minutes%=seconds%/60
  let seconds%=seconds% mod 60

  fnreturn hour$(hours%,minutes%,seconds%)

end function

function enum%

  ' Then return the current value of `enumerated%`,
  ' incrementing it for the next time.

  inc enumerated%
  fnreturn enumerated%-1

end function

function capitalized$(this_text$)

  fnreturn upper$(left$(this_text$,1))+mid$(this_text$,2)

end function

function replaced$(source$,oldTxt$,newTxt$)

  ' Replace all occurrences of `oldTxt$` in `source$` with `newTxt$`.

  local position%,chunk%

  let position%=1

  let chunk%=len(oldTxt$)

  do
    let position%=instr(source$,oldTxt$,position%)
    if position% then
      let source$=left$(source$,position%-1)+newTxt$+mid$(source$,position%+chunk%)
      let position%=position%+1+chunk%
    end if
    debug(source$)
  loop until position%=0

  fnreturn source$

end function

function decimal_digits_only%(text$)

	local character$,characters%,n%

	let characters%=len(text$)
	for n%=1 to characters%
		let character$=mid$(text$,n%,1)
		if character$<"0" or character$>"9" then fnreturn false
	next n%

	fnreturn characters%<>0

end function

' ==============================================================
' Multilingual texts {{{1

' Note: The functions are ordered alphabetically.

function and_$ ' {{{2

  select case output_language%
    case esperanto%
      fnreturn "kaj"
    case interlingue%
      fnreturn "e"
    case spanish%
      fnreturn "y"
  end select

end function

function at_$ ' {{{2

  select case output_language%
    case esperanto%,spanish%
      fnreturn "en"
    case interlingue%
      fnreturn "in"
  end select

end function

function entity_$ ' {{{2

  select case output_language%
    case esperanto%
      fnreturn "estaĵo"
    case interlingue%,spanish%
      fnreturn "ente"
  end select

end function

function he_catchs_you_$ ' {{{2

  local out_$

  select case output_language%
    case esperanto%
      out_$="Antaŭ ol vi povas reagi, "
      out_$=out_$+"li prenas vin ĉe la kolo per unu el liaj grandaj manoj, "
      out_$=out_$+"kaj diras:"
    case interlingue%
      out_$="Ante que vu posse reacter, "
      out_$=out_$+"il capte vos ye li col per un ex su grand manus, "
      out_$=out_$+"e di:"
    case spanish%
      out_$="Antes de que puedas reaccionar, "
      out_$=out_$+"te agarra por el cuello con una de sus grandes manos, "
      out_$=out_$+"y te dice:"
  end select

  fnreturn out_$

end function

function here_$ ' {{{2

  select case output_language%
    case esperanto%
      fnreturn "ĉi tie"
    case interlingue%
      fnreturn "ci"
    case spanish%
      fnreturn "aquí"
  end select

end function

function how_did_you_enter_$ ' {{{2

  select case output_language%
    case esperanto%
      fnreturn "Kiel vi eniris ĉi-tien?"
    case interlingue%
      fnreturn "Qualmen vu intrat ci?"
    case spanish%
      fnreturn "¿Cómo has entrado aquí?"
  end select

end function

function impossible_$ ' {{{2

  select case output_language%
    case esperanto%
      fnreturn "Neeble."
    case interlingue%
      fnreturn "Ínpossibil."
    case spanish%
      fnreturn "Imposible."
  end select

end function

function is_at_$ ' {{{2

  select case output_language%
    case esperanto%
      fnreturn "estas "+at_$
    case interlingue%
      fnreturn "es "+at_$
    case spanish%
      fnreturn "está "+at_$
  end select

end function

function is_here_$ ' {{{2

  select case output_language%
    case esperanto%
      fnreturn "estas "+here_$
    case interlingue%
      fnreturn "es "+here_$
    case spanish%
      fnreturn "está "+here_$
  end select

end function

function is_held_by_you_$ ' {{{2

  select case output_language%
    case esperanto%
      fnreturn "estas tenata de vi"
    case interlingue%
      fnreturn "es tenet de vu"
    case spanish%
      fnreturn "está en tu poder"
  end select

end function

function no_way_$ ' XXX REMARK -- Not used. ' {{{2

  select case output_language%
    case esperanto%
      fnreturn "Neniel."
    case interlingue%
      fnreturn "Nequalmen."
    case spanish%
      fnreturn "De ninguna manera."
  end select

end function

function question_mark_$ ' {{{2

  select case output_language%
    case spanish%
      fnreturn "¿"
    case else
      fnreturn ""
  end select

end function

function the_flashlight_is_off_$ ' {{{2

  select case output_language%
    case esperanto%
      fnreturn "La lumilo ekmallumiĝis."
    case interlingue%
      fnreturn "Li tasca-lampe ha extintet se subitmen."
    case spanish%
      fnreturn "La linterna se ha apagado de repente."
  end select

end function

function the_guard_goes_to_$ ' {{{2

  select case output_language%
    case esperanto%
      fnreturn "La gvardisto iras al"
    case interlingue%
      fnreturn "Li gardero ea vers"
    case spanish%
      fnreturn "El guarda se va hacia"
  end select

end function

function to_take_$ ' {{{2

  select case output_language%
    case esperanto%
      fnreturn "Preni"
    case interlingue%
      fnreturn "Prener"
    case spanish%
      fnreturn "Coger"
  end select

end function

function you_already_have_$ ' {{{2

  select case output_language%
    case esperanto%
      fnreturn "Vi jam havas"
    case interlingue%
      fnreturn "Vu ja have"
    case spanish%
      fnreturn "Ya tienes"
  end select

end function

function you_are_in_$ ' {{{2

  select case output_language%
    case esperanto%
      fnreturn "Vi estas en"
    case interlingue%
      fnreturn "Vu sta in"
    case spanish%
      fnreturn "Estás en"
  end select

end function

function you_can_not_go_that_way_$ ' {{{2

  select case output_language%
    case esperanto%
      fnreturn "Vi ne povas iri tien."
    case interlingue%
      fnreturn "Vu ne posse ear ta."
    case spanish%
      fnreturn "No puedes ir en esa dirección."
  end select

end function

function you_carry_nothing_$ ' {{{2

  select case output_language%
    case esperanto%
      fnreturn "Vi portas nenion."
    case interlingue%
      fnreturn "Vu porta nequó."
    case spanish%
      fnreturn "Nada llevas contigo."
  end select

end function

function you_drop_$ ' {{{2

  select case output_language%
    case esperanto%
      fnreturn "Vi lasas"
    case interlingue%
      fnreturn "Vu lassa"
    case spanish%
      fnreturn "Dejas"
  end select

end function

function you_have_$ ' {{{2

  select case output_language%
    case esperanto%
      fnreturn "Vi havas"
    case interlingue%
      fnreturn "Vu have"
    case spanish%
      fnreturn "Tienes"
  end select

end function

function you_hear_something_in_the_corridor_$ ' {{{2

  select case output_language%
    case esperanto%
      fnreturn "Vi aŭdas ion en la koridoro…"
    case interlingue%
      fnreturn "Vu audi alquó in li coridor…"
    case spanish%
      fnreturn "Oyes algo en el pasillo…"
  end select

end function

function you_hear_steps_from_$(direction%) ' {{{2

  select case output_language%
    case esperanto%
      fnreturn "Vi aŭdas paŝojn de "+iff$(is_cardinal_point%(direction%),"la","")
    case interlingue%
      fnreturn "Vu audi passus "+iff$(is_cardinal_point%(direction%),"del","de")
    case spanish%
      fnreturn "Oyes pasos "+iff$(is_cardinal_point%(direction%),"al","")
  end select

end function

function you_see_$ ' {{{2

  select case output_language%
    case esperanto%
      fnreturn "Vi vidas"
    case interlingue%
      fnreturn "Vu vide"
    case spanish%
      fnreturn "Ves"
  end select

end function

sub you_see_nothing_special

  wt_type_para(you_see_nothing_special_$+".")

end sub

sub you_see_nothing_special_about(entity%)

  wt_type_para(you_see_nothing_special_$)
  select case output_language%
    case esperanto%,interlingue%
      wt_type("pri")
    case spanish%
      wt_type("en")
  end select
  wt_type(name$(entity%)+".")

end sub

function you_see_nothing_special_$ ' {{{2

  select case output_language%
    case esperanto%
      fnreturn "Vi vidas nenion specialan"
    case interlingue%
      fnreturn "Vu vide nequó special"
    case spanish%
      fnreturn "Nada ves de especial"
  end select

end function

function you_take_$ ' {{{2

  select case output_language%
    case esperanto%
      fnreturn "Vi prenas"
    case interlingue%
      fnreturn "Vu prende"
    case spanish%
      fnreturn "Coges"
  end select

end function

' ==============================================================
' Language tools {{{1

function t$(esperanto$,interlingue$,spanish$)

  ' XXX REMARK -- Not used yet.

  select case output_language%
    case esperanto%  :fnreturn esperanto$
    case interlingue%:fnreturn interlingue$
    case spanish%    :fnreturn spanish$
  end select

end function

sub select_languages(commands_language%,texts_language%)

  let input_language%=commands_language%
  let output_language%=texts_language%

  if input_language%=output_language% then
    select case input_language%
      case esperanto%
        wt_type_para("[Esperanto aktivita.]")
      case interlingue%
        wt_type_para("[Interlingue activat.]")
      case spanish%
        wt_type_para("[Español activado.]")
    end select
  else
    select case input_language%
      case esperanto%
        wt_type_para("[Esperanto aktivita por la komandoj.]")
      case interlingue%
        wt_type_para("[Interlingue activat por li comandes.]")
      case spanish%
        wt_type_para("[Español activado para los comandos.]")
    end select
    select case output_language%
      case esperanto%
        wt_type_para("[Esperanto aktivita por la tekstoj.]")
      case interlingue%
        wt_type_para("[Interlingue activat por li textus.]")
      case spanish%
        wt_type_para("[Español activado para los textos.]")
    end select
  end if

end sub

' ==============================================================
' Data {{{1

' -----------------------------------------------
' Articles {{{2

sub make_articles

  ' type:   indefinite, definite, possesive
  ' gender: masculine, feminine, neuter
  ' number: singular, plural

  let article$(indefinite%,neuter%,singular%,esperanto%)=""
  let article$(indefinite%,neuter%,plural%,esperanto%)=""
  let article$(definite%,neuter%,singular%,esperanto%)="la"
  let article$(definite%,neuter%,plural%,esperanto%)="la"
  let article$(possesive%,neuter%,singular%,esperanto%)="mia"
  let article$(possesive%,neuter%,plural%,esperanto%)="miaj"
  let article$(possesive%,neuter%,singular%,esperanto%)="mia"
  let article$(possesive%,neuter%,plural%,esperanto%)="miaj"

  let article$(indefinite%,neuter%,singular%,interlingue%)="un"
  let article$(indefinite%,neuter%,plural%,interlingue%)=""
  let article$(definite%,neuter%,singular%,interlingue%)="li"
  let article$(definite%,neuter%,plural%,interlingue%)="li"
  let article$(possesive%,neuter%,singular%,interlingue%)="mi"
  let article$(possesive%,neuter%,plural%,interlingue%)="mi"

  let article$(indefinite%,masculine%,singular%,spanish%)="un"
  let article$(indefinite%,masculine%,plural%,spanish%)="unos"
  let article$(indefinite%,feminine%,singular%,spanish%)="una"
  let article$(indefinite%,feminine%,plural%,spanish%)="unas"
  let article$(definite%,masculine%,singular%,spanish%)="el"
  let article$(definite%,masculine%,plural%,spanish%)="los"
  let article$(definite%,feminine%,singular%,spanish%)="la"
  let article$(definite%,feminine%,plural%,spanish%)="las"
  let article$(possesive%,masculine%,singular%,spanish%)="mi"
  let article$(possesive%,masculine%,plural%,spanish%)="mis"
  let article$(possesive%,feminine%,singular%,spanish%)="mi"
  let article$(possesive%,feminine%,plural%,spanish%)="mis"

end sub

' -----------------------------------------------
' Map {{{2

sub make_exits(entity%,north%,south%,east%,west%,inside%,outside%)

  let is_location%(entity%)=true
  let exit_location%(entity%,the_north%)=north%
  let exit_location%(entity%,the_south%)=south%
  let exit_location%(entity%,the_east%)=east%
  let exit_location%(entity%,the_west%)=west%
  let exit_location%(entity%,the_inside%)=inside%
  let exit_location%(entity%,the_outside%)=outside%

end sub

sub make_map

  make_exits(the_bathroom%,0,0,0,the_corridor_0%,0,0)
  make_exits(the_classroom%,0,0,0,the_corridor_1%,0,0)
  make_exits(the_corridor_0%,the_reception%,the_corridor_1%,the_bathroom%,0,0,0)
  make_exits(the_corridor_1%,the_corridor_0%,the_corridor_2%,the_classroom%,the_library%,0,0)
  make_exits(the_corridor_2%,the_corridor_1%,the_junk_room%,the_dining_room%,0,0,0)
  make_exits(the_dining_room%,0,the_kitchen%,0,the_corridor_2%,0,0)
  make_exits(the_outside_0%,the_outside_1%,the_outside_3%,locked%(the_reception%),0,locked%(the_reception%),0)
  make_exits(the_outside_1%,0,0,the_outside_2%,the_outside_0%,0,0)
  make_exits(the_outside_2%,the_outside_1%,the_outside_3%,0,0,0,0)
  make_exits(the_outside_3%,0,0,the_outside_2%,the_outside_0%,0,0)
  make_exits(the_junk_room%,the_corridor_2%,0,0,0,0,0)
  make_exits(the_kitchen%,the_dining_room%,0,0,0,0,0)
  make_exits(the_library%,0,0,the_corridor_1%,0,0,0)
  make_exits(the_office%,0,the_reception%,0,0,0,0)
  make_exits(the_secret_room%,0,0,0,0,0,0)
  make_exits(the_reception%,the_office%,the_corridor_0%,0,locked%(the_outside_0%),0,0)

end sub

' -----------------------------------------------
' Entities {{{2

sub make_entity(entity%,its_location%,its_article_type%,is_portable%)

  let location%(entity%)=its_location%
  let article_type%(entity%)=its_article_type%
  let is_portable%(entity%)=is_portable%

end sub

sub make_entities

  ' Parameters:
  ' make_entity(entity_id,location,article_type,portable)

  make_entity(the_all%,the_limbo%,no_article%,false)
  make_entity(the_ballpen%,the_limbo%,indefinite%,true)
  make_entity(the_book%,the_limbo%,indefinite%,true)
  make_entity(the_brick%,the_limbo%,indefinite%,true)
  make_entity(the_dining_room_tables%,the_dining_room%,indefinite%,false)
  make_entity(the_door%,the_limbo%,indefinite%,false)
  make_entity(the_east%,the_limbo%,definite%,false)
  make_entity(the_guard%,the_limbo%,definite%,false)
  make_entity(the_inside%,the_limbo%,no_article%,false)
  make_entity(the_inventory%,the_limbo%,indefinite%,false)
  make_entity(the_key%,the_limbo%,definite%,true)
  make_entity(the_north%,the_limbo%,definite%,false)
  make_entity(the_outside%,the_limbo%,no_article%,false)
  make_entity(the_paper_piece%,the_limbo%,indefinite%,true)
  make_entity(the_paper_sheet%,the_limbo%,indefinite%,true)
  make_entity(the_pencil%,the_limbo%,indefinite%,true)
  make_entity(the_pot_x%,the_limbo%,indefinite%,true)
  make_entity(the_pot_0%,the_outside_0%,indefinite%,true)
  make_entity(the_pot_1%,the_outside_1%,indefinite%,true)
  make_entity(the_pot_2%,the_outside_2%,indefinite%,true)
  make_entity(the_pot_3%,the_outside_3%,indefinite%,true)
  make_entity(the_safe%,the_limbo%,indefinite%,false)
  make_entity(the_shoe%,the_limbo%,indefinite%,true)
  make_entity(the_sock%,the_limbo%,indefinite%,true)
  make_entity(the_south%,the_limbo%,definite%,false)
  make_entity(the_flashlight%,the_protagonist%,indefinite%,true)
  make_entity(the_wall_x%,the_limbo%,indefinite%,false)
  make_entity(the_wall_0%,the_outside_0%,indefinite%,false)
  make_entity(the_wall_1%,the_outside_1%,indefinite%,false)
  make_entity(the_wall_2%,the_outside_2%,indefinite%,false)
  make_entity(the_wall_3%,the_outside_3%,indefinite%,false)
  make_entity(the_west%,the_limbo%,definite%,false)

  ' Long names

  ' Note: In Esperanto names "*" marks the position of the accusative
  ' "n" endings.

  let long_name$(the_bathroom%,esperanto%)="la necesejo*"
  let long_name$(the_bathroom%,interlingue%)="li toilette"
  let long_name$(the_bathroom%,spanish%)="el cuarto de baño"
  let long_name$(the_classroom%,esperanto%)="la klasĉambro*"
  let long_name$(the_classroom%,interlingue%)="li aula"
  let long_name$(the_classroom%,spanish%)="el aula"
  let long_name$(the_corridor_0%,esperanto%)="la norda* ekstremo* de la koridoro"
  let long_name$(the_corridor_0%,interlingue%)="li fine nordic del coridor"
  let long_name$(the_corridor_0%,spanish%)="el extremo norte del pasillo"
  let long_name$(the_corridor_1%,esperanto%)="la centra* parto* de la koridoro"
  let long_name$(the_corridor_1%,interlingue%)="li parte central del coridor"
  let long_name$(the_corridor_1%,spanish%)="el tramo central del pasillo"
  let long_name$(the_corridor_2%,esperanto%)="la suda* ekstremo* de la koridoro"
  let long_name$(the_corridor_2%,interlingue%)="li fine sudic del coridor"
  let long_name$(the_corridor_2%,spanish%)="el extremo sur del pasillo"
  let long_name$(the_dining_room%,esperanto%)="la manĝejo*"
  let long_name$(the_dining_room%,interlingue%)="li manjatoria"
  let long_name$(the_dining_room%,spanish%)="el comedor"
  let long_name$(the_junk_room%,esperanto%)="la fortenejo*"
  let long_name$(the_junk_room%,interlingue%)="li depó" ' XXX TODO --
  let long_name$(the_junk_room%,spanish%)="el trastero"
  let long_name$(the_kitchen%,esperanto%)="la kuirejo*"
  let long_name$(the_kitchen%,interlingue%)="li cocinería"
  let long_name$(the_kitchen%,spanish%)="la cocina"
  let long_name$(the_library%,esperanto%)="la librejo*"
  let long_name$(the_library%,interlingue%)="li biblioteca"
  let long_name$(the_library%,spanish%)="la biblioteca"
  let long_name$(the_limbo%,esperanto%)="la limbo*"
  let long_name$(the_limbo%,interlingue%)="li limbo"
  let long_name$(the_limbo%,spanish%)="el limbo"
  let long_name$(the_office%,esperanto%)="la oficejo* de la direktoro"
  let long_name$(the_office%,interlingue%)="li buró del director"
  let long_name$(the_office%,spanish%)="el despacho del director"
  let long_name$(the_outside_0%,esperanto%)="la okcidenta* flanko* de la konstruaĵo"
  let long_name$(the_outside_0%,interlingue%)="li látere occidental del construction"
  let long_name$(the_outside_0%,spanish%)="el oeste del edificio"
  let long_name$(the_outside_1%,esperanto%)="la norda* flanko* de la konstruaĵo"
  let long_name$(the_outside_1%,interlingue%)="li látere nordic del construction"
  let long_name$(the_outside_1%,spanish%)="el norte del edificio"
  let long_name$(the_outside_2%,esperanto%)="la orienta* flanko* de la konstruaĵo"
  let long_name$(the_outside_2%,interlingue%)="li látere oriental del construction"
  let long_name$(the_outside_2%,spanish%)="el este del edificio"
  let long_name$(the_outside_3%,esperanto%)="la suda* flanko* de la konstruaĵo"
  let long_name$(the_outside_3%,interlingue%)="li látere sudic del construction"
  let long_name$(the_outside_3%,spanish%)="el sur del edificio"
  let long_name$(the_protagonist%,esperanto%)="la protagonisto"
  let long_name$(the_protagonist%,interlingue%)="li protagonist"
  let long_name$(the_protagonist%,spanish%)="el protagonista"
  let long_name$(the_reception%,esperanto%)="la akceptejo*"
  let long_name$(the_reception%,interlingue%)="li hall"
  let long_name$(the_reception%,spanish%)="la recepción"
  let long_name$(the_safe%,spanish%)="la caja fuerte"
  let long_name$(the_secret_room%,esperanto%)="la sekreta* ĉambro*"
  let long_name$(the_secret_room%,interlingue%)="li chambre secret"
  let long_name$(the_secret_room%,spanish%)="la habitación secreta"
  let long_name$(the_tape%,spanish%)="la cinta de casete"

end sub

' =============================================================
' Vocabulary {{{1

' Words can be either verbs, which are associated with an action, or
' nouns, which are associated with an entity. One single word can be
' a verb and a noun at the same time.
'
' Several words can be associated with one entity, and one word can
' be associated with several entities.  This is how it works:
'
' When several words are associated with one entity, the one whose
' "entity_name" argument is "true" will be the name of the entity.
'
' When one word is associated with several entities, it must be
' associated first with an ambiguous entity, a fake entity
' identifier whose actual value will be calculated by the parser,
' depending on the current location or other data. The identifier of
' ambiguous entities uses the "X" suffix.

sub make_word(its_language%,ambiguity%,the_word$,its_action%,its_entity%,its_gender%,its_number%,is_entity_name%)

  ' Parameters:

  ' its_language%:   language of the word
  ' ambiguity%:      parameter used only to keep the calls ordered
  ' the_word$:       the word
  ' its_action%:     action associated to the word
  ' its_entity%:     entity associated to the word
  ' its_gender%:     grammatical gender of the word
  ' its_number%:     number of the word (singular or plural)
  ' is_entity_name%: flag: is the word the entity name?

  ' When `making%` is `true`, `make_word` adds the word to the
  ' vocabulary; when `making%` is `false`, `make_word` just counts the
  ' words.

  inc words%
  if making_vocabulary% then
    let word$(words%)=the_word$
    let word_action%(words%)=its_action%
    let word_entity%(words%)=its_entity%
    let word_language%(words%)=its_language%
    if its_entity%<>no_entity% then
      let gender%(its_entity%,its_language%)=its_gender%
      let number%(its_entity%,its_language%)=its_number%
      if is_entity_name% then
        let name_word%(its_entity%,its_language%)=words%
      end if
    end if
  end if

end sub

sub make_vocabulary

  local its_entity%,its_gender%,its_number%,its_language%,is_entity_name%

  let words%=0 ' init the counter
  read_vocabulary(false) ' first just count the words
  dim word$(words%)
  dim word_action%(words%)
  dim word_entity%(words%)
  dim word_language%(words%)
  let words%=0 ' init the counter
  read_vocabulary(true) ' make it

end sub

sub read_vocabulary(making%)

  ' When `making%` is `true`, `make_word` adds the word to the
  ' vocabulary; when `making%` is `false`, `make_word` just counts the
  ' words.

  ' The second parameter of `make_word` is the ambiguity flag. It is
  ' used only to make it easier to keep the calls ordered in the
  ' source: Ambiguous words (0) must be defined first to make the
  ' parser find them first.

  let making_vocabulary%=making%

  make_word(esperanto%,0,"eksteraĵojn",to_go_out%,the_outside_x%,neuter%,plural%,true)
  make_word(esperanto%,0,"eksteraĵon",to_go_out%,the_outside_x%,neuter%,singular%,false)
  make_word(esperanto%,0,"flor-poton",no_action%,the_pot_x%,neuter%,singular%,true)
  make_word(esperanto%,0,"floro-poton",no_action%,the_pot_x%,neuter%,singular%,false)
  make_word(esperanto%,0,"floropoton",no_action%,the_pot_x%,neuter%,singular%,false)
  make_word(esperanto%,0,"florpoton",no_action%,the_pot_x%,neuter%,singular%,false)
  make_word(esperanto%,0,"koridoron",no_action%,the_corridor_x%,neuter%,singular%,true)
  make_word(esperanto%,0,"murojn",no_action%,the_wall_x%,neuter%,plural%,false)
  make_word(esperanto%,0,"muron",no_action%,the_wall_x%,neuter%,singular%,true)
  make_word(esperanto%,0,"poton",no_action%,the_pot_x%,neuter%,singular%,false)
  make_word(esperanto%,0,"tablon",no_action%,the_table_x%,neuter%,singular%,true)
  make_word(esperanto%,1,"#castellano",to_hash_spanish%,the_spanish_language%,0,0,false)
  make_word(esperanto%,1,"#cols",to_hash_columns%,the_spanish_language%,0,0,false)
  make_word(esperanto%,1,"#columns",to_hash_columns%,the_spanish_language%,0,0,false)
  make_word(esperanto%,1,"#debug",to_hash_debug%,no_entity%,0,0,false)
  make_word(esperanto%,1,"#drop",to_hash_drop%,no_entity%,0,0,false)
  make_word(esperanto%,1,"#eo",to_hash_esperanto%,the_esperanto_language%,0,0,false)
  make_word(esperanto%,1,"#epo",to_hash_esperanto%,the_esperanto_language%,0,0,false)
  make_word(esperanto%,1,"#es",to_hash_spanish%,the_spanish_language%,0,0,false)
  make_word(esperanto%,1,"#esp",to_hash_spanish%,the_spanish_language%,0,0,false)
  make_word(esperanto%,1,"#español",to_hash_spanish%,the_spanish_language%,0,0,false)
  make_word(esperanto%,1,"#esperanto",to_hash_esperanto%,the_esperanto_language%,0,0,false)
  make_word(esperanto%,1,"#go",to_hash_go%,no_entity%,0,0,false)
  make_word(esperanto%,1,"#helpi",to_hash_help%,no_entity%,0,0,false)
  make_word(esperanto%,1,"#helpon",to_hash_help%,no_entity%,0,0,false)
  make_word(esperanto%,1,"#helpu",to_hash_help%,no_entity%,0,0,false)
  make_word(esperanto%,1,"#hispana",to_hash_spanish%,the_spanish_language%,0,0,false)
  make_word(esperanto%,1,"#ie",to_hash_interlingue%,the_interlingue_language%,0,0,false)
  make_word(esperanto%,1,"#ile",to_hash_interlingue%,the_interlingue_language%,0,0,false)
  make_word(esperanto%,1,"#interlingue",to_hash_interlingue%,the_interlingue_language%,0,0,false)
  make_word(esperanto%,1,"#interlingveo",to_hash_interlingue%,the_interlingue_language%,0,0,false)
  make_word(esperanto%,1,"#langs",to_hash_langs%,no_entity%,0,0,false)
  make_word(esperanto%,1,"#locate",to_hash_locate%,no_entity%,0,0,false)
  make_word(esperanto%,1,"#occidental",to_hash_interlingue%,the_interlingue_language%,0,0,false)
  make_word(esperanto%,1,"#okcidentalo",to_hash_interlingue%,the_interlingue_language%,0,0,false)
  make_word(esperanto%,1,"#resize",to_hash_resize%,no_entity%,0,0,false)
  make_word(esperanto%,1,"#rows",to_hash_rows%,the_interlingue_language%,0,0,false)
  make_word(esperanto%,1,"#stop",to_hash_stop%,no_entity%,0,0,false)
  make_word(esperanto%,1,"#take",to_hash_take%,no_entity%,0,0,false)
  make_word(esperanto%,1,"akceptejon",no_action%,the_reception%,neuter%,singular%,true)
  make_word(esperanto%,1,"bibliotekon",no_action%,the_library%,neuter%,singular%,false)
  make_word(esperanto%,1,"brikon",no_action%,the_brick%,neuter%,singular%,true)
  make_word(esperanto%,1,"bul-krajonon",no_action%,the_ballpen%,neuter%,singular%,true)
  make_word(esperanto%,1,"bulkrajonon",no_action%,the_ballpen%,neuter%,singular%,false)
  make_word(esperanto%,1,"chion",no_action%,the_all%,neuter%,singular%,false)
  make_word(esperanto%,1,"cxion",no_action%,the_all%,neuter%,singular%,false)
  make_word(esperanto%,1,"e",to_go_east%,the_east%,neuter%,singular%,false)
  make_word(esperanto%,1,"easte",to_go_east%,the_east%,neuter%,singular%,false)
  make_word(esperanto%,1,"easten",to_go_east%,the_east%,neuter%,singular%,false)
  make_word(esperanto%,1,"easton",to_go_east%,the_east%,neuter%,singular%,true)
  make_word(esperanto%,1,"ek",to_examine%,no_entity%,0,0,false)
  make_word(esperanto%,1,"eksteren",to_go_out%,the_outside%,0,0,true)
  make_word(esperanto%,1,"ekzameni",to_examine%,no_entity%,0,0,false)
  make_word(esperanto%,1,"ekzamenu",to_examine%,no_entity%,0,0,false)
  make_word(esperanto%,1,"elirejojn",no_action%,the_exit%,neuter%,plural%,true)
  make_word(esperanto%,1,"elirejon",no_action%,the_exit%,neuter%,singular%,false)
  make_word(esperanto%,1,"eliri",to_go_out%,no_entity%,0,0,false)
  make_word(esperanto%,1,"eliru",to_go_out%,no_entity%,0,0,false)
  make_word(esperanto%,1,"elshalti",to_turn_off%,no_entity%,0,0,false)
  make_word(esperanto%,1,"elshaltu",to_turn_off%,no_entity%,0,0,false)
  make_word(esperanto%,1,"elsxalti",to_turn_off%,no_entity%,0,0,false)
  make_word(esperanto%,1,"elsxaltu",to_turn_off%,no_entity%,0,0,false)
  make_word(esperanto%,1,"elŝalti",to_turn_off%,no_entity%,0,0,false)
  make_word(esperanto%,1,"elŝaltu",to_turn_off%,no_entity%,0,0,false)
  make_word(esperanto%,1,"enen",to_go_in%,the_inside%,0,0,true)
  make_word(esperanto%,1,"eniri",to_go_in%,no_entity%,0,0,false)
  make_word(esperanto%,1,"eniru",to_go_in%,no_entity%,0,0,false)
  make_word(esperanto%,1,"eoste",to_go_east%,the_east%,neuter%,singular%,false)
  make_word(esperanto%,1,"eosten",to_go_east%,the_east%,neuter%,singular%,false)
  make_word(esperanto%,1,"eoston",to_go_east%,the_east%,neuter%,singular%,true)
  make_word(esperanto%,1,"estingi",to_turn_off%,no_entity%,0,0,false)
  make_word(esperanto%,1,"estingu",to_turn_off%,no_entity%,0,0,false)
  make_word(esperanto%,1,"fari",to_do%,no_entity%,0,0,false)
  make_word(esperanto%,1,"faru",to_do%,no_entity%,0,0,false)
  make_word(esperanto%,1,"flor-poton",no_action%,the_pot_0%,neuter%,singular%,true)
  make_word(esperanto%,1,"flor-poton",no_action%,the_pot_1%,neuter%,singular%,true)
  make_word(esperanto%,1,"flor-poton",no_action%,the_pot_2%,neuter%,singular%,true)
  make_word(esperanto%,1,"flor-poton",no_action%,the_pot_3%,neuter%,singular%,true)
  make_word(esperanto%,1,"floropoton",no_action%,the_pot_0%,neuter%,singular%,false)
  make_word(esperanto%,1,"floropoton",no_action%,the_pot_1%,neuter%,singular%,false)
  make_word(esperanto%,1,"floropoton",no_action%,the_pot_2%,neuter%,singular%,false)
  make_word(esperanto%,1,"floropoton",no_action%,the_pot_3%,neuter%,singular%,false)
  make_word(esperanto%,1,"florpoton",no_action%,the_pot_0%,neuter%,singular%,false)
  make_word(esperanto%,1,"florpoton",no_action%,the_pot_1%,neuter%,singular%,false)
  make_word(esperanto%,1,"florpoton",no_action%,the_pot_2%,neuter%,singular%,false)
  make_word(esperanto%,1,"florpoton",no_action%,the_pot_3%,neuter%,singular%,false)
  make_word(esperanto%,1,"folion",no_action%,the_paper_sheet%,neuter%,singular%,true)
  make_word(esperanto%,1,"for-iri",to_go%,no_entity%,0,0,false)
  make_word(esperanto%,1,"for-iru",to_go%,no_entity%,0,0,false)
  make_word(esperanto%,1,"for-kuri",to_go_out%,no_entity%,0,0,false)
  make_word(esperanto%,1,"for-kuru",to_go_out%,no_entity%,0,0,false)
  make_word(esperanto%,1,"foriri",to_go%,no_entity%,0,0,false)
  make_word(esperanto%,1,"foriru",to_go%,no_entity%,0,0,false)
  make_word(esperanto%,1,"forkuri",to_go_out%,no_entity%,0,0,false)
  make_word(esperanto%,1,"forkuru",to_go_out%,no_entity%,0,0,false)
  make_word(esperanto%,1,"fortenejo",no_action%,the_junk_room%,neuter%,singular%,false)
  make_word(esperanto%,1,"gvardiston",no_action%,the_guard%,neuter%,singular%,true)
  make_word(esperanto%,1,"i",to_inventory%,the_inventory%,neuter%,singular%,false)
  make_word(esperanto%,1,"internen",to_go_in%,the_inside%,0,0,false)
  make_word(esperanto%,1,"inventari",to_inventory%,no_entity%,0,0,false)
  make_word(esperanto%,1,"inventaron",no_action%,the_inventory%,neuter%,singular%,true)
  make_word(esperanto%,1,"inventaru",to_inventory%,no_entity%,0,0,false)
  make_word(esperanto%,1,"iri",to_go%,no_entity%,0,0,false)
  make_word(esperanto%,1,"iru",to_go%,no_entity%,0,0,false)
  make_word(esperanto%,1,"jes",no_action%,the_yes%,0,0,false)
  make_word(esperanto%,1,"kasedon",no_action%,the_tape%,neuter%,singular%,true)
  make_word(esperanto%,1,"kiras-kason",no_action%,the_safe%,neuter%,singular%,true)
  make_word(esperanto%,1,"kiraskason",no_action%,the_safe%,neuter%,singular%,false)
  make_word(esperanto%,1,"klaschambro",no_action%,the_classroom%,neuter%,singular%,false)
  make_word(esperanto%,1,"klascxambro",no_action%,the_classroom%,neuter%,singular%,false)
  make_word(esperanto%,1,"klasĉambro",no_action%,the_classroom%,neuter%,singular%,false)
  make_word(esperanto%,1,"konekti",to_turn_on%,no_entity%,0,0,false)
  make_word(esperanto%,1,"konektu",to_turn_on%,no_entity%,0,0,false)
  make_word(esperanto%,1,"krajonon",no_action%,the_pencil%,neuter%,singular%,true)
  make_word(esperanto%,1,"kuirejon",no_action%,the_kitchen%,neuter%,singular%,true)
  make_word(esperanto%,1,"lasi",to_drop%,no_entity%,0,0,false)
  make_word(esperanto%,1,"lasu",to_drop%,no_entity%,0,0,false)
  make_word(esperanto%,1,"legi",to_read%,no_entity%,0,0,false)
  make_word(esperanto%,1,"legu",to_read%,no_entity%,0,0,false)
  make_word(esperanto%,1,"librejo",no_action%,the_library%,neuter%,singular%,false)
  make_word(esperanto%,1,"libron",no_action%,the_book%,neuter%,singular%,true)
  make_word(esperanto%,1,"lumilon",no_action%,the_flashlight%,neuter%,singular%,true)
  make_word(esperanto%,1,"malenen",to_go_out%,the_outside%,0,0,false)
  make_word(esperanto%,1,"malfermi",to_open%,no_entity%,0,0,false)
  make_word(esperanto%,1,"malfermu",to_open%,no_entity%,0,0,false)
  make_word(esperanto%,1,"malinternen",to_go_out%,the_outside%,0,0,false)
  make_word(esperanto%,1,"malpreni",to_drop%,no_entity%,0,0,false)
  make_word(esperanto%,1,"malprenu",to_drop%,no_entity%,0,0,false)
  make_word(esperanto%,1,"mon-shrankon",no_action%,the_safe%,neuter%,singular%,false)
  make_word(esperanto%,1,"mon-sxrankon",no_action%,the_safe%,neuter%,singular%,false)
  make_word(esperanto%,1,"mon-ŝrankon",no_action%,the_safe%,neuter%,singular%,true)
  make_word(esperanto%,1,"monshrankon",no_action%,the_safe%,neuter%,singular%,false)
  make_word(esperanto%,1,"monsxrankon",no_action%,the_safe%,neuter%,singular%,false)
  make_word(esperanto%,1,"monŝrankon",no_action%,the_safe%,neuter%,singular%,false)
  make_word(esperanto%,1,"muron",no_action%,the_wall_0%,neuter%,singular%,true)
  make_word(esperanto%,1,"muron",no_action%,the_wall_1%,neuter%,singular%,true)
  make_word(esperanto%,1,"muron",no_action%,the_wall_2%,neuter%,singular%,true)
  make_word(esperanto%,1,"muron",no_action%,the_wall_3%,neuter%,singular%,true)
  make_word(esperanto%,1,"n",to_go_north%,the_north%,neuter%,singular%,false)
  make_word(esperanto%,1,"ne",no_action%,the_no%,0,0,false)
  make_word(esperanto%,1,"necesejo",no_action%,the_bathroom%,neuter%,singular%,false)
  make_word(esperanto%,1,"norde",to_go_north%,the_north%,neuter%,singular%,false)
  make_word(esperanto%,1,"norden",to_go_north%,the_north%,neuter%,singular%,false)
  make_word(esperanto%,1,"nordon",to_go_north%,the_north%,neuter%,singular%,true)
  make_word(esperanto%,1,"observi",to_look%,no_entity%,0,0,false)
  make_word(esperanto%,1,"observu",to_look%,no_entity%,0,0,false)
  make_word(esperanto%,1,"oficejo",no_action%,the_office%,neuter%,singular%,false)
  make_word(esperanto%,1,"okcidente",to_go_west%,the_west%,neuter%,singular%,false)
  make_word(esperanto%,1,"okcidenten",to_go_west%,the_west%,neuter%,singular%,false)
  make_word(esperanto%,1,"okcidenton",to_go_west%,the_west%,neuter%,singular%,true)
  make_word(esperanto%,1,"oriente",to_go_east%,the_east%,neuter%,singular%,false)
  make_word(esperanto%,1,"orienten",to_go_east%,the_east%,neuter%,singular%,false)
  make_word(esperanto%,1,"orientighi",to_list_exits%,no_entity%,neuter%,singular%,false)
  make_word(esperanto%,1,"orientighu",to_list_exits%,no_entity%,neuter%,singular%,false)
  make_word(esperanto%,1,"orientigxi",to_list_exits%,no_entity%,neuter%,singular%,false)
  make_word(esperanto%,1,"orientigxu",to_list_exits%,no_entity%,neuter%,singular%,false)
  make_word(esperanto%,1,"orientiĝi",to_list_exits%,no_entity%,neuter%,singular%,false)
  make_word(esperanto%,1,"orientiĝu",to_list_exits%,no_entity%,neuter%,singular%,false)
  make_word(esperanto%,1,"orienton",to_go_east%,the_east%,neuter%,singular%,true)
  make_word(esperanto%,1,"paper-pecon",no_action%,the_paper_piece%,neuter%,singular%,true)
  make_word(esperanto%,1,"papereton",no_action%,the_paper_piece%,neuter%,singular%,false)
  make_word(esperanto%,1,"paperon",no_action%,the_paper_sheet%,neuter%,singular%,true)
  make_word(esperanto%,1,"paperpecon",no_action%,the_paper_piece%,neuter%,singular%,false)
  make_word(esperanto%,1,"piediri",to_go%,no_entity%,0,0,false)
  make_word(esperanto%,1,"piediru",to_go%,no_entity%,0,0,false)
  make_word(esperanto%,1,"pordon",no_action%,the_door%,neuter%,singular%,true)
  make_word(esperanto%,1,"poton",no_action%,the_pot_0%,neuter%,singular%,false)
  make_word(esperanto%,1,"poton",no_action%,the_pot_1%,neuter%,singular%,false)
  make_word(esperanto%,1,"poton",no_action%,the_pot_2%,neuter%,singular%,false)
  make_word(esperanto%,1,"poton",no_action%,the_pot_3%,neuter%,singular%,false)
  make_word(esperanto%,1,"preni",to_take%,no_entity%,0,0,false)
  make_word(esperanto%,1,"prenu",to_take%,no_entity%,0,0,false)
  make_word(esperanto%,1,"pri-serchi",to_examine%,no_entity%,0,0,false)
  make_word(esperanto%,1,"pri-serchu",to_examine%,no_entity%,0,0,false)
  make_word(esperanto%,1,"pri-sercxi",to_examine%,no_entity%,0,0,false)
  make_word(esperanto%,1,"pri-sercxu",to_examine%,no_entity%,0,0,false)
  make_word(esperanto%,1,"pri-serĉi",to_examine%,no_entity%,0,0,false)
  make_word(esperanto%,1,"pri-serĉu",to_examine%,no_entity%,0,0,false)
  make_word(esperanto%,1,"priserchi",to_examine%,no_entity%,0,0,false)
  make_word(esperanto%,1,"priserchu",to_examine%,no_entity%,0,0,false)
  make_word(esperanto%,1,"prisercxi",to_examine%,no_entity%,0,0,false)
  make_word(esperanto%,1,"prisercxu",to_examine%,no_entity%,0,0,false)
  make_word(esperanto%,1,"priserĉi",to_examine%,no_entity%,0,0,false)
  make_word(esperanto%,1,"priserĉu",to_examine%,no_entity%,0,0,false)
  make_word(esperanto%,1,"promeni",to_go%,no_entity%,0,0,false)
  make_word(esperanto%,1,"promenu",to_go%,no_entity%,0,0,false)
  make_word(esperanto%,1,"r",to_look%,no_entity%,0,0,false)
  make_word(esperanto%,1,"rigardi",to_look%,no_entity%,0,0,false)
  make_word(esperanto%,1,"rigardu",to_look%,no_entity%,0,0,false)
  make_word(esperanto%,1,"s",to_go_south%,the_south%,neuter%,singular%,false)
  make_word(esperanto%,1,"sefon",no_action%,the_safe%,neuter%,singular%,false)
  make_word(esperanto%,1,"shalti",to_turn_on%,no_entity%,0,0,false)
  make_word(esperanto%,1,"shaltu",to_turn_on%,no_entity%,0,0,false)
  make_word(esperanto%,1,"shlosilon",no_action%,the_key%,neuter%,singular%,false)
  make_word(esperanto%,1,"shtrumpeton",no_action%,the_sock%,neuter%,singular%,false)
  make_word(esperanto%,1,"shuon",no_action%,the_shoe%,neuter%,singular%,false)
  make_word(esperanto%,1,"son-bendon",no_action%,the_tape%,neuter%,singular%,false)
  make_word(esperanto%,1,"sonbendon",no_action%,the_tape%,neuter%,singular%,false)
  make_word(esperanto%,1,"sude",to_go_south%,the_south%,neuter%,singular%,false)
  make_word(esperanto%,1,"suden",to_go_south%,the_south%,neuter%,singular%,false)
  make_word(esperanto%,1,"sudon",to_go_south%,the_south%,neuter%,singular%,true)
  make_word(esperanto%,1,"sxalti",to_turn_on%,no_entity%,0,0,false)
  make_word(esperanto%,1,"sxaltu",to_turn_on%,no_entity%,0,0,false)
  make_word(esperanto%,1,"sxlosilon",no_action%,the_key%,neuter%,singular%,false)
  make_word(esperanto%,1,"sxtrumpeton",no_action%,the_sock%,neuter%,singular%,false)
  make_word(esperanto%,1,"sxuon",no_action%,the_shoe%,neuter%,singular%,false)
  make_word(esperanto%,1,"tablojn",no_action%,the_dining_room_tables%,neuter%,plural%,false)
  make_word(esperanto%,1,"tablon",no_action%,the_dining_room_tables%,neuter%,singular%,true)
  make_word(esperanto%,1,"u",to_go_west%,the_west%,neuter%,singular%,false)
  make_word(esperanto%,1,"ueste",to_go_west%,the_west%,neuter%,singular%,false)
  make_word(esperanto%,1,"uesten",to_go_west%,the_west%,neuter%,singular%,false)
  make_word(esperanto%,1,"ueston",to_go_west%,the_west%,neuter%,singular%,false)
  make_word(esperanto%,1,"ux",to_go_west%,the_west%,neuter%,singular%,false)
  make_word(esperanto%,1,"uxeste",to_go_west%,the_west%,neuter%,singular%,false)
  make_word(esperanto%,1,"uxesten",to_go_west%,the_west%,neuter%,singular%,false)
  make_word(esperanto%,1,"uxeston",to_go_west%,the_west%,neuter%,singular%,false)
  make_word(esperanto%,1,"x",to_list_exits%,no_entity%,0,0,false) ' XXX TODO --
  make_word(esperanto%,1,"ĉion",no_action%,the_all%,neuter%,singular%,true)
  make_word(esperanto%,1,"ŝalti",to_turn_on%,no_entity%,0,0,false)
  make_word(esperanto%,1,"ŝaltu",to_turn_on%,no_entity%,0,0,false)
  make_word(esperanto%,1,"ŝlosilon",no_action%,the_key%,neuter%,singular%,true)
  make_word(esperanto%,1,"ŝtrumpeton",no_action%,the_sock%,neuter%,singular%,true)
  make_word(esperanto%,1,"ŝuon",no_action%,the_shoe%,neuter%,singular%,true)
  make_word(esperanto%,1,"ŭ",to_go_west%,the_west%,neuter%,singular%,false)
  make_word(esperanto%,1,"ŭeste",to_go_west%,the_west%,neuter%,singular%,false)
  make_word(esperanto%,1,"ŭesten",to_go_west%,the_west%,neuter%,singular%,false)
  make_word(esperanto%,1,"ŭeston",to_go_west%,the_west%,neuter%,singular%,true)
  make_word(interlingue%,0,"coridor",no_action%,the_corridor_x%,neuter%,singular%,true)
  make_word(interlingue%,0,"externe",to_go_out%,the_outside_x%,neuter%,singular%,true)
  make_word(interlingue%,0,"flor-pott",no_action%,the_pot_x%,neuter%,singular%,false)
  make_word(interlingue%,0,"flor-potte",no_action%,the_pot_x%,neuter%,singular%,true)
  make_word(interlingue%,0,"florpott",no_action%,the_pot_x%,neuter%,singular%,false)
  make_word(interlingue%,0,"florpotte",no_action%,the_pot_x%,neuter%,singular%,false)
  make_word(interlingue%,0,"mur",no_action%,the_wall_x%,neuter%,singular%,true)
  make_word(interlingue%,0,"mures",no_action%,the_wall_x%,neuter%,plural%,false)
  make_word(interlingue%,0,"paret",no_action%,the_wall_x%,neuter%,singular%,false)
  make_word(interlingue%,0,"parete",no_action%,the_wall_x%,neuter%,singular%,false)
  make_word(interlingue%,0,"paretes",no_action%,the_wall_x%,neuter%,plural%,false)
  make_word(interlingue%,0,"pott",no_action%,the_pot_x%,neuter%,singular%,false)
  make_word(interlingue%,0,"potte",no_action%,the_pot_x%,neuter%,singular%,false)
  make_word(interlingue%,0,"table",no_action%,the_table_x%,neuter%,singular%,true)
  make_word(interlingue%,1,"#auxilia",to_hash_help%,no_entity%,0,0,false)
  make_word(interlingue%,1,"#auxiliar",to_hash_help%,no_entity%,0,0,false)
  make_word(interlingue%,1,"#castellano",to_hash_spanish%,the_spanish_language%,0,0,false)
  make_word(interlingue%,1,"#cols",to_hash_columns%,the_spanish_language%,0,0,false)
  make_word(interlingue%,1,"#columns",to_hash_columns%,the_spanish_language%,0,0,false)
  make_word(interlingue%,1,"#debug",to_hash_debug%,no_entity%,0,0,false)
  make_word(interlingue%,1,"#drop",to_hash_drop%,no_entity%,0,0,false)
  make_word(interlingue%,1,"#eo",to_hash_esperanto%,the_esperanto_language%,0,0,false)
  make_word(interlingue%,1,"#epo",to_hash_esperanto%,the_esperanto_language%,0,0,false)
  make_word(interlingue%,1,"#es",to_hash_spanish%,the_spanish_language%,0,0,false)
  make_word(interlingue%,1,"#esp",to_hash_spanish%,the_spanish_language%,0,0,false)
  make_word(interlingue%,1,"#español",to_hash_spanish%,the_spanish_language%,0,0,false)
  make_word(interlingue%,1,"#esperanto",to_hash_esperanto%,the_esperanto_language%,0,0,false)
  make_word(interlingue%,1,"#go",to_hash_go%,no_entity%,0,0,false)
  make_word(interlingue%,1,"#hispan",to_hash_spanish%,the_spanish_language%,0,0,false)
  make_word(interlingue%,1,"#ie",to_hash_interlingue%,the_interlingue_language%,0,0,false)
  make_word(interlingue%,1,"#ile",to_hash_interlingue%,the_interlingue_language%,0,0,false)
  make_word(interlingue%,1,"#interlingue",to_hash_interlingue%,the_interlingue_language%,0,0,false)
  make_word(interlingue%,1,"#langs",to_hash_langs%,no_entity%,0,0,false)
  make_word(interlingue%,1,"#locate",to_hash_locate%,no_entity%,0,0,false)
  make_word(interlingue%,1,"#resize",to_hash_resize%,no_entity%,0,0,false)
  make_word(interlingue%,1,"#rows",to_hash_rows%,the_interlingue_language%,0,0,false)
  make_word(interlingue%,1,"#stop",to_hash_stop%,no_entity%,0,0,false)
  make_word(interlingue%,1,"#sucurse",to_hash_help%,no_entity%,0,0,false)
  make_word(interlingue%,1,"#sucurser",to_hash_help%,no_entity%,0,0,false)
  make_word(interlingue%,1,"#take",to_hash_take%,no_entity%,0,0,false)
  make_word(interlingue%,1,"abandona",to_drop%,no_entity%,0,0,false)
  make_word(interlingue%,1,"abandonar",to_drop%,no_entity%,0,0,false)
  make_word(interlingue%,1,"accende",to_turn_on%,no_entity%,0,0,false)
  make_word(interlingue%,1,"accender",to_turn_on%,no_entity%,0,0,false)
  make_word(interlingue%,1,"ad-exter",to_go_out%,the_outside%,0,0,false)
  make_word(interlingue%,1,"ad-exteriore",to_go_out%,the_outside%,0,0,false)
  make_word(interlingue%,1,"ad-externe",to_go_out%,the_outside%,0,0,false)
  make_word(interlingue%,1,"ad-interiore",to_go_in%,the_inside%,0,0,false)
  make_word(interlingue%,1,"ad-intra",to_go_in%,the_inside%,0,0,false)
  make_word(interlingue%,1,"ad-éxter",to_go_out%,the_outside%,0,0,false)
  make_word(interlingue%,1,"adexter",to_go_out%,the_outside%,0,0,false)
  make_word(interlingue%,1,"adexteriore",to_go_out%,the_outside%,0,0,false)
  make_word(interlingue%,1,"adexterne",to_go_out%,the_outside%,0,0,false)
  make_word(interlingue%,1,"adinteriore",to_go_in%,the_inside%,0,0,false)
  make_word(interlingue%,1,"adintra",to_go_in%,the_inside%,0,0,false)
  make_word(interlingue%,1,"adéxter",to_go_out%,the_outside%,0,0,false)
  make_word(interlingue%,1,"aperte",to_open%,no_entity%,0,0,false)
  make_word(interlingue%,1,"aperter",to_open%,no_entity%,0,0,false)
  make_word(interlingue%,1,"aula",no_action%,the_classroom%,neuter%,singular%,false)
  make_word(interlingue%,1,"biblioteca",no_action%,the_library%,neuter%,singular%,false)
  make_word(interlingue%,1,"brique",no_action%,the_brick%,neuter%,singular%,true)
  make_word(interlingue%,1,"buró",no_action%,the_office%,neuter%,singular%,true)
  make_word(interlingue%,1,"cabinet",no_action%,the_office%,neuter%,singular%,false)
  make_word(interlingue%,1,"capte",to_take%,no_entity%,0,0,false)
  make_word(interlingue%,1,"capter",to_take%,no_entity%,0,0,false)
  make_word(interlingue%,1,"casset",no_action%,the_tape%,0,singular%,true)
  make_word(interlingue%,1,"cassett",no_action%,the_tape%,0,singular%,false)
  make_word(interlingue%,1,"cassette",no_action%,the_tape%,0,singular%,false)
  make_word(interlingue%,1,"cede",to_drop%,no_entity%,0,0,false)
  make_word(interlingue%,1,"ceder",to_drop%,no_entity%,0,0,false)
  make_word(interlingue%,1,"clave",no_action%,the_key%,neuter%,singular%,true)
  make_word(interlingue%,1,"cocina",no_action%,the_kitchen%,neuter%,singular%,true)
  make_word(interlingue%,1,"cocineria",no_action%,the_kitchen%,neuter%,singular%,true)
  make_word(interlingue%,1,"cocinería",no_action%,the_kitchen%,neuter%,singular%,true)
  make_word(interlingue%,1,"conecta",to_turn_on%,no_entity%,0,0,false)
  make_word(interlingue%,1,"conectar",to_turn_on%,no_entity%,0,0,false)
  make_word(interlingue%,1,"crayon",no_action%,the_pencil%,neuter%,singular%,true)
  make_word(interlingue%,1,"demi-strump",no_action%,the_sock%,neuter%,singular%,false)
  make_word(interlingue%,1,"demi-strumpe",no_action%,the_sock%,neuter%,singular%,false)
  make_word(interlingue%,1,"demistrump",no_action%,the_sock%,neuter%,singular%,false)
  make_word(interlingue%,1,"demistrumpe",no_action%,the_sock%,neuter%,singular%,false)
  make_word(interlingue%,1,"demí-strump",no_action%,the_sock%,neuter%,singular%,true)
  make_word(interlingue%,1,"demí-strumpe",no_action%,the_sock%,neuter%,singular%,true)
  make_word(interlingue%,1,"demístrump",no_action%,the_sock%,neuter%,singular%,false)
  make_word(interlingue%,1,"demístrumpe",no_action%,the_sock%,neuter%,singular%,false)
  make_word(interlingue%,1,"depó",no_action%,the_junk_room%,neuter%,singular%,false)
  make_word(interlingue%,1,"ea",to_go%,no_entity%,0,0,false)
  make_word(interlingue%,1,"ear",to_go%,no_entity%,0,0,false)
  make_word(interlingue%,1,"escapa",to_go_out%,no_entity%,0,0,false)
  make_word(interlingue%,1,"escapar",to_go_out%,no_entity%,0,0,false)
  make_word(interlingue%,1,"ex",to_examine%,no_entity%,0,0,false)
  make_word(interlingue%,1,"ex-ea",to_go_out%,no_entity%,0,0,false)
  make_word(interlingue%,1,"ex-eada",to_list_exits%,the_exit%,neuter%,singular%,false)
  make_word(interlingue%,1,"ex-eadas",to_list_exits%,the_exit%,neuter%,plural%,false)
  make_word(interlingue%,1,"ex-ear",to_go_out%,no_entity%,0,0,false)
  make_word(interlingue%,1,"examina",to_examine%,no_entity%,0,0,false)
  make_word(interlingue%,1,"examina",to_examine%,no_entity%,0,0,false)
  make_word(interlingue%,1,"examinar",to_examine%,no_entity%,0,0,false)
  make_word(interlingue%,1,"examinar",to_examine%,no_entity%,0,0,false)
  make_word(interlingue%,1,"exea",to_go_out%,no_entity%,0,0,false)
  make_word(interlingue%,1,"exear",to_go_out%,no_entity%,0,0,false)
  make_word(interlingue%,1,"exteriore",to_go_out%,the_outside%,0,0,true)
  make_word(interlingue%,1,"externe",to_go_out%,the_outside%,0,0,false)
  make_word(interlingue%,1,"extinte",to_turn_off%,no_entity%,0,0,false)
  make_word(interlingue%,1,"extinter",to_turn_off%,no_entity%,0,0,false)
  make_word(interlingue%,1,"fa",to_do%,no_entity%,0,0,false)
  make_word(interlingue%,1,"far",to_do%,no_entity%,0,0,false)
  make_word(interlingue%,1,"flor-pote",no_action%,the_pot_0%,neuter%,singular%,true)
  make_word(interlingue%,1,"flor-pote",no_action%,the_pot_1%,neuter%,singular%,true)
  make_word(interlingue%,1,"flor-pote",no_action%,the_pot_2%,neuter%,singular%,true)
  make_word(interlingue%,1,"flor-pote",no_action%,the_pot_3%,neuter%,singular%,true)
  make_word(interlingue%,1,"florpote",no_action%,the_pot_0%,neuter%,singular%,false)
  make_word(interlingue%,1,"florpote",no_action%,the_pot_1%,neuter%,singular%,false)
  make_word(interlingue%,1,"florpote",no_action%,the_pot_2%,neuter%,singular%,false)
  make_word(interlingue%,1,"florpote",no_action%,the_pot_3%,neuter%,singular%,false)
  make_word(interlingue%,1,"folio",no_action%,the_paper_sheet%,neuter%,singular%,true)
  make_word(interlingue%,1,"for-curre",to_go_out%,no_entity%,0,0,false)
  make_word(interlingue%,1,"for-currer",to_go_out%,no_entity%,0,0,false)
  make_word(interlingue%,1,"forcurre",to_go_out%,no_entity%,0,0,false)
  make_word(interlingue%,1,"forcurrer",to_go_out%,no_entity%,0,0,false)
  make_word(interlingue%,1,"fugi",to_go_out%,no_entity%,0,0,false)
  make_word(interlingue%,1,"fugir",to_go_out%,no_entity%,0,0,false)
  make_word(interlingue%,1,"garda-moné",no_action%,the_safe%,neuter%,singular%,false)
  make_word(interlingue%,1,"gardamoné",no_action%,the_safe%,neuter%,singular%,false)
  make_word(interlingue%,1,"gardero",no_action%,the_guard%,neuter%,singular%,true)
  make_word(interlingue%,1,"globul-crayon",no_action%,the_ballpen%,neuter%,singular%,false)
  make_word(interlingue%,1,"globul-pen",no_action%,the_ballpen%,neuter%,singular%,true)
  make_word(interlingue%,1,"globulcrayon",no_action%,the_ballpen%,neuter%,singular%,false)
  make_word(interlingue%,1,"globulpen",no_action%,the_ballpen%,neuter%,singular%,false)
  make_word(interlingue%,1,"hall",no_action%,the_reception%,neuter%,singular%,true)
  make_word(interlingue%,1,"i",to_inventory%,the_inventory%,neuter%,singular%,false)
  make_word(interlingue%,1,"in-ea",to_go_in%,no_entity%,0,0,false)
  make_word(interlingue%,1,"in-ear",to_go_in%,no_entity%,0,0,false)
  make_word(interlingue%,1,"inea",to_go_in%,no_entity%,0,0,false)
  make_word(interlingue%,1,"inear",to_go_in%,no_entity%,0,0,false)
  make_word(interlingue%,1,"inspecte",to_examine%,no_entity%,0,0,false)
  make_word(interlingue%,1,"inspecter",to_examine%,no_entity%,0,0,false)
  make_word(interlingue%,1,"interiore",to_go_in%,the_inside%,0,0,true)
  make_word(interlingue%,1,"interne",to_go_in%,the_inside%,0,0,false)
  make_word(interlingue%,1,"intra",to_go_in%,the_inside%,0,0,false)
  make_word(interlingue%,1,"intrar",to_go_in%,no_entity%,0,0,false)
  make_word(interlingue%,1,"inventaria",to_inventory%,no_entity%,0,0,false)
  make_word(interlingue%,1,"inventariar",to_inventory%,no_entity%,0,0,false)
  make_word(interlingue%,1,"inventarie",to_inventory%,the_inventory%,neuter%,singular%,true)
  make_word(interlingue%,1,"jetta",to_drop%,no_entity%,0,0,false)
  make_word(interlingue%,1,"jettar",to_drop%,no_entity%,0,0,false)
  make_word(interlingue%,1,"lansa",to_drop%,no_entity%,0,0,false)
  make_word(interlingue%,1,"lansar",to_drop%,no_entity%,0,0,false)
  make_word(interlingue%,1,"lee",to_read%,no_entity%,0,0,false)
  make_word(interlingue%,1,"leer",to_read%,no_entity%,0,0,false)
  make_word(interlingue%,1,"libre",no_action%,the_book%,neuter%,singular%,true)
  make_word(interlingue%,1,"moné-scaf",no_action%,the_safe%,neuter%,singular%,true)
  make_word(interlingue%,1,"monéscaf",no_action%,the_safe%,neuter%,singular%,false)
  make_word(interlingue%,1,"mur",no_action%,the_wall_0%,neuter%,singular%,true)
  make_word(interlingue%,1,"mur",no_action%,the_wall_1%,neuter%,singular%,true)
  make_word(interlingue%,1,"mur",no_action%,the_wall_2%,neuter%,singular%,true)
  make_word(interlingue%,1,"mur",no_action%,the_wall_3%,neuter%,singular%,true)
  make_word(interlingue%,1,"n",to_go_north%,the_north%,neuter%,singular%,false)
  make_word(interlingue%,1,"ne",no_action%,the_no%,0,0,false)
  make_word(interlingue%,1,"no",no_action%,the_no%,0,0,false)
  make_word(interlingue%,1,"nord",to_go_north%,the_north%,neuter%,singular%,true)
  make_word(interlingue%,1,"observa",to_look%,no_entity%,0,0,false)
  make_word(interlingue%,1,"observar",to_look%,no_entity%,0,0,false)
  make_word(interlingue%,1,"occidente",to_go_west%,the_west%,neuter%,singular%,false)
  make_word(interlingue%,1,"oficie",no_action%,the_office%,neuter%,singular%,false)
  make_word(interlingue%,1,"omni",no_action%,the_all%,neuter%,singular%,false)
  make_word(interlingue%,1,"omnicos",no_action%,the_all%,neuter%,singular%,true)
  make_word(interlingue%,1,"oriente",to_go_east%,the_east%,neuter%,singular%,false)
  make_word(interlingue%,1,"ost",to_go_east%,the_east%,neuter%,singular%,true)
  make_word(interlingue%,1,"paper-fragment",no_action%,the_paper_piece%,neuter%,singular%,false)
  make_word(interlingue%,1,"paper-pezze",no_action%,the_paper_piece%,neuter%,singular%,true)
  make_word(interlingue%,1,"papere",no_action%,the_paper_sheet%,neuter%,singular%,true)
  make_word(interlingue%,1,"paperette",no_action%,the_paper_piece%,neuter%,singular%,false)
  make_word(interlingue%,1,"paperfragment",no_action%,the_paper_piece%,neuter%,singular%,false)
  make_word(interlingue%,1,"paperpezze",no_action%,the_paper_piece%,neuter%,singular%,false)
  make_word(interlingue%,1,"porta",no_action%,the_door%,neuter%,singular%,true)
  make_word(interlingue%,1,"prende",to_take%,no_entity%,0,0,false)
  make_word(interlingue%,1,"prender",to_take%,no_entity%,0,0,false)
  make_word(interlingue%,1,"r",to_look%,no_entity%,0,0,false)
  make_word(interlingue%,1,"regarda",to_look%,no_entity%,0,0,false)
  make_word(interlingue%,1,"regardar",to_look%,no_entity%,0,0,false)
  make_word(interlingue%,1,"retro-ea",to_go_out%,no_entity%,0,0,false)
  make_word(interlingue%,1,"retro-ear",to_go_out%,no_entity%,0,0,false)
  make_word(interlingue%,1,"retroea",to_go_out%,no_entity%,0,0,false)
  make_word(interlingue%,1,"retroear",to_go_out%,no_entity%,0,0,false)
  make_word(interlingue%,1,"s",to_go_south%,the_south%,neuter%,singular%,false)
  make_word(interlingue%,1,"sapate",no_action%,the_shoe%,neuter%,singular%,true)
  make_word(interlingue%,1,"sercha",to_examine%,no_entity%,0,0,false)
  make_word(interlingue%,1,"serchar",to_examine%,no_entity%,0,0,false)
  make_word(interlingue%,1,"son-bande",no_action%,the_tape%,0,singular%,false)
  make_word(interlingue%,1,"sonbande",no_action%,the_tape%,0,singular%,false)
  make_word(interlingue%,1,"specta",to_look%,no_entity%,0,0,false)
  make_word(interlingue%,1,"spectar",to_look%,no_entity%,0,0,false)
  make_word(interlingue%,1,"strumpette",no_action%,the_sock%,neuter%,singular%,true)
  make_word(interlingue%,1,"sude",to_go_south%,the_south%,neuter%,singular%,true)
  make_word(interlingue%,1,"surti",to_go_out%,no_entity%,0,0,false)
  make_word(interlingue%,1,"surtida",to_list_exits%,the_exit%,neuter%,singular%,false)
  make_word(interlingue%,1,"surtidas",to_list_exits%,the_exit%,neuter%,plural%,true)
  make_word(interlingue%,1,"surtir",to_go_out%,no_entity%,0,0,false)
  make_word(interlingue%,1,"table",no_action%,the_dining_room_tables%,neuter%,singular%,false)
  make_word(interlingue%,1,"tables",no_action%,the_dining_room_tables%,neuter%,plural%,true)
  make_word(interlingue%,1,"tasca-lamp",no_action%,the_flashlight%,neuter%,singular%,true)
  make_word(interlingue%,1,"tasca-lampe",no_action%,the_flashlight%,neuter%,singular%,true)
  make_word(interlingue%,1,"tascalamp",no_action%,the_flashlight%,neuter%,singular%,false)
  make_word(interlingue%,1,"tascalampe",no_action%,the_flashlight%,neuter%,singular%,false)
  make_word(interlingue%,1,"toilette",no_action%,the_bathroom%,neuter%,singular%,false)
  make_word(interlingue%,1,"tot",no_action%,the_all%,neuter%,singular%,false)
  make_word(interlingue%,1,"viagea",to_go%,no_entity%,0,0,false)
  make_word(interlingue%,1,"viagear",to_go%,no_entity%,0,0,false)
  make_word(interlingue%,1,"w",to_go_west%,the_west%,neuter%,singular%,false)
  make_word(interlingue%,1,"west",to_go_west%,the_west%,neuter%,singular%,true)
  make_word(interlingue%,1,"x",to_list_exits%,no_entity%,0,0,false) ' XXX TODO --
  make_word(interlingue%,1,"yes",no_action%,the_yes%,0,0,false)
  make_word(spanish%,0,"corredor",no_action%,the_corridor_x%,masculine%,singular%,true)
  make_word(spanish%,0,"exterior",to_go_out%,the_outside_x%,masculine%,singular%,true)
  make_word(spanish%,0,"exteriores",to_go_out%,the_outside_x%,masculine%,plural%,false)
  make_word(spanish%,0,"maceta",no_action%,the_pot_x%,feminine%,singular%,true)
  make_word(spanish%,0,"mesa",no_action%,the_table_x%,feminine%,singular%,true)
  make_word(spanish%,0,"muro",no_action%,the_wall_x%,masculine%,singular%,true)
  make_word(spanish%,0,"muros",no_action%,the_wall_x%,masculine%,plural%,false)
  make_word(spanish%,0,"pared",no_action%,the_wall_x%,feminine%,singular%,false)
  make_word(spanish%,0,"paredes",no_action%,the_wall_x%,feminine%,plural%,false)
  make_word(spanish%,0,"pasillo",no_action%,the_corridor_x%,masculine%,singular%,true)
  make_word(spanish%,0,"tiesto",no_action%,the_pot_x%,masculine%,singular%,false)
  make_word(spanish%,1,"#auxilia",to_hash_help%,no_entity%,0,0,false)
  make_word(spanish%,1,"#auxiliar",to_hash_help%,no_entity%,0,0,false)
  make_word(spanish%,1,"#auxilio",to_hash_help%,no_entity%,0,0,false)
  make_word(spanish%,1,"#ayuda",to_hash_help%,no_entity%,0,0,false)
  make_word(spanish%,1,"#ayudar",to_hash_help%,no_entity%,0,0,false)
  make_word(spanish%,1,"#castellano",to_hash_spanish%,the_spanish_language%,0,0,false)
  make_word(spanish%,1,"#cols",to_hash_columns%,the_spanish_language%,0,0,false)
  make_word(spanish%,1,"#columns",to_hash_columns%,the_spanish_language%,0,0,false)
  make_word(spanish%,1,"#debug",to_hash_debug%,no_entity%,0,0,false)
  make_word(spanish%,1,"#drop",to_hash_drop%,no_entity%,0,0,false)
  make_word(spanish%,1,"#eo",to_hash_esperanto%,the_esperanto_language%,0,0,false)
  make_word(spanish%,1,"#epo",to_hash_esperanto%,the_esperanto_language%,0,0,false)
  make_word(spanish%,1,"#es",to_hash_spanish%,the_spanish_language%,0,0,false)
  make_word(spanish%,1,"#esp",to_hash_spanish%,the_spanish_language%,0,0,false)
  make_word(spanish%,1,"#español",to_hash_spanish%,the_spanish_language%,0,0,false)
  make_word(spanish%,1,"#esperanto",to_hash_esperanto%,the_esperanto_language%,0,0,false)
  make_word(spanish%,1,"#go",to_hash_go%,no_entity%,0,0,false)
  make_word(spanish%,1,"#ie",to_hash_interlingue%,the_interlingue_language%,0,0,false)
  make_word(spanish%,1,"#ile",to_hash_interlingue%,the_interlingue_language%,0,0,false)
  make_word(spanish%,1,"#interlingue",to_hash_interlingue%,the_interlingue_language%,0,0,false)
  make_word(spanish%,1,"#interlingüe",to_hash_interlingue%,the_interlingue_language%,0,0,false)
  make_word(spanish%,1,"#langs",to_hash_langs%,no_entity%,0,0,false)
  make_word(spanish%,1,"#locate",to_hash_locate%,no_entity%,0,0,false)
  make_word(spanish%,1,"#occidental",to_hash_interlingue%,the_interlingue_language%,0,0,false)
  make_word(spanish%,1,"#resize",to_hash_resize%,no_entity%,0,0,false)
  make_word(spanish%,1,"#rows",to_hash_rows%,the_interlingue_language%,0,0,false)
  make_word(spanish%,1,"#socorre",to_hash_help%,no_entity%,0,0,false)
  make_word(spanish%,1,"#socorrer",to_hash_help%,no_entity%,0,0,false)
  make_word(spanish%,1,"#socorro",to_hash_help%,no_entity%,0,0,false)
  make_word(spanish%,1,"#stop",to_hash_stop%,no_entity%,0,0,false)
  make_word(spanish%,1,"#take",to_hash_take%,no_entity%,0,0,false)
  make_word(spanish%,1,"abre",to_open%,no_entity%,0,0,false)
  make_word(spanish%,1,"abrir",to_open%,no_entity%,0,0,false)
  make_word(spanish%,1,"adentro",to_go_in%,the_inside%,0,0,false)
  make_word(spanish%,1,"afuera",to_go_out%,the_outside%,0,0,false)
  make_word(spanish%,1,"apaga",to_turn_off%,no_entity%,0,0,false)
  make_word(spanish%,1,"apagar",to_turn_off%,no_entity%,0,0,false)
  make_word(spanish%,1,"aseo",no_action%,the_bathroom%,masculine%,singular%,false)
  make_word(spanish%,1,"aseos",no_action%,the_bathroom%,masculine%,plural%,false)
  make_word(spanish%,1,"aula",no_action%,the_classroom%,masculine%,singular%,false)
  make_word(spanish%,1,"baño",no_action%,the_bathroom%,masculine%,singular%,false)
  make_word(spanish%,1,"baños",no_action%,the_bathroom%,masculine%,plural%,false)
  make_word(spanish%,1,"biblioteca",no_action%,the_library%,feminine%,singular%,false)
  make_word(spanish%,1,"boli",no_action%,the_ballpen%,masculine%,singular%,false)
  make_word(spanish%,1,"bolígrafo",no_action%,the_ballpen%,masculine%,singular%,true)
  make_word(spanish%,1,"caja",no_action%,the_safe%,feminine%,singular%,false)
  make_word(spanish%,1,"calcetín",no_action%,the_sock%,masculine%,singular%,true)
  make_word(spanish%,1,"casete",no_action%,the_tape%,masculine%,singular%,false)
  make_word(spanish%,1,"cassette",no_action%,the_tape%,masculine%,singular%,false)
  make_word(spanish%,1,"cinta",no_action%,the_tape%,feminine%,singular%,true)
  make_word(spanish%,1,"clase",no_action%,the_classroom%,feminine%,singular%,false)
  make_word(spanish%,1,"cocina",no_action%,the_kitchen%,feminine%,singular%,true)
  make_word(spanish%,1,"coge",to_take%,no_entity%,0,0,false)
  make_word(spanish%,1,"coger",to_take%,no_entity%,0,0,false)
  make_word(spanish%,1,"conecta",to_turn_on%,no_entity%,0,0,false)
  make_word(spanish%,1,"conectar",to_turn_on%,no_entity%,0,0,false)
  make_word(spanish%,1,"deja",to_drop%,no_entity%,0,0,false)
  make_word(spanish%,1,"dejar",to_drop%,no_entity%,0,0,false)
  make_word(spanish%,1,"dentro",to_go_in%,the_inside%,0,0,false)
  make_word(spanish%,1,"despacho",no_action%,the_office%,masculine%,singular%,true)
  make_word(spanish%,1,"dirigirse",to_go%,no_entity%,0,0,false)
  make_word(spanish%,1,"dirigirte",to_go%,no_entity%,0,0,false)
  make_word(spanish%,1,"dirígete",to_go%,no_entity%,0,0,false)
  make_word(spanish%,1,"e",to_go_east%,the_east%,masculine%,singular%,false)
  make_word(spanish%,1,"encaminarse",to_go%,no_entity%,0,0,false)
  make_word(spanish%,1,"encaminarte",to_go%,no_entity%,0,0,false)
  make_word(spanish%,1,"encamínate",to_go%,no_entity%,0,0,false)
  make_word(spanish%,1,"encender",to_turn_on%,no_entity%,0,0,false)
  make_word(spanish%,1,"enciende",to_turn_on%,no_entity%,0,0,false)
  make_word(spanish%,1,"entra",to_go_in%,no_entity%,0,0,false)
  make_word(spanish%,1,"entrar",to_go_in%,no_entity%,0,0,false)
  make_word(spanish%,1,"escapa",to_go_out%,no_entity%,0,0,false)
  make_word(spanish%,1,"escapar",to_go_out%,no_entity%,0,0,false)
  make_word(spanish%,1,"este",to_go_east%,the_east%,masculine%,singular%,true)
  make_word(spanish%,1,"ex",to_examine%,no_entity%,0,0,false)
  make_word(spanish%,1,"examina",to_examine%,no_entity%,0,0,false)
  make_word(spanish%,1,"examinar",to_examine%,no_entity%,0,0,false)
  make_word(spanish%,1,"excusado",no_action%,the_bathroom%,masculine%,singular%,false)
  make_word(spanish%,1,"folio",no_action%,the_paper_sheet%,masculine%,singular%,false)
  make_word(spanish%,1,"fuera",to_go_out%,the_outside%,0,0,false)
  make_word(spanish%,1,"guarda",no_action%,the_guard%,masculine%,singular%,true)
  make_word(spanish%,1,"guardés",no_action%,the_guard%,masculine%,singular%,false)
  make_word(spanish%,1,"guardia",no_action%,the_guard%,masculine%,singular%,false)
  make_word(spanish%,1,"hacer",to_do%,no_entity%,0,0,false)
  make_word(spanish%,1,"hall",no_action%,the_reception%,feminine%,singular%,false)
  make_word(spanish%,1,"haz",to_do%,no_entity%,0,0,false)
  make_word(spanish%,1,"huir",to_go_out%,no_entity%,0,0,false)
  make_word(spanish%,1,"huye",to_go_out%,no_entity%,0,0,false)
  make_word(spanish%,1,"i",to_inventory%,the_inventory%,masculine%,singular%,false)
  make_word(spanish%,1,"inspecciona",to_examine%,no_entity%,0,0,false)
  make_word(spanish%,1,"inspeccionar",to_examine%,no_entity%,0,0,false)
  make_word(spanish%,1,"interior",to_go_in%,the_inside%,0,0,true)
  make_word(spanish%,1,"inventariar",to_inventory%,no_entity%,0,0,false)
  make_word(spanish%,1,"inventario",to_inventory%,the_inventory%,masculine%,singular%,true)
  make_word(spanish%,1,"inventaría",to_inventory%,no_entity%,0,0,false)
  make_word(spanish%,1,"ir",to_go%,no_entity%,0,0,false)
  make_word(spanish%,1,"irse",to_go%,no_entity%,0,0,false)
  make_word(spanish%,1,"ladrillo",no_action%,the_brick%,masculine%,singular%,true)
  make_word(spanish%,1,"lapicero",no_action%,the_pencil%,masculine%,singular%,false)
  make_word(spanish%,1,"largarse",to_go%,no_entity%,0,0,false)
  make_word(spanish%,1,"largarte",to_go%,no_entity%,0,0,false)
  make_word(spanish%,1,"lee",to_read%,no_entity%,0,0,false)
  make_word(spanish%,1,"leer",to_read%,no_entity%,0,0,false)
  make_word(spanish%,1,"libro",no_action%,the_book%,masculine%,singular%,true)
  make_word(spanish%,1,"linterna",no_action%,the_flashlight%,feminine%,singular%,true)
  make_word(spanish%,1,"llave",no_action%,the_key%,feminine%,singular%,true)
  make_word(spanish%,1,"lápiz",no_action%,the_pencil%,masculine%,singular%,true)
  make_word(spanish%,1,"lárgate",to_go%,no_entity%,0,0,false)
  make_word(spanish%,1,"m",to_look%,no_entity%,0,0,false)
  make_word(spanish%,1,"marcha",to_go%,no_entity%,0,0,false)
  make_word(spanish%,1,"marchar",to_go%,no_entity%,0,0,false)
  make_word(spanish%,1,"marcharse",to_go%,no_entity%,0,0,false)
  make_word(spanish%,1,"marcharte",to_go%,no_entity%,0,0,false)
  make_word(spanish%,1,"mesa",no_action%,the_dining_room_tables%,feminine%,singular%,false)
  make_word(spanish%,1,"mesas",no_action%,the_dining_room_tables%,feminine%,plural%,true)
  make_word(spanish%,1,"mira",to_look%,no_entity%,0,0,false)
  make_word(spanish%,1,"mirar",to_look%,no_entity%,0,0,false)
  make_word(spanish%,1,"muro",no_action%,the_wall_0%,masculine%,singular%,true)
  make_word(spanish%,1,"muro",no_action%,the_wall_1%,masculine%,singular%,true)
  make_word(spanish%,1,"muro",no_action%,the_wall_2%,masculine%,singular%,true)
  make_word(spanish%,1,"muro",no_action%,the_wall_3%,masculine%,singular%,true)
  make_word(spanish%,1,"márchate",to_go%,no_entity%,0,0,false)
  make_word(spanish%,1,"n",to_go_north%,the_north%,masculine%,singular%,false)
  make_word(spanish%,1,"no",no_action%,the_no%,0,0,false)
  make_word(spanish%,1,"norte",to_go_north%,the_north%,masculine%,singular%,true)
  make_word(spanish%,1,"o",to_go_west%,the_west%,masculine%,singular%,false)
  make_word(spanish%,1,"observa",to_look%,no_entity%,0,0,false)
  make_word(spanish%,1,"observar",to_look%,no_entity%,0,0,false)
  make_word(spanish%,1,"oeste",to_go_west%,the_west%,masculine%,singular%,true)
  make_word(spanish%,1,"oficina",no_action%,the_office%,masculine%,singular%,false)
  make_word(spanish%,1,"papel",no_action%,the_paper_sheet%,masculine%,singular%,true)
  make_word(spanish%,1,"papelito",no_action%,the_paper_piece%,masculine%,singular%,true)
  make_word(spanish%,1,"pirarse",to_go%,no_entity%,0,0,false)
  make_word(spanish%,1,"pirarte",to_go%,no_entity%,0,0,false)
  make_word(spanish%,1,"puerta",no_action%,the_door%,feminine%,singular%,true)
  make_word(spanish%,1,"pírate",to_go%,no_entity%,0,0,false)
  make_word(spanish%,1,"recepción",no_action%,the_reception%,feminine%,singular%,true)
  make_word(spanish%,1,"recibidor",no_action%,the_reception%,feminine%,singular%,false)
  make_word(spanish%,1,"recoge",to_take%,no_entity%,0,0,false)
  make_word(spanish%,1,"recoger",to_take%,no_entity%,0,0,false)
  make_word(spanish%,1,"registra",to_examine%,no_entity%,0,0,false)
  make_word(spanish%,1,"registrar",to_examine%,no_entity%,0,0,false)
  make_word(spanish%,1,"retrete",no_action%,the_bathroom%,masculine%,singular%,false)
  make_word(spanish%,1,"s",to_go_south%,the_south%,masculine%,singular%,false)
  make_word(spanish%,1,"sal",to_go_out%,no_entity%,0,0,false)
  make_word(spanish%,1,"salida",to_list_exits%,the_exit%,feminine%,singular%,false)
  make_word(spanish%,1,"salidas",to_list_exits%,the_exit%,feminine%,plural%,true)
  make_word(spanish%,1,"salir",to_go_out%,no_entity%,0,0,false)
  make_word(spanish%,1,"servicio",no_action%,the_bathroom%,masculine%,singular%,false)
  make_word(spanish%,1,"servicios",no_action%,the_bathroom%,masculine%,plural%,false)
  make_word(spanish%,1,"soltar",to_drop%,no_entity%,0,0,false)
  make_word(spanish%,1,"suelta",to_drop%,no_entity%,0,0,false)
  make_word(spanish%,1,"sur",to_go_south%,the_south%,masculine%,singular%,true)
  make_word(spanish%,1,"sí",no_action%,the_yes%,0,0,false)
  make_word(spanish%,1,"tiesto",no_action%,the_pot_0%,masculine%,singular%,true)
  make_word(spanish%,1,"tiesto",no_action%,the_pot_1%,masculine%,singular%,true)
  make_word(spanish%,1,"tiesto",no_action%,the_pot_2%,masculine%,singular%,true)
  make_word(spanish%,1,"tiesto",no_action%,the_pot_3%,masculine%,singular%,true)
  make_word(spanish%,1,"tira",to_drop%,no_entity%,0,0,false)
  make_word(spanish%,1,"tirar",to_drop%,no_entity%,0,0,false)
  make_word(spanish%,1,"todo",no_action%,the_all%,masculine%,singular%,true)
  make_word(spanish%,1,"toma",to_take%,no_entity%,0,0,false)
  make_word(spanish%,1,"tomar",to_take%,no_entity%,0,0,false)
  make_word(spanish%,1,"trastero",no_action%,the_junk_room%,masculine%,singular%,false)
  make_word(spanish%,1,"ve",to_go%,no_entity%,0,0,false)
  make_word(spanish%,1,"vete",to_go%,no_entity%,0,0,false)
  make_word(spanish%,1,"vigilante",no_action%,the_guard%,masculine%,singular%,false)
  make_word(spanish%,1,"x",to_list_exits%,no_entity%,0,0,false)
  make_word(spanish%,1,"wc",no_action%,the_bathroom%,masculine%,singular%,false)
  make_word(spanish%,1,"zapato",no_action%,the_shoe%,masculine%,singular%,true)

end sub

' ==============================================================
' Data interface {{{1

function entity_article$(this_entity%)

  ' Proper article$ for an entity, with a trailing space; or an empty
  ' string.

  local proper_article$

  debug("in entity_article$("+str$(this_entity%)+")")
  debug("article_type= "+str$(article_type%(this_entity%)))
  debug("gender= "+str$(gender%(this_entity%,output_language%)))
  debug("number= "+str$(number%(this_entity%,output_language%)))
  debug("output_language%= "+str$(output_language%))

  if article_type%(this_entity%)=no_article% then
    fnreturn ""
  else
    let proper_article$=article$(article_type%(this_entity%),gender%(this_entity%,output_language%),number%(this_entity%,output_language%),output_language%)
    if len(proper_article$) then
      fnreturn proper_article$+" "
    else
      fnreturn ""
    end if
  end if

end function

function entity_word$(this_entity%)

  ' The word associated with an entity.

  local word_number%

  let word_number%=name_word%(this_entity%,output_language%)

  debug("in entity_word$("+str$(this_entity%)+"):")
  debug("name_word%("+str$(this_entity%)+","+str$(output_language%)+")=")
  debug(str$(name_word%(this_entity%,output_language%)))

  if word_number% then
    debug("='"+word$(word_number%)+"'")
    fnreturn word$(name_word%(this_entity%,output_language%))
  else
    debug("=''")
    fnreturn ""
  end if

end function

function name$(this_entity%)

  debug("in name$("+str$(this_entity%)+")")

  if has_long_name%(this_entity%) then
    fnreturn the_long_name$(this_entity%)
  else
    fnreturn short_name$(this_entity%)
  end if

end function

function short_name$(this_entity%)

  local its_word$

  let its_word$=entity_word$(this_entity%)
  if output_language%=esperanto% then
    let its_word$=without_accusative$(its_word$)
  end if
  debug("return article$ and word: "+entity_article$(this_entity%)+its_word$)
  fnreturn entity_article$(this_entity%)+its_word$

end function

function without_accusative$(word$)

    if right$(word$,1)="n" then
      debug("remove accusative '-n' from '"+word$+"'")
      let word$=left$(word$,len(word$)-1)
    end if
    fnreturn word$

end function

function has_long_name%(this_entity%)

  fnreturn len(long_name$(this_entity%,output_language%))<>0

end function

function the_long_name$(this_entity%)

  local this_entity_long_name$

  let this_entity_long_name$=long_name$(this_entity%,output_language%)

  if output_language%=esperanto% then
    ' Remove the accusative position marks from the long name.
    debug("remove '*' from long name")
    let this_entity_long_name$=replaced$(this_entity_long_name$,"*","")
  end if
  debug("return long name: "+this_entity_long_name$)
  fnreturn this_entity_long_name$

end function

function name_in_accusative$(this_entity%)

  local this_entity_word$,this_entity_long_name$

  debug("in name_in_accusative$("+str$(this_entity%)+")")

  let this_entity_word$=entity_word$(this_entity%)
  let this_entity_long_name$=long_name$(this_entity%,output_language%)

  if len(long_name$(this_entity%,output_language%)) then
    if output_language%=esperanto% then
      ' Add the accusative ending to the long name.
      debug("replace '*' with 'n' in long name")
      let this_entity_long_name$=replaced$(this_entity_long_name$,"*","n")
    end if
    debug("return long name: "+this_entity_long_name$)
    fnreturn this_entity_long_name$
  else
    debug("return article$ and word: "+entity_article$(this_entity%)+this_entity_word$)
    fnreturn entity_article$(this_entity%)+this_entity_word$
  end if

end function

function here%

  fnreturn location%(the_protagonist%)

end function

function is_around_here%(this_entity%)

  ' Is an entity around here?
  fnreturn are_adjacent%(location%(this_entity%),here%)

end function

function is_already_visited%(this_entity%)

  ' Is the given location already visited by the protagonist?
  fnreturn visits%(this_entity%)>1

end function

function is_first_visit%(this_entity%)

  ' Is it the protagonist's first visit to the given location?
  fnreturn visits%(this_entity%)=1

end function

function long_location_description%(this_entity%)

  ' Show the long location description?
  fnreturn is_first_visit%(this_entity%) or action%=to_look% or action%=to_examine%

end function

function is_held_by%(holder_entity%,held_entity%)

  fnreturn location%(held_entity%)=holder_entity%

end function

sub be_here(this_entity%)

  let location%(this_entity%)=here%

end sub

function is_here%(this_entity%)

  fnreturn location%(this_entity%)=here%

end function

function is_locked%(this_entity%)

  ' Is the given entity marked as locked?
  fnreturn this_entity%<0

end function

function locked%(this_entity%)

  ' Return the given location identifier, transformed to
  ' locked.  This is used in the map.
  fnreturn -abs(this_entity%)

end function

function unlocked%(this_entity%)

  ' Return the given location identifier, transformed to
  ' unlocked.  This is used in the map.
  fnreturn abs(this_entity%)

end function

function is_pot%(this_entity%)

  fnreturn this_entity%>=the_pot_0% and this_entity%<=the_pot_3%

end function

sub be_known(this_entity%)

  if article_type%(this_entity%)<>possesive% then
    let article_type%(this_entity%)=definite%
  end if

end sub

function is_readable%(this_entity%)

  fnreturn this_entity%=the_paper_sheet% or this_entity%=the_paper_piece%

end function

function is_visible_to%(viewer_entity%,view_entity%)

  fnreturn is_held_by%(viewer_entity%,view_entity%) or is_here%(view_entity%)

end function

function is_direction%(this_entity%)

  fnreturn this_entity%>=the_north% and this_entity%<=the_outside%

end function

function is_cardinal_point%(this_entity%)

  fnreturn this_entity%>=first_cardinal_point% and this_entity%<=last_cardinal_point%

end function

function entities_held_by%(holder%)

  ' Return the number of entities carried by `holder%` and
  ' fill the array `carried_entity%` with all of them.

  local count%,this%

  debug("entities range in entities_held_by%= "+str$(first_thing_entity%)+".."+str$(last_thing_entity%))
  for this%=first_thing_entity% to last_thing_entity%
    if is_held_by%(me%,this%) then
      inc count%
      let carried_entity%(count%)=this%
    end if
  next this%

  fnreturn count%

end function

function is_corridor%(this_entity%)

  ' Is location _this_entity_ a corridor?
  fnreturn this_entity%>=the_corridor_0% and this_entity%<=the_corridor_2%

end function

function is_outside%(this_entity%)

  ' Is location _entity_ outside the building?

  select case this_entity%
    case the_outside_0%
      fnreturn true
    case the_outside_1%
      fnreturn true
    case the_outside_2%
      fnreturn true
    case the_outside_3%
      fnreturn true
    case else
      fnreturn false
  end select

end function

function are_adjacent%(entity1%,entity2%)

  ' Are locations _entity1_ and _entity2_ adjacent, i.e. are
  ' they connected?

  fnreturn direction%(entity1%,entity2%) or direction%(entity2%,entity1%)

end function

function direction%(entity1%,entity2%)

  ' Return the entity identifier of the direction% that leads
  ' from location _entity1_ to location _entity2_. If no
  ' direction% connects them, return zero.

  local this_direction%

  for this_direction%=first_direction% to last_direction%
    if exit_location%(entity1%,this_direction%)=entity2% then
      fnreturn this_direction%
    end if
  next this_direction%
  fnreturn 0

end function

function opposite_direction%(this_direction%)

  select case this_direction%
    case the_north%
      fnreturn the_south%
    case the_south%
      fnreturn the_north%
    case the_west%
      fnreturn the_east%
    case the_east%
      fnreturn the_west%
    case the_outside%
      fnreturn the_inside%
    case the_inside%
      fnreturn the_outside%
  end select

end function

' ==============================================================
' Main {{{1

sub main

  do
    wt_clear
    credits
    language_menu
    intro
    game
    if game_over% then
      the_end
    end if
  loop

end sub

' ==============================================================
' Game loop {{{1

sub game

  init_parser
  init_game
  enter_location

  do
    listen_and_obey
    global_plot
  loop until game_over%

end sub

function game_over%

  ' XXX TODO --

  fnreturn banished% or success%

end function

function success%

  if not is_outside%(here%)            then fnreturn false
  if not is_held_by%(me%,the_paper_sheet%) then fnreturn false else fnreturn true

end function

' ==============================================================
' Input {{{1

function user_input$

  wt_cr
  wt_empty_keyboard_buffer
  line input "> ",txt$
  let wt_displayed_rows%=0
  fnreturn txt$

end function

' ==============================================================
' Errors {{{1

sub not_carried_error(this_entity%)

  select case output_language%
    case esperanto%
      wt_type_para("Vi ne havas")
    case interlingue%
      wt_type_para("Vu ne have")
    case spanish%
      wt_type_para("No tienes")
  end select
  wt_type(name_in_accusative$(this_entity%)+".")

end sub

sub dunno_error

  select case output_language%
    case esperanto%
      wt_type_para("Kio?")
    case interlingue%
      wt_type_para("Quo?")
    case spanish%
      wt_type_para("¿Qué?")
  end select

end sub

sub darkness_error

  select case output_language%
    case esperanto%
      wt_type_para("La mallumo ne permesas tion al vi.")
    case interlingue%
      wt_type_para("Li obscuritá ne permisse to a vos.")
    case spanish%
      wt_type_para("La oscuridad no te lo permite.")
  end select

end sub

sub not_seen_here_error(this_entity%)

  select case output_language%
    case esperanto%
      wt_type_para("Vi ne vidas "+name_in_accusative$(this_entity%)+" ĉi tie.")
    case interlingue%
      wt_type_para("Vu ne vide "+name_in_accusative$(this_entity%)+" ci.")
    case spanish%
      wt_type_para("No ves "+name_in_accusative$(this_entity%)+" aquí.")
  end select

end sub

sub you_are_not_there_error(this_entity%)

  select case output_language%
    case esperanto%
      wt_type_para("Vi ne estas en "+name$(this_entity%)+".")
    case interlingue%
      wt_type_para("Vu ne sta in "+name$(this_entity%)+".")
    case spanish%
      wt_type_para("No estás en "+name$(this_entity%)+".")
  end select

end sub

' ==============================================================
' Parser {{{1

sub init_parser

  ' Global variables used by the parser.

  let valid_command%=true
  let remaining_commands$=""
  let empty_command%=false
  let action%=no_action%
  let complement%=no_entity%
  let previous_action%=no_action%
	let last_unknown_command_word$=""

end sub

sub listen_and_obey

  local new_commands$

  if len(remaining_commands$) then
    debug("remaining command="+remaining_commands$)
    let new_commands$=remaining_commands$
  else
    let new_commands$=user_input$
  end if

  if is_valid_command%(new_commands$) then
    obey(action%,complement%)
  end if

end sub

function is_valid_command%(user_commands$)

  ' Parse the given command, updating the variables `action%`
  ' and `complement%`, and returning a result code: _true_ if
  ' the parsing was successful, _false_ if an error was thrown
  ' during the process.

  let empty_command%=false
  let valid_command%=true
  let action%=no_action%
  let complement%=no_entity%

  debug("parameter in is_valid_command%()=«"+user_commands$+"»")

  parse_commands(user_commands$)

  if action% then
    ' XXX TMP --
    debug("action%= "+str$(action%))
  end if

  if complement% then
    ' XXX TMP --
    debug("complement%= "+str$(complement%)+"("+name$(complement%)+")")
  end if

  select case complement%

    case the_corridor_x%
      let complement%=unambiguous_corridor_x%
    case the_outside_x%
      let complement%=unambiguous_outside_x%
    case the_pot_x%
      let complement%=unambiguous_pot_x%
    case the_table_x%
      let complement%=unambiguous_table_x%
    case the_wall_x%
      let complement%=unambiguous_wall_x%

  end select

  if complement% then
    ' XXX TMP --
    debug("complement%= "+str$(complement%)+"("+name$(complement%)+")")
  end if

  if action%=no_action% and empty_command%=false then
    'do_debug("no action found")
    if previous_action%<>no_action% and complement%<>no_entity% then
      'do_debug("the previous one is used instead")
      let action%=previous_action%
    else
      dunno_error
      let valid_command%=false
    end if
  end if

  if empty_command%=false then
    let previous_action%=action%
  end if

  debug("parse returns: "+str$(valid_command%))
  fnreturn valid_command%

end function

sub parse_commands(user_commands$)

  local command_separator%

  'do_debug("untouched user_commands$=«"+user_commands$+"»")

  let user_commands$=replaced$(user_commands$,","," , ")
  let user_commands$=replaced$(user_commands$,"."," , ")
  let user_commands$=replaced$(user_commands$,";"," , ")
  let user_commands$=" "+user_commands$+" "
  let user_commands$=replaced$(user_commands$," "+and_$+" "," , ")

  'do_debug("tidied user_commands$=«"+user_commands$+"»")

  let command_separator%=instr(user_commands$,",")
  debug("command_separator%="+str$(command_separator%))
  if command_separator% then
    parse_command(left$(user_commands$,command_separator%-1))
    let remaining_commands$=mid$(user_commands$,command_separator%+1)
    debug("still remaining_commands$="+remaining_commands$)
  else
    parse_command(user_commands$)
    let remaining_commands$=""
  end if

end sub

sub parse_command(this_command$)

  local word_end%,a_word$

	let last_unknown_command_word$=""

  let this_command$=trim$(this_command$)
  debug("this_command$=«"+this_command$+"»")

  if len(this_command$)=0 then
    debug("Empty command.")
    let empty_command%=true
    let valid_command%=false
    exit sub
  end if

  let this_command$=this_command$+" "

  do while len(this_command$)
    let word_end%=instr(this_command$," ")
    debug("word_end%="+str$(word_end%))
    let a_word$=left$(this_command$,max(0,word_end%-1))
    debug("a_word$=«"+a_word$+"»")
    let this_command$=right$(this_command$,len(this_command$)-word_end%)
    if word_end%<>0 and len(a_word$)<>0 then
      parse_word(a_word$)
    end if
  loop

end sub

sub parse_word(command_word$)

  local word%

  debug("searching the words of language #"+str$(input_language%)+" for '"+command_word$+"'")
  for word%=1 to words%
    debug("word%="+str$(word%))

    if word_language%(word%)=input_language% then
      debug(str$(word%)+": "+word$(word%))

      if command_word$=word$(word%) then
        debug("found '"+word$(word%)+"'")

        if action%=no_action% then

          debug("no action was found yet")
          if word_action%(word%) then
            debug("'"+word$(word%)+"' is the action")
            let action%=word_action%(word%)
          elseif word_entity%(word%) then
            if complement%=no_entity% then
              debug("'"+word$(word%)+"' is the complement")
              let complement%=word_entity%(word%)
              exit sub
            else
              ' Second complement found.
              if complement%<>word_entity%(word%) then
                debug("error: two complements")
                debug("previous complement= "+str$(complement%)+"("+name$(complement%)+")")
                dunno_error
                let valid_command%=false
                exit sub
              end if
            end if
          end if

        else

          debug("there's an action already: "+str$(action%))
          if word_entity%(word%) then
            debug(word$(word%)+" is a noun")
            if complement%=no_entity% then
              debug(word$(word%)+" is the complement")
              let complement%=word_entity%(word%)
              exit sub
            else
              ' Second complement found.
              if complement%<>word_entity%(word%) then
                debug("error: two complements")
                debug("previous complement = "+str$(complement%)+"("+name$(complement%)+")")
                dunno_error ' two complements in the command
                let valid_command%=false
                exit sub
              end if
            end if
          elseif word_action%(word%) then
            ' Second action found.
            if action%<>word_action%(word%) then
              debug("error: two actions")
              dunno_error ' two actions in the command
              let valid_command%=false
              exit sub
            end if
          end if

        end if

      end if

    end if

  next word%

	let last_unknown_command_word$=command_word$

end sub

function unambiguous_corridor_x%

  ' Make 'the_corridor_x%' unambiguous

  local corridor%

  select case here%
    case the_bathroom%
      let corridor%=the_corridor_0%
    case the_classroom%
      let corridor%=the_corridor_1%
    case the_corridor_0%
      let corridor%=the_corridor_0%
    case the_corridor_1%
      let corridor%=the_corridor_1%
    case the_corridor_2%
      let corridor%=the_corridor_2%
    case the_dining_room%
      let corridor%=the_corridor_2%
    case the_junk_room%
      let corridor%=the_corridor_2%
    case the_library%
      let corridor%=the_corridor_1%
    case the_reception%
      let corridor%=the_corridor_0%
    case else
      let corridor%=last_corridor%
  end select

  let last_corridor%=corridor%
  fnreturn corridor%

end function

function unambiguous_outside_x%

  ' Make 'the_outside_x%' unambiguous

  ' XXX TODO -- Complete.

  local outside%

  select case here%
    case the_reception%
      let outside%=the_outside_0%
    case the_outside_0%
      let outside%=the_outside_0%
    case the_outside_1%
      let outside%=the_outside_1%
    case the_outside_2%
      let outside%=the_outside_2%
    case the_outside_3%
      let outside%=the_outside_3%
    case else
      let outside%=last_outside%
  end select

  let last_outside%=outside%
  fnreturn outside%

end function

function unambiguous_pot_x%

  ' Make 'the_pot_x%' unambiguous

  local pot%

  select case here%
    case the_outside_0%
      let pot%=the_pot_0%
    case the_outside_1%
      let pot%=the_pot_1%
    case the_outside_2%
      let pot%=the_pot_2%
    case the_outside_3%
      let pot%=the_pot_3%
    case else
      let pot%=last_pot%
  end select

  let last_pot%=pot%
  fnreturn pot%

end function

function unambiguous_table_x%

  ' Make 'the_table_x%' unambiguous

  ' XXX TODO --
  ' if here%=the_dining_room% then
  '   fnreturn the_dining_room_tables%
  ' else
  '   fnreturn the_living_table%
  ' end if

  fnreturn the_dining_room_tables%

end function

function unambiguous_wall_x%

  ' Make 'the_wall_x%' unambiguous

  select case here%
    case the_outside_0%
      fnreturn the_wall_0%
    case the_outside_1%
      fnreturn the_wall_1%
    case the_outside_2%
      fnreturn the_wall_2%
    case the_outside_3%
      fnreturn the_wall_3%
    case else
      fnreturn the_wall_0%
  end select

end function

' ==============================================================
' The end {{{1

sub the_end

  let playing_time%=time-start_time%

  if banished% then

    select case output_language%
      case esperanto%
        wt_type_para("Vi estas forĵetita el la Eduka Komplekso.")
      case interlingue%
        wt_type_para("Vu ha esset expulset ex li Complexe Educativ.")
      case spanish%
        wt_type_para("Has sido expulsado del Complejo Educativo.")
    end select

    select case output_language%
      case esperanto%
        wt_type("Venontfoje estu pli atentema.")
      case interlingue%
        wt_type("Atente plu bon li sequent vez.")
      case spanish%
        wt_type("La próxima vez ten más cuidado.")
    end select

  else

    select case output_language%
      case esperanto%
        wt_type_para("Vi atingis vian celon.")
      case interlingue%
        wt_type_para("Vu ha atinget vor scope.")
      case spanish%
        wt_type_para("Has logrado tu objetivo.")
    end select

    select case output_language%
      case esperanto%
        wt_type("Gratulon!")
      case interlingue%
        wt_type("Gratulationes!")
      case spanish%
        wt_type("¡Enhorabuena!")
    end select

  end if

  time_report

  if not banished% then

    if playing_time%<record_time% then

      let record_time%=playing_time%
      ' let best_player_name$=player_name ' XXX TODO --
      select case output_language%
        case esperanto%
          wt_type_para("Vi starigis novan rekordon!")
        case interlingue%
          wt_type_para("Vu ha etablisset un nov record!")
        case spanish%
          wt_type_para("¡Has establecido un nuevo récord!")
      end select

    else

      select case output_language%
        case esperanto%
          wt_type_para("La rikordon plu havas")
          wt_type(best_player_name$+", kun tempo")
        case interlingue%
          wt_type_para(best_player_name$+" ancor have li record,")
          wt_type("con li témpore")
        case spanish%
          wt_type_para("El récor sigue en posesión de")
          wt_type(best_player_name$+", con un tiempo de")
      end select

      wt_type(time_$(record_time%)+".")

    end if

  end if

  select case output_language%
    case esperanto%
      wt_type_para("Premu klavon por ludi.")
    case interlingue%
      wt_type_para("Presse un taste por luder.")
    case spanish%
      wt_type_para("Pulsa una tecla para jugar.")
  end select

  input$(1)

end sub

sub time_report

  select case output_language%
    case esperanto%
      wt_type_para("Vi")
      wt_type(iff$(banished%,"estis forĵetita post","sukcesis en"))
    case interlingue%
      wt_type_para("Vu ha")
      wt_type(iff$(banished%,"esset expulset pos","succesat in"))
    case spanish%
      wt_type_para(iff$(banished%,"Has sido expulsado después de","Lo has logrado en"))
  end select
  wt_type(time_$(playing_time%)+".")

end sub

' ==============================================================
' Action dispatcher {{{1

sub obey(action%,complement%)

  debug("in obey")

  if complement% then
    be_known(complement%)
  end if

  select case action%
    case no_action%
      exit sub
    case to_do%
      do_do(complement%)
    case to_drop%
      do_drop(complement%)
    case to_examine%
      do_examine(complement%)
    case to_go%
      do_go(complement%)
    case to_go_east%
      do_go_east(complement%)
    case to_go_in%
      do_go_in(complement%)
    case to_go_north%
      do_go_north(complement%)
    case to_go_out%
      do_go_out(complement%)
    case to_go_south%
      do_go_south(complement%)
    case to_go_west%
      do_go_west(complement%)
    case to_hash_columns%
      do_hash_columns(complement%)
    case to_hash_debug%
      do_hash_debug
    case to_hash_drop%
      do_hash_drop(complement%)
    case to_hash_esperanto%
      do_hash_esperanto(complement%)
    case to_hash_go%
      do_hash_go(complement%)
    case to_hash_help%
      do_hash_help(complement%)
    case to_hash_interlingue%
      do_hash_interlingue(complement%)
    case to_hash_langs%
      do_hash_langs(complement%)
    case to_hash_locate%
      do_hash_locate(complement%)
    case to_hash_resize%
      do_hash_resize(complement%)
    case to_hash_rows%
      do_hash_rows(complement%)
    case to_hash_spanish%
      do_hash_spanish(complement%)
    case to_hash_stop%
      do_hash_stop(complement%)
    case to_hash_take%
      do_hash_take(complement%)
    case to_inventory%
      do_inventory(complement%)
    case to_list_exits%
      do_list_exits(complement%)
    case to_look%
      do_look(complement%)
    case to_open%
      do_open(complement%)
    case to_read%
      do_read(complement%)
    case to_take%
      do_take(complement%)
    case to_turn_off%
      do_turn_off(complement%)
    case to_turn_on%
      do_turn_on(complement%)
    case else
      fatal_problem("Out of flow in `obey`")
  end select

end sub

' ==============================================================
' Actions {{{1

' -----------------------------------------------
' do_do {{{2

sub do_do(this_entity%)

  debug("do_do")

  if this_entity%=the_inventory% then
    do_inventory(this_entity%)
  else
    dunno_error
  end if

end sub

' -----------------------------------------------
' do_drop {{{2

sub do_drop(this_entity%)

  debug("do_drop")

  local carried%,n%

  let carried%=entities_held_by%(the_protagonist%)

  if this_entity%=the_all% then

    if carried% then

      wt_type_para(you_drop_$)
      for n%=1 to carried%
        if n%=carried% then
          ' the last one
          if carried%>1 then wt_type(and_$)
          wt_type(name_in_accusative$(carried_entity%(n%))+".")
        elseif n%=carried%-1 then
          ' the last but one
          wt_type(name_in_accusative$(carried_entity%(n%)))
        else
          wt_type(name_in_accusative$(carried_entity%(n%))+",")
        end if
        be_here(carried_entity%(n%))
      next n%

    else

      wt_type_para(you_carry_nothing_$)

    end if

  else

    if not is_held_by%(me%,this_entity%) then
      not_carried_error(this_entity%)
    else
      be_here(this_entity%)
      wt_type_para(you_drop_$+" "+name_in_accusative$(this_entity%)+".")
    end if

  end if

end sub

' -----------------------------------------------
' do_examine {{{2

sub do_examine(this_entity%)

  debug("do_examine")

  look_at(this_entity%,true)

end sub

' -----------------------------------------------
' do_go {{{2

sub do_go(this_entity%)

  debug("do_go")

  if is_direction%(this_entity%) then
    do_go_direction(this_entity%)
  else
    dunno_error
  end if

end sub

sub do_go_direction(this_direction%)

  debug("do_go")
  debug("do_go_direction("+str$(this_direction%)+")")

  do_go_location(exit_location%(here%,this_direction%),this_direction%)

end sub

' -----------------------------------------------
' do_go_east {{{2

sub do_go_east(this_entity%)

  debug("do_go_east")

  if this_entity%=no_entity% then
    do_go_direction(the_east%)
  else
    dunno_error
  end if

end sub

' -----------------------------------------------
' do_go_in {{{2

sub do_go_in(this_entity%)

  debug("do_go_in")

  if this_entity%=no_entity% then
    do_go_direction(the_inside%)
  else
    dunno_error
  end if

end sub

' -----------------------------------------------
' do_go_north {{{2

sub do_go_north(this_entity%)

  debug("do_go_north")

  if this_entity%=no_entity% then
    do_go_direction(the_north%)
  else
    dunno_error
  end if

end sub

' -----------------------------------------------
' do_go_out {{{2

sub do_go_out(this_entity%)

  debug("do_go_out")

  local this_location%

  if is_direction%(this_entity%) then
    do_go_direction(this_entity%)
  else

    let this_location%=exit_location%(here%,the_outside%)

    if this_location%=0 then
      let this_location%=previous_location%
    end if

    do_go_location(this_location%,the_outside%)

  end if

end sub

' -----------------------------------------------
' do_go_south {{{2

sub do_go_south(this_entity%)

  debug("do_go_south")

  if this_entity%=no_entity% then
    do_go_direction(the_south%)
  else
    dunno_error
  end if

end sub

' -----------------------------------------------
' do_go_west {{{2

sub do_go_west(this_entity%)

  debug("do_go_west")

  if this_entity%=no_entity% then
    do_go_direction(the_west%)
  else
    dunno_error
  end if

end sub

' -----------------------------------------------
' do_go_location {{{2

sub do_go_location(this_location%,this_direction%)

  debug("do_go_location("+str$(this_location%)+","+str$(this_direction%)+")")

  if this_location%=0 then

    wt_type_para(you_can_not_go_that_way_$)

  elseif is_locked%(this_location%) then

    debug("is locked%!")

    if is_held_by%(me%,the_key%) then

      select case output_language%
        case esperanto%
          wt_type_para("Vi malŝlosas la pordon.")
        case interlingue%
          wt_type_para("Vu clave-aperte li porta.")
        case spanish%
          wt_type_para("Abres la puerta con la llave.")
      end select
      ' Unlock the door from this side:
      debug("here%="+str$(here%))
      debug("this_direction%="+str$(this_direction%))
      let exit_location%(here%,this_direction%)=unlocked%(this_location%)
      ' Unlock from the other side
      ' XXX FIXME -- it  works only if exits are regular
      ' (N<-->S, E<-->W, etc):
      let exit_location%(unlocked%(this_location%),opposite_direction%(this_direction%))=here%

      let previous_location%=here%
      let location%(the_protagonist%)=unlocked%(this_location%)
      enter_location

    else
      wt_type_para(you_can_not_go_that_way_$)
      select case output_language%
        case esperanto%
          wt_type("Estas ŝlosita pordo.")
        case interlingue%
          wt_type("Hay un porta clave-cludet.")
        case spanish%
          wt_type("Hay una puerta cerrada con llave.")
      end select
    end if

  else

    let previous_location%=here%
    let location%(the_protagonist%)=this_location%
    enter_location

  end if

end sub

' -----------------------------------------------
' do_hash_columns {{{2

sub do_hash_columns(this_entity%)

	if this_entity%=no_entity% then
		if decimal_digits_only%(last_unknown_command_word$) then
			let wt_cols%=val(last_unknown_command_word$)
		else
			dunno_error
		end if
	else
		dunno_error
	end if

end sub

' -----------------------------------------------
' do_hash_debug {{{2

sub do_hash_debug

  let debugging%=not debugging%

  select case output_language%
    case esperanto%
      do_debug("La erarserĉilo estas "+iff$(debugging%,"aktivigita","malaktivigita")+".")
    case interlingue%
      do_debug("Li depuration es "+iff$(debugging%,"activat","desactivat")+".")
    case spanish%
      do_debug("La depuración está "+iff$(debugging%,"activada","desactivada")+".")
  end select

end sub

' -----------------------------------------------
' do_hash_drop {{{2

sub do_hash_drop(this_entity%)

  if this_entity%<>no_entity% then
    be_here(this_entity%)
  else
    dunno_error
  end if

end sub

' -----------------------------------------------
' do_hash_esperanto {{{2

sub do_hash_esperanto(this_entity%)

  debug("do_hash_esperanto")
  select case this_entity%
    case the_esperanto_language%,no_entity%
      select_languages(esperanto%,esperanto%)
    case the_interlingue_language%
      select_languages(esperanto%,interlingue%)
    case the_spanish_language%
      select_languages(esperanto%,spanish%)
    case else
      dunno_error
  end select

end sub

' -----------------------------------------------
' do_hash_go {{{2

sub do_hash_go(this_entity%)

  if this_entity%<>no_entity% then
    let location%(the_protagonist%)=this_entity%
  else
    dunno_error
  end if

end sub

' -----------------------------------------------
' do_hash_help {{{2

sub do_hash_help(this_entity%)

  ' XXX TODO --

  select case output_language%
    case esperanto%
      wt_type_para("La help-sistemo ankoraŭ ne estas programita.")
    case interlingue%
      wt_type_para("Li auxilie-sistema ancor ne es programmat.")
    case spanish%
      wt_type_para("El sistema de ayuda aún no está programado.")
  end select

  let last_unknown_command_word$=""

end sub

' -----------------------------------------------
' do_hash_interlingue {{{2

sub do_hash_interlingue(this_entity%)

  debug("do_hash_interlingue")
  select case this_entity%
    case the_esperanto_language%
      select_languages(interlingue%,esperanto%)
    case the_interlingue_language%,no_entity%
      select_languages(interlingue%,interlingue%)
    case the_spanish_language%
      select_languages(interlingue%,spanish%)
    case else
      dunno_error
  end select

end sub

' -----------------------------------------------
' do_hash_langs {{{2

sub do_hash_langs(this_entity%)

  if this_entity%=no_entity% then
    do_debug("input: #"+str$(input_language%))
    do_debug("output: #"+str$(output_language%))
  else
    dunno_error
  end if
end sub

' -----------------------------------------------
' do_hash_locate {{{2

sub do_hash_locate(this_entity%)

  local txt$

  if this_entity%=no_entity% then
    dunno_error
  else
    let txt$=entity_id$(this_entity%)
    if is_here%(this_entity%) then
      let txt$=txt$+" "+is_here_$+", "+at_$
    elseif is_held_by%(me%,this_entity%) then
      let txt$=txt$+" "+is_held_by_you_$+","
    else
      let txt$=txt$+" "+is_at_$
    endif
    let txt$=txt$+" "+entity_id$(location%(this_entity%))+"."
    do_debug(txt$)
  end if

end sub

function entity_id$(this_entity%)

  fnreturn name$(this_entity%)+" ("+entity_$+" "+str$(this_entity%)+")"

end function

' -----------------------------------------------
' do_hash_resize {{{2

let screen_width$,screen_height$=""

sub do_hash_resize(this_entity%)

	if this_entity%=no_entity% then
    if in_screen_size_format%(last_unknown_command_word$) then
      let wt_cols%=val(screen_width$)
      let wt_rows%=val(screen_height$)
      wt_clear
    else
      wt_update_screen_size
    end if
	else
		dunno_error
	end if

end sub

function in_screen_size_format%(txt$)

  local separator%
  let txt$=lower$(txt$)
  let separator%=instr(txt$,"x")
  if separator% then
    let screen_width$=left$(txt$,separator%-1)
    let screen_height$=mid$(txt$,separator%+1)
    fnreturn decimal_digits_only%(screen_width$) and decimal_digits_only%(screen_height$)
  else
    fnreturn false
  end if

end function

' -----------------------------------------------
' do_hash_rows {{{2

sub do_hash_rows(this_entity%)

	if this_entity%=no_entity% then
		if decimal_digits_only%(last_unknown_command_word$) then
			let wt_rows%=val(last_unknown_command_word$)
		else
			dunno_error
		end if
	else
		dunno_error
	end if

end sub

' -----------------------------------------------
' do_hash_spanish {{{2

sub do_hash_spanish(this_entity%)

  debug("do_hash_spanish")
  select case this_entity%
    case the_esperanto_language%
      select_languages(spanish%,esperanto%)
    case the_interlingue_language%
      select_languages(spanish%,interlingue%)
    case the_spanish_language%,no_entity%
      select_languages(spanish%,spanish%)
    case else
      dunno_error
  end select

end sub

' -----------------------------------------------
' do_hash_stop {{{2

sub do_hash_stop(this_entity%)

  if this_entity%<>no_entity% then
    stop
  else
    dunno_error
  end if

end sub

' -----------------------------------------------
' do_hash_take {{{2

sub do_hash_take(this_entity%)

  if this_entity%<>no_entity% then
    let location%(this_entity%)=the_protagonist%
  else
    dunno_error
  end if

end sub

' -----------------------------------------------
' do_inventory {{{2

sub do_inventory(this_entity%)

  local carried%,displayed%,n%

  if this_entity%<>no_entity% then
    dunno_error
    exit sub
  end if

  let carried%=entities_held_by%(the_protagonist%)

  if carried% then

    let displayed%=0
    wt_type_para(you_have_$)
    for n%=1 to carried%
      debug("carried_entity%("+str$(n%)+")= "+name$(carried_entity%(n%)))
      inc displayed%
      if displayed%=carried% then
        ' the last one
        if carried%>1 then
          wt_type(and_$)
        end if
        wt_type(name_in_accusative$(carried_entity%(n%))+".")
      elseif displayed%=carried%-1 then
          ' the last but one
          wt_type(name_in_accusative$(carried_entity%(n%)))
      else
        wt_type(name_in_accusative$(carried_entity%(n%))+",")
      end if
    next n%

  else

    wt_type_para(you_carry_nothing_$)

  end if

end sub

' -----------------------------------------------
' do_list_exits {{{2

sub do_list_exits(this_entity%)

  if this_entity%=no_entity% then
    list_exits
  else
    dunno_error
  end if

end sub

' -----------------------------------------------
' do_look {{{2

sub do_look(this_entity%)

  debug("do_look")
  look_at(this_entity%,false)

end sub

sub look_at(this_entity%,in_detail%)

  if not is_there_light% then
    darkness_error
  elseif this_entity%=the_all% then
    describe_entity(this_entity%,in_detail%)
  elseif this_entity%=no_entity% then
    describe_current_location(in_detail%)
  elseif this_entity%=the_exit% then
    list_exits
  elseif is_location%(this_entity%) then
    look_at_location(this_entity%,in_detail%)
  elseif is_direction%(this_entity%) then
    about_direction(this_entity%)
  elseif not is_visible_to%(me%,this_entity%) then
    not_seen_here_error(this_entity%)
  else
    describe_entity(this_entity%,in_detail%)
  end if

end sub

sub look_at_location(this_entity%,in_detail%)

  if this_entity%=here% then
    describe_entity(this_entity%,in_detail%)
  else
    you_are_not_there_error(this_entity%)
  end if

end sub

' -----------------------------------------------
' do_open {{{2

sub do_open(this_entity%)

  debug("do_open")

  select case this_entity%
    case the_door%
      do_open_a_door
    case the_safe%
      do_open_the_safe
    case else
      dunno_error
  end select

end sub

sub do_open_a_door

  local this_direction%,this_direction_name$
  local this_location%,opposite_direction%,unlocked_location

    for this_direction%=first_cardinal_point% to last_cardinal_point%
      debug("About to check connection to "+name$(this_direction%))
      let this_location%=exit_location%(here%,this_direction%)
      if this_location%<>nowhere% and is_locked%(this_location%) then

        if not is_held_by%(me%,the_key%) then

          select case output_language%
            case esperanto%
              wt_type_para("Vi ne havas la ŝlosilon.")
            case interlingue%
              wt_type_para("Vu ne have li clave.")
            case spanish%
              wt_type_para("No tienes la llave.")
          end select
          exit sub

        else

          debug("About to open "+name$(this_direction%)+" door to "+name$(unlocked%(this_location%)))
          let exit_location%(here%,this_direction%)=unlocked%(this_location%)
          let exit_location%(unlocked%(this_location%),opposite_direction%(this_direction%))=here%
          let this_direction_name$=entity_word$(this_direction%)
          select case output_language%
            case esperanto%
              wt_type_para("Vi malfermas la pordon al")
              let this_direction_name$=left$(this_direction_name$,len(this_direction_name$)-1)
            case interlingue%
              wt_type_para("Vu aperte li porta vers")
            case spanish%
              wt_type_para("Abres la puerta que va al")
          end select
          wt_type(this_direction_name$+".")
          exit sub

        end if

      end if

    next this_direction%

    select case output_language%
      case esperanto%
        wt_type_para("Ne estas ŝlositaj pordoj.")
      case interlingue%
        wt_type_para("Ne hay portas clave-cludet.")
      case spanish%
        wt_type_para("No hay puertas cerradas con llave.")
    end select

end sub

sub do_open_the_safe

  if is_here%(the_safe%) then
    if the_safe_is_open% then
      select case output_language%
        case esperanto%
          wt_type_para("Ĝi jam estis malfermita.")
        case interlingue%
          wt_type_para("It ja esset apertet.")
        case spanish%
          wt_type_para("Ya estaba abierta.")
      end select
    else
      try_open_the_safe
    end if
  else
    not_seen_here_error(the_safe%)
  end if

end sub

sub try_open_the_safe

  local combination$

	if decimal_digits_only%(last_unknown_command_word$) then

		let combination$=last_unknown_command_word$

	else

		select case output_language%
			case esperanto%
				wt_type_para("Kiu estas la ĉifro?")
			case interlingue%
				wt_type_para("Quel es li combination?")
			case spanish%
				wt_type_para("¿Cuál es la combinación?")
		end select

		let combination$=user_input$

	end if

  select case output_language%
    case esperanto%
      wt_type_para("Vi provas ĝin…")
    case interlingue%
      wt_type_para("Vu prova it…")
    case spanish%
      wt_type_para("La pruebas…")
  end select

  sleep 2

  if combination$=safe_code$ then
    the_safe_opens
  else
    the_safe_does_not_open
  end if

end sub

sub the_safe_opens

  ' XXX TODO -- Take the contents.
  select case output_language%
    case esperanto%
      wt_type("kaj la mon-ŝranko malfermiĝas.")
    case interlingue%
      wt_type("e li moné-scaf aperte se.")
    case spanish%
      wt_type("y la caja se abre.")
  end select
  let the_safe_is_open%=true

end sub

sub the_safe_does_not_open

  select case output_language%
    case esperanto%
      wt_type("sed la mon-ŝranko ne malfermiĝas.")
    case interlingue%
      wt_type("ma li moné-scaf ne aperte se.")
    case spanish%
      wt_type("pero la caja no se abre.")
  end select

  select case output_language%
    case esperanto%
      wt_type("Ŝajnas ke tiu ne estas la ĉifro.")
    case interlingue%
      wt_type("It sembla que ti ne es li combination.")
    case spanish%
      wt_type("Parece que esa no es la combinación.")
  end select

end sub

' -----------------------------------------------
' do_read {{{2

sub do_read(this_entity%)

  debug("do_read")

  if not is_readable%(this_entity%) then
    dunno_error
    exit sub
  end if
  if not is_held_by%(me%,this_entity%) then
    not_carried_error(this_entity%)
    exit sub
  end if
  if not is_there_light% then
    darkness_error
    exit sub
  end if
  if this_entity%=the_paper_sheet% then
    ' XXX TODO
    select case output_language%
      case esperanto%
        wt_type_para("Ĝi estas malplena.")
      case interlingue%
        wt_type_para("It es ínscrit.")
      case spanish%
        wt_type_para("Está en blanco.")
    end select
    exit sub
  end if
  if this_entity%=the_paper_piece% then
    read_the_paper_piece
  else
    dunno_error
  end if

end sub

sub read_the_paper_piece

  select case output_language%
    case esperanto%
      wt_type_para("Vi legas tion kio estas skribita:")
    case interlingue%
      wt_type_para("Vu lee ti quel es scrit:")
    case spanish%
      wt_type_para("Lees lo que está escrito:")
  end select
  wt_type("«"+safe_code$+"»")

end sub

' ==============================================================
' do_take {{{2

sub do_take(this_entity%)

  debug("do_take")

  local n%,present%

  if is_held_by%(me%,this_entity%) then
    wt_type_para(you_already_have_$+name_in_accusative$(this_entity%)+".")
    exit sub
  end if

  if not is_there_light% then
    darkness_error
    exit sub
  end if

  if this_entity%=the_all% then

    debug("do_take the_all%")

    let present%=present_entities%

    if present% then
      for n%=1 to present%
        do_take_present_this(present_entity%(n%))
      next n%
    else
      select case output_language%
        case esperanto%
          wt_type_para("Vi vidas nenion preneblan.")
        case interlingue%
          wt_type_para("Vu vide nequó prendibil.")
        case spanish%
          wt_type_para("Nada ves aquí que puedas recoger.")
      end select

    end if

  else

    do_take_this(this_entity%)

  end if

end sub

sub do_take_this(entity%)

  debug("do_take_this("+str$(entity%)+")")

  if is_here%(entity%) then
    do_take_present_this(entity%)
  else
    not_seen_here_error(entity%)
  end if

end sub

sub do_take_present_this(entity%)

  debug("do_take_present_this("+str$(entity%)+")")

  if is_pot%(entity%) then
    select case output_language%
      case esperanto%
        wt_type_para("Tiu flor-poto certe pezas pli ol bovino.")
      case interlingue%
        wt_type_para("Ti flor-pote pesa plu quam vacca.")
      case spanish%
        wt_type_para("Ese tiesto pesa más que una vaca.")
    end select
    exit sub
  end if

  if not is_portable%(entity%) then
    wt_type_para(question_mark_$+to_take_$+" "+name_in_accusative$(entity%)+"? "+impossible_$)
  else

  ' XXX TODO improve or remove this plot condition
  '   if carried%=max_carried% then
  '     wt_type_para("No puedo llevar más cosas.")
  '     return
  '   end if

    let location%(entity%)=the_protagonist%
    wt_type_para(you_take_$+" "+name_in_accusative$(entity%)+".")
  end if

end sub

' -----------------------------------------------
' do_turn_off {{{2

sub do_turn_off(this_entity%)

  debug("do_turn_off")

  if not is_held_by%(me%,this_entity%) then
    not_carried_error(this_entity%)
  elseif flashlight_on% then
    select case output_language%
      case esperanto%
        wt_type_para("Vi malŝaltas")
      case interlingue%
        wt_type_para("Vu extinte")
      case spanish%
        wt_type_para("Apagas")
    end select
    wt_type(name_in_accusative$(this_entity%)+".")
    let flashlight_on%=false
  else
    select case output_language%
      case esperanto%
        wt_type_para("Ĝi jam estas malŝaltita.")
      case interlingue%
        wt_type_para("It ja es extintet.")
      case spanish%
        wt_type_para("Ya está apagada.")
    end select
  end if

end sub

' -----------------------------------------------
' do_turn_on {{{2

sub do_turn_on(this_entity%)

  debug("do_turn_on")

  if not is_held_by%(me%,this_entity%) then
    not_carried_error(this_entity%)
  elseif flashlight_on% then
    select case output_language%
      case esperanto%
        wt_type_para("Ĝi jam estas ŝaltita.")
      case interlingue%
        wt_type_para("It ja es accendet.")
      case spanish%
        wt_type_para("Ya está encendida.")
    end select
  else
    select case output_language%
      case esperanto%
        wt_type_para("Vi ŝaltas")
      case interlingue%
        wt_type_para("Vu accende")
      case spanish%
        wt_type_para("Enciendes")
    end select
    wt_type(name_in_accusative$(this_entity%)+".")
    let flashlight_on%=true
  end if

end sub

' -----------------------------------------------
' Plot {{{1

sub global_plot

  ' Handle the global global_plot.

  if flashlight_on% then
    if battery_life% then
      dec battery_life%
      if battery_life%=0 then
        wt_type_para(the_flashlight_is_off_$)
        let flashlight_on%=false
      end if
    end if
  end if

  if not banished% then
    the_guard_moves
  end if

end sub

function surprising_location_event%

  ' Handle surprising events that may happen right after
  ' entering a location. If the event is surprising enough,
  ' return _true_, so the usual location description will not
  ' be displayed; otherwise return _false_.

  if is_here%(the_guard%) then
    select case output_language%
      case esperanto%
        wt_type_para("La gvardisto estas ĉi-tie!")
      case interlingue%
        wt_type_para("Li gardero es ci!")
      case spanish%
        wt_type_para("¡El guarda está aquí!")
    end select
    sleep 1
    catched_by_the_guard
    fnreturn true
  else
    fnreturn false
  end if

end function

' -----------------------------------------------
' The guard {{{2

sub the_guard_moves

  ' The guard moves to a random adjacent location.

  local the_direction%,guard_previous_location%

  let the_direction%=between%(first_cardinal_point%,last_cardinal_point%)

  if exit_location%(location%(the_guard%),the_direction%) then

    let guard_previous_location%=location%(the_guard%)
    let location%(the_guard%)=unlocked%(exit_location%(location%(the_guard%),the_direction%))
    debug("The guard goes to "+str$(location%(the_guard%))+" ("+name$(location%(the_guard%))+").")

    if is_here%(the_guard%) then
      the_guard_appears_from(guard_previous_location%)
    elseif guard_previous_location%=here% then
      wt_type(the_guard_goes_to_$+" "+name$(the_direction%)+".")
    elseif are_adjacent%(here%,location%(the_guard%)) then
      wt_type_para(you_hear_steps_from_$(the_direction%))
      wt_type(entity_word$(direction%(here%,location%(the_guard%)))+"…")
    elseif is_corridor%(location%(the_guard%)) and is_corridor%(here%) then
      wt_type_para(you_hear_something_in_the_corridor_$)
    end if

  end if

end sub

sub the_guard_appears_from(origin%)

  select case output_language%
    case esperanto%
      wt_type_para("Vi subite eksentas, ke iu alvenas de")
    case interlingue%
      wt_type_para("Subitmen vu senti que alquí ariva de")
    case spanish%
      wt_type_para("De pronto sientes que alguien llega desde")
  end select

  wt_type(name$(origin%)+",")

  select case output_language%
    case esperanto%
      wt_type("kaj post ol vi turniĝas malrapide,")
      wt_type("vi iĝas senmova pro la surprizo:")
      wt_type("jen la gvardisto.")
    case interlingue%
      wt_type("y tras girarte despacio")
      wt_type("te quedas paralizado por la sorpresa:")
      wt_type("es el guarda.")
    case spanish%
      wt_type("e pos tornar vos lentmen,")
      wt_type("vu es paralisat del surprise:")
      wt_type("ti es li gardero.")
  end select

  catched_by_the_guard

end sub

sub catched_by_the_guard

  if guard_met% then
    catched_by_the_guard_again
  else
    catched_by_the_guard_first_time
  end if

  inc guard_met%

end sub

sub catched_by_the_guard_first_time

  ' XXX TODO -- Improve the logic and the texts.

  wt_type_para(he_catchs_you_$)

  if is_outside%(here%) then
    select case output_language%
      case esperanto%
        wt_type_para("—Kion vi faras ĉi-tie, vagabundante ĉi-hore?")
      case interlingue%
        wt_type_para("—Quo vu fa ci, vagabundante ti-ci hora?")
      case spanish%
        wt_type_para("—¿Qué haces tú aquí, vagabundeando a estas horas?")
    end select
  else
    let banished%=true
    wt_type_para("—"+how_did_you_enter_$)
  end if

  select case output_language%
    case esperanto%
      wt_type_para("Ankoraŭ ĉirkaŭpremante vian kolon,")
      wt_type("li rapide okulumas ĉirkaŭe,")
      wt_type("kiel serĉante…")
    case interlingue%
      ' XXX TODO -- Confirm "serrar":
      wt_type_para("Sin cessar serrar vor col,")
      wt_type("li rapidmen regarda circum se,")
      wt_type("quam serchante…")
    case spanish%
      wt_type_para("Sin dejar de apretarte el cuello,")
      wt_type("echa un rápido vistazo alrededor,")
      wt_type("como buscando…")
  end select


  if is_here%(the_safe%) and the_safe_is_open% then
    let banished%=true
    select case output_language%
      case esperanto%
        wt_type("Subite io prenas lian atenton…")
        wt_type_para("—Vi malfermis la sefon! —li krias—.")
      case interlingue%
        wt_type("Subitmen alquó prende su atention…")
        wt_type_para("—Vu ha apertet li moné-scaf! —il cria—.")
      case spanish%
        wt_type("De pronto algo llama su atención…")
        wt_type_para("—¡Has abierto la caja fuerte! —grita—.")
    end select

  end if

  if is_held_by%(me%,the_paper_sheet%) then
    select case output_language%
      case esperanto%
        ' XXX TODO --
        wt_type_para("Lia rigardo ree fiksiĝas sur vin, kiel bor-maŝino,")
        wt_type("kaj li tuj rimarkas kion vi havas en la manoj.")
        wt_type_para("—Kio estas tiu papero kiun vi kaŝas tie? Lasu min vidi…")
        wt_type_para("Vi timante donas al li la paperon, kiun li prenas per sia libera mano.")
        wt_type_para("—Do… —dice, okulumante ĝin.")
        ' XXX TODO --
        wt_type_para("Li rigardas ĝin ambaŭflanke kaj, post ol trovi ĝin tute malplena,")
        wt_type("li redonas ĝin al vi.")
      case interlingue%
        ' XXX TODO --
        wt_type_para("Su regarde denov fixat se sur vos, quam un perforator,")
        wt_type("e il strax remarca to quo vu have in vor manus.")
        wt_type_para("—Quo es ti papere quel vu cela ta? Lassa me vider…")
        wt_type_para("Vu timorosimen dona le li papere, quel il prendre por su manu líber.")
        wt_type_para("—Alor… —il di, regardante it.")
        ' XXX TODO --
        wt_type_para("Il regarda su du láteres e, pos trovar les tot ínusat,")
        wt_type("il reda it a vos.")
      case spanish%
        ' XXX TODO --
        wt_type_para("Su mirada vuelve a clavarse en ti, como un taladro,")
        wt_type("y de repente se fija en lo que tienes en las manos.")
        wt_type_para("—¿Qué es ese papel que tienes ahí escondido? Déjame ver…")
        wt_type_para("Le entregas temerosamente el papel, que toma con su mano libre.")
        wt_type_para("—Vaya… —dice, echándole un vistazo.")
        ' XXX TODO --
        wt_type_para("Lo mira por ambas caras y, al ver que está todo en blanco,")
        wt_type("te lo devuelve.")
    end select
  end if

  if banished% then
    select case output_language%
      case esperanto%
        wt_type_para("—Ĉi tio signifas via tuja elpelo el ĉi tiu lernejo.")
      case interlingue%
        wt_type_para("—To-ci significa vor ínmediat expulsion ex ti-ci scola.")
      case spanish%
        wt_type_para("—Esto significa tu inmediata expulsión de esta escuela.")
    end select
  else
    select case output_language%
      case esperanto%
        wt_type_para("Li turnas sin al vi kaj diras:")
        wt_type_para("—Ĉu vi scias, ke troviĝi ĉi-hore en la lernejo")
        wt_type("estas grava manko de disciplino?")
        wt_type("Ĉi-tia konduto ne estas propra de bona lernejano.")
      case interlingue%
        wt_type_para("Il torna se vers vos e di:")
        wt_type_para("—Esque vu save que star in li scola ti-ci hora")
        wt_type("es un grav manca de discipline?")
        wt_type("Tal conduida ne es propri de un bon scolero.")
      case spanish%
        wt_type_para("Se vuelve hacia ti y te dice:")
        wt_type_para("—¿Sabes que estar en la escuela a estas horas")
        wt_type("es una grave falta de disciplina?")
        wt_type("Este tipo de conducta no es propia de un buen alumno.")
    end select
    if the_guard_leaves% then
      select case output_language%
        case esperanto%
          wt_type_para("Uf!… Preskaŭ!")
        case interlingue%
          wt_type_para("Presc!") ' XXX TODO -- interjection
        case spanish%
          wt_type_para("¡Uf!… Por poco!")
      end select
    end if
  end if

end sub

sub catched_by_the_guard_again

  ' XXX TODO --

end sub

function the_guard_leaves%

  local this_direction%,this_location%

  if exits%(location%(the_guard%)) then

    do
      let this_direction%=between%(first_cardinal_point%,last_cardinal_point%)
      let this_location%=exit_location%(location%(the_guard%),this_direction%)
    loop until this_location%
    let location%(the_guard%)=unlocked%(this_location%)
    select case output_language%
      case esperanto%
        wt_type_para("Li faras duonturnon kaj iras al")
      case interlingue%
        wt_type_para("Il demí-torna se e vade a")
      case spanish%
        wt_type_para("Se da media vuelta y se va hacia")
    end select
    wt_type(name$(this_direction%)+".")
    fnreturn true

  else

    select case output_language%
      case esperanto%
        wt_type_para("La gvardisto serĉas elirejon, sensukcese.")
      case interlingue%
        wt_type_para("Li gardero sercha un exeada, sin successe.")
      case spanish%
        wt_type_para("El guarda busca una salida, sin éxito.")
    end select
    fnreturn false

  end if

end function

' -----------------------------------------------
' The pots {{{2

sub search_pot(entity%)

  ' Search pot _entity_.

  local examined% ' count
  let examined% = examined_pots%

  if the_key_was_found_already% then

    about_this_pot(entity%,false) ' describe it without details

  else

    ' The key has not being found yet.

    if entity%=key_pot% then

      ' The key is hidden in this pot.

      select case output_language%
        case esperanto%
          wt_type_para("Ĉi-tie estas la ŝlosilo!")
        case interlingue%
          wt_type_para("Li clave es ci!")
        case spanish%
          wt_type_para("¡Aquí está la llave!")
      end select

      select case examined%
        case 0
          select case output_language%
            case esperanto%
              wt_type("Je la unua fojo!")
            case interlingue%
              wt_type("Ye li prim vez!")
            case spanish%
              wt_type("¡A la primera!")
          end select
        case 1
          select case output_language%
            case esperanto%
              wt_type("Je la dua provo, bonŝance.")
            case interlingue%
              wt_type("Ye li duesim prova, felicimen.")
            case spanish%
              wt_type("Al segundo intento, ha habido suerte.")
          end select
        case 2
          select case output_language%
            case esperanto%
              wt_type("Ĝi ne estis tiom malfacila.")
            case interlingue%
              wt_type("It ne esset tant desfacil.")
            case spanish%
              wt_type("No ha sido tan difícil.")
          end select
        case 3
          select case output_language%
            case esperanto%
              wt_type("Jam estis tempo, finfine.")
            case interlingue%
              wt_type("It ja esset témpore, in fine.")
            case spanish%
              wt_type("Ya era hora, por fin.")
          end select
        case 4
          select case output_language%
            case esperanto%
              wt_type("Ĝi estis en la lasta flor-poto, kompreneble…")
            case interlingue%
              wt_type("It esset in li ultim flor-pote, naturalmen…")
            case spanish%
              wt_type("Estaba en el último tiesto, por supuesto…")
          end select
      end select

      let location%(the_key%)=the_protagonist%
      let key_pot%=-key_pot% ' mark the key as found

    else

      ' The key is not hidden in this pot.

      if examinations%(entity%) then

        select case output_language%
          case esperanto%
            wt_type_para("Ĉi tiu jam estas bone ekzamenita. Ĉi tie ne")
          case interlingue%
            wt_type_para("Ti-ci jam es bon examinat. Ci ne")
          case spanish%
            wt_type_para("Este ya está bien visto. Aquí no")
        end select

      else

        select case output_language%
          case esperanto%
            wt_type(iff$(examined%,"Ankaŭ en ĉi tiu ne","In ĉi tiu unua ne"))
          case interlingue%
            wt_type(iff$(examined%,"Anc in ti-ci ne","In ti-ci prim ne"))
          case spanish%
            wt_type("En este "+iff$(examined%,"tampoco","primero no"))
        end select

      end if

      select case output_language%
        case esperanto%
          wt_type("estas la ŝlosilo.")
        case interlingue%
          wt_type("sta li clave.")
        case spanish%
          wt_type("está la llave.")
      end select

    end if

  end if

end sub

function examined_pots%

  ' Return the total number of pots that have been examined in
  ' detail.

  local count%,pot%

  for pot%=the_pot_0% to the_pot_3%
    let count%=count%+abs(examinations%(pot%)<>0)
  next pot%

  fnreturn count%

end function

function the_key_was_found_here%(entity%)

  fnreturn the_key_was_found_already% and entity%=abs(key_pot%)

end function

function the_key_was_found_already%

  fnreturn key_pot%<0

end function

' -----------------------------------------------
' Light {{{2

function is_there_light%

  if here%=the_junk_room% then
    if flashlight_on% then
      fnreturn is_held_by%(me%,the_flashlight%) or is_here%(the_flashlight%)
    else
      fnreturn false
    end if
  else
    fnreturn true
  end if

end function

' ==============================================================
' Locations {{{1

' -----------------------------------------------
' Enter location {{{2

sub enter_location

  let visits%(here%)=visits%(here%)+1
  ruler
  show_location_title(here%)
  if not surprising_location_event% and not game_over% then
    describe_location(here%,true)
  end if

end sub

' -----------------------------------------------
' Describe location {{{2

sub show_location_title(entity%)

  debug("in show_location_title("+str$(entity%)+")")
  wt_type_para(you_are_in_$)
  wt_type(name$(entity%)+".")
  debug("Location entity number= "+str$(here%))

end sub

sub describe_current_location(in_detail%)

  show_location_title(here%)
  describe_location(here%,in_detail%)

end sub

sub describe_location(entity%,in_detail%)

  describe_entity(entity%,in_detail%)
  list_present_entities
  list_exits

end sub

' -----------------------------------------------
' List present entities {{{2

sub list_present_entities

  local n%,present%,this_entity%

  let present%=present_entities%

  debug("present%= "+str$(present%))

  if present% then

    wt_type_para(you_see_$)
    for n%=1 to present%
      debug("present_entity%(n%)= "+str$(present_entity%(n%)))
      let this_entity%=present_entity%(n%)
      if n%=present% then
        ' the last one
        if present%>1 then wt_type(and_$)
        wt_type(name_in_accusative$(this_entity%)+".")
      elseif n%=present%-1 then
        ' the last but one
        wt_type(name_in_accusative$(this_entity%))
      else
        wt_type(name_in_accusative$(this_entity%)+",")
      end if
    next n%

  end if

end sub

function present_entities%

  ' Return the number of present entities and fill the array
  ' `present_entity%` with all of them.

  local count%,this_entity%

  debug("entities range in present_entities%= "+str$(first_thing_entity%)+".."+str$(last_thing_entity%))
  for this_entity%=first_thing_entity% to last_thing_entity%
    debug("checking entity "+str$(this_entity%))
    if is_here%(this_entity%) then
      inc count%
      let present_entity%(count%)=this_entity%
    end if
  next this_entity%

  fnreturn count%

end function

' -----------------------------------------------
' List exits {{{2

sub list_exits

  debug("list_exits")

  local this_direction%,exits_here%,displayed%

  let exits_here%=exits%(here%)

  debug("exits_here%: "+str$(exits_here%))

  if exits_here%=0 then exit sub

  let displayed%=0
  select case output_language%
    case esperanto%
      wt_type_para("Estas elirejo"+iff$(exits_here%>1,"j","")+" al")
    case interlingue%
      wt_type_para("Hay exeada"+iff$(exits_here%>1,"s","")+" vers")
    case spanish%
      wt_type_para("Hay salida"+iff$(exits_here%>1,"s","")+" hacia")
  end select

  for this_direction%=first_direction% to last_direction%

    debug("Exit "+str$(this_direction%)+": "+str$(exit_location%(here%,this_direction%)))

    if exit_location%(here%,this_direction%) then
      inc displayed%
      if displayed%=exits_here% then
        ' the last one
        if exits_here%>1 then wt_type(and_$)
        wt_type(exit_description$(this_direction%)+".")
        exit sub
      end if

      if displayed%=exits_here%-1 then
        ' the last but one
        wt_type(exit_description$(this_direction%))
      else
        wt_type(exit_description$(this_direction%)+",")
      end if
    end if

  next this_direction%

end sub

function exit_description$(this_direction%)

  ' Return the list item corresponding to the location which
  ' can be reached towards _direction_ from the current
  ' location.

  local result$

  debug("in exit_description$("+str$(this_direction%)+")")
  let result$=name$(this_direction%)
  debug("name$("+str$(this_direction%)+")="+result$)
  let result$=result$+" ("
  let result$=result$+name$(unlocked%(exit_location%(here%,this_direction%)))
  let result$=result$+")"

  fnreturn result$

end function

function exits%(entity%)

  ' Return the number of current exits of _location_, including
  ' locked doors.

  debug("exits%("+str$(entity%)+")")

  local out%

  let out%=     (exit_location%(entity%,the_north%)  <>0)
  debug("north out%="+str$(out%))
  let out%=out%+(exit_location%(entity%,the_south%)  <>0)
  debug("south out%="+str$(out%))
  let out%=out%+(exit_location%(entity%,the_east%)   <>0)
  debug("east out%="+str$(out%))
  let out%=out%+(exit_location%(entity%,the_west%)   <>0)
  debug("west out%="+str$(out%))
  let out%=out%+(exit_location%(entity%,the_inside%) <>0)
  debug("inside out%="+str$(out%))
  let out%=out%+(exit_location%(entity%,the_outside%)<>0)
  debug("outside out%="+str$(out%))

  fnreturn abs(out%)

end function

' ==============================================================
' Entity descriptions {{{1

sub describe_entity(entity%,in_detail%)

  select case entity%

    case the_all%
      about_the_all(in_detail%)
    case the_ballpen%
      about_the_ballpen(in_detail%)
    case the_bathroom%
      about_the_bathroom(in_detail%)
    case the_book%
      about_the_book(in_detail%)
    case the_brick%
      about_the_brick(in_detail%)
    case the_classroom%
      about_the_classroom(in_detail%)
    case the_corridor_0%
      about_the_corridor_0(in_detail%)
    case the_corridor_1%
      about_the_corridor_1(in_detail%)
    case the_corridor_2%
      about_the_corridor_2(in_detail%)
    case the_dining_room%
      about_the_dining_room(in_detail%)
    case the_dining_room_tables%
      about_the_dining_room_tables(in_detail%)
    case the_door%
      about_the_door(in_detail%)
    case the_east%
      about_direction(the_east%)
    case the_outside_0%
      about_the_outside_0(in_detail%)
    case the_outside_1%
      about_the_outside_1(in_detail%)
    case the_outside_2%
      about_the_outside_2(in_detail%)
    case the_outside_3%
      about_the_outside_3(in_detail%)
    case the_guard%
      about_the_guard(in_detail%)
    case the_inside%
      about_direction(the_inside%)
    case the_inventory%
      do_inventory(the_inventory%)
    case the_junk_room%
      about_the_junk_room(in_detail%)
    case the_key%
      about_the_key(in_detail%)
    case the_kitchen%
      about_the_kitchen(in_detail%)
    case the_library%
      about_the_library(in_detail%)
    case the_north%
      about_direction(the_north%)
    case the_office%
      about_the_office(in_detail%)
    case the_secret_room%
      about_the_secret_room(in_detail%)
    case the_outside%
      about_direction(the_outside%)
    case the_paper_piece%
      about_the_paper_piece(in_detail%)
    case the_paper_sheet%
      about_the_paper_sheet(in_detail%)
    case the_pencil%
      about_the_pencil(in_detail%)
    case the_pot_0%
      about_this_pot(the_pot_0%,in_detail%)
    case the_pot_1%
      about_this_pot(the_pot_1%,in_detail%)
    case the_pot_2%
      about_this_pot(the_pot_2%,in_detail%)
    case the_pot_3%
      about_this_pot(the_pot_3%,in_detail%)
    case the_reception%
      about_the_reception(in_detail%)
    case the_safe%
      about_the_safe(in_detail%)
    case the_shoe%
      about_the_shoe(in_detail%)
    case the_sock%
      about_the_sock(in_detail%)
    case the_south%
      about_direction(the_south%)
    case the_flashlight%
      about_the_flashlight(in_detail%)
    case the_wall_0%
      about_the_wall_0(in_detail%)
    case the_wall_1%
      about_the_wall_1(in_detail%)
    case the_wall_2%
      about_the_wall_2(in_detail%)
    case the_wall_3%
      about_the_wall_3(in_detail%)
    case the_west%
      about_direction(the_west%)

    case else

      you_see_nothing_special

  end select

  let examinations%(entity%)=examinations%(entity%)+in_detail%

end sub

' -----------------------------------------------
' about_direction {{{2

sub about_direction(this_direction%)

  local this_location%

  let this_location%=exit_location%(here%,this_direction%)

  if this_location% then
    look_to_direction(this_direction%,this_location%)
    exit sub
  end if

  if this_direction%=the_outside% then
    ' No explicit way out, so use the previous location instead.
    debug("The previous location is used instead: "+str$(previous_location%))
    look_to_direction(this_direction%,previous_location%)
  else
    select case output_language%
      case esperanto%
        wt_type_para("Ne estas elirejo al "+iff$(this_direction%<the_inside%,"la ",""))
      case interlingue%
        wt_type_para("Ne hay exeada "+iff$(this_direction%<the_inside%,"al ",""))
      case spanish%
        wt_type_para("No hay salida hacia "+iff$(this_direction%<the_inside%,"el ",""))
    end select
    wt_type(name$(this_direction%)+".")
  end if

end sub

sub look_to_direction(this_direction%,this_entity%)

  local message$

  select case output_language%
    case esperanto%
      let message$= "Ĉe "
    case interlingue%
      let message$= "Vers "
    case spanish%
      let message$= "Hacia "
  end select
  let message$=message$+name$(this_direction%)
  select case output_language%
    case esperanto%
      let message$=message$+" estas "+name$(unlocked%(this_entity%))
    case interlingue%
      let message$=message$+" es "+name$(unlocked%(this_entity%))
    case spanish%
      let message$=message$+" está "+name$(unlocked%(this_entity%))
  end select
  select case output_language%
    case esperanto%
      let message$=message$+iff$(is_locked%(this_entity%),", sed li pordo estas ŝlosita","")
    case interlingue%
      let message$=message$+iff$(is_locked%(this_entity%),", ma li porta es clave-cludet","")
    case spanish%
      let message$=message$+iff$(is_locked%(this_entity%),", pero la puerta está cerrada con llave","")
  end select
  let message$=message$+"."

  wt_type_para(message$)

end sub

' -----------------------------------------------
' about_the_all {{{2

sub about_the_all(in_detail%)

  describe_current_location(in_detail%)

end sub

' -----------------------------------------------
' about_the_ballpen {{{2

sub about_the_ballpen(in_detail%)

  ' XXX TODO --

  ' wt.type_para("Es un bolígrafo azul de lo más normal,")
  ' wt.type("con la carga de tinta a medias")
  ' wt.type("y el extremo superior bien mordisqueado.")

  you_see_nothing_special_about(the_ballpen%)

end sub

' -----------------------------------------------
' about_the_bathroom {{{2

sub about_the_bathroom(in_detail%)

  ' XXX TODO --

  ' wt.type_para("Todo está muy limpio.")
  you_see_nothing_special_about(the_bathroom%)

end sub

' -----------------------------------------------
' about_the_book {{{2

sub about_the_book(in_detail%)

  ' XXX TODO --

  ' if in_detail% then
  '   wt_type_para("Examinas el libro polvoriento.")
  ' else
  '   wt_type_para("El libro está polvoriento.")
  ' end if
  you_see_nothing_special_about(the_book%)

end sub

' -----------------------------------------------
' about_the_brick {{{2

sub about_the_brick(in_detail%)

  ' XXX TODO --

  ' wt.type_para("Es un ladrillo de obra.")
  you_see_nothing_special_about(the_brick%)

end sub

' -----------------------------------------------
' about_the_classroom {{{2

sub about_the_classroom(in_detail%)

  ' XXX TODO --

  ' wt.type_para("Aquí estudian los alfa.")
  you_see_nothing_special_about(the_classroom%)

end sub

' -----------------------------------------------
' about_the_corridor_0 {{{2

sub about_the_corridor_0(in_detail%)

  ' XXX TODO --

  ' wt.type_para("El extremo norte del pasillo.")
  you_see_nothing_special_about(the_corridor_0%)

end sub

' -----------------------------------------------
' about_the_corridor_1 {{{2

sub about_the_corridor_1(in_detail%)

  ' XXX TODO --

  ' wt.type_para("El tramo central del pasillo.")
  you_see_nothing_special_about(the_corridor_1%)

end sub

' -----------------------------------------------
' about_the_corridor_2 {{{2

sub about_the_corridor_2(in_detail%)

  ' XXX TODO --

  ' wt.type_para("El extremo sur del pasillo.")
  you_see_nothing_special_about(the_corridor_2%)

end sub

' -----------------------------------------------
' about_the_dining_room {{{2

sub about_the_dining_room(in_detail%)

  ' XXX TODO --

  ' wt.type_para("El comedor o refectorio.")
  you_see_nothing_special_about(the_dining_room%)

end sub

' -----------------------------------------------
' about_the_dining_room_tables {{{2

sub about_the_dining_room_tables(in_detail%)

  ' XXX TODO --

  ' wt.type_para("Son viejas y desgastadas mesas de madera.")
  you_see_nothing_special_about(the_dining_room_tables%)

end sub

' -----------------------------------------------
' about_the_door {{{2

sub about_the_door(in_detail%)

  ' XXX TODO --

  ' wt.type_para("Una puerta como cualquier otra.")
  you_see_nothing_special_about(the_door%)

end sub

' -----------------------------------------------
' about_the_outside_0 {{{2

sub about_the_outside_0(in_detail%)

  ' XXX TODO --

  ' wt.type_para("El lado oeste del complejo.")
  you_see_nothing_special_about(the_outside_0%)

end sub

' -----------------------------------------------
' about_the_outside_1 {{{2

sub about_the_outside_1(in_detail%)

  ' XXX TODO --

  ' wt.type_para("El lado norte del complejo.")
  you_see_nothing_special_about(the_outside_1%)

end sub

' -----------------------------------------------
' about_the_outside_2 {{{2

sub about_the_outside_2(in_detail%)

  ' XXX TODO --

  ' wt.type_para("El lado este del complejo.")
  you_see_nothing_special_about(the_outside_2%)

end sub

' -----------------------------------------------
' about_the_outside_3 {{{2

sub about_the_outside_3(in_detail%)

  ' XXX TODO --

  ' wt.type_para("El lado sur del complejo.")
  you_see_nothing_special_about(the_outside_3%)

end sub

' -----------------------------------------------
' about_the_guard {{{2

sub about_the_guard(in_detail%)

  ' XXX TODO --

  wt_type_para("Luzgardo, "+name$(the_guard%)+".")
  ' XXX TODO -- Add his name to the vocabulary.
  ' select case output_language%
  '   case esperanto%
  '     wt_type_para("la gvardisto.")
  '   case interlingue%
  '     wt_type_para("li gardero.")
  '   case spanish%
  '     wt_type_para("el guarda.")
  ' end select

end sub

' -----------------------------------------------
' about_the_junk_room {{{2

sub about_the_junk_room(in_detail%)

  ' XXX TODO --

  ' if not is_there_light% then
  '   wt_type_para("Todo está a oscuras.")
  ' else
  ' ' XXX FIXME print something here to finish the paragraph
  '   let light%=false
  ' end if
  you_see_nothing_special_about(the_junk_room%)

end sub

' -----------------------------------------------
' about_the_key {{{2

sub about_the_key(in_detail%)

  ' XXX TODO --

  select case output_language%
    case esperanto%
      wt_type_para("La ĉefŝlosilo kiun «la Klavulo» havigis al si.")
    case interlingue%
      wt_type_para("Li chefclave quem «li Tastario» acompleet.")
    case spanish%
      wt_type_para("La llave maestra que consiguió «el Teclas».")
  end select

end sub

' -----------------------------------------------
' about_the_kitchen {{{2

sub about_the_kitchen(in_detail%)

  ' XXX TODO --

  ' wt.type_para("La suciedad cubre los muebles.")
  you_see_nothing_special_about(the_kitchen%)

end sub

' -----------------------------------------------
' about_the_library {{{2

sub about_the_library(in_detail%)

  ' XXX TODO --

  you_see_nothing_special_about(the_library%)

end sub

' -----------------------------------------------
' about_the_office {{{2

sub about_the_office(in_detail%)

  ' XXX TODO --

  ' wt.type_para("El despacho del director.")
  you_see_nothing_special_about(the_office%)

end sub

' -----------------------------------------------
' about_the_paper_piece {{{2

sub about_the_paper_piece(in_detail%)

  ' XXX TODO --

    if is_held_by%(me%,the_paper_piece%) then
      select case output_language%
        case esperanto%
          wt_type_para("Ĝi havas ion skribitan.")
        case interlingue%
          wt_type_para("It have alquó scrit.")
        case spanish%
          wt_type_para("Tiene algo escrito.")
      end select
      sleep 1
      read_the_paper_piece
    else
      you_see_nothing_special_about(the_paper_piece%)
    end if

end sub

' -----------------------------------------------
' about_the_paper_sheet {{{2

sub about_the_paper_sheet(in_detail%)

  ' XXX TODO --

  you_see_nothing_special_about(the_paper_sheet%)
  select case output_language%
    case esperanto%
      wt_type("Ĝi estas malplena.") ' XXX TODO -- Confirm.
    case interlingue%
      wt_type("It es vacui.") ' XXX TODO -- Confirm.
    case spanish%
      wt_type("Está en blanco.")
  end select

end sub

' -----------------------------------------------
' about_the_pencil {{{2

sub about_the_pencil(in_detail%)

  ' XXX TODO --

  ' wt.type_para("Un lápiz vulgar, de color de madera, bien afilado.")
  you_see_nothing_special_about(the_pencil%)

end sub

' -----------------------------------------------
' about_the_reception {{{2

sub about_the_reception(in_detail%)

  ' XXX TODO --

  ' wt.type_para("La recepción.")
  you_see_nothing_special_about(the_reception%)

end sub

' -----------------------------------------------
' about_the_safe {{{2

sub about_the_safe(in_detail%)

  ' XXX TODO --

  select case output_language%
    case esperanto%
      wt_type_para("La mon-ŝrankon de la direktoro.")
    case interlingue%
      wt_type_para("Li moné-scaf del director.")
    case spanish%
      wt_type_para("La caja fuerte del director.")
  end select

  if the_safe_is_open% then
    select case output_language%
      case esperanto%
        wt_type("Ĝi estas malfermita.")
      case interlingue%
        wt_type("It es apert.")
      case spanish%
        wt_type("Está abierta.")
    end select
  else
    select case output_language%
      case esperanto%
        wt_type("Ĝi estas fermita.")
      case interlingue%
        wt_type("It es cludet.")
      case spanish%
        wt_type("Está cerrada.")
    end select
  end if

end sub

' -----------------------------------------------
' about_the_secret_room {{{2

sub about_the_secret_room(in_detail%)

  ' XXX TODO --

  ' wt.type_para("La secretaría.")
  you_see_nothing_special_about(the_secret_room%)

end sub

' -----------------------------------------------
' about_the_shoe {{{2

sub about_the_shoe(in_detail%)

  ' XXX TODO --

  ' wt.type_para("Un viejo zapato roto.")
  you_see_nothing_special_about(the_shoe%)

end sub

' -----------------------------------------------
' about_the_sock {{{2

sub about_the_sock(in_detail%)

  ' XXX TODO --

  ' wt.type_para("Un viejo calcetín mugriento y maloliente.")
  you_see_nothing_special_about(the_sock%)

end sub

' -----------------------------------------------
' about_the_flashlight {{{2

sub about_the_flashlight(in_detail%)

  select case output_language%
    case esperanto%
      wt_type_para("Ĝi estas ordinara lumilo.")
    case interlingue%
      wt_type_para("It es un ordinari tasca-lampe.")
    case spanish%
      wt_type_para("Es una linterna corriente.")
  end select

  if flashlight_on% then
    select case output_language%
      case esperanto%
        wt_type("Ĝi estas ŝaltita.")
      case interlingue%
        wt_type("It es accendet.")
      case spanish%
        wt_type("Está encendida.")
    end select
  else
    select case output_language%
      case esperanto%
        wt_type("Ĝi estas malŝaltita.")
      case interlingue%
        wt_type("It ne es accendet.")
      case spanish%
        wt_type("Está apagada.")
    end select
  end if

  if not in_detail% then exit sub

  if flashlight_on%=false and battery_life%=0 then
    select case output_language%
      case esperanto%
        wt_type("La baterio estas elĉerpita.")
      case interlingue%
        wt_type("Li baterie es exhaustet.")
      case spanish%
        wt_type("La batería está agotada.")
    end select
  end if

end sub

' -----------------------------------------------
' about_the_wall_0 {{{2

sub about_the_wall_0(in_detail%)

  ' XXX TODO --

  ' wt.type_para("Un muro.")
  you_see_nothing_special_about(the_wall_0%)

end sub

' -----------------------------------------------
' about_the_wall_1 {{{2

sub about_the_wall_1(in_detail%)

  ' XXX TODO --

  ' wt.type_para("Un muro.")
  you_see_nothing_special_about(the_wall_1%)

end sub

' -----------------------------------------------
' about_the_wall_2 {{{2

sub about_the_wall_2(in_detail%)

  ' XXX TODO --

  ' wt.type_para("Un muro.")
  you_see_nothing_special_about(the_wall_2%)

end sub

' -----------------------------------------------
' about_the_wall_3 {{{2

sub about_the_wall_3(in_detail%)

  ' XXX TODO --

  ' wt.type_para("Un muro.")
  you_see_nothing_special_about(the_wall_3%)

end sub

' -----------------------------------------------
' about_this_pot {{{2

sub about_this_pot(entity%,in_detail%)

  ' XXX TODO --

  if in_detail% then
    search_pot(entity%)
  else
    select case output_language%
      case esperanto%
        wt_type("Ĝi ŝajnas tre peza.")
        exit sub
      case interlingue%
        wt_type("It sembla tre pesant.")
        exit sub
      case spanish%
        wt_type("Parece muy pesado.")
        exit sub
    end select
    if the_key_was_found_here%(entity%) then
    select case output_language%
      case esperanto%
        wt_type("Bonan lokon elektis «la Klavulo» por kaŝi la ŝlosilon.")
      case interlingue%
        wt_type("Bon loc «li Tastario» selectet por celar li clave.")
      case spanish%
        wt_type("Buen sitio eligió «el Teclas»  para esconder la llave.")
    end select
    end if
  end if

end sub

' ==============================================================
' Text output {{{1

sub type_para_in(this_color%,this_text$)

  local foreground%
  let foreground%=wt_foreground%
  let wt_foreground%=this_color%
  wt_type_para(this_text$) ' XXX TODO --
  let wt_foreground%=foreground%
  color wt_foreground% ' otherwise `input$` will use `this_color%`

end sub

sub type_in(this_color%,this_text$)

  local foreground%
  let foreground%=wt_foreground%
  let wt_foreground%=this_color%
  wt_type(this_text$) ' XXX TODO --
  let wt_foreground%=foreground%
  color wt_foreground% ' otherwise `input$` will use `this_color%`

end sub

sub problem(this_text$)

  type_para_in(red%,this_text$)

end sub

sub do_debug(this_text$)

  type_in(yellow%,"["+this_text$+"]")

end sub

sub debug(this_text$)

  if debugging% then
    do_debug(this_text$)
  end if

end sub

sub debug_pause(this_text$)

  if debugging% then
    do_debug(this_text$)
  end if

end sub

sub fatal_problem(this_text$)

  type_para_in(red%,"Internal error: "+this_text$)

end sub

sub ruler

  local indentation%
  let indentation%=wt_indentation%
  let wt_indentation%=0
  wt_type_para(string$(wt_cols%,"-"))
  let wt_indentation%=indentation%

end sub

' ==============================================================
' Info {{{1

sub credits

  wt_type("CE4 (v"+version$+")")
  wt_cr
  wt_type(copyright$)
  wt_cr

end sub

sub language_menu

  local lang%

  let output_language%=0

  wt_do_cr

  wt_type("1) ESPAÑOL:")
  ' wt.type("Pulsa la tecla «1» para jugar en español.")
  wt_type("Escribe «1» para jugar en español.") ' XXX TMP --
  wt_type("Podrás cambiar la lengua en cualquier momento durante el juego.")
  ' XXX TODO -- inform about the help command
  wt_do_cr
  wt_do_cr

  wt_type("2) ESPERANTO:")
  ' wt.type("Premu la klavon «2» por ludi en Esperanto.")
  wt_type("Tajpu «2» por ludi en Esperanto.") ' XXX TMP --
  wt_type("Vi povos ŝanĝi la lingvon iam ajn dum la ludo.")
  ' XXX TODO -- inform about the help command
  wt_do_cr
  wt_do_cr

  wt_type("3) INTERLINGUE:")
  ' wt.type("Presse li taste «3» por luder in Interlingue (Occidental).")
  wt_type("Tippa «3» por luder in Interlingue/Occidental.") ' XXX TMP --
  wt_type("Vu va posser changear li lingue alquande durante li lude.")
  ' XXX TODO -- inform about the help command
  wt_do_cr
  wt_do_cr

  do

    let lang%=code(input$(1))-asc("0")

    select case lang%
      case 1:
        let input_language% = spanish%
        let output_language% = spanish%
      case 2:
        let input_language% = esperanto%
        let output_language% = esperanto%
      case 3:
        let input_language% = interlingue%
        let output_language% = interlingue%
    end select

  loop until output_language%

end sub

sub intro

  wt_clear

  select case output_language%

    case esperanto%

      wt_type_para("Jam estas preskaŭ meznokto. Kia malvarmo!")

      wt_type_para("Krome, via amiko «la klavulo» lasis vin sola.")
      wt_type("«Mi ŝtelos la ŝlosilon… kaj kaŝos ĝin… en florpoton…»,")
      wt_type("li diris al vi ĉi-matene, subite, dum la ekzameno")
      wt_type("pri matematiko,")
      wt_type("tiele tre mallaŭte, kun sia")
      wt_type("sufloro de mortanta muŝo.")
      wt_type("«Tiel ni ne riskos… perdi ĝin vespere.")
      wt_type("Ĉi-nokte ni revenos… eniros…")
      wt_type("kaj solvos la problemon», li aldonis.")

      wt_type_para("Sed vi atendis lin jam duonhoron, kaj li ne aperis.")
      wt_type("Vi esperas ke, almenaŭ, li faris kion li diris.")

      wt_type_para("Nun do vi mem devas trovi la ŝlosilon,")
      wt_type("kaŝeniri la lernejon kaj trovi la kasedon")
      wt_type("kiun la instruisto prenis de vi hodiaŭ en la klasĉambro,")
      wt_type("antaŭ ke li eksciu, ke ĝi ne enhavas muzikon")
      wt_type("sed vian ĵus programitan aventur-ludon")
      wt_type("por la komputilo ZX Spectrum,")
      wt_type("en kiu li mem ludas gravan rolon…")

    case interlingue%

      wt_type_para("It ja es demí-nocte. Quant frigore!")

      wt_type_para("Adplu vor amíco «li Tastario» ha lassat vos sol.")
      wt_type("«Yo va furter li clave… e celar it… intra un flor-pote…»,")
      wt_type("il dit vos ho-matine, sovente, durante li examination de matematica,")
      wt_type("talmen tre piani, con su")
      wt_type("chuchota de morient mosca.")
      wt_type("«Talmen yo ne va riscar… perder it in li véspere.")
      wt_type("Ho-nocte noi va revenir… va intrar…")
      wt_type("e va soluer li problema», il adjuntet.")

      wt_type_para("Ma vu ha atendet le ja un demí-hor, e il ne ha aparit.")
      wt_type("Vu espera que, adminim, il fat quo il dit.")

      wt_type_para("Dunc nu vu self deve trovar li clave,")
      wt_type("furtivmen intrar li scola e trovar li cassete")
      wt_type("quem li instructor prendet de vu hodíe in li aula,")
      wt_type("ante que il vell conscier, que it ne contene musica")
      wt_type("ma vor just programmat aventur-lude")
      wt_type("por li computator ZX Spectrum,")
      wt_type("in quel il lude un grav rol…")

    case spanish%

      wt_type_para("Ya es medianoche. ¡Qué frío!")

      wt_type_para("Y para colmo tu amigo «el Teclas» te ha dejado solo.")
      wt_type("«Voy a robar la llave… y a esconderla… en un tiesto…»,")
      wt_type("te dijo esta mañana, de repente, durante el examen de matemáticas,")
      wt_type("así en voz muy baja, con su")
      wt_type("susurro de mosca moribunda.")
      wt_type("«Así no me arriesgo… a perderla por la tarde.")
      wt_type("Esta noche volvemos… entramos…")
      wt_type("y arreglamos el asunto», añadió.")

      wt_type_para("Pero llevas esperándolo media hora y no ha aparecido.")
      wt_type("Confías en que, por lo menos, haya hecho lo que te dijo.")

      wt_type_para("Así que ahora tendrás que buscar tú mismo la llave,")
      wt_type("entrar a escondidas en el colegio y encontrar el casete")
      wt_type("que el profesor te quitó hoy en la clase,")
      wt_type("antes de que se dé cuenta de que no tiene música")
      wt_type("sino tu juego de aventuras recién programado")
      wt_type("para la computadora ZX Spectrum,")
      wt_type("en el cual él tiene un papel importante…")

  end select

  wt_cr
  wt_pause
  wt_clear

end sub

' ==============================================================
' Init {{{1

sub init_once

  ' Note: Called only once, before the first game.

  init_screen

  make_vocabulary
  make_articles
  make_map

  let record_time%=0.25*3600*100 ' 15 min in centiseconds
  let best_player_name$="Lutherus" ' XXX TODO -- Change.

end sub

sub init_screen

  wt_init
  let wt_rows%=21 ' XXX TODO -- Calculate.
  let wt_cols%=73 ' XXX TODO -- Calculate.
  let wt_indentation%=2 ' spaces at the start of a paragraph's first line
  let wt_paragraph_separation%=0 ' blank lines between paragraphs
  wt_clear

end sub

sub init_game

  ' Init needed before every game.

  local digit%,this_entity%,this_location%

  randomize

  init_arrays

  ' The protagonist

  let location%(the_protagonist%)=between%(the_outside_0%,the_outside_3%)
  let previous_location%=0 ' XXX TODO -- Generalize for all characters.
  let banished%=false

  ' The guard

  let guard_met%=0 ' counter ' XXX  not used yet

  do
    let location%(the_guard%)=between%(the_outside_0%,the_outside_3%)
  loop until is_here%(the_guard%)=0

  ' Choose a random location for most entities

  for this_entity%=1 to entities%
    if is_portable%(this_entity%) and not is_pot%(this_entity%) then
      do
        let this_location%=between%(first_location%,last_location%)
      loop until is_outside%(this_location%)=0
      let location%(this_entity%)=this_location%
    end if
  next this_entity%

  ' Make sure some entities are in some locations

  let location%(the_book%)=the_library% ' XXX needed? could be set in the original data
  select case between%(0,2)
    case 0
      let location%(the_flashlight%)=the_reception%
    case 1
      let location%(the_flashlight%)=the_classroom%
    case 2
      let location%(the_flashlight%)=the_junk_room%
  end select
  let location%(the_key%)=the_limbo%

  ' The safe

  let location%(the_safe%)=the_office%
  let the_safe_is_open%=false
  for digit%=1 to safe_code_digits%
    let safe_code$=safe_code$+random_digit$
  next digit%

  ' Plot

  let flashlight_on%=true
  let battery_life%=between%(16,24) ' in turns
  let key_pot%=between%(the_pot_0%,the_pot_3%)
  let location%(the_key%)=key_pot%
  let last_pot%=0 ' last pot manipulated by the protagonist
  let last_corridor%=0 ' last corridor location mentioned by the protagonist
  let last_outside%=0 ' last outside location mentioned by the protagonist

  let start_time%=time

end sub

sub init_arrays

  ' Init the variable arrays with their default contents.

  local n%

  for n%=1 to entities%
    let visits%(n%)=0
  next n%

  make_entities

end sub

' ==============================================================
' Debug tools {{{1

sub check_map

  ' XXX FIXME -- The sub freezes after printing direction% 5.

  debug("in check_map")
  local this_direction%,this_entity%,this_entity_exit%

  for this_entity%=1 to entities%
    if is_location%(this_entity%) then
      debug("this_entity% ("+str$(this_entity%)+") is a location")
      wt_type_para("Exits of entity "+str$(this_entity%)+" ("+name$(this_entity%)+"):")
      for this_direction%=1 to max_exits%
        wt_cr
        debug("this_direction%= "+str$(this_direction%))
        this_entity_exit%=exit_location%(this_entity%,this_direction%)
        debug("this_entity_exit%= "+str$(this_entity_exit%))
        if this_entity_exit% then
          wt_type_para("- "+str$(this_entity_exit%)+" ("+name$(this_entity_exit%)+")")
        else
          debug("no exit")
        end if
      next this_direction%
      input$(1)
    end if
  next this_entity%

end sub

sub check_words

  local n%
  for n%=1 to words%
    print n%," ";word$(n%)
  next n%

end sub

sub check_entities

  local e%,l%
  for e%=1 to entities%
      print using "000 ";e%
    for l%=1 to languages%
      let output_language%=l%
      print "    ";short_name$(e%);" ";
      if has_long_name%(e%) then
        print "(";the_long_name$(e%);")"
      else
        print
      end if
    next l%
    input$(1)
  next e%

end sub

sub check_articles
  local t%,g%,n%
  for t%=1 to 3
    for g%=1 to 3
      for n%=1 to 2
        print mid$("IDP",t%,1);" ";
        print mid$("MFN",g%,1);" ";
        print mid$("SP",n%,1);"  ";
        for l%=1 to languages%
          print mid$("eoiees",(l%-1)*2+1,2);": ";
          print using "#####";article$(t%,g%,n%,l%);" ";
        next l%
        print
        input$(1)
      next n%
    next g%
  next t%

end sub

' Template:

' select case output_language%
'   case esperanto%
'   case interlingue%
'   case spanish%
' end select

' vim: filetype=bas

Deleted src/ce4.bas.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
#!/usr/bin/env tbas
' ce4.bas

' CE4

' A text adventure in Spanish, Esperanto and Interlingue,
' programmed in tbas, under development

let version$="0.120.0-dev.8+201912070112"

' ==============================================================
' Author and license {{{1

let copyright$="(C) 2014,2015,2016,2017,2018,2019 Marcos Cruz (programandala.net)"

' You may do whatever you want with this work, so long as you
' retain all copyright, authorship, acknowledgment and credit
' notices and this license in all redistributed copies and
' derived works.  There is no warranty.

' ==============================================================
' Config {{{1

cls
let debugging%=true

' ==============================================================
' Requirements {{{1

library "lib/wt.bas"

' ==============================================================
' Constants {{{1

' Languages
let esperanto% = 1
let interlingue% = 2
let spanish% = 3
let languages% = 3

' Noun attributes
let masculine%=1
let feminine%=2
let neuter%=3
let singular%=1
let plural%=2

' Article types
let no_article%=0
let indefinite%=1
let definite%=2
let possesive%=3

' Plot
let max_carried%=3 ' maximum number of entities that can be carried XXX TMP
let safe_code_digits%=4

' Text output
let pause_prompt$="[...]"
let pause_centiseconds%=100

' ==============================================================
' Action identifiers {{{1

let enumerated%=0

let no_action%=enum ' must be zero

let to_do%=enum
let to_drop%=enum
let to_examine%=enum
let to_go%=enum
let to_go_east%=enum
let to_go_in%=enum
let to_go_north%=enum
let to_go_out%=enum
let to_go_south%=enum
let to_go_west%=enum
let to_hash_debug%=enum
let to_hash_drop%=enum
let to_hash_go%=enum
let to_hash_input%=enum
let to_hash_langs%=enum
let to_hash_locate%=enum
let to_hash_output%=enum
let to_hash_take%=enum
let to_hash_use_esperanto%=enum
let to_hash_use_interlingue%=enum
let to_hash_use_spanish%=enum
let to_inventory%=enum
let to_list_exits%=enum
let to_look%=enum
let to_open%=enum
let to_read%=enum
let to_show_graphics%=enum
let to_take%=enum
let to_turn_off%=enum
let to_turn_on%=enum

let actions%=enumerated% ' count

' ==============================================================
' Entity identifiers {{{1

' The cardinal points and directions must be the first
' identifiers, and they must be in the given order (north,
' south, east, west, inside and outside).  The order of the
' rest of entities is unimportant.

let enumerated%=0

' XXX FIXME -- Why tbas throws error "incorrect number of arguments" here?:
let no_entity%=enum ' must be zero

' ----------------------------------------------
' Directions {{{2

let the_north%=enum
let the_south%=enum
let the_east%=enum
let the_west%=enum
let the_inside%=enum
let the_outside%=enum

let max_exits%=enumerated% ' count

let first_direction=the_north%
let last_direction%=the_outside%
let first_cardinal_point=the_north%
let last_cardinal_point%=the_west%

' ----------------------------------------------
' Virtual or special {{{2

let the_all%=enum
let the_corridor_x%=enum ' ambiguous entity
let the_esperanto_language%=enum
let the_exit%=enum
let the_interlingue_language%=enum
let the_inventory%=enum
let the_limbo%=enum
let the_no%=enum
let the_outside_x%=enum ' ambiguous entity
let the_pot_x%=enum ' ambiguous entity
let the_spanish_language%=enum
let the_table_x%=enum ' ambiguous entity
let the_wall_x%=enum ' ambiguous entity
let the_yes%=enum

' ----------------------------------------------
' Characters {{{2

let the_guard%=enum
let the_protagonist%=enum

' ----------------------------------------------
' Things {{{2

let the_wall_0%=first_thing_entity%=enum
let the_wall_1%=enum
let the_wall_2%=enum
let the_wall_3%=enum
let the_ballpen%=enum
let the_book%=enum
let the_brick%=enum
let the_dining_room_tables%=enum
let the_door%=enum
let the_key%=enum
let the_paper_piece%=enum
let the_paper_sheet%=enum
let the_pencil%=enum
let the_pot_0%=enum
let the_pot_1%=enum
let the_pot_2%=enum
let the_pot_3%=enum
let the_safe%=enum
let the_shoe%=enum
let the_sock%=enum
let the_flashlight%=last_thing_entity%=enum

' ----------------------------------------------
' Locations {{{2

let the_bathroom%=first_location=enum
let the_classroom%=enum
let the_corridor_0%=enum
let the_corridor_1%=enum
let the_corridor_2%=enum
let the_dining_room%=enum
let the_junk_room%=enum
let the_kitchen%=enum
let the_library%=enum
let the_office%=enum
let the_outside_0%=enum
let the_outside_1%=enum
let the_outside_2%=enum
let the_outside_3%=enum
let the_reception%=enum
let the_secret_room%=last_location=enum

let entities%=enumerated% ' count

' ==============================================================
' Variables {{{1

let input_language%=spanish% ' current input language
let output_language%=spanish% ' current output language

let total_playing_seconds%=0
let playing_hours%=0
let playing_minutes%=0
let playing_seconds%=0

let enumerated%=0

' ==============================================================
' Arrays {{{1

' -----------------------------------------------
' Articles {{{2

dim article$(3,3,2,languages%)

' type:   indefinite, definite, possesive
' gender: masculine, feminine, neuter
' number: singular, plural

' -----------------------------------------------
' Entities {{{2

dim location%(entities%)
  ' The location (or holder) of all entities.

dim name_word%(entities%,languages%)
  ' Number of the vocabulary word associated with an entity, and used
  ' as name when no explicit name has been defined in `long_name$`.

dim gender%(entities%,languages%)
  ' `masculine%`, `feminine%` or `neuter%`.

dim number%(entities%,languages%)
  ' `singular%` or `plural%`.

dim article_type%(entities%)
  ' `indefinite%`, `definite%` or `possesive%`.

dim is_location%(entities%)
  ' A flag. Entities that are locations have a true flag.

dim is_portable%(entities%)
  ' A flag. Entities that are portable have a true flag.

dim examinations%(entities%)
  ' A count: times an entity has been examined in detail.
  '
  ' XXX REMARK -- This count is useless with directions, unless
  ' the counter is reset after the protagonist have entered a
  ' new location. It is pretty useless with inventory an
  ' probably others as well.

dim carried_entity%(100) ' XXX TODO -- size
  ' A list of entities that are carried by the protagonist,
  ' updated by `carried_entities`.

dim present_entity%(100) ' XXX TODO -- size
  ' A list of entities that are in the current location,
  ' updated by `present_entities`.

dim long_name$(entities%,languages%)

' -----------------------------------------------
' Map {{{2

dim exit_location%(entities%,max_exits%)

' ==============================================================
' Boot {{{1

init_once

if debugging% then
  ' show_map
end if

main
end

' ==============================================================
' Stock functions {{{1

sub between%(low%,high%)
  ' Return a random integer between _high%_ and _low%_.
  return int(rnd*(high%-low%)+low%)
end sub

sub random_digit$
  ' Return a random digit.
  return chr$(between%(asc("0"),asc("9")))
end sub

sub zero(n%)
  return  right$("00"+str$(n%),2)
end sub

sub hour(h%,m%,s%)
  ' Hour, minute and second as an ISO time string.
  return  zero(h%)+":"+zero(m%)+":"+zero(s%)
end sub

sub enum

  ' Then return the current value of `enumerated%`,
  ' incrementing it for the next time.

  let enumerated%=enumerated%+1
  return enumerated%-1
end sub

sub capitalized(this_text$)
  return upper$(left$(this_text$,1))+mid$(this_text$,2)
end sub

sub replaced(source$,oldTxt$,newTxt$)

  ' Replaces all occurrences of `oldTxt$` in `source$` with `newTxt$`.

  local position%,chunk%

  let chunk%=len(oldTxt$)

  do
    let position%=instr(source$,oldTxt$)
    if position% then
      let source$=left$(source$,position%-1)+newTxt$+mid$(source$,position%+chunk%)
    end if
  loop while position%

  return source$
end sub

sub split(text$, delimiter$,return split$())

  ' Split a string `text$` at specified `delimiter$`.
  ' The parts are returned in array `split$()`.
  ' The returned value is the number of array elements.

  ' Credits:
  ' Code adapted from:
  ' Richard Russel's String library v1.2 (2018-11-11),
  ' included with BBCSDL.

  local pos%, part%, from%, chunk%
  let chunk% = len(delimiter$)
  let part% = 0
  let from% = 1
  do
    let pos% = instr(text$, delimiter$, from%)
    if pos% then
      let split$(part%) = mid$(text$, from%, pos%-from%)
      let from% = pos%+chunk%
      let part%=part%+1
    end if
  loop while pos%
  if from%<=len(text$) then
    let split$(part%) = mid$(text$, from%)
    let part%=part%+1
  end if
  return  part%
end sub

sub max(n1%,n2%)
  if n1%>n2% then
    return n1%
  else
    return n2%  
  end if
end sub  

sub repeated(times%,string$)
  local result$,n%
  for n%=1 to times%
    let result$=result$+string$
  next n%
  return result$
end sub

' ==============================================================
' Stock procedures {{{1

sub ruler
  local indentation%
  let indentation%=wt_indentation%
  let wt_indentation%=0
  wt_type_para(repeated(wt_cols%,"-"))
  let wt_indentation%=indentation%
end sub

' ==============================================================
' Multilingual texts {{{1

sub and_
  select output_language%
    case esperanto%
      return "kaj"
    case interlingue%
      return "e"
    case spanish%
      return "y"
  end select
end sub

sub no_way_
  select output_language%
    case esperanto%
      return "Neniel."
    case interlingue%
      return "Nequalmen."
    case spanish%
      return "De ninguna manera."
  end select
end sub

sub question_mark_
  select output_language%
    case spanish%
      return "¿"
    case else
      return ""
  end select
end sub

sub you_already_have_
  select output_language%
    case esperanto%
      return "Vi jam havas"
    case interlingue%
      return "Vu ja have"
    case spanish%
      return "Ya tienes"
  end select
end sub

sub you_are_in_
  select output_language%
    case esperanto%
      return "Vi estas en"
    case interlingue%
      return "Vu sta in"
    case spanish%
      return "Estás en"
  end select
end sub

sub you_can_not_go_that_way_
  select output_language%
    case esperanto%
      return "Vi ne povas iri tien."
    case interlingue%
      return "Vu ne posse ear ta."
    case spanish%
      return "No puedes ir en esa dirección."
  end select
end sub

sub you_carry_nothing_
  select output_language%
    case esperanto%
      return "Vi portas nenion."
    case interlingue%
      return "Vu porta nequó."
    case spanish%
      return "Nada llevas contigo."
  end select
end sub

sub you_drop_
  select output_language%
    case esperanto%
      return "Vi lasas"
    case interlingue%
      return "Vu lassa"
    case spanish%
      return "Dejas"
  end select
end sub

sub you_have_
  select output_language%
    case esperanto%
      return "Vi havas"
    case interlingue%
      return "Vu have"
    case spanish%
      return "Tienes"
  end select
end sub

sub you_see_
  select output_language%
    case esperanto%
      return "Vi vidas"
    case interlingue%
      return "Vu vide"
    case spanish%
      return "Ves"
  end select
end sub

sub you_see_nothing_special_
  select output_language%
    case esperanto%
      return "Vi vidas nenion specialan."
    case interlingue%
      return "Vu vide nequó special."
    case spanish%
      return "Nada ves de especial."
  end select
end sub

sub you_see_nothing_special
  wt_type_para(you_see_nothing_special_)
end sub

sub you_take_
  select output_language%
    case esperanto%
      return "Vi prenas"
    case interlingue%
      return "Vu prende"
    case spanish%
      return "Coges"
  end select
end sub

' ==============================================================
' Data {{{1

' -----------------------------------------------
' Articles {{{2

' type:   indefinite, definite, possesive
' gender: masculine, feminine, neuter
' number: singular, plural

let article$(indefinite%,neuter%,singular%,esperanto%)=""
let article$(indefinite%,neuter%,plural%,esperanto%)=""
let article$(definite%,neuter%,singular%,esperanto%)="la"
let article$(definite%,neuter%,plural%,esperanto%)="la"
let article$(possesive%,neuter%,singular%,esperanto%)="mia"
let article$(possesive%,neuter%,plural%,esperanto%)="miaj"
let article$(possesive%,neuter%,singular%,esperanto%)="mia"
let article$(possesive%,neuter%,plural%,esperanto%)="miaj"

let article$(indefinite%,neuter%,singular%,interlingue%)="un"
let article$(indefinite%,neuter%,plural%,interlingue%)=""
let article$(definite%,neuter%,singular%,interlingue%)="li"
let article$(definite%,neuter%,plural%,interlingue%)="li"
let article$(possesive%,neuter%,singular%,interlingue%)="mi"
let article$(possesive%,neuter%,plural%,interlingue%)="mi"

let article$(indefinite%,masculine%,singular%,spanish%)="un"
let article$(indefinite%,masculine%,plural%,spanish%)="unos"
let article$(indefinite%,feminine%,singular%,spanish%)="una"
let article$(indefinite%,feminine%,plural%,spanish%)="unas"
let article$(definite%,masculine%,singular%,spanish%)="el"
let article$(definite%,masculine%,plural%,spanish%)="los"
let article$(definite%,feminine%,singular%,spanish%)="la"
let article$(definite%,feminine%,plural%,spanish%)="las"
let article$(possesive%,masculine%,singular%,spanish%)="mi"
let article$(possesive%,masculine%,plural%,spanish%)="mis"
let article$(possesive%,feminine%,singular%,spanish%)="mi"
let article$(possesive%,feminine%,plural%,spanish%)="mis"

' XXX old
' let article$(noone,masculine%+singular%,spanish%)="ningún"
' let article$(noone,masculine%+plural%,spanish%)="ningunos"
' let article$(noone,feminine+singular%,spanish%)="ninguna"
' let article$(noone,feminine+plural%,spanish%)="ningunas"
' let article$(someone,masculine%+singular%,spanish%)="alguno"
' let article$(someone,masculine%+plural%,spanish%)="algunos"
' let article$(someone,feminine+singular%,spanish%)="alguna"
' let article$(someone,feminine+plural%,spanish%)="algunas"

' -----------------------------------------------
' Map {{{2

' ? "entities%=",entities% ' XXX INFORMER
' ? "max_exits%=",max_exits%' XXX INFORMER

sub make_exits(entity%,north%,south%,east%,west%,inside%,outside%)

  let is_location%(entity%)=true
  let exit_location%(entity%,the_north%)=north%
  let exit_location%(entity%,the_south%)=south%
  let exit_location%(entity%,the_east%)=east%
  let exit_location%(entity%,the_west%)=west%
  let exit_location%(entity%,the_inside%)=inside%
  let exit_location%(entity%,the_outside%)=outside%

end sub

sub make_map

  make_exits(the_bathroom%,0,0,0,the_corridor_0%,0,0)
  make_exits(the_classroom%,0,0,0,the_corridor_1%,0,0)
  make_exits(the_corridor_0%,the_reception%,the_corridor_1%,the_bathroom%,0,0,0)
  make_exits(the_corridor_1%,the_corridor_0%,the_corridor_2%,the_classroom%,the_library%,0,0)
  make_exits(the_corridor_2%,the_corridor_1%,the_junk_room%,the_dining_room%,0,0,0)
  make_exits(the_dining_room%,0,the_kitchen%,0,the_corridor_2%,0,0)
  make_exits(the_outside_0%,the_outside_1%,the_outside_3%,locked(the_reception%),0,locked(the_reception%),0)
  make_exits(the_outside_1%,0,0,the_outside_2%,the_outside_0%,0,0)
  make_exits(the_outside_2%,the_outside_1%,the_outside_3%,0,0,0,0)
  make_exits(the_outside_3%,0,0,the_outside_2%,the_outside_0%,0,0)
  make_exits(the_junk_room%,the_corridor_2%,0,0,0,0,0)
  make_exits(the_kitchen%,the_dining_room%,0,0,0,0,0)
  make_exits(the_library%,0,0,the_corridor_1%,0,0,0)
  make_exits(the_office%,0,the_reception%,0,0,0,0)
  make_exits(the_secret_room%,0,0,0,0,0,0)
  make_exits(the_reception%,the_office%,the_corridor_0%,0,locked(the_outside_0%),0,0)

end sub

' -----------------------------------------------
' Entities {{{2

sub make_entity(entity%,its_location%,its_article_type%,is_portable%)

  let location%(entity%)=its_location%
  let article_type%(entity%)=its_article_type%
  let is_portable%(entity%)=is_portable%

end sub

sub make_entities

  ' Parameters:
  ' make_entity(entity_id,location,article_type,portable)

  make_entity(the_all%,the_limbo%,no_article%,false)
  make_entity(the_ballpen%,the_limbo%,indefinite%,true)
  make_entity(the_book%,the_limbo%,indefinite%,true)
  make_entity(the_brick%,the_limbo%,indefinite%,true)
  make_entity(the_dining_room_tables%,the_dining_room%,indefinite%,true)
  make_entity(the_door%,the_limbo%,indefinite%,true)
  make_entity(the_east%,the_limbo%,definite%,false)
  make_entity(the_guard%,the_limbo%,definite%,true)
  make_entity(the_inside%,the_limbo%,no_article%,false)
  make_entity(the_inventory%,the_limbo%,indefinite%,false)
  make_entity(the_key%,the_limbo%,definite%,true)
  make_entity(the_north%,the_limbo%,definite%,false)
  make_entity(the_outside%,the_limbo%,no_article%,false)
  make_entity(the_paper_piece%,the_limbo%,indefinite%,true)
  make_entity(the_paper_sheet%,the_limbo%,indefinite%,true)
  make_entity(the_pencil%,the_limbo%,indefinite%,true)
  make_entity(the_pot_x%,the_limbo%,indefinite%,true)
  make_entity(the_pot_0%,the_outside_0%,indefinite%,true)
  make_entity(the_pot_1%,the_outside_1%,indefinite%,true)
  make_entity(the_pot_2%,the_outside_2%,indefinite%,true)
  make_entity(the_pot_3%,the_outside_3%,indefinite%,true)
  make_entity(the_safe%,the_limbo%,indefinite%,false)
  make_entity(the_shoe%,the_limbo%,indefinite%,true)
  make_entity(the_sock%,the_limbo%,indefinite%,true)
  make_entity(the_south%,the_limbo%,definite%,false)
  make_entity(the_flashlight%,the_protagonist%,indefinite%,true)
  make_entity(the_wall_x%,the_limbo%,indefinite%,false)
  make_entity(the_wall_0%,the_outside_0%,indefinite%,false)
  make_entity(the_wall_1%,the_outside_1%,indefinite%,false)
  make_entity(the_wall_2%,the_outside_2%,indefinite%,false)
  make_entity(the_wall_3%,the_outside_3%,indefinite%,false)
  make_entity(the_west%,the_limbo%,definite%,false)

end sub

' .............................
' Long names {{{3

' Note: In Esperanto names "*" marks the position of the accusative
' "n" endings.

let long_name$(the_bathroom%,esperanto%)="la necesejo*"
let long_name$(the_bathroom%,interlingue%)="li toilette"
let long_name$(the_bathroom%,spanish%)="el cuarto de baño"
let long_name$(the_classroom%,esperanto%)="la klasĉambro*"
let long_name$(the_classroom%,interlingue%)="li aula"
let long_name$(the_classroom%,spanish%)="el aula"
let long_name$(the_corridor_0%,esperanto%)="la norda* ekstremo* de la koridoro"
let long_name$(the_corridor_0%,interlingue%)="li fine nordic del coridor"
let long_name$(the_corridor_0%,spanish%)="el extremo norte del pasillo"
let long_name$(the_corridor_1%,esperanto%)="la centra* parto* de la koridoro"
let long_name$(the_corridor_1%,interlingue%)="li parte central del coridor"
let long_name$(the_corridor_1%,spanish%)="el tramo central del pasillo"
let long_name$(the_corridor_2%,esperanto%)="la suda* ekstremo* de la koridoro"
let long_name$(the_corridor_2%,interlingue%)="li fine sudic del coridor"
let long_name$(the_corridor_2%,spanish%)="el extremo sur del pasillo"
let long_name$(the_dining_room%,esperanto%)="la manĝejo*"
let long_name$(the_dining_room%,interlingue%)="li manjatoria"
let long_name$(the_dining_room%,spanish%)="el comedor"
let long_name$(the_junk_room%,esperanto%)="la fortenejo*"
let long_name$(the_junk_room%,interlingue%)="li depó" ' XXX TODO --
let long_name$(the_junk_room%,spanish%)="el trastero"
let long_name$(the_kitchen%,esperanto%)="la kuirejo*"
let long_name$(the_kitchen%,interlingue%)="li cocinería"
let long_name$(the_kitchen%,spanish%)="la cocina"
let long_name$(the_library%,esperanto%)="la librejo*"
let long_name$(the_library%,interlingue%)="li biblioteca"
let long_name$(the_library%,spanish%)="la biblioteca"
let long_name$(the_limbo%,esperanto%)="la limbo*"
let long_name$(the_limbo%,interlingue%)="li limbo"
let long_name$(the_limbo%,spanish%)="el limbo"
let long_name$(the_office%,esperanto%)="la oficejo* de la direktoro"
let long_name$(the_office%,interlingue%)="li oficie del director"
let long_name$(the_office%,spanish%)="el despacho del director"
let long_name$(the_outside_0%,esperanto%)="la okcidenta* flanko* de la konstruaĵo"
let long_name$(the_outside_0%,interlingue%)="li látere occidental del construction"
let long_name$(the_outside_0%,spanish%)="el oeste del edificio"
let long_name$(the_outside_1%,esperanto%)="la norda* flanko* de la konstruaĵo"
let long_name$(the_outside_1%,interlingue%)="li látere nordic del construction"
let long_name$(the_outside_1%,spanish%)="el norte del edificio"
let long_name$(the_outside_2%,esperanto%)="la orienta* flanko* de la konstruaĵo"
let long_name$(the_outside_2%,interlingue%)="li látere oriental del construction"
let long_name$(the_outside_2%,spanish%)="el este del edificio"
let long_name$(the_outside_3%,esperanto%)="la suda* flanko* de la konstruaĵo"
let long_name$(the_outside_3%,interlingue%)="li látere sudic del construction"
let long_name$(the_outside_3%,spanish%)="el sur del edificio"
let long_name$(the_reception%,esperanto%)="la akceptejo*"
let long_name$(the_reception%,interlingue%)="li hall"
let long_name$(the_reception%,spanish%)="la recepción"
let long_name$(the_safe%,spanish%)="la caja fuerte"
let long_name$(the_secret_room%,esperanto%)="la sekreta* ĉambro*"
let long_name$(the_secret_room%,interlingue%)="li chambre secret"
let long_name$(the_secret_room%,spanish%)="la habitación secreta"

' =============================================================
' Vocabulary {{{1

' Words can be either verbs, which are associated with an action, or
' nouns, which are associated with an entity. One single word can be
' a verb and a noun at the same time.
'
' Several words can be associated with one entity, and one word can
' be associated with several entities.  This is how it works:
'
' When several words are associated with one entity, the one whose
' "entity_name" argument is "true" will be the name of the entity.
'
' When one word is associated with several entities, it must be
' associated first with an ambiguous entity, a fake entity
' identifier whose actual value will be calculated by the parser,
' depending on the current location or other data. The identifier of
' ambiguous entities uses the "X" suffix.

sub make_vocabulary

  local its_entity%,its_gender%,its_number%,its_language%,is_entity_name%

  let words%=vocabulary_size
  dim word$(words%)
  dim word_action%(words%)
  dim word_entity%(words%)
  dim word_language%(words%)

  restore_vocabulary

  for word%=1 to words%

    read word$(word%), word_action%(word%)
    read its_entity%, its_gender%, its_number%
    read word_language%(word%), is_entity_name%

    if its_entity%<>no_entity% then
      let word_entity%(word%)=its_entity%
      let gender%(its_entity%,its_language%)=its_gender%
      let number%(its_entity%,its_language%)=its_number%
      if is_entity_name% then
        let name_word%(its_entity%,its_language%)=word%
      end if
    end if

  next word%

end sub

sub vocabulary_size
  local words%,word$,x%
  restore_vocabulary
  do
    read word$,x%,x%,x%,x%,x%,x%
    let words%=words%-(len(word$)<>0)
  loop while len(word$)
  return words%
end sub

sub restore_vocabulary

  restore +0

  ' Each `data` line contais the following fields:

  ' string:  the word
  ' integer: its associated action
  ' integer: its associated entity
  ' integer: its grammatical gender
  ' integer: its number
  ' integer: its language
  ' flag:    is the word the entity name?

  ' ------------------------------------------
  ' Esperanto {{{2

  ' Ambiguous words
  '
  ' They must be defined first to make the parser find them
  ' first.

  data "eksteraĵon",no_action%,the_outside_x%,neuter%,singular%,esperanto%,false
  data "eksteraĵojn",no_action%,the_outside_x%,neuter%,plural%,esperanto%,false
  data "florpoton",no_action%,the_pot_x%,neuter%,singular%,esperanto%,false
  data "flor-poton",no_action%,the_pot_x%,neuter%,singular%,esperanto%,true
  data "koridoron",no_action%,the_corridor_x%,neuter%,singular%,esperanto%,false
  data "murojn",no_action%,the_wall_x%,neuter%,plural%,esperanto%,false
  data "muron",no_action%,the_wall_x%,neuter%,singular%,esperanto%,true
  data "tablon",no_action%,the_table_x%,neuter%,singular%,esperanto%,true

  ' Unambiguous words

  data "#castellano",to_hash_use_spanish%,the_spanish_language%,0,0,esperanto%,false
  data "#debug",to_hash_debug%,no_entity%,0,0,esperanto%,false
  data "#drop",to_hash_drop%,no_entity%,0,0,esperanto%,false
  data "#eo",to_hash_use_esperanto%,the_esperanto_language%,0,0,esperanto%,false
  data "#epo",to_hash_use_esperanto%,the_esperanto_language%,0,0,esperanto%,false
  data "#es",to_hash_use_spanish%,the_spanish_language%,0,0,esperanto%,false
  data "#esp",to_hash_use_spanish%,the_spanish_language%,0,0,esperanto%,false
  data "#español",to_hash_use_spanish%,the_spanish_language%,0,0,esperanto%,false
  data "#esperanto",to_hash_use_esperanto%,the_esperanto_language%,0,0,esperanto%,false
  data "#go",to_hash_go%,no_entity%,0,0,esperanto%,false
  data "#ie",to_hash_use_interlingue%,the_interlingue_language%,0,0,esperanto%,false
  data "#ile",to_hash_use_interlingue%,the_interlingue_language%,0,0,esperanto%,false
  data "#input",to_hash_input%,no_entity%,0,0,esperanto%,false
  data "#interlingue",to_hash_use_interlingue%,the_interlingue_language%,0,0,esperanto%,false
  data "#langs",to_hash_langs%,no_entity%,0,0,esperanto%,false
  data "#locate",to_hash_locate%,no_entity%,0,0,esperanto%,false
  data "#output",to_hash_output%,no_entity%,0,0,esperanto%,false
  data "#take",to_hash_take%,no_entity%,0,0,esperanto%,false
  data "akceptejo",no_action%,the_reception%,neuter%,singular%,esperanto%,false
  data "biblioteko",no_action%,the_library%,neuter%,singular%,esperanto%,false
  data "brikon",no_action%,the_brick%,neuter%,singular%,esperanto%,true
  data "bul-krajonon",no_action%,the_ballpen%,neuter%,singular%,esperanto%,true
  data "bulkrajonon",no_action%,the_ballpen%,neuter%,singular%,esperanto%,false
  data "chion",no_action%,the_all%,neuter%,singular%,esperanto%,false
  data "cxion",no_action%,the_all%,neuter%,singular%,esperanto%,false
  data "e",to_go_east%,the_east%,neuter%,singular%,esperanto%,false
  data "easte",to_go_east%,the_east%,neuter%,singular%,esperanto%,false
  data "easten",to_go_east%,the_east%,neuter%,singular%,esperanto%,false
  data "easton",to_go_east%,the_east%,neuter%,singular%,esperanto%,true
  data "ek",to_examine%,no_entity%,0,0,esperanto%,false
  data "eksteren",to_go_out%,the_outside%,0,0,esperanto%,false
  data "ekzameni",to_examine%,no_entity%,0,0,esperanto%,false
  data "ekzamenu",to_examine%,no_entity%,0,0,esperanto%,false
  data "elirejojn",no_action%,the_exit%,neuter%,plural%,esperanto%,false
  data "elirejon",no_action%,the_exit%,neuter%,singular%,esperanto%,false
  data "eliri",to_go_out%,no_entity%,0,0,esperanto%,false
  data "eliru",to_go_out%,no_entity%,0,0,esperanto%,false
  data "elshalti",to_turn_off%,no_entity%,0,0,esperanto%,false
  data "elshaltu",to_turn_off%,no_entity%,0,0,esperanto%,false
  data "elsxalti",to_turn_off%,no_entity%,0,0,esperanto%,false
  data "elsxaltu",to_turn_off%,no_entity%,0,0,esperanto%,false
  data "elŝalti",to_turn_off%,no_entity%,0,0,esperanto%,false
  data "elŝaltu",to_turn_off%,no_entity%,0,0,esperanto%,false
  data "enen",to_go_in%,the_inside%,0,0,esperanto%,false
  data "eniri",to_go_in%,no_entity%,0,0,esperanto%,false
  data "eniru",to_go_in%,no_entity%,0,0,esperanto%,false
  data "eoste",to_go_east%,the_east%,neuter%,singular%,esperanto%,false
  data "eosten",to_go_east%,the_east%,neuter%,singular%,esperanto%,false
  data "eoston",to_go_east%,the_east%,neuter%,singular%,esperanto%,true
  data "estingi",to_turn_off%,no_entity%,0,0,esperanto%,false
  data "estingu",to_turn_off%,no_entity%,0,0,esperanto%,false
  data "fari",to_do%,no_entity%,0,0,esperanto%,false
  data "faru",to_do%,no_entity%,0,0,esperanto%,false
  data "flor-poton",no_action%,the_pot_0%,neuter%,singular%,esperanto%,true
  data "flor-poton",no_action%,the_pot_1%,neuter%,singular%,esperanto%,true
  data "flor-poton",no_action%,the_pot_2%,neuter%,singular%,esperanto%,true
  data "flor-poton",no_action%,the_pot_3%,neuter%,singular%,esperanto%,true
  data "florpoton",no_action%,the_pot_0%,neuter%,singular%,esperanto%,false
  data "florpoton",no_action%,the_pot_1%,neuter%,singular%,esperanto%,false
  data "florpoton",no_action%,the_pot_2%,neuter%,singular%,esperanto%,false
  data "florpoton",no_action%,the_pot_3%,neuter%,singular%,esperanto%,false
  data "folion",no_action%,the_paper_sheet%,neuter%,singular%,esperanto%,true
  data "for-iri",to_go%,no_entity%,0,0,esperanto%,false
  data "for-iru",to_go%,no_entity%,0,0,esperanto%,false
  data "for-kuri",to_go_out%,no_entity%,0,0,esperanto%,false
  data "for-kuru",to_go_out%,no_entity%,0,0,esperanto%,false
  data "foriri",to_go%,no_entity%,0,0,esperanto%,false
  data "foriru",to_go%,no_entity%,0,0,esperanto%,false
  data "forkuri",to_go_out%,no_entity%,0,0,esperanto%,false
  data "forkuru",to_go_out%,no_entity%,0,0,esperanto%,false
  data "fortenejo",no_action%,the_junk_room%,neuter%,singular%,esperanto%,false
  data "gvardiston",no_action%,the_guard%,neuter%,singular%,esperanto%,true
  data "i",to_inventory%,the_inventory%,neuter%,singular%,esperanto%,false
  data "internen",to_go_in%,the_inside%,0,0,esperanto%,false
  data "inventari",to_inventory%,no_entity%,0,0,esperanto%,false
  data "inventaron",no_action%,the_inventory%,neuter%,singular%,esperanto%,true
  data "inventaru",to_inventory%,no_entity%,0,0,esperanto%,false
  data "iri",to_go%,no_entity%,0,0,esperanto%,false
  data "iru",to_go%,no_entity%,0,0,esperanto%,false
  data "jes",no_action%,the_yes%,0,0,esperanto%,false
  data "kiras-kason",no_action%,the_safe%,neuter%,singular%,esperanto%,true
  data "kiraskason",no_action%,the_safe%,neuter%,singular%,esperanto%,false
  data "klaschambro",no_action%,the_classroom%,neuter%,singular%,esperanto%,false
  data "klascxambro",no_action%,the_classroom%,neuter%,singular%,esperanto%,false
  data "klasĉambro",no_action%,the_classroom%,neuter%,singular%,esperanto%,false
  data "konekti",to_turn_on%,no_entity%,0,0,esperanto%,false
  data "konektu",to_turn_on%,no_entity%,0,0,esperanto%,false
  data "krajonon",no_action%,the_pencil%,neuter%,singular%,esperanto%,true
  data "kuirejon",no_action%,the_kitchen%,neuter%,singular%,esperanto%,true
  data "lasi",to_drop%,no_entity%,0,0,esperanto%,false
  data "lasu",to_drop%,no_entity%,0,0,esperanto%,false
  data "legi",to_read%,no_entity%,0,0,esperanto%,false
  data "legu",to_read%,no_entity%,0,0,esperanto%,false
  data "librejo",no_action%,the_library%,neuter%,singular%,esperanto%,false
  data "libron",no_action%,the_book%,neuter%,singular%,esperanto%,true
  data "lumilon",no_action%,the_flashlight%,neuter%,singular%,esperanto%,true
  data "malenen",to_go_out%,the_outside%,0,0,esperanto%,false
  data "malfermi",to_open%,no_entity%,0,0,esperanto%,false
  data "malfermu",to_open%,no_entity%,0,0,esperanto%,false
  data "malinternen",to_go_out%,the_outside%,0,0,esperanto%,false
  data "malpreni",to_drop%,no_entity%,0,0,esperanto%,false
  data "malprenu",to_drop%,no_entity%,0,0,esperanto%,false
  data "mon-shrankon",no_action%,the_safe%,neuter%,singular%,esperanto%,false
  data "mon-sxrankon",no_action%,the_safe%,neuter%,singular%,esperanto%,false
  data "mon-ŝrankon",no_action%,the_safe%,neuter%,singular%,esperanto%,true
  data "monshrankon",no_action%,the_safe%,neuter%,singular%,esperanto%,false
  data "monsxrankon",no_action%,the_safe%,neuter%,singular%,esperanto%,false
  data "monŝrankon",no_action%,the_safe%,neuter%,singular%,esperanto%,false
  data "muron",no_action%,the_wall_0%,neuter%,singular%,esperanto%,true
  data "muron",no_action%,the_wall_1%,neuter%,singular%,esperanto%,true
  data "muron",no_action%,the_wall_2%,neuter%,singular%,esperanto%,true
  data "muron",no_action%,the_wall_3%,neuter%,singular%,esperanto%,true
  data "n",to_go_north%,the_north%,neuter%,singular%,esperanto%,false
  data "ne",no_action%,the_no%,0,0,esperanto%,false
  data "necesejo",no_action%,the_bathroom%,neuter%,singular%,esperanto%,false
  data "norde",to_go_north%,the_north%,neuter%,singular%,esperanto%,false
  data "norden",to_go_north%,the_north%,neuter%,singular%,esperanto%,false
  data "nordon",to_go_north%,the_north%,neuter%,singular%,esperanto%,true
  data "observi",to_look%,no_entity%,0,0,esperanto%,false
  data "observu",to_look%,no_entity%,0,0,esperanto%,false
  data "oficejo",no_action%,the_office%,neuter%,singular%,esperanto%,false
  data "okcidente",to_go_west%,the_west%,neuter%,singular%,esperanto%,false
  data "okcidenten",to_go_west%,the_west%,neuter%,singular%,esperanto%,false
  data "okcidenton",to_go_west%,the_west%,neuter%,singular%,esperanto%,true
  data "oriente",to_go_east%,the_east%,neuter%,singular%,esperanto%,false
  data "orienten",to_go_east%,the_east%,neuter%,singular%,esperanto%,false
  data "orientighi",to_list_exits%,no_entity%,neuter%,singular%,esperanto%,false
  data "orientighu",to_list_exits%,no_entity%,neuter%,singular%,esperanto%,false
  data "orientigxi",to_list_exits%,no_entity%,neuter%,singular%,esperanto%,false
  data "orientigxu",to_list_exits%,no_entity%,neuter%,singular%,esperanto%,false
  data "orientiĝi",to_list_exits%,no_entity%,neuter%,singular%,esperanto%,false
  data "orientiĝu",to_list_exits%,no_entity%,neuter%,singular%,esperanto%,false
  data "orienton",to_go_east%,the_east%,neuter%,singular%,esperanto%,true
  data "paper-pecon",no_action%,the_paper_piece%,neuter%,singular%,esperanto%,true
  data "papereton",no_action%,the_paper_piece%,neuter%,singular%,esperanto%,false
  data "paperon",no_action%,the_paper_sheet%,neuter%,singular%,esperanto%,true
  data "paperpecon",no_action%,the_paper_piece%,neuter%,singular%,esperanto%,false
  data "piediri",to_go%,no_entity%,0,0,esperanto%,false
  data "piediru",to_go%,no_entity%,0,0,esperanto%,false
  data "pordon",no_action%,the_door%,neuter%,singular%,esperanto%,true
  data "preni",to_take%,no_entity%,0,0,esperanto%,false
  data "prenu",to_take%,no_entity%,0,0,esperanto%,false
  data "pri-serchi",to_examine%,no_entity%,0,0,esperanto%,false
  data "pri-serchu",to_examine%,no_entity%,0,0,esperanto%,false
  data "pri-sercxi",to_examine%,no_entity%,0,0,esperanto%,false
  data "pri-sercxu",to_examine%,no_entity%,0,0,esperanto%,false
  data "pri-serĉi",to_examine%,no_entity%,0,0,esperanto%,false
  data "pri-serĉu",to_examine%,no_entity%,0,0,esperanto%,false
  data "priserchi",to_examine%,no_entity%,0,0,esperanto%,false
  data "priserchu",to_examine%,no_entity%,0,0,esperanto%,false
  data "prisercxi",to_examine%,no_entity%,0,0,esperanto%,false
  data "prisercxu",to_examine%,no_entity%,0,0,esperanto%,false
  data "priserĉi",to_examine%,no_entity%,0,0,esperanto%,false
  data "priserĉu",to_examine%,no_entity%,0,0,esperanto%,false
  data "promeni",to_go%,no_entity%,0,0,esperanto%,false
  data "promenu",to_go%,no_entity%,0,0,esperanto%,false
  data "r",to_look%,no_entity%,0,0,esperanto%,false
  data "rigardi",to_look%,no_entity%,0,0,esperanto%,false
  data "rigardu",to_look%,no_entity%,0,0,esperanto%,false
  data "s",to_go_south%,the_south%,neuter%,singular%,esperanto%,false
  data "sefon",no_action%,the_safe%,neuter%,singular%,esperanto%,false
  data "shalti",to_turn_on%,no_entity%,0,0,esperanto%,false
  data "shaltu",to_turn_on%,no_entity%,0,0,esperanto%,false
  data "shlosilon",no_action%,the_key%,neuter%,singular%,esperanto%,false
  data "shtrumpeton",no_action%,the_sock%,neuter%,singular%,esperanto%,false
  data "shuon",no_action%,the_shoe%,neuter%,singular%,esperanto%,false
  data "sude",to_go_south%,the_south%,neuter%,singular%,esperanto%,false
  data "suden",to_go_south%,the_south%,neuter%,singular%,esperanto%,false
  data "sudon",to_go_south%,the_south%,neuter%,singular%,esperanto%,true
  data "sxalti",to_turn_on%,no_entity%,0,0,esperanto%,false
  data "sxaltu",to_turn_on%,no_entity%,0,0,esperanto%,false
  data "sxlosilon",no_action%,the_key%,neuter%,singular%,esperanto%,false
  data "sxtrumpeton",no_action%,the_sock%,neuter%,singular%,esperanto%,false
  data "sxuon",no_action%,the_shoe%,neuter%,singular%,esperanto%,false
  data "tablojn",no_action%,the_dining_room_tables%,neuter%,plural%,esperanto%,false
  data "tablon",no_action%,the_dining_room_tables%,neuter%,singular%,esperanto%,true
  data "u",to_go_west%,the_west%,neuter%,singular%,esperanto%,false
  data "ueste",to_go_west%,the_west%,neuter%,singular%,esperanto%,false
  data "uesten",to_go_west%,the_west%,neuter%,singular%,esperanto%,false
  data "ueston",to_go_west%,the_west%,neuter%,singular%,esperanto%,false
  data "ux",to_go_west%,the_west%,neuter%,singular%,esperanto%,false
  data "uxeste",to_go_west%,the_west%,neuter%,singular%,esperanto%,false
  data "uxesten",to_go_west%,the_west%,neuter%,singular%,esperanto%,false
  data "uxeston",to_go_west%,the_west%,neuter%,singular%,esperanto%,false
  data "x",to_list_exits%,no_entity%,0,0,esperanto%,false ' XXX TODO --
  data "ĉion",no_action%,the_all%,neuter%,singular%,esperanto%,true
  data "ŝalti",to_turn_on%,no_entity%,0,0,esperanto%,false
  data "ŝaltu",to_turn_on%,no_entity%,0,0,esperanto%,false
  data "ŝlosilon",no_action%,the_key%,neuter%,singular%,esperanto%,true
  data "ŝtrumpeton",no_action%,the_sock%,neuter%,singular%,esperanto%,true
  data "ŝuon",no_action%,the_shoe%,neuter%,singular%,esperanto%,true
  data "ŭ",to_go_west%,the_west%,neuter%,singular%,esperanto%,false
  data "ŭeste",to_go_west%,the_west%,neuter%,singular%,esperanto%,false
  data "ŭesten",to_go_west%,the_west%,neuter%,singular%,esperanto%,false
  data "ŭeston",to_go_west%,the_west%,neuter%,singular%,esperanto%,true

  ' ------------------------------------------
  ' Interlingue {{{2

  ' Ambiguous words
  '
  ' They must be defined first to make the parser find them first.

  data "coridor",no_action%,the_corridor_x%,neuter%,singular%,interlingue%,true
  data "externe",no_action%,the_outside_x%,neuter%,singular%,interlingue%,false
  data "flor-pot",no_action%,the_pot_x%,neuter%,singular%,interlingue%,true
  data "flor-pote",no_action%,the_pot_x%,neuter%,singular%,interlingue%,true
  data "florpot",no_action%,the_pot_x%,neuter%,singular%,interlingue%,false
  data "florpote",no_action%,the_pot_x%,neuter%,singular%,interlingue%,false
  data "mur",no_action%,the_wall_x%,neuter%,singular%,interlingue%,true
  data "mures",no_action%,the_wall_x%,neuter%,plural%,interlingue%,false
  data "paret",no_action%,the_wall_x%,neuter%,singular%,interlingue%,false
  data "parete",no_action%,the_wall_x%,neuter%,singular%,interlingue%,false
  data "paretes",no_action%,the_wall_x%,neuter%,plural%,interlingue%,false
  data "table",no_action%,the_table_x%,neuter%,singular%,interlingue%,true
  ' Unambiguous words

  data "#castellano",to_hash_use_spanish%,the_spanish_language%,0,0,interlingue%,false
  data "#debug",to_hash_debug%,no_entity%,0,0,interlingue%,false
  data "#drop",to_hash_drop%,no_entity%,0,0,interlingue%,false
  data "#eo",to_hash_use_esperanto%,the_esperanto_language%,0,0,interlingue%,false
  data "#epo",to_hash_use_esperanto%,the_esperanto_language%,0,0,interlingue%,false
  data "#es",to_hash_use_spanish%,the_spanish_language%,0,0,interlingue%,false
  data "#esp",to_hash_use_spanish%,the_spanish_language%,0,0,interlingue%,false
  data "#español",to_hash_use_spanish%,the_spanish_language%,0,0,interlingue%,false
  data "#esperanto",to_hash_use_esperanto%,the_esperanto_language%,0,0,interlingue%,false
  data "#go",to_hash_go%,no_entity%,0,0,interlingue%,false
  data "#ie",to_hash_use_interlingue%,the_interlingue_language%,0,0,interlingue%,false
  data "#ile",to_hash_use_interlingue%,the_interlingue_language%,0,0,interlingue%,false
  data "#input",to_hash_input%,no_entity%,0,0,interlingue%,false
  data "#interlingue",to_hash_use_interlingue%,the_interlingue_language%,0,0,interlingue%,false
  data "#langs",to_hash_langs%,no_entity%,0,0,interlingue%,false
  data "#locate",to_hash_locate%,no_entity%,0,0,interlingue%,false
  data "#output",to_hash_output%,no_entity%,0,0,interlingue%,false
  data "#take",to_hash_take%,no_entity%,0,0,interlingue%,false
  data "accende",to_turn_on%,no_entity%,0,0,interlingue%,false
  data "accender",to_turn_on%,no_entity%,0,0,interlingue%,false
  data "ad-exter",to_go_out%,the_outside%,0,0,interlingue%,false
  data "ad-exteriore",to_go_in%,the_inside%,0,0,interlingue%,false
  data "ad-externe",to_go_out%,the_outside%,0,0,interlingue%,false
  data "ad-interiore",to_go_in%,the_inside%,0,0,interlingue%,false
  data "ad-intra",to_go_in%,the_inside%,0,0,interlingue%,false
  data "ad-éxter",to_go_out%,the_outside%,0,0,interlingue%,false
  data "adexter",to_go_out%,the_outside%,0,0,interlingue%,false
  data "adexteriore",to_go_in%,the_inside%,0,0,interlingue%,false
  data "adexterne",to_go_out%,the_outside%,0,0,interlingue%,false
  data "adinteriore",to_go_in%,the_inside%,0,0,interlingue%,false
  data "adintra",to_go_in%,the_inside%,0,0,interlingue%,false
  data "adéxter",to_go_out%,the_outside%,0,0,interlingue%,false
  data "aperte",to_open%,no_entity%,0,0,interlingue%,false
  data "aperter",to_open%,no_entity%,0,0,interlingue%,false
  data "aula",no_action%,the_classroom%,neuter%,singular%,interlingue%,false
  data "biblioteca",no_action%,the_library%,neuter%,singular%,interlingue%,false
  data "brique",no_action%,the_brick%,neuter%,singular%,interlingue%,true
  data "capte",to_take%,no_entity%,0,0,interlingue%,false
  data "capter",to_take%,no_entity%,0,0,interlingue%,false
  data "clave",no_action%,the_key%,neuter%,singular%,interlingue%,true
  data "cocina",no_action%,the_kitchen%,neuter%,singular%,interlingue%,true
  data "cocineria",no_action%,the_kitchen%,neuter%,singular%,interlingue%,true
  data "cocinería",no_action%,the_kitchen%,neuter%,singular%,interlingue%,true
  data "conecta",to_turn_on%,no_entity%,0,0,interlingue%,false
  data "conectar",to_turn_on%,no_entity%,0,0,interlingue%,false
  data "crayon",no_action%,the_pencil%,neuter%,singular%,interlingue%,true
  data "demi-strump",no_action%,the_sock%,neuter%,singular%,interlingue%,false
  data "demi-strumpe",no_action%,the_sock%,neuter%,singular%,interlingue%,false
  data "demistrump",no_action%,the_sock%,neuter%,singular%,interlingue%,false
  data "demistrumpe",no_action%,the_sock%,neuter%,singular%,interlingue%,false
  data "demí-strump",no_action%,the_sock%,neuter%,singular%,interlingue%,true
  data "demí-strumpe",no_action%,the_sock%,neuter%,singular%,interlingue%,true
  data "demístrump",no_action%,the_sock%,neuter%,singular%,interlingue%,false
  data "demístrumpe",no_action%,the_sock%,neuter%,singular%,interlingue%,false
  data "depó",no_action%,the_junk_room%,neuter%,singular%,interlingue%,false
  data "ea",to_go%,no_entity%,0,0,interlingue%,false
  data "ear",to_go%,no_entity%,0,0,interlingue%,false
  data "escapa",to_go_out%,no_entity%,0,0,interlingue%,false
  data "escapar",to_go_out%,no_entity%,0,0,interlingue%,false
  data "ex",to_examine%,no_entity%,0,0,interlingue%,false
  data "ex-ea",to_go_out%,no_entity%,0,0,interlingue%,false
  data "ex-eada",to_list_exits%,the_exit%,neuter%,singular%,interlingue%,false
  data "ex-eadas",to_list_exits%,the_exit%,neuter%,plural%,interlingue%,false
  data "ex-ear",to_go_out%,no_entity%,0,0,interlingue%,false
  data "examina",to_examine%,no_entity%,0,0,interlingue%,false
  data "examina",to_examine%,no_entity%,0,0,interlingue%,false
  data "examinar",to_examine%,no_entity%,0,0,interlingue%,false
  data "examinar",to_examine%,no_entity%,0,0,interlingue%,false
  data "exea",to_go_out%,no_entity%,0,0,interlingue%,false
  data "exear",to_go_out%,no_entity%,0,0,interlingue%,false
  data "exteriore",no_action%,the_inside%,0,0,interlingue%,false
  data "externe",no_action%,the_outside%,0,0,interlingue%,false
  data "extinte",to_turn_off%,no_entity%,0,0,interlingue%,false
  data "extinter",to_turn_off%,no_entity%,0,0,interlingue%,false
  data "fa",to_do%,no_entity%,0,0,interlingue%,false
  data "far",to_do%,no_entity%,0,0,interlingue%,false
  data "flor-pote",no_action%,the_pot_0%,neuter%,singular%,interlingue%,true
  data "flor-pote",no_action%,the_pot_1%,neuter%,singular%,interlingue%,true
  data "flor-pote",no_action%,the_pot_2%,neuter%,singular%,interlingue%,true
  data "flor-pote",no_action%,the_pot_3%,neuter%,singular%,interlingue%,true
  data "florpote",no_action%,the_pot_0%,neuter%,singular%,interlingue%,false
  data "florpote",no_action%,the_pot_1%,neuter%,singular%,interlingue%,false
  data "florpote",no_action%,the_pot_2%,neuter%,singular%,interlingue%,false
  data "florpote",no_action%,the_pot_3%,neuter%,singular%,interlingue%,false
  data "folio",no_action%,the_paper_sheet%,neuter%,singular%,interlingue%,true
  data "for-curre",to_go_out%,no_entity%,0,0,interlingue%,false
  data "for-currer",to_go_out%,no_entity%,0,0,interlingue%,false
  data "forcurre",to_go_out%,no_entity%,0,0,interlingue%,false
  data "forcurrer",to_go_out%,no_entity%,0,0,interlingue%,false
  data "fugi",to_go_out%,no_entity%,0,0,interlingue%,false
  data "fugir",to_go_out%,no_entity%,0,0,interlingue%,false
  data "garda-moné",no_action%,the_safe%,neuter%,singular%,interlingue%,false
  data "gardamoné",no_action%,the_safe%,neuter%,singular%,interlingue%,false
  data "gardero",no_action%,the_guard%,neuter%,singular%,interlingue%,false
  data "globul-crayon",no_action%,the_ballpen%,neuter%,singular%,interlingue%,false
  data "globul-pen",no_action%,the_ballpen%,neuter%,singular%,interlingue%,true
  data "globulcrayon",no_action%,the_ballpen%,neuter%,singular%,interlingue%,false
  data "globulpen",no_action%,the_ballpen%,neuter%,singular%,interlingue%,false
  data "hall",no_action%,the_reception%,neuter%,singular%,interlingue%,false
  data "i",to_inventory%,the_inventory%,neuter%,singular%,interlingue%,false
  data "in-ea",to_go_in%,no_entity%,0,0,interlingue%,false
  data "in-ear",to_go_in%,no_entity%,0,0,interlingue%,false
  data "inea",to_go_in%,no_entity%,0,0,interlingue%,false
  data "inear",to_go_in%,no_entity%,0,0,interlingue%,false
  data "inspecte",to_examine%,no_entity%,0,0,interlingue%,false
  data "inspecter",to_examine%,no_entity%,0,0,interlingue%,false
  data "interiore",no_action%,the_inside%,0,0,interlingue%,false
  data "intra",to_go_in%,the_inside%,0,0,interlingue%,false
  data "intrar",to_go_in%,no_entity%,0,0,interlingue%,false
  data "inventaria",to_inventory%,no_entity%,0,0,interlingue%,false
  data "inventariar",to_inventory%,no_entity%,0,0,interlingue%,false
  data "inventarie",to_inventory%,the_inventory%,neuter%,singular%,interlingue%,true
  data "jetta",to_drop%,no_entity%,0,0,interlingue%,false
  data "jettar",to_drop%,no_entity%,0,0,interlingue%,false
  data "lansa",to_drop%,no_entity%,0,0,interlingue%,false
  data "lansar",to_drop%,no_entity%,0,0,interlingue%,false
  data "lee",to_read%,no_entity%,0,0,interlingue%,false
  data "leer",to_read%,no_entity%,0,0,interlingue%,false
  data "libre",no_action%,the_book%,neuter%,singular%,interlingue%,true
  data "moné-scaf",no_action%,the_safe%,neuter%,singular%,interlingue%,true
  data "monéscaf",no_action%,the_safe%,neuter%,singular%,interlingue%,false
  data "mur",no_action%,the_wall_0%,neuter%,singular%,interlingue%,true
  data "mur",no_action%,the_wall_1%,neuter%,singular%,interlingue%,true
  data "mur",no_action%,the_wall_2%,neuter%,singular%,interlingue%,true
  data "mur",no_action%,the_wall_3%,neuter%,singular%,interlingue%,true
  data "n",to_go_north%,the_north%,neuter%,singular%,interlingue%,false
  data "ne",no_action%,the_no%,0,0,interlingue%,false
  data "no",no_action%,the_no%,0,0,interlingue%,false
  data "nord",to_go_north%,the_north%,neuter%,singular%,interlingue%,true
  data "observa",to_look%,no_entity%,0,0,interlingue%,false
  data "observar",to_look%,no_entity%,0,0,interlingue%,false
  data "occidente",to_go_west%,the_west%,neuter%,singular%,interlingue%,false
  data "oficie",no_action%,the_office%,neuter%,singular%,interlingue%,false
  data "omni",no_action%,the_all%,neuter%,singular%,interlingue%,false
  data "omnicós",no_action%,the_all%,neuter%,singular%,interlingue%,true
  data "oriente",to_go_east%,the_east%,neuter%,singular%,interlingue%,false
  data "ost",to_go_east%,the_east%,neuter%,singular%,interlingue%,true
  data "paper-fragment",no_action%,the_paper_piece%,neuter%,singular%,interlingue%,false
  data "paper-pezze",no_action%,the_paper_piece%,neuter%,singular%,interlingue%,true
  data "papere",no_action%,the_paper_sheet%,neuter%,singular%,interlingue%,true
  data "paperette",no_action%,the_paper_piece%,neuter%,singular%,interlingue%,false
  data "paperfragment",no_action%,the_paper_piece%,neuter%,singular%,interlingue%,false
  data "paperpezze",no_action%,the_paper_piece%,neuter%,singular%,interlingue%,false
  data "porta",no_action%,the_door%,neuter%,singular%,interlingue%,true
  data "prende",to_take%,no_entity%,0,0,interlingue%,false
  data "prender",to_take%,no_entity%,0,0,interlingue%,false
  data "r",to_look%,no_entity%,0,0,interlingue%,false
  data "regarda",to_look%,no_entity%,0,0,interlingue%,false
  data "regardar",to_look%,no_entity%,0,0,interlingue%,false
  data "retro-ea",to_go_out%,no_entity%,0,0,interlingue%,false
  data "retro-ear",to_go_out%,no_entity%,0,0,interlingue%,false
  data "retroea",to_go_out%,no_entity%,0,0,interlingue%,false
  data "retroear",to_go_out%,no_entity%,0,0,interlingue%,false
  data "s",to_go_south%,the_south%,neuter%,singular%,interlingue%,false
  data "sapate",no_action%,the_shoe%,neuter%,singular%,interlingue%,true
  data "sercha",to_examine%,no_entity%,0,0,interlingue%,false
  data "serchar",to_examine%,no_entity%,0,0,interlingue%,false
  data "specta",to_look%,no_entity%,0,0,interlingue%,false
  data "spectar",to_look%,no_entity%,0,0,interlingue%,false
  data "strumpette",no_action%,the_sock%,neuter%,singular%,interlingue%,true
  data "sude",to_go_south%,the_south%,neuter%,singular%,interlingue%,true
  data "surti",to_go_out%,no_entity%,0,0,interlingue%,false
  data "surtida",to_list_exits%,the_exit%,neuter%,singular%,interlingue%,false
  data "surtidas",to_list_exits%,the_exit%,neuter%,plural%,interlingue%,false
  data "surtir",to_go_out%,no_entity%,0,0,interlingue%,false
  data "table",no_action%,the_dining_room_tables%,neuter%,singular%,interlingue%,false
  data "tables",no_action%,the_dining_room_tables%,neuter%,plural%,interlingue%,true
  data "tasca-lamp",no_action%,the_flashlight%,neuter%,singular%,interlingue%,true
  data "tasca-lampe",no_action%,the_flashlight%,neuter%,singular%,interlingue%,true
  data "tascalamp",no_action%,the_flashlight%,neuter%,singular%,interlingue%,false
  data "tascalampe",no_action%,the_flashlight%,neuter%,singular%,interlingue%,false
  data "toilette",no_action%,the_bathroom%,neuter%,singular%,interlingue%,false
  data "tot",no_action%,the_all%,neuter%,singular%,interlingue%,false
  data "viagea",to_go%,no_entity%,0,0,interlingue%,false
  data "viagear",to_go%,no_entity%,0,0,interlingue%,false
  data "w",to_go_west%,the_west%,neuter%,singular%,interlingue%,false
  data "west",to_go_west%,the_west%,neuter%,singular%,interlingue%,true
  data "x",to_list_exits%,no_entity%,0,0,interlingue%,false ' XXX TODO --
  data "yes",no_action%,the_yes%,0,0,interlingue%,false

  ' ------------------------------------------
  ' Spanish {{{2

  ' Ambiguous words
  '
  ' They must be defined first to make the parser find them
  ' first.

  data "corredor",no_action%,the_corridor_x%,masculine%,singular%,spanish%,true
  data "exterior",no_action%,the_outside_x%,masculine%,singular%,spanish%,true
  data "exteriores",no_action%,the_outside_x%,masculine%,plural%,spanish%,true
  data "maceta",no_action%,the_pot_x%,masculine%,singular%,spanish%,true
  data "mesa",no_action%,the_table_x%,feminine%,singular%,spanish%,true
  data "muro",no_action%,the_wall_x%,masculine%,singular%,spanish%,true
  data "muros",no_action%,the_wall_x%,masculine%,plural%,spanish%,false
  data "pared",no_action%,the_wall_x%,feminine%,singular%,spanish%,false
  data "paredes",no_action%,the_wall_x%,feminine%,plural%,spanish%,false
  data "pasillo",no_action%,the_corridor_x%,masculine%,singular%,spanish%,true
  data "tiesto",no_action%,the_pot_x%,masculine%,singular%,spanish%,false

  ' Unambiguous words

  data "#castellano",to_hash_use_spanish%,the_spanish_language%,0,0,spanish%,false
  data "#debug",to_hash_debug%,no_entity%,0,0,spanish%,false
  data "#drop",to_hash_drop%,no_entity%,0,0,spanish%,false
  data "#eo",to_hash_use_esperanto%,the_esperanto_language%,0,0,spanish%,false
  data "#epo",to_hash_use_esperanto%,the_esperanto_language%,0,0,spanish%,false
  data "#es",to_hash_use_spanish%,the_spanish_language%,0,0,spanish%,false
  data "#esp",to_hash_use_spanish%,the_spanish_language%,0,0,spanish%,false
  data "#español",to_hash_use_spanish%,the_spanish_language%,0,0,spanish%,false
  data "#esperanto",to_hash_use_esperanto%,the_esperanto_language%,0,0,spanish%,false
  data "#go",to_hash_go%,no_entity%,0,0,spanish%,false
  data "#ie",to_hash_use_interlingue%,the_interlingue_language%,0,0,spanish%,false
  data "#ile",to_hash_use_interlingue%,the_interlingue_language%,0,0,spanish%,false
  data "#input",to_hash_input%,no_entity%,0,0,spanish%,false
  data "#interlingue",to_hash_use_interlingue%,the_interlingue_language%,0,0,spanish%,false
  data "#langs",to_hash_langs%,no_entity%,0,0,spanish%,false
  data "#locate",to_hash_locate%,no_entity%,0,0,spanish%,false
  data "#output",to_hash_output%,no_entity%,0,0,spanish%,false
  data "#take",to_hash_take%,no_entity%,0,0,spanish%,false
  data "abre",to_open%,no_entity%,0,0,spanish%,false
  data "abrir",to_open%,no_entity%,0,0,spanish%,false
  data "adentro",to_go_in%,the_inside%,0,0,spanish%,false
  data "afuera",to_go_out%,the_outside%,0,0,spanish%,false
  data "apaga",to_turn_off%,no_entity%,0,0,spanish%,false
  data "apagar",to_turn_off%,no_entity%,0,0,spanish%,false
  data "aseo",no_action%,the_bathroom%,masculine%,singular%,spanish%,false
  data "aseos",no_action%,the_bathroom%,masculine%,plural%,spanish%,false
  data "aula",no_action%,the_classroom%,masculine%,singular%,spanish%,false
  data "baño",no_action%,the_bathroom%,masculine%,singular%,spanish%,false
  data "baños",no_action%,the_bathroom%,masculine%,plural%,spanish%,false
  data "biblioteca",no_action%,the_library%,feminine%,singular%,spanish%,false
  data "boli",no_action%,the_ballpen%,masculine%,singular%,spanish%,false
  data "bolígrafo",no_action%,the_ballpen%,masculine%,singular%,spanish%,true
  data "caja",no_action%,the_safe%,feminine%,singular%,spanish%,false
  data "calcetín",no_action%,the_sock%,masculine%,singular%,spanish%,true
  data "clase",no_action%,the_classroom%,feminine%,singular%,spanish%,false
  data "cocina",no_action%,the_kitchen%,feminine%,singular%,spanish%,false
  data "coge",to_take%,no_entity%,0,0,spanish%,false
  data "coger",to_take%,no_entity%,0,0,spanish%,false
  data "conecta",to_turn_on%,no_entity%,0,0,spanish%,false
  data "conectar",to_turn_on%,no_entity%,0,0,spanish%,false
  data "deja",to_drop%,no_entity%,0,0,spanish%,false
  data "dejar",to_drop%,no_entity%,0,0,spanish%,false
  data "dentro",to_go_in%,the_inside%,0,0,spanish%,false
  data "despacho",no_action%,the_office%,masculine%,singular%,spanish%,false
  data "dirigirse",to_go%,no_entity%,0,0,spanish%,false
  data "dirigirte",to_go%,no_entity%,0,0,spanish%,false
  data "dirígete",to_go%,no_entity%,0,0,spanish%,false
  data "e",to_go_east%,the_east%,masculine%,singular%,spanish%,false
  data "encaminarse",to_go%,no_entity%,0,0,spanish%,false
  data "encaminarte",to_go%,no_entity%,0,0,spanish%,false
  data "encamínate",to_go%,no_entity%,0,0,spanish%,false
  data "encender",to_turn_on%,no_entity%,0,0,spanish%,false
  data "enciende",to_turn_on%,no_entity%,0,0,spanish%,false
  data "entra",to_go_in%,no_entity%,0,0,spanish%,false
  data "entrar",to_go_in%,no_entity%,0,0,spanish%,false
  data "escapa",to_go_out%,no_entity%,0,0,spanish%,false
  data "escapar",to_go_out%,no_entity%,0,0,spanish%,false
  data "este",to_go_east%,the_east%,masculine%,singular%,spanish%,true
  data "ex",to_examine%,no_entity%,0,0,spanish%,false
  data "examina",to_examine%,no_entity%,0,0,spanish%,false
  data "examinar",to_examine%,no_entity%,0,0,spanish%,false
  data "excusado",no_action%,the_bathroom%,masculine%,singular%,spanish%,false
  data "folio",no_action%,the_paper_sheet%,masculine%,singular%,spanish%,false
  data "fuera",to_go_out%,the_outside%,0,0,spanish%,false
  data "guarda",no_action%,the_guard%,masculine%,singular%,spanish%,true
  data "guardia",no_action%,the_guard%,masculine%,singular%,spanish%,false
  data "hacer",to_do%,no_entity%,0,0,spanish%,false
  data "haz",to_do%,no_entity%,0,0,spanish%,false
  data "huir",to_go_out%,no_entity%,0,0,spanish%,false
  data "huye",to_go_out%,no_entity%,0,0,spanish%,false
  data "i",to_inventory%,the_inventory%,masculine%,singular%,spanish%,false
  data "inspecciona",to_examine%,no_entity%,0,0,spanish%,false
  data "inspeccionar",to_examine%,no_entity%,0,0,spanish%,false
  data "inventariar",to_inventory%,no_entity%,0,0,spanish%,false
  data "inventario",to_inventory%,the_inventory%,masculine%,singular%,spanish%,true
  data "inventaría",to_inventory%,no_entity%,0,0,spanish%,false
  data "ir",to_go%,no_entity%,0,0,spanish%,false
  data "irse",to_go%,no_entity%,0,0,spanish%,false
  data "ladrillo",no_action%,the_brick%,masculine%,singular%,spanish%,true
  data "lapicero",no_action%,the_pencil%,masculine%,singular%,spanish%,false
  data "largarse",to_go%,no_entity%,0,0,spanish%,false
  data "lee",to_read%,no_entity%,0,0,spanish%,false
  data "leer",to_read%,no_entity%,0,0,spanish%,false
  data "libro",no_action%,the_book%,masculine%,singular%,spanish%,true
  data "linterna",no_action%,the_flashlight%,feminine%,singular%,spanish%,true
  data "llave",no_action%,the_key%,feminine%,singular%,spanish%,true
  data "lápiz",no_action%,the_pencil%,masculine%,singular%,spanish%,true
  data "largarse",to_go%,no_entity%,0,0,spanish%,false
  data "largarte",to_go%,no_entity%,0,0,spanish%,false
  data "lárgate",to_go%,no_entity%,0,0,spanish%,false
  data "m",to_look%,no_entity%,0,0,spanish%,false
  data "marcha",to_go%,no_entity%,0,0,spanish%,false
  data "marchar",to_go%,no_entity%,0,0,spanish%,false
  data "marcharse",to_go%,no_entity%,0,0,spanish%,false
  data "marcharte",to_go%,no_entity%,0,0,spanish%,false
  data "mesa",no_action%,the_dining_room_tables%,feminine%,singular%,spanish%,false
  data "mesas",no_action%,the_dining_room_tables%,feminine%,plural%,spanish%,true
  data "mira",to_look%,no_entity%,0,0,spanish%,false
  data "mirar",to_look%,no_entity%,0,0,spanish%,false
  data "muro",no_action%,the_wall_0%,masculine%,singular%,spanish%,true
  data "muro",no_action%,the_wall_1%,masculine%,singular%,spanish%,true
  data "muro",no_action%,the_wall_2%,masculine%,singular%,spanish%,true
  data "muro",no_action%,the_wall_3%,masculine%,singular%,spanish%,true
  data "márchate",to_go%,no_entity%,0,0,spanish%,false
  data "n",to_go_north%,the_north%,masculine%,singular%,spanish%,false
  data "no",no_action%,the_no%,0,0,spanish%,false
  data "norte",to_go_north%,the_north%,masculine%,singular%,spanish%,true
  data "o",to_go_west%,the_west%,masculine%,singular%,spanish%,false
  data "observa",to_look%,no_entity%,0,0,spanish%,false
  data "observar",to_look%,no_entity%,0,0,spanish%,false
  data "oeste",to_go_west%,the_west%,masculine%,singular%,spanish%,true
  data "papel",no_action%,the_paper_sheet%,masculine%,singular%,spanish%,true
  data "papelito",no_action%,the_paper_piece%,masculine%,singular%,spanish%,true
  data "puerta",no_action%,the_door%,feminine%,singular%,spanish%,true
  data "recepción",no_action%,the_reception%,feminine%,singular%,spanish%,true
  data "recoge",to_take%,no_entity%,0,0,spanish%,false
  data "recoger",to_take%,no_entity%,0,0,spanish%,false
  data "registra",to_examine%,no_entity%,0,0,spanish%,false
  data "registrar",to_examine%,no_entity%,0,0,spanish%,false
  data "retrete",no_action%,the_bathroom%,masculine%,singular%,spanish%,false
  data "s",to_go_south%,the_south%,masculine%,singular%,spanish%,false
  data "sal",to_go_out%,no_entity%,0,0,spanish%,false
  data "salida",to_list_exits%,the_exit%,feminine%,singular%,spanish%,false
  data "salidas",to_list_exits%,the_exit%,feminine%,plural%,spanish%,true
  data "salir",to_go_out%,no_entity%,0,0,spanish%,false
  data "servicio",no_action%,the_bathroom%,masculine%,singular%,spanish%,false
  data "servicios",no_action%,the_bathroom%,masculine%,plural%,spanish%,false
  data "soltar",to_drop%,no_entity%,0,0,spanish%,false
  data "suelta",to_drop%,no_entity%,0,0,spanish%,false
  data "sur",to_go_south%,the_south%,masculine%,singular%,spanish%,true
  data "sí",no_action%,the_yes%,0,0,spanish%,false
  data "tiesto",no_action%,the_pot_0%,masculine%,singular%,spanish%,true
  data "tiesto",no_action%,the_pot_1%,masculine%,singular%,spanish%,true
  data "tiesto",no_action%,the_pot_2%,masculine%,singular%,spanish%,true
  data "tiesto",no_action%,the_pot_3%,masculine%,singular%,spanish%,true
  data "tira",to_drop%,no_entity%,0,0,spanish%,false
  data "tirar",to_drop%,no_entity%,0,0,spanish%,false
  data "todo",no_action%,the_all%,masculine%,singular%,spanish%,false
  data "toma",to_take%,no_entity%,0,0,spanish%,false
  data "tomar",to_take%,no_entity%,0,0,spanish%,false
  data "trastero",no_action%,the_junk_room%,masculine%,singular%,spanish%,false
  data "ve",to_go%,no_entity%,0,0,spanish%,false
  data "vete",to_go%,no_entity%,0,0,spanish%,false
  data "vigilante",no_action%,the_guard%,masculine%,singular%,spanish%,false
  data "x",to_list_exits%,no_entity%,0,0,spanish%,false
  data "zapato",no_action%,the_shoe%,masculine%,singular%,spanish%,true

  data "",0,0,0,0,0,0 ' end of data

end sub

' ==============================================================
' Data interface {{{1

sub entity_article(this_entity%)
  ' Proper article$ for an entity, with a trailing space; or an empty
  ' string.
  local proper_article$

  debug("in entity_article("+str$(this_entity%)+")")
  debug("article_type= "+str$(article_type%(this_entity%)))
  debug("gender= "+str$(gender%(this_entity%,output_language%)))
  debug("number= "+str$(number%(this_entity%,output_language%)))
  debug("output_language%= "+str$(output_language%))
  if article_type%(this_entity%)=no_article% then
    return ""
  else
    let proper_article$=article$(article_type%(this_entity%),gender%(this_entity%,output_language%),number%(this_entity%,output_language%),output_language%)
    if len(proper_article$) then
      return proper_article$+" "
    else
      return ""
    end if
  end if
end sub

sub entity_word(this_entity%)

  ' The word associated with an entity.

  local word_number%

  let word_number%=name_word%(this_entity%,output_language%)

  debug("in entity_word("+str$(this_entity%)+"):")
  debug("name_word%("+str$(this_entity%)+","+str$(output_language%)+")=")
  debug(str$(name_word%(this_entity%,output_language%)))

  if word_number% then
    debug("='"+word$(word_number%)+"'")
    retturn word$(name_word%(this_entity%,output_language%))
  else
    debug("=''")
    return ""
  end if
end sub

sub name(this_entity%)

  local this_entity_word$,this_entity_long_name$

  debug("in name("+str$(this_entity%)+")")

  let this_entity_long_name$=long_name$(this_entity%,output_language%)

  if len(this_entity_long_name$) then
    if output_language%=esperanto% then
      ' Remove the accusative position marks from the long name.
      debug("remove '*' from long name")
      let this_entity_long_name$=replaced(this_entity_long_name$,"*","")
    end if
    debug("return long name: "+this_entity_long_name$)
    return this_entity_long_name$
  else
    let this_entity_word$=entity_word(this_entity%)
    if output_language%=esperanto% then
      ' Remove the accusative ending from the vocabulary word.
      debug("remove accusative '-n' from '"+this_entity_word$+"'")
      let this_entity_word$=left$(this_entity_word$,len(this_entity_word$)-1)
    end if
    debug("return article$ and word: "+entity_article(this_entity%)+this_entity_word$)
    return entity_article(this_entity%)+this_entity_word$
  end if
end sub

sub name_in_accusative(this_entity%)

  local this_entity_word$,this_entity_long_name$

  debug("in name_in_accusative("+str$(this_entity%)+")")

  let this_entity_word$=entity_word(this_entity%)
  let this_entity_long_name$=long_name$(this_entity%,output_language%)

  if len(long_name$(this_entity%,output_language%)) then
    if output_language%=esperanto% then
      ' Add the accusative ending to the long name.
      debug("replace '*' with 'n' in long name")
      let this_entity_long_name$=replaced(this_entity_long_name$,"*","n")
    end if
    debug("return long name: "+this_entity_long_name$)
    return this_entity_long_name$
  else
    debug("return article$ and word: "+entity_article(this_entity%)+this_entity_word$)
    return entity_article(this_entity%)+this_entity_word$
  end if
endsub

sub is_around_here(this_entity%)
  ' Is an entity around here?
  return are_adjacent(location%(this_entity%),location%(the_protagonist%))
end sub

sub is_already_visited(this_entity%)
  ' Is the given location already visited by the protagonist?
  return visits%(this_entity%)>1
end sub

sub is_first_visit(this_entity%)
  ' Is it the protagonist's first visit to the given location?
  return visits%(this_entity%)=1
end sub

sub long_location_description(this_entity%)
  ' Show the long location description?
  return is_first_visit(this_entity%) or action%=to_look% or action%=to_examine%
end sub

sub is_carried(this_entity%)
  return the_protagonist%=location%(this_entity%)
end sub

sub is_not_carried(this_entity%)
  return the_protagonist%<>location%(this_entity%)
end sub

sub be_here(this_entity%)
  let location%(this_entity%)=location%(the_protagonist%)
end sub

sub is_here(this_entity%)
  return location%(the_protagonist%)=location%(this_entity%)
end sub

sub is_not_here(this_entity%)
  return location%(the_protagonist%)<>location%(this_entity%)
end sub

sub is_locked(this_entity%)
  ' Is the given entity marked as locked?
  return this_entity%<0
end sub

sub locked(this_entity%)
  ' Return the given location identifier, transformed to
  ' locked.  This is used in the map.
  return -abs(this_entity%)
end sub

sub unlocked(this_entity%)
  ' Return the given location identifier, transformed to
  ' unlocked.  This is used in the map.
  return abs(this_entity%)
end sub

sub is_pot(this_entity%)
  return this_entity%>=the_pot_0% and this_entity%<=the_pot_3%
end sub

sub be_known(this_entity%)
  if article_type%(this_entity%)<>possesive% then
    let article_type%(this_entity%)=definite%
  end if
end sub

sub is_readable(this_entity%)
  return this_entity%=the_paper_sheet% or this_entity%=the_paper_piece%
end sub

sub is_not_readable(this_entity%)
  return not is_readable(this_entity%)
end sub

sub is_not_visible(this_entity%)
  return is_not_carried(this_entity%) and is_not_here(this_entity%)
end sub

sub is_direction(this_entity%)
  return this_entity%>=the_north% and this_entity%<=the_outside%
end sub

sub is_cardinal_point(this_entity%)
  return this_entity%>=first_cardinal_point and this_entity%<=last_cardinal_point%
end sub

sub carried_entities

  ' Return the number of entities carried by the protagonist and
  ' fill the array `carried_entity%` with all of them.
  '
  ' XXX TODO -- Replace with `entities_carried_by` and make the
  ' carrier a parameter.

  local count%,this_entity%

  debug("entities range in carried_entities= "+str$(first_thing_entity%)+".."+str$(last_thing_entity%))
  for this_entity%=first_thing_entity% to last_thing_entity%
    if is_carried(this_entity%) then
      let carried_entity%(count%)=this_entity%
      let count%=count%+1
    end if
  next this_entity%

  return count%
end sub

sub is_corridor(this_entity%)
  ' Is location _this_entity_ a corridor?
  return this_entity%>=the_corridor_0% and this_entity%<=the_corridor_2%
end sub

sub is_outside(this_entity%)

  ' Is location _entity_ outside the building?

  select this_entity%
    case the_outside_0%
      return true
    case the_outside_1%
      return true
    case the_outside_2%
      return true
    case the_outside_3%
      return true
    case else          
      return false
  end select

end sub

sub are_adjacent(entity1%,entity2%)

  ' Are locations _entity1_ and _entity2_ adjacent, i.e. are
  ' they connected?

  return direction(entity1%,entity2%) or direction(entity2%,entity1%)
end sub

sub direction(entity1%,entity2%)

  ' Return the entity identifier of the direction that leads
  ' from location _entity1_ to location _entity2_. If no
  ' direction connects them, return zero.

  local this_direction%

  for this_direction%=first_direction to last_direction%
    if exit_location%(entity1%,this_direction%)=entity2% then
      return this_direction%
      exit sub
    end if
  next this_direction%
  return 0
end sub

sub opposite_direction(this_direction%)

  select this_direction%
    case the_north%
      return the_south%
    case the_south%
      return the_north%
    case the_west%
      return the_east%
    case the_east%
      return the_west%
    case the_outside%
      return the_inside%
    case the_inside%
      return the_outside%
  end select
end sub

' ==============================================================
' Main {{{1

sub main

  do
    wt_clear
    credits
    language_menu
    intro
    game
    if game_over then
      the_end
    end if
  loop

end sub

' ==============================================================
' Game loop {{{1

sub game

  init_game
  enter_location

  do
    if parsed(user_input) then
      obey(action%,complement%)
    end if
    global_plot
  loop until game_over

end sub

sub game_over

  ' XXX TODO --

  return banished% or success
end sub

sub success

  if not is_outside(location%(the_protagonist%)) then return false
  if not exam_copied%                               then return false ' XXX old
  if not marks_modified                             then return false ' XXX old
  if not is_carried(the_paper_sheet%)            then return false else return true
end sub

' ==============================================================
' Input {{{1

sub user_input

  local txt$
  wt_cr
  line input "> " txt$
  return txt$
end sub

sub text_pause

  local void%
  wt_cr
  wt_type(pause_prompt$)
  wt_cr
  void%=inkey(pause_centiseconds%)

end sub

' ==============================================================
' Errors {{{1

sub not_carried_error(this_entity%)
  select output_language%
    case esperanto%
      wt_type_para("Vi ne havas")
    case interlingue%
      wt_type_para("Vu ne have")
    case spanish%
      wt_type_para("No tienes")
  end select
  wt_type(name_in_accusative(this_entity%)+".")
end sub

sub dunno_error
  select output_language%
    ' XXX TODO -- Use interjections in Esperanto and Interlingue.
    case esperanto%
      wt_type_para("Kio?")
    case interlingue%
      wt_type_para("Quo?")
    case spanish%
      wt_type_para("¿Eh?")
  end select
end sub

sub darkness_error
  select output_language%
    case esperanto%
      wt_type_para("La mallumo ne permesas tion al vi.")
    case interlingue%
      wt_type_para("Li obscuritá ne permisse to a vos.")
    case spanish%
      wt_type_para("La oscuridad no te lo permite.")
  end select
end sub

sub not_seen_here_error(this_entity%)
  select output_language%
    case esperanto%
      wt_type_para("Vi ne vidas "+name_in_accusative(this_entity%)+" ĉi tie.")
    case interlingue%
      wt_type_para("Vu ne vide "+name_in_accusative(this_entity%)+" ci.")
    case spanish%
      wt_type_para("No ves "+name_in_accusative(this_entity%)+" aquí.")
  end select
end sub

sub you_are_not_there_error(this_entity%)
  select output_language%
    case esperanto%
      wt_type_para("Vi ne estas en "+name(this_entity%)+".")
    case interlingue%
      wt_type_para("Vu ne sta in "+name(this_entity%)+".")
    case spanish%
      wt_type_para("No estás en "+name(this_entity%)+".")
  end select
end sub

' ==============================================================
' Parser {{{1

sub parsed(command$)

  ' Parse the given command, updating the variables `action%`
  ' and `complement%`, and returning a result code: _true_ if
  ' the parsing was successful, _false_ if an error was thrown
  ' during the process.

  local valid_command%,command_words%,split_command$()

  let valid_command%=true
  dim split_command$(100) ' XXX TODO -- size

  command_words%=split(command$," ",split_command$())

  let action%=no_action%
  let complement%=no_entity%

  parse_command

  if action% then
    debug("action%= "+str$(action%))
  end if

  if complement% then
    debug("complement%= "+str$(complement%)+"("+name(complement%)+")")
  end if

  select complement%

    case the_corridor_x%
      let complement%=unambiguous_corridor_x
    case the_outside_x%
      let complement%=unambiguous_outside_x
    case the_pot_x%
      let complement%=unambiguous_pot_x
    case the_table_x%
      let complement%=unambiguous_table_x
    case the_wall_x%
      let complement%=unambiguous_wall_x

  end select

  if complement% then
    debug("complement%= "+str$(complement%)+"("+name(complement%)+")")
  end if

  if action%=no_action% then
    debug("no action found")
    dunno_error
    let valid_command%=false
  end if

  debug("parse returns: "+str$(valid_command%))
  return valid_command%
end sub

sub parse_command

  ' XXX TODO -- pass the command words array as a parameter

  local word%

  for word%=0 to words%-1
    debug("searching the words of language #"+str$(input_language%)+" for '"+split_command$(word%)+"'")
    parse_word(split_command$(word%))
  next word%

end sub

sub parse_word(word$)

  local word%

  for word%=1 to words%
    debug("word%="+str$(word%))

    if word_language%(word%)=input_language% then
      debug(str$(word%)+": "+word$(word%))

      if word$=word$(word%) then
        debug("found '"+word$(word%)+"'")

        if action%=no_action% then

          debug("no action was found yet")
          if word_action%(word%) then
            debug("'"+word$(word%)+"' is the action")
            let action%=word_action%(word%)
          else
            if word_entity%(word%) then
              if complement%=no_entity% then
                debug("'"+word$(word%)+"' is the complement")
                let complement%=word_entity%(word%)
                endproc
              else
                ' Second complement found.
                if complement%<>word_entity%(word%) then
                  debug("error: two complements")
                  debug("previous complement= "+str$(complement%)+"("+name(complement%)+")")
                  dunno_error
                  let valid_command%=false
                  endproc
                end if
              end if
            end if
          end if

        else

          debug("there's an action already: "+str$(action%))
          if word_entity%(word%) then
            debug(word$(word%)+" is a noun")
            if complement%=no_entity% then
              debug(word$(word%)+" is the complement")
              let complement%=word_entity%(word%)
              endproc
            else
              ' Second complement found.
              if complement%<>word_entity%(word%) then
                debug("error: two complements")
                debug("previous complement = "+str$(complement%)+"("+name(complement%)+")")
                dunno_error ' two complements in the command
                let valid_command%=false
                endproc
              end if
            end if
          else
            if word_action%(word%) then
              ' Second action found.
              if action%<>word_action%(word%) then
                debug("error: two actions")
                dunno_error ' two actions in the command
                let valid_command%=false
                endproc
              end if
            end if
          end if

        end if

      end if

    end if

  next word%

end sub

sub unambiguous_corridor_x

  ' Make 'the_corridor_x%' unambiguous

  local corridor%

  select location%(the_protagonist%)
    case the_bathroom%
      let corridor%=the_corridor_0%
    case the_class
      let corridor%=the_corridor_1%
    case the_corridor_0%
      let corridor%=the_corridor_0%
    case the_corridor_1%
      let corridor%=the_corridor_1%
    case the_corridor_2%
      let corridor%=the_corridor_2%
    case the_dining_room%
      let corridor%=the_corridor_2%
    case the_junk_room%
      let corridor%=the_corridor_2%
    case the_library%
      let corridor%=the_corridor_1%
    case the_reception%
      let corridor%=the_corridor_0%
    case else
      let corridor%=last_corridor%
  end select

  let last_corridor%=corridor%
  return corridor%
end sub

sub unambiguous_outside_x

  ' Make 'the_outside_x%' unambiguous

  ' XXX TODO -- Complete.

  local outside%

  select location%(the_protagonist%)
    case the_reception%
      let outside%=the_outside_0%
    case the_outside_0%
      let outside%=the_outside_0%
    case the_outside_1%
      let outside%=the_outside_1%
    case the_outside_2%
      let outside%=the_outside_2%
    case the_outside_3%
      let outside%=the_outside_3%
    case else
      let outside%=last_outside%
  end select

  let last_outside%=outside%
  return outside%
end sub

sub unambiguous_pot_x

  ' Make 'the_pot_x%' unambiguous

  local pot%

  select location%(the_protagonist%)
    case the_outside_0%
      let pot%=the_pot_0%
    case the_outside_1%
      let pot%=the_pot_1%
    case the_outside_2%
      let pot%=the_pot_2%
    case the_outside_3%
      let pot%=the_pot_3%
    case else
      let pot%=last_pot%
  end select

  let last_pot%=pot%
  return pot%
end sub

sub unambiguous_table_x

  ' Make 'the_table_x%' unambiguous

  ' XXX TODO --
  return  the_dining_room_tables%
end sub
  ' if location%(the_protagonist%)=the_dining_room% then
  '   = the_dining_room_tables%
  ' else
  '   = the_living_table
  ' end if

sub unambiguous_wall_x

  ' Make 'the_wall_x%' unambiguous

  select location%(the_protagonist%)
    case the_outside_0%
      return the_wall_0%
    case the_outside_1%
      return the_wall_1%
    case the_outside_2%
      return the_wall_2%
    case the_outside_3%
      return the_wall_3%
    case else
      return the_wall_0%
  end select
end sub

' ==============================================================
' The end {{{1

sub the_end

  let total_playing_seconds%=tim/1000-first_playing_second
  let playing_minutes%=int (total_playing_seconds%/60)
  let playing_seconds%=int (total_playing_seconds%-playing_minutes%*60)
  let playing_hours%=int (playing_minutes%/60)
  let playing_minutes%=playing_minutes%-playing_hours%*60

  if banished% then

    select output_language%
      case esperanto%
        wt_type_para("Vi estas forĵetita el la Eduka Komplekso.")
      case interlingue%
        wt_type_para("Vu ha esset expulset ex li Complexe Educativ.")
      case spanish%
        wt_type_para("Has sido expulsado del Complejo Educativo.")
    end select

    select output_language%
      case esperanto%
        wt_type("Venontfoje estu pli atentema.")
      case interlingue%
        wt_type("Atente plu bon li sequent vez.")
      case spanish%
        wt_type("La próxima vez ten más cuidado.")
    end select

  else

    select output_language%
      case esperanto%
        wt_type_para("Vi atingis vian celon.")
      case interlingue%
        wt_type_para("Vu ha atinget vor scope.")
      case spanish%
        wt_type_para("Has logrado tu objetivo.")
    end select

    select output_language%
      case esperanto%
        wt_type("Gratulon!")
      case interlingue%
        wt_type("Gratulationes!")
      case spanish%
        wt_type("¡Enhorabuena!")
    end select

  end if

  time_report

  if not banished% then

    if playing_hours%<record_hours% then

      ' XXX TODO --

      let record_hours%=playing_hours%
      let best_player_name$=player_name ' XXX
      select output_language%
        case esperanto%
          wt_type_para("Vi starigis novan rekordon!")
        case interlingue%
          wt_type_para("Vu ha etablisset un nov record!")
        case spanish%
          wt_type_para("¡Has establecido un nuevo récord!")
      end select

    else

      select output_language%
        case esperanto%
          wt_type_para("La rikordon plu havas")
          wt_type(best_player_name$+", kun tempo")
        case interlingue%
          wt_type_para(best_player_name$+" ancor have li record,")
          wt_type("con li témpore")
        case spanish%
          wt_type_para("El récor sigue en posesión de")
          wt_type(best_player_name$+", con un tiempo de")
      end select

      wt_type(time$(record_hours%)+".")

    end if

  end if

  select output_language%
    case esperanto%
      wt_type_para("Premu klavon por ludi.")
    case interlingue%
      wt_type_para("Presse un taste por luder.")
    case spanish%
      wt_type_para("Pulsa una tecla para jugar.")
  end select
  delay 60000

end sub

sub time_report

  select output_language%
    case esperanto%
      wt_type_para("Vi")
      wt_type(iff(banished%,"estis forĵetita post","sukcesis en"))
    case interlingue%
      wt_type_para("Vu ha")
      wt_type(iff(banished%,"esset expulset pos","succesat in"))
    case spanish%
      wt_type_para(iff(banished%,"Has sido expulsado después de","Lo has logrado en"))
  end select
  ' XXX TODO -- Add "hours", "minutes" and "seconds":
  wt_type(hour(playing_hours%,playing_minutes%,playing_seconds%)+".")

end sub

' ==============================================================
' Action dispatcher {{{1

sub obey(action%,complement%)

  debug("in obey")

  if complement% then
    be_known(complement%)
  end if

  select action%
    case no_action%
      =
    case to_do%
      do_do(complement%)
    case to_drop%
      do_drop(complement%)
    case to_examine%
      do_examine(complement%)
    case to_go%
      do_go(complement%)
    case to_go_east%
      do_go_east(complement%)
    case to_go_in%
      do_go_in(complement%)
    case to_go_north%
      do_go_north(complement%)
    case to_go_out%
      do_go_out(complement%)
    case to_go_south%
      do_go_south(complement%)
    case to_go_west%
      do_go_west(complement%)
    case to_hash_debug%
      do_hash_debug
    case to_hash_drop%
      do_hash_drop(complement%)
    case to_hash_go%
      do_hash_go(complement%)
    case to_hash_input%
      do_hash_input(complement%)
    case to_hash_langs%
      do_hash_langs
    case to_hash_locate%
      do_hash_locate(complement%)
    case to_hash_output%
      do_hash_output(complement%)
    case to_hash_take%
      do_hash_take(complement%)
    case to_hash_use_esperanto%
      do_hash_use_esperanto
    case to_hash_use_interlingue%
      do_hash_use_interlingue
    case to_hash_use_spanish%
      do_hash_use_spanish
    case to_inventory%
      do_inventory(complement%)
    case to_list_exits%
      do_list_exits(complement%)
    case to_look%
      do_look(complement%)
    case to_open%
      do_open(complement%)
    case to_read%
      do_read(complement%)
    case to_take%
      do_take(complement%)
    case to_turn_off%
      do_turn_off(complement%)
    case to_turn_on%
      do_turn_on(complement%)
    case else
      fatal_problem("Out of flow in `obey`")
  end select

end sub

' ==============================================================
' Actions {{{1

' -----------------------------------------------
' do_do {{{2

sub do_do(this_entity%)

  debug("do_do")

  if this_entity%=the_inventory% then
    do_inventory
  else
    dunno_error
  end if

end sub

' -----------------------------------------------
' do_drop {{{2

sub do_drop(this_entity%)

  debug("do_drop")

  local carried_entities%,displayed%,n%

  let carried_entities%=carried_entities

  if this_entity%=the_all% then

    if carried_entities% then

      wt_type_para(you_drop_)
      let displayed%=0
      for n%=1 to carried_entities%
        let displayed%=displayed%+1
        if displayed%=carried_entities% then
          ' the last one
          if carried_entities%>1 then wt_type(and_)
          wt_type(name_in_accusative(carried_entity%(n%))+".")
        else
          if displayed%=carried_entities%-1 then
            ' the last but one
            wt_type(name_in_accusative(carried_entity%(n%)))
          end if
        else
          wt_type(name_in_accusative(carried_entity%(n%))+",")
        end if
        be_here(carried_entity%(n%))
      next n%

    else

      wt_type_para(you_carry_nothing_)

    end if

  else

    if is_not_carried(this_entity%) then
      not_carried_error(this_entity%)
    else
      be_here(this_entity%)
      wt_type_para(you_drop_+" "+name_in_accusative(this_entity%)+".")
    end if

  end if

end sub

' -----------------------------------------------
' do_examine {{{2

sub do_examine(this_entity%)

  debug("do_examine")

  look_at(this_entity%,1)

end sub

' -----------------------------------------------
' do_go {{{2

sub do_go(this_entity%)

  debug("do_go")

  if is_direction(this_entity%) then
    do_go_direction(this_entity%)
  else
    dunno_error
  end if

end sub

sub do_go_direction(this_direction%)

  debug("do_go")

  do_go_location(exit_location%(location%(the_protagonist%),this_direction%))

end sub

' -----------------------------------------------
' do_go_east {{{2

sub do_go_east(this_entity%)

  debug("do_go_east")

  if this_entity%=no_entity% then
    do_go_direction(the_east%)
  else
    dunno_error
  end if

end sub

' -----------------------------------------------
' do_go_in {{{2

sub do_go_in(this_entity%)

  debug("do_go_in")

  if this_entity%=no_entity% then
    do_go_direction(the_inside%)
  else
    dunno_error
  end if

end sub

' -----------------------------------------------
' do_go_north {{{2

sub do_go_north(this_entity%)

  debug("do_go_north")

  if this_entity%=no_entity% then
    do_go_direction(the_north%)
  else
    dunno_error
  end if

end sub

' -----------------------------------------------
' do_go_out {{{2

sub do_go_out(this_entity%)

  debug("do_go_out")

  local this_location%

  if is_direction(this_entity%) then
    do_go_direction(this_entity%)
  else

    let this_location%=exit_location%(location%(the_protagonist%),the_outside%)

    if this_location%=0 then
      let this_location%=previous_location%
    end if

    do_go_location(this_location%)

  end if

end sub

' -----------------------------------------------
' do_go_south {{{2

sub do_go_south(this_entity%)

  debug("do_go_south")

  if this_entity%=no_entity% then
    do_go_direction(the_south%)
  else
    dunno_error
  end if

end sub

' -----------------------------------------------
' do_go_west {{{2

sub do_go_west(this_entity%)

  debug("do_go_west")

  if this_entity%=no_entity% then
    do_go_direction(the_west%)
  else
    dunno_error
  end if

end sub

' -----------------------------------------------
' do_go_location {{{2

sub do_go_location(this_location%)

  ' XXX FIXME -- `this_direction%` is not init:

  if this_location%=0 then

    wt_type_para(you_can_not_go_that_way_)

  else

    if is_locked(this_location%) then

      if is_carried(the_key%) then

        select output_language%
          case esperanto%
            wt_type_para("Vi malŝlosas la pordon.")
          case interlingue%
            wt_type_para("Vu clave-aperte li porta.")
          case spanish%
            wt_type_para("Abres la puerta con la llave.")
        end select
        ' Unlock the door from this side:
        let exit_location%(location%(the_protagonist%),this_direction%)=unlocked(this_location%)
        ' Unlock from the other side
        ' XXX FIXME -- it  works only if exits are regular
        ' (N<-->S, E<-->W, etc):
        let exit_location%(unlocked(this_location%),opposite_direction(this_direction%))=location%(the_protagonist%)

        let previous_location%=location%(the_protagonist%)
        let location%(the_protagonist%)=unlocked(this_location%)
        enter_location

      else
        wt_type_para(you_can_not_go_that_way_)
        select output_language%
          case esperanto%
            wt_type("Estas ŝlosita pordo.")
          case interlingue%
            wt_type("Hay un porta clave-cludet.")
          case spanish%
            wt_type("Hay una puerta cerrada con llave.")
        end select
      end if

    end if

  else

    let previous_location%=location%(the_protagonist%)
    let location%(the_protagonist%)=this_location%
    enter_location

  end if

end sub

' -----------------------------------------------
' do_hash_debug {{{2

sub do_hash_debug

  let debugging%=not debugging%

  select output_language%
    case esperanto%
      do_debug("La erarserĉilo estas "+iff(debugging%,"aktivigita","malaktivigita")+".")
    case interlingue%
      do_debug("Li depuration es "+iff(debugging%,"activat","desactivat")+".")
    case spanish%
      do_debug("La depuración está "+iff(debugging%,"activada","desactivada")+".")
  end select

end sub

' -----------------------------------------------
' do_hash_drop {{{2

sub do_hash_drop(this_entity%)
  be_here(this_entity%)
end sub

' -----------------------------------------------
' do_hash_go {{{2

sub do_hash_go(this_entity%)
  let location%(the_protagonist%)=this_entity%
end sub

' -----------------------------------------------
' do_hash_input {{{2

sub do_hash_input(this_entity%)
  select this_entity%
    case the_esperanto_language%
      let input_language%=esperanto%
      wt_type_para("[Esperanto aktivita por la komandoj.]")
    case the_interlingue_language%
      let input_language%=interlingue%
      wt_type_para("[Interlingue activat por li comandes.]")
    case the_spanish_language%
      let input_language%=spanish%
      wt_type_para("[Español activado para los comandos.]")
    case else
      dunno_error
  end select
end sub

' -----------------------------------------------
' do_hash_langs {{{2

sub do_hash_langs

  do_debug("input: #"+str$(input_language%))
  do_debug("output: #"+str$(output_language%))

end sub

' -----------------------------------------------
' do_hash_locate {{{2

sub do_hash_locate(this_entity%)

  local message%,entity_$

  select output_language%
    case esperanto%
      let entity_$="estaĵo"
    case interlingue%
      let entity_$="ente"
    case spanish%
      let entity_$="ente"
  end select

  let message%=name(this_entity%)
  let message%=message%+" ("+entity_$+" "+str$(this_entity%)+")"
  select output_language%
    case esperanto%
      let message%=message%+" estas en "
    case interlingue%
      let message%=message%+" es in "
    case spanish%
      let message%=message%+" está en "
  end select
  let message%=message%+name(location%(this_entity%))
  let message%=message%+" ("+entity_$+" "+str$(location%(this_entity%))+")."

  do_debug(message%)

end sub

' -----------------------------------------------
' do_hash_output {{{2

sub do_hash_output(this_entity%)
  select this_entity%
    case the_esperanto_language%
      let output_language%=esperanto%
      wt_type_para("[Esperanto aktivita por la tekstoj.]")
    case the_interlingue_language%
      let output_language%=interlingue%
      wt_type_para("[Interlingue activat por li textus.]")
    case the_spanish_language%
      let output_language%=spanish%
      wt_type_para("[Español activado para los textos.]")
    case else
      dunno_error
  end select
end sub

' -----------------------------------------------
' do_hash_take {{{2

sub do_hash_take(this_entity%)
  let location%(this_entity%)=the_protagonist%
end sub

' -----------------------------------------------
' do_hash_use_esperanto {{{2

sub do_hash_use_esperanto
  debug("do_hash_use_esperanto")
  let input_language%=esperanto%
  let output_language%=esperanto%
  wt_type_para("[Esperanto aktivigita.]")
end sub

' -----------------------------------------------
' do_hash_use_interlingue {{{2

sub do_hash_use_interlingue
  debug("do_hash_use_interlingue")
  let input_language%=interlingue%
  let output_language%=interlingue%
  wt_type_para("[Interlingue activat.]")
end sub

' -----------------------------------------------
' do_hash_use_spanish {{{2

sub do_hash_use_spanish
  debug("do_hash_use_spanish")
  let input_language%=spanish%
  let output_language%=spanish%
  wt_type_para("[Español activado.]")
end sub

' ==============================================================
' do_inventory {{{2

sub do_inventory(this_entity%)

  local carried_entities%,displayed%,n%

  if this_entity%<>no_entity% then
    dunno_error
    endproc
  end if

  let carried_entities%=carried_entities

  if carried_entities% then

    let displayed%=0
    wt_type_para(you_have_)
    for n%=1 to carried_entities%
      debug("carried_entity%("+str$(n%)+")= "+name(carried_entity%(n%)))
      let displayed%=displayed%+1
      if displayed%=carried_entities% then
        ' the last one
        if carried_entities%>1 then
          wt_type(and_)
        end if
        wt_type(name_in_accusative(carried_entity%(n%))+".")
      else
        if displayed%=carried_entities%-2 then
          ' the last but one
          wt_type(name_in_accusative(carried_entity%(n%)))
        end if
      else
        wt_type(name_in_accusative(carried_entity%(n%))+",")
      end if
    next n%

  else

    wt_type_para(you_carry_nothing_)

  end if

end sub

' -----------------------------------------------
' do_list_exits {{{2

sub do_list_exits(this_entity%)

  if this_entity%=no_entity% then
    show_exits
  else
    dunno_error
  end if

end sub

' -----------------------------------------------
' do_look {{{2

sub do_look(this_entity%)

  debug("do_look")
  look_at(this_entity%,0)

end sub

sub look_at(this_entity%,level)

  if not light% then
    darkness_error
    endproc
  end if
  if this_entity%=the_all% then
    describe_entity(this_entity%,level)
    endproc
  end if
  if this_entity%=no_entity% then
    describe_current_location
    endproc
  end if
  if this_entity%=the_exit% then
    show_exits
    endproc
  end if
  if is_location%(this_entity%) then
    describe_location(this_entity%,level)
    endproc
  end if
  if is_direction(this_entity%) then
    about_direction(this_entity%)
    endproc
  end if
  if is_not_visible(this_entity%) then
    not_seen_here_error(this_entity%)
    endproc
  end if
  describe_entity(this_entity%,level)

end sub

' -----------------------------------------------
' do_open {{{2

sub do_open(this_entity%)

  debug("do_open")

  select this_entity%
    case the_door%
      do_open_a_door
    case the_safe%
      do_open_the_safe
    case else
      dunno_error
  end select

end sub

sub do_open_a_door

  local this_direction%,this_direction_name%
  local this_location%,opposite_direction,unlocked_location

    for this_direction%=first_cardinal_point to last_cardinal_point%
      debug("About to check connection to "+name(this_direction%))
      let this_location%=exit_location%(location%(the_protagonist%),this_direction%)
      if this_location% and is_locked(this_location%) then

        if is_not_carried(the_key%) then

          select output_language%
            case esperanto%
              wt_type_para("Vi ne havas la ŝlosilon.")
            case interlingue%
              wt_type_para("Vu ne have li clave.")
            case spanish%
              wt_type_para("No tienes la llave.")
          end select
          return

        else

          debug("About to open "+name(this_direction%)+" door to "+name(unlocked(this_location%)))
          let exit_location%(location%(the_protagonist%),this_direction%)=unlocked(this_location%)
          let exit_location%(unlocked(this_location%),opposite_direction(this_direction%))=location%(the_protagonist%)
          let this_direction_name%=entity_word(this_direction%)
          select output_language%
            case esperanto%
              wt_type_para("Vi malfermas la pordon al")
              let this_direction_name%=left$(this_direction_name%,len(this_direction_name%)-1)
            case interlingue%
              wt_type_para("Vu aperte li porta vers")
            case spanish%
              wt_type_para("Abres la puerta que va al")
          end select
          wt_type(this_direction_name%+".")
          return

        end if

      end if

    next this_direction%

    select output_language%
      case esperanto%
        wt_type_para("Ne estas ŝlositaj pordoj.")
      case interlingue%
        wt_type_para("Ne hay portas clave-cludet.")
      case spanish%
        wt_type_para("No hay puertas cerradas con llave.")
    end select

end sub

sub do_open_the_safe

  if is_here(the_safe%) then
    if the_safe_is_open% then
      select output_language%
        case esperanto%
          wt_type_para("Ĝi jam estis malfermita.")
        case interlingue%
          wt_type_para("It ja esset apertet.")
        case spanish%
          wt_type_para("Ya estaba abierta.")
      end select
    else
      select output_language%
        case esperanto%
          wt_type_para("Kiu estas la ĉifro?")
        case interlingue%
          wt_type_para("Quel es li combination?")
        case spanish%
          wt_type_para("¿Cuál es la combinación?")
      end select
      if safe_code$=user_input then
        ' XXX TODO -- Take the contents.
        select output_language%
          case esperanto%
            wt_type_para("La mon-ŝranko malfermiĝas.")
          case interlingue%
            wt_type_para("Li moné-scaf aperte se.")
          case spanish%
            wt_type_para("La caja se abre.")
        end select
        let the_safe_is_open%=true
      else
        select output_language%
          case esperanto%
            wt_type_para("La mon-ŝranko ne malfermiĝas.")
          case interlingue%
            wt_type_para("Li moné-scaf ne aperte se.")
          case spanish%
            wt_type_para("La caja no se abre.")
        end select
        select output_language%
          case esperanto%
            wt_type("Ŝajnas ke tiu ne estas la ĉifro.")
          case interlingue%
            wt_type("It sembla que ti ne es li combination.")
          case spanish%
            wt_type("Parece que esa no es la combinación.")
        end select
      end if
    end if
  else
    not_seen_here_error(the_safe%)
  end if

end sub

' -----------------------------------------------
' do_read {{{2

sub do_read(this_entity%)

  debug("do_read")

  if is_not_readable(this_entity%) then
    dunno_error
    endproc
  end if
  if is_not_carried(this_entity%) then
    not_carried_error(this_entity%)
    endproc
  end if
  if not light% then
    darkness_error
    endproc
  end if
  if this_entity%=the_paper_sheet% then
    ' XXX TODO
    select output_language%
      case esperanto%
        wt_type_para("Ĝi estas malplena.")
      case interlingue%
        wt_type_para("It es ínscrit.")
      case spanish%
        wt_type_para("Está en blanco.")
    end select
    endproc
  end if
  if this_entity%=the_paper_piece% then
    read_the_paper_piece
  else
    dunno_error
  end if

end sub

sub read_the_paper_piece
  select output_language%
    case esperanto%
      wt_type_para("Vi legas tion kio estas skribita:")
    case interlingue%
      wt_type_para("Vu lee ti quel es scrit:")
    case spanish%
      wt_type_para("Lees lo que está escrito:")
  end select
  wt_type("«"+safe_code$+"»")
end sub

' ==============================================================
' do_take {{{2

sub do_take(this_entity%)

  debug("do_take")

  local n%,present_entities%

  if is_carried(this_entity%) then
    wt_type_para(you_already_have_+name_in_accusative(this_entity%)+".")
    endproc
  end if

  if not light% then
    darkness_error
    endproc
  end if

  if this_entity%=the_all% then

    debug("do_take the_all%")

    let present_entities%=present_entities

    if present_entities% then
      for n%=0 to present_entities%-1
        do_take_present_this(present_entity%(n%))
      next n%
    else
      select output_language%
        case esperanto%
          wt_type_para("Vi vidas nenion preneblan.")
        case interlingue%
          wt_type_para("Vu vide nequó prendibil.")
        case spanish%
          wt_type_para("Nada ves aquí que puedas recoger.")
      end select

    end if

  else

    do_take_this(this_entity%)

  end if

end sub

sub do_take_this(entity%)

  debug("do_take_this("+str$(entity%)+")")

  if is_here(entity%) then
    do_take_present_this(entity%)
  else
    not_seen_here_error(entity%)
  end if

end sub

sub do_take_present_this(entity%)

  debug("do_take_present_this("+str$(entity%)+")")

  if is_pot(entity%) then
    select output_language%
      case esperanto%
        fn_type_para("Tiu flor-poto certe pezas pli ol bovino.")
      case interlingue%
        fn_type_para("Ti flor-pote pesa plu quam vacca.")
      case spanish%
        fn_type_para("Ese tiesto pesa más que una vaca.")
    end select
    endproc
  end if

  if not is_portable%(entity%) then
    wt_type_para(question_mark_+capitalized(name_in_accusative(entity%))+"? "+no_way_)
  else

  ' XXX TODO improve or remove this plot condition
  '   if carried_entities%=max_carried% then
  '     wt_type_para("No puedo llevar más cosas.")
  '     return
  '   end if

    let location%(entity%)=the_protagonist%
    wt_type_para(you_take_+" "+name_in_accusative(entity%)+".")
  end if

end sub

' -----------------------------------------------
' do_turn_off {{{2

sub do_turn_off(this_entity%)

  debug("do_turn_off")

  if is_not_carried(this_entity%) then
    not_carried_error(this_entity%)
  else
    if light% then
      select output_language%
        case esperanto%
          wt_type_para("Vi malŝaltas")
        case interlingue%
          wt_type_para("Vu extinte")
        case spanish%
          wt_type_para("Apagas")
      end select
      wt_type(name_in_accusative(this_entity%)+".")
      let light%=false
    else
      select output_language%
        case esperanto%
          wt_type_para("Ĝi jam estas malŝaltita.")
        case interlingue%
          wt_type_para("It ja es extintet.")
        case spanish%
          wt_type_para("Ya está apagada.")
      end select
    end if
  end if

end sub

' -----------------------------------------------
' do_turn_on {{{2

sub do_turn_on(this_entity%)

  debug("do_turn_on")

  if is_not_carried(this_entity%) then
    not_carried_error(this_entity%)
  else
    if light% then
      select output_language%
        case esperanto%
          wt_type_para("Ĝi jam estas ŝaltita.")
        case interlingue%
          wt_type_para("It ja es accendet.")
        case spanish%
          wt_type_para("Ya está encendida.")
      end select
    else
      select output_language%
        case esperanto%
          wt_type_para("Vi ŝaltas")
        case interlingue%
          wt_type_para("Vu accende")
        case spanish%
          wt_type_para("Enciendes")
      end select
      wt_type_para(name_in_accusative(this_entity%)+".")
      let light%=true
    end if
  end if

end sub

' -----------------------------------------------
' Plot {{{1

sub global_plot

  ' Handle the global global_plot.

  if not banished% then
    the_guard_moves
  end if

end sub

sub surprising_location_event

  ' Handle surprising events that may happen right after
  ' entering a location. If the event is surprising enough,
  ' return _true_, so the usual location description will not
  ' be displayed; otherwise return _false_.

  if is_here(the_guard%) then
    select output_language%
      case esperanto%
        wt_type_para("La gvardisto estas ĉi-tie!")
      case interlingue%
        wt_type_para("Li gardero es ci!")
      case spanish%
        wt_type_para("¡El guarda está aquí!")
    end select
    delay 2000
    catched_by_the_guard
    return true
  else
    return false
  end if
end sub

' -----------------------------------------------
' The guard {{{2

sub the_guard_moves

  ' The guard moves to a random adjacent location.

  local the_direction%,guard_previous_location%

  let the_direction%=between%(first_cardinal_point,last_cardinal_point%)

  if exit_location%(location%(the_guard%),the_direction%) then

    let guard_previous_location%=location%(the_guard%)
    let location%(the_guard%)=unlocked(exit_location%(location%(the_guard%),the_direction%))
    debug("The guard goes to "+str$(location%(the_guard%))+" ("+name(location%(the_guard%))+").")

    if is_here(the_guard%) then
      wt_type_para("De pronto sientes que alguien llega desde")
      wt_type(name(guard_previous_location%)+",")
      delay 2000
      wt_type("y cuando te das la vuelta te quedas de piedra:")
      wt_type("Es el guarda de seguridad.")
      delay 2000
      catched_by_the_guard
      endproc
    end if

    if guard_previous_location%=location%(the_protagonist%) then
      wt_type("El guarda se va hacia "+name(the_direction%)+".")
      endproc
    end if

    if are_adjacent(location%(the_protagonist%),location%(the_guard%)) then
      wt_type_para("Oyes pasos "+iff(is_cardinal_point(the_direction%),"al",""))
      wt_type(entity_word(direction(location%(the_protagonist%),location%(the_guard%)))+"...")
      endproc
    end if

    if is_corridor(location%(the_guard%)) and is_corridor(location%(the_protagonist%)) then
      wt_type_para("Has oído algo en el pasillo...")
    end if

  end if

end sub

sub catched_by_the_guard

  ' XXX TODO -- Improve the logic and the texts.

  let guard_met%=guard_met%+1

  wt_type_para("Antes de que puedas reaccionar,")
  wt_type("te agarra fuertemente por el cuello con una de sus grandes manos,")
  wt_type("y te dice:")

  if is_outside(location%(the_protagonist%)) then
    wt_type_para("—¿Qué haces tú rondando por aquí a estas horas?")
  else
    let banished%=true
    wt_type_para("—¿Cómo has entrado aquí?")
  end if

  if is_here(the_safe%) and the_safe_is_open% then
    wt_type_para("Sin dejar de apretarte el cuello, echa un vistazo alrededor")
    wt_type("y, lógicamente, algo llama enseguida su atención:")
    wt_type_para("—¡Y además has abierto la caja fuerte! —grita—.")
    wt_type("¡Maldito hereje!")
  end if

  if is_carried(the_paper_sheet%) then
    wt_type_para("Entonces, la presión de su mano parece aflojarse ligeramente")
    wt_type("mientras su mirada vuelve a clavarse en ti, como un taladro,")
    wt_type("y se fija en lo que tienes entre las manos.")
    wt_type_para("—¿Qué es ese papel que tienes ahí escondido? Déjame ver...")
    delay 2000
    wt_type_para("Le entregas temerosamente el papel, que toma con su mano libre.")
    delay 3000
    wt_type_para("—Hum... —dice, echando un vistazo.")
    delay 4000
    wt_type_para("—Así que has copiado el examen... —dice por fin.")
    let banished%=true
  end if

  if banished% then
    wt_type_para("—Esto significa tu inmediata expulsión de este complejo.")
  else
    wt_type_para("Se vuelve hacia ti y te dice:")
    wt_type_para("—¿Sabes que estar en el complejo a estas horas es una grave falta de disciplina?")
    delay 2000
    wt_type("Este comportamiento no es propio de un alumno que se está formando en el complejo.")
    if the_guard_leaves then
      wt_type_para("¡Uf!... Por poco.")
    end if
  end if

end sub

sub the_guard_leaves

  local this_direction%,this_location%,success%

  if exits(location%(the_guard%)) then

    do
      let this_direction%=between%(first_cardinal_point,last_cardinal_point%)
      let this_location%=exit_location%(location%(the_guard%),this_direction%)
    loop until this_location%
    let location%(the_guard%)=unlocked(this_location%)
    wt_type_para("Se da media vuelta y se va hacia "+name(this_direction%)+".")
    let success%=true

  else

    wt_type_para("El guarda busca una salida, sin éxito.")
    let success%=false

  end if

  return success%
end sub

' -----------------------------------------------
' The pots {{{2

sub search_pot(entity%)

  ' Search pot _entity_.

  if the_key_was_found_already then

    about_this_pot(entity%,0) ' just describe the pot without details

  else

    ' The key has not being found yet.

    if entity%=key_pot% then

      ' The key is hidden in this pot.

      select output_language%
        case esperanto%
          wt_type_para("Ĉi-tie estas la ŝlosilo!")
        case interlingue%
          wt_type_para("Li clave es ci!")
        case spanish%
          wt_type_para("¡Aquí está la llave!")
      end select

      select examined_pots
        case 0
          select output_language%
            case esperanto%
              wt_type("Je la unua fojo!")
            case interlingue%
              wt_type("Ye li prim vez!")
            case spanish%
              wt_type("¡A la primera!")
          end select
        case 1
          select output_language%
            case esperanto%
              wt_type("Je la dua provo, bonŝance.")
            case interlingue%
              wt_type("Ye li duesim prova, felicimen.")
            case spanish%
              wt_type("Al segundo intento, ha habido suerte.")
          end select
        case 2
          select output_language%
            case esperanto%
              wt_type("Ĝi ne estis tiom malfacila.")
            case interlingue%
              wt_type("It ne esset tant desfacil.")
            case spanish%
              wt_type("No ha sido tan difícil.")
          end select
        case 3
          select output_language%
            case esperanto%
              wt_type("Jam estis tempo, finfine.")
            case interlingue%
              wt_type("It ja esset témpore, in fine.")
            case spanish%
              wt_type("Ya era hora, por fin.")
          end select
        case 4
          select output_language%
            case esperanto%
              wt_type("Ĝi estis en la lasta flor-poto, kompreneble...")
            case interlingue%
              wt_type("It esset in li ultim flor-poto, naturalmen...")
            case spanish%
              wt_type("Estaba en el último tiesto, por supuesto...")
          end select
      end select

      let location%(the_key%)=the_protagonist%
      let key_pot%=-key_pot% ' mark the key as found

    else

      ' The key is not hidden in this pot.

      if examinations%(entity%) then

        select output_language%
          case esperanto%
            wt_type_para("Ĉi tiu jam estas bone ekzamenita. Ĉi tie ne")
          case interlingue%
            wt_type_para("Ti-ci jam es bon examinat. Ci ne")
          case spanish%
            wt_type_para("Este ya está bien visto. Aquí no")
        end select

      else

        select output_language%
          case esperanto%
            wt_type(iff(examined_pots,"Ankaŭ en ĉi tiu ne","In ĉi tiu unua ne"))
          case interlingue%
            wt_type(iff(examined_pots,"Anc in ti-ci ne","In ti-ci prim ne"))
          case spanish%
            wt_type("En este "+iff(examined_pots,"tampoco","primero no"))
        end select

      end if

      select output_language%
        case esperanto%
          wt_type("estas la ŝlosilo.")
        case interlingue%
          wt_type("sta li clave.")
        case spanish%
          wt_type("está la llave.")
      end select

    end if

  end if

end sub

sub examined_pots

  ' Return the total number of pots that have been examined in
  ' detail.

  local count%,pot%

  for pot%=the_pot_0% to the_pot_3%
    let count%=count%+(examinations%(pot%)<>0)
  next pot%

  return count%
end sub

sub the_key_was_found_here(entity%)
  return the_key_was_found_already and entity%=abs(key_pot%)
end sub

sub the_key_was_found_already
  return key_pot%<0
end sub

' ==============================================================
' Locations {{{1

' -----------------------------------------------
' Enter location {{{2

sub enter_location

  let visits%(location%(the_protagonist%))=visits%(location%(the_protagonist%))+1
  ruler
  show_location_title(location%(the_protagonist%))
  if not surprising_location_event and not game_over then
    describe_entity(location%(the_protagonist%),1)
    show_entities
    show_exits
  end if

end sub

' -----------------------------------------------
' Describe location {{{2

sub show_location_title(entity%)

  debug("in show_location_title("+str$(entity%)+")")
  wt_type_para(you_are_in_)
  wt_type(name(entity%)+".")
  debug("Location entity number= "+str$(location%(the_protagonist%)))

end sub

sub describe_current_location

  show_location_title(location%(the_protagonist%))
  describe_entity(location%(the_protagonist%),1)
  show_entities
  show_exits

end sub

' -----------------------------------------------
' List present entities {{{2

sub show_entities

  local n%,present_entities%,this_entity%

  let present_entities%=present_entities

  debug("present_entities%= "+str$(present_entities%))

  if present_entities% then

    wt_type_para(you_see_)
    for n%=0 to present_entities%-1
      debug("present_entity%(n%)= "+str$(present_entity%(n%)))
      let this_entity%=present_entity%(n%)
      if n%=present_entities%-1 then
        if present_entities%>1 then
          wt_type(and_)
        end if
        wt_type(name_in_accusative(this_entity%)+".") ' the last one
        endproc
      end if

      if n%=present_entities%-2 then
        wt_type(name_in_accusative(this_entity%)) ' the last but one
      else
        wt_type(name_in_accusative(this_entity%)+",")
      end if
    next n%

  end if

end sub

sub present_entities

  ' Return the number of present entities and fill the array
  ' `present_entity%` with all of them.

  local count%,this_entity%

  debug("entities range in present_entities= "+str$(first_thing_entity%)+".."+str$(last_thing_entity%))
  for this_entity%=first_thing_entity% to last_thing_entity%
    if is_here(this_entity%) then
      let present_entity%(count%)=this_entity%
      let count%=count%++1
    end if
  next this_entity%

  return count%
end sub

' -----------------------------------------------
' List exits {{{2

sub show_exits

  debug("show_exits")

  local this_direction%,exits_here%,displayed%

  let exits_here%=exits(location%(the_protagonist%))

  debug("exits_here%: "+str$(exits_here%))

  if exits_here%=0 then endproc

  let displayed%=0
  select output_language%
    case esperanto%
      wt_type_para("Estas elirejo"+left$("j",exits_here%>1)+" al")
    case interlingue%
      wt_type_para("Hay exeada"+left$("s",exits_here%>1)+" vers")
    case spanish%
      wt_type_para("Hay salida"+left$("s",exits_here%>1)+" hacia")
  end select

  for this_direction%=first_cardinal_point to last_cardinal_point%

    debug("Exit "+str$(this_direction%)+": "+str$(exit_location%(location%(the_protagonist%),this_direction%)))

    if exit_location%(location%(the_protagonist%),this_direction%) then
      let displayed%=displayed%+1
      if displayed%=exits_here% then
        if exits_here%>1 then
          wt_type(and_)
        end if
        wt_type(exit_description(this_direction%)+".") ' the last one
        endproc
      end if

      if displayed%=exits_here%-1 then
        wt_type(exit_description(this_direction%)) ' the last but one
      else
        wt_type(exit_description(this_direction%)+",")
      end if
    end if

  next this_direction%

end sub

sub exit_description(this_direction%)

  ' Return the list item corresponding to the location which
  ' can be reached towards _direction_ from the current
  ' location.

  local result$

  debug("in exit_description("+str$(this_direction%)+")")
  let result$=name(this_direction%)
  debug("name("+str$(this_direction%)+")="+result$)
  let result$=result$+" ("
  let result$=result$+name(unlocked(exit_location%(location%(the_protagonist%),this_direction%)))
  let result$=result$+")"

  return result$
end sub

sub exits(entity%)

  ' Return the number of current exits of _location_, including
  ' locked doors.

  debug("exits("+str$(entity%)+")")

  local out%

  let out%=       (exit_location%(entity%,the_north%)  <>0)
  let out%=out%+(exit_location%(entity%,the_south%)  <>0)
  let out%=out%+(exit_location%(entity%,the_east%)   <>0)
  let out%=out%+(exit_location%(entity%,the_west%)   <>0)
  let out%=out%+(exit_location%(entity%,the_inside%) <>0)
  let out%=out%+(exit_location%(entity%,the_outside%)<>0)

  return out%
end sub

' ==============================================================
' Entity descriptions {{{1

sub describe_location(this_entity%,detailed%)

  if location%(the_protagonist%)=this_entity% then
    describe_entity(entity%,detailed%)
  else
    you_are_not_there_error(this_entity%)
  end if

end sub

sub describe_entity(entity%,detailed%)

  select entity%

    case the_all%
      about_the_all(detailed%)
    case the_ballpen%
      about_the_ballpen(detailed%)
    case the_bathroom%
      about_the_bathroom(detailed%)
    case the_book%
      about_the_book(detailed%)
    case the_brick%
      about_the_brick(detailed%)
    case the_classroom%
      about_the_classroom(detailed%)
    case the_corridor_0%
      about_the_corridor_0(detailed%)
    case the_corridor_1%
      about_the_corridor_1(detailed%)
    case the_corridor_2%
      about_the_corridor_2(detailed%)
    case the_dining_room%
      about_the_dining_room(detailed%)
    case the_dining_room_tables%
      about_the_dining_room_tables(detailed%)
    case the_door%
      about_the_door(detailed%)
    case the_east%
      about_direction(the_east%)
    case the_outside_0%
      about_the_outside_0(detailed%)
    case the_outside_1%
      about_the_outside_1(detailed%)
    case the_outside_2%
      about_the_outside_2(detailed%)
    case the_outside_3%
      about_the_outside_3(detailed%)
    case the_guard%
      about_the_guard(detailed%)
    case the_inside%
      about_direction(the_inside%)
    case the_inventory%
      do_inventory
    case the_junk_room%
      about_the_junk_room(detailed%)
    case the_key%
      about_the_key(detailed%)
    case the_kitchen%
      about_the_kitchen(detailed%)
    case the_library%
      about_the_library(detailed%)
    case the_north%
      about_direction(the_north%)
    case the_office%
      about_the_office(detailed%)
    case the_secret_room%
      about_the_secret_room(detailed%)
    case the_outside%
      about_direction(the_outside%)
    case the_paper_piece%
      about_the_paper_piece(detailed%)
    case the_paper_sheet%
      about_the_paper_sheet(detailed%)
    case the_pencil%
      about_the_pencil(detailed%)
    case the_pot_0%
      about_this_pot(the_pot_0%,detailed%)
    case the_pot_1%
      about_this_pot(the_pot_1%,detailed%)
    case the_pot_2%
      about_this_pot(the_pot_2%,detailed%)
    case the_pot_3%
      about_this_pot(the_pot_3%,detailed%)
    case the_reception%
      about_the_reception(detailed%)
    case the_safe%
      about_the_safe(detailed%)
    case the_shoe%
      about_the_shoe(detailed%)
    case the_sock%
      about_the_sock(detailed%)
    case the_south%
      about_direction(the_south%)
    case the_flashlight%
      about_the_flashlight(detailed%)
    case the_wall_0%
      about_the_wall_0(detailed%)
    case the_wall_1%
      about_the_wall_1(detailed%)
    case the_wall_2%
      about_the_wall_2(detailed%)
    case the_wall_3%
      about_the_wall_3(detailed%)
    case the_west%
      about_direction(the_west%)

    case else

      wt_type_para(you_see_nothing_special_)

  end select

  let examinations%(entity%)=examinations%(entity%)+detailed%

end sub

' -----------------------------------------------
' about_direction {{{2

sub about_direction(this_direction%)

  local this_location%

  let this_location%=exit_location%(location%(the_protagonist%),this_direction%)

  if this_location% then
    look_to_direction(this_direction%,this_location%)
    endproc
  end if

  if this_direction%=the_outside% then
    ' No explicit way out, so use the previous location instead.
    debug("The previous location is used instead: "+str$(previous_location%))
    look_to_direction(this_direction%,previous_location%)
  else
    select output_language%
      case esperanto%
        wt_type_para("Ne estas elirejo al "+iff(this_direction%<the_inside%,"la ",""))
      case interlingue%
        wt_type_para("Ne hay exeada "+iff(this_direction%<the_inside%,"al ",""))
      case spanish%
        wt_type_para("No hay salida hacia "+iff(this_direction%<the_inside%,"el ",""))
    end select
    wt_type(name(this_direction%)+".")
  end if

end sub

sub look_to_direction(this_direction%,this_entity%)

  local message%

  select output_language%
    case esperanto%
      let message%= "Ĉe "
    case interlingue%
      let message%= "Vers "
    case spanish%
      let message%= "Hacia "
  end select
  let message%=message%+name(this_direction%)
  select output_language%
    case esperanto%
      let message%=message%+" estas "+name(unlocked(this_entity%))
    case interlingue%
      let message%=message%+" es "+name(unlocked(this_entity%))
    case spanish%
      let message%=message%+" está "+name(unlocked(this_entity%))
  end select
  select output_language%
    case esperanto%
      let message%=message%+iff(is_locked(this_entity%),", sed li pordo estas ŝlosita","")
    case interlingue%
      let message%=message%+iff(is_locked(this_entity%),", ma li porta es clave-cludet","")
    case spanish%
      let message%=message%+iff(is_locked(this_entity%),", pero la puerta está cerrada con llave","")
  end select
  let message%=message%+"."

  wt_type_para(message%)

end sub

' -----------------------------------------------
' about_the_all {{{2

sub about_the_all(detailed%)

  describe_current_location

end sub

' -----------------------------------------------
' about_the_ballpen {{{2

sub about_the_ballpen(detailed%)

  ' XXX TODO --

  ' wt.type_para("Es un bolígrafo azul de lo más normal,")
  ' wt.type("con la carga de tinta a medias")
  ' wt.type("y el extremo superior bien mordisqueado.")

  you_see_nothing_special

end sub

' -----------------------------------------------
' about_the_bathroom {{{2

sub about_the_bathroom(detailed%)

  ' XXX TODO --

  ' wt.type_para("Todo está muy limpio.")
  you_see_nothing_special

end sub

' -----------------------------------------------
' about_the_book {{{2

sub about_the_book(detailed%)

  ' XXX TODO --

  ' if detailed% then
  '   wt_type_para("Examinas el libro polvoriento.")
  ' else
  '   wt_type_para("El libro está polvoriento.")
  ' end if
  you_see_nothing_special

end sub

' -----------------------------------------------
' about_the_brick {{{2

sub about_the_brick(detailed%)

  ' XXX TODO --

  ' wt.type_para("Es un ladrillo de obra.")
  you_see_nothing_special

end sub

' -----------------------------------------------
' about_the_classroom {{{2

sub about_the_classroom(detailed%)

  ' XXX TODO --

  ' wt.type_para("Aquí estudian los alfa.")
  you_see_nothing_special

end sub

' -----------------------------------------------
' about_the_corridor_0 {{{2

sub about_the_corridor_0(detailed%)

  ' XXX TODO --

  ' wt.type_para("El extremo norte del pasillo.")
  you_see_nothing_special

end sub

' -----------------------------------------------
' about_the_corridor_1 {{{2

sub about_the_corridor_1(detailed%)

  ' XXX TODO --

  ' wt.type_para("El tramo central del pasillo.")
  you_see_nothing_special

end sub

' -----------------------------------------------
' about_the_corridor_2 {{{2

sub about_the_corridor_2(detailed%)

  ' XXX TODO --

  ' wt.type_para("El extremo sur del pasillo.")
  you_see_nothing_special

end sub

' -----------------------------------------------
' about_the_dining_room {{{2

sub about_the_dining_room(detailed%)

  ' XXX TODO --

  ' wt.type_para("El comedor o refectorio.")
  you_see_nothing_special

end sub

' -----------------------------------------------
' about_the_dining_room_tables {{{2

sub about_the_dining_room_tables(detailed%)

  ' XXX TODO --

    ' XXX TODO
  ' wt.type_para("Son viejas y desgastadas mesas de madera.")
  you_see_nothing_special

end sub

' -----------------------------------------------
' about_the_door {{{2

sub about_the_door(detailed%)

  ' XXX TODO --

  ' wt.type_para("Una puerta como cualquier otra.")
  you_see_nothing_special

end sub

' -----------------------------------------------
' about_the_outside_0 {{{2

sub about_the_outside_0(detailed%)

  ' XXX TODO --

  ' wt.type_para("El lado oeste del complejo.")

end sub

' -----------------------------------------------
' about_the_outside_1 {{{2

sub about_the_outside_1(detailed%)

  ' XXX TODO --

  ' wt.type_para("El lado norte del complejo.")

end sub

' -----------------------------------------------
' about_the_outside_2 {{{2

sub about_the_outside_2(detailed%)

  ' XXX TODO --

  ' wt.type_para("El lado este del complejo.")

end sub

' -----------------------------------------------
' about_the_outside_3 {{{2

sub about_the_outside_3(detailed%)

  ' XXX TODO --

  ' wt.type_para("El lado sur del complejo.")

end sub

' -----------------------------------------------
' about_the_guard {{{2

sub about_the_guard(detailed%)

  ' XXX TODO --

  wt_type_para("Luzgardo,")
  select output_language%
    case esperanto%
      wt_type_para("la gardisto.")
    case interlingue%
      wt_type_para("li gardero.")
    case spanish%
      wt_type_para("el guarda.")
  end select

end sub

' -----------------------------------------------
' about_the_junk_room {{{2

sub about_the_junk_room(detailed%)

  ' XXX TODO --

  ' if not light% then
  '   wt_type_para("Todo está a oscuras.")
  ' else
  ' ' XXX FIXME print something here to finish the paragraph
  '   let light%=false
  ' end if

end sub

' -----------------------------------------------
' about_the_key {{{2

sub about_the_key(detailed%)

  ' XXX TODO --

  select output_language%
    case esperanto%
      wt_type_para("La ĉefŝlosilo kiun Gafopelao havigis al si.")
    case interlingue%
      wt_type_para("Li chefclave quem Gafopelao acompleet.")
    case spanish%
      wt_type_para("La llave maestra que consiguió el Gafopelao.")
  end select

end sub

' -----------------------------------------------
' about_the_kitchen {{{2

sub about_the_kitchen(detailed%)

  ' XXX TODO --

  ' wt.type_para("La suciedad cubre los muebles.")

end sub

' -----------------------------------------------
' about_the_library {{{2

sub about_the_library(detailed%)

  ' XXX TODO --

  ' wt.type_para(you_see_nothing_special_)

end sub

' -----------------------------------------------
' about_the_office {{{2

sub about_the_office(detailed%)

  ' XXX TODO --

  ' wt.type_para("El despacho del director.")

end sub

' -----------------------------------------------
' about_the_paper_piece {{{2

sub about_the_paper_piece(detailed%)

  ' XXX TODO --

    if is_carried(the_paper_piece%) then
      select output_language%
        case esperanto%
          wt_type_para("Ĝi havas ion skribitan.")
        case interlingue%
          wt_type_para("It have alquó scrit.")
        case spanish%
          wt_type_para("Tiene algo escrito.")
      end select
      delay 2000
      read_the_paper_piece
    else
      you_see_nothing_special
    end if

end sub

' -----------------------------------------------
' about_the_paper_sheet {{{2

sub about_the_paper_sheet(detailed%)

  ' XXX TODO --

  select output_language%
    case esperanto%
      wt_type_para("Ĝi estas malplena.") ' XXX TODO -- Confirm.
    case interlingue%
      wt_type_para("It es vacui.") ' XXX TODO -- Confirm.
    case spanish%
      wt_type_para("Está en blanco.")
  end select

end sub

' -----------------------------------------------
' about_the_pencil {{{2

sub about_the_pencil(detailed%)

  ' XXX TODO --

  ' wt.type_para("Un lápiz vulgar, de color de madera, bien afilado.")

end sub

' about_the_reception {{{2

sub about_the_reception(detailed%)

  ' XXX TODO --

  ' wt.type_para("La recepción.")

end sub

' -----------------------------------------------
' about_the_safe {{{2

sub about_the_safe(detailed%)

  ' XXX TODO --

  select output_language%
    case esperanto%
      wt_type_para("La mon-ŝrankon de la direktoro.")
    case interlingue%
      wt_type_para("Li moné-scaf del director.")
    case spanish%
      wt_type_para("La caja fuerte del director.")
  end select

  if the_safe_is_open% then
    select output_language%
      case esperanto%
        wt_type("Ĝi estas malfermita.")
      case interlingue%
        wt_type("It es apert.")
      case spanish%
        wt_type("Está abierta.")
    end select
  else
    select output_language%
      case esperanto%
        wt_type("Ĝi estas fermita.")
      case interlingue%
        wt_type("It es cludet.")
      case spanish%
        wt_type("Está cerrada.")
    end select
  end if

end sub

' -----------------------------------------------
' about_the_secret_room {{{2

sub about_the_secret_room(detailed%)

  ' XXX TODO --

  ' wt.type_para("La secretaría.")

end sub

' -----------------------------------------------
' about_the_shoe {{{2

sub about_the_shoe(detailed%)

  ' XXX TODO --

  ' wt.type_para("Un viejo zapato roto.")
  you_see_nothing_special

end sub

' -----------------------------------------------
' about_the_sock {{{2

sub about_the_sock(detailed%)

  ' XXX TODO --

  ' wt.type_para("Un viejo calcetín mugriento y maloliente.")
  you_see_nothing_special

end sub

' -----------------------------------------------
' about_the_flashlight {{{2

sub about_the_flashlight(detailed%)

  ' XXX TODO --

  ' wt.type_para("Una linterna de pilas.")
  you_see_nothing_special

end sub

' -----------------------------------------------
' about_the_wall_0 {{{2

sub about_the_wall_0(detailed%)

  ' XXX TODO --

  ' wt.type_para("Un muro.")
  you_see_nothing_special

end sub

' -----------------------------------------------
' about_the_wall_1 {{{2

sub about_the_wall_1(detailed%)

  ' XXX TODO --

  ' wt.type_para("Un muro.")
  you_see_nothing_special

end sub

' -----------------------------------------------
' about_the_wall_2 {{{2

sub about_the_wall_2(detailed%)

  ' XXX TODO --

  ' wt.type_para("Un muro.")
  you_see_nothing_special

end sub

' -----------------------------------------------
' about_the_wall_3 {{{2

sub about_the_wall_3(detailed%)

  ' XXX TODO --

  ' wt.type_para("Un muro.")
  you_see_nothing_special

end sub

' -----------------------------------------------
' about_this_pot {{{2

sub about_this_pot(entity%,detailed%)

  ' XXX TODO --

  if detailed% then
    search_pot(entity%)
  else
    select output_language%
      case esperanto%
        return "Ĝi ŝajnas tre peza."
        exit sub
      case interlingue%
        return "It sembla tre pesant."
        exit sub
      case spanish%
        return "Parece muy pesado."
        exit sub
    end select
    if the_key_was_found_here(entity%) then
    select output_language%
      case esperanto%
        wt_type("Bonan lokon elektis Gafopelao por kaŝi la ŝlosilon.")
      case interlingue%
        wt_type("Bon loc Gafopelao selectet por celar li clave.")
      case spanish%
        wt_type("Buen sitio eligió el Gafopelao para esconder la llave.")
    end select
    end if
  end if

end sub

' ==============================================================
' Text output {{{1

sub type_para_in(this_color%,this_text$)
  local foreground%
  let foreground%=wt_foreground%
  let wt_foreground%=this_color%
  wt_type_para(this_text$) ' XXX TODO --
  let wt_foreground%=foreground%
end sub

sub type_in(this_color%,this_text$)
  local foreground%
  let foreground%=wt_foreground%
  let wt_foreground%=this_color%
  wt_type(this_text$) ' XXX TODO --
  let wt_foreground%=foreground%
end sub

sub problem(this_text$)
  type_para_in(red%,this_text$)
end sub

sub do_debug(this_text$)
  type_in(yellow%,"["+this_text$+"]")
end sub

sub debug(this_text$)
  if debugging% then
    do_debug(this_text$)
  end if
end sub

sub debug_pause(this_text$)
  if debugging% then
    do_debug(this_text$)
  end if
end sub

sub fatal_problem(this_text$)
  type_para_in(red%,"Internal error: "+this_text$)
end sub

' ==============================================================
' Info {{{1

sub credits

  wt_type("CE4 (v"+version$+")")
  wt_cr
  wt_type(copyright$)
  wt_cr

end sub

sub language_menu

  local lang%

  let output_language%=0

  wt_do_cr

  wt_type("1) ESPAÑOL:")
  ' wt.type("Pulsa la tecla «1» para jugar en español.")
  wt_type("Escribe «1» para jugar en español.") ' XXX TMP --
  wt_type("Podrás cambiar la lengua en cualquier momento durante el juego.")
  wt_do_cr
  wt_do_cr

  wt_type("2) ESPERANTO:")
  ' wt.type("Premu la klavon «2» por ludi en Esperanto.")
  wt_type("Tajpu «2» por ludi en Esperanto.") ' XXX TMP --
  wt_type("Vi povos ŝanĝi la lingvon iam ajn dum la ludo.")
  wt_do_cr
  wt_do_cr

  wt_type("3) INTERLINGUE:")
  ' wt.type("Presse li taste «3» por luder in Interlingue (Occidental).")
  wt_type("Tippa «3» por luder in Interlingue (Occidental).") ' XXX TMP --
  wt_type("Vu va posser changear li lingue alquande durante li lude.")
  wt_do_cr

  do

    let lang%=inkey(0)-asc("0")

    select lang%
      case 1:
        let input_language% = spanish%
        let output_language% = spanish%
      case 2:
        let input_language% = esperanto%
        let output_language% = esperanto%
      case 3:
        let input_language% = interlingue%
        let output_language% = interlingue%
    end select

  loop until output_language%

end sub

sub intro

  wt_clear

  select output_language%

    case esperanto%

      wt_type_para("Jam estas meznokto. Kia malvarmo.")

      wt_type_para("Krome, la Gafopelao abandonis vin.")
      wt_type("«Mi kaŝos la ŝlosilon en florpoton»,")
      wt_type("li diris hieraŭ al vi, subite, dum la ekzameno")
      wt_type("pri matematiko,")
      wt_type("tiele mallaŭte, kun sia")
      wt_type("...") ' XXX TODO --
      wt_type("«Sed poste mi diros, kiun mi elektis.")
      wt_type("Telefonu min je la vespermanĝa horo kaj mi diros».")

      wt_type("Nek vespermanĝe nek noktomanĝe:")

      ' XXX TODO --

      wt_type_para("Nun do vi mem devas trovi la ŝlosilon.")

    case interlingue%

      wt_type_para("It ja es demí-nocte. Quant frigore!")

      wt_type_para("Adplu vor amíco Gafopelao ha abandonat vos.")
      wt_type("«Yo va celar li clave intra un flor-pote»,")
      wt_type("li yer dit vos, sovente, durante li examination de matematica,")
      wt_type("talmen tre piani, con su")
      wt_type("chuchota de morient címice:") ' XXX TODO -- Translate Spanish "chicharra".
      wt_type("«Ma yo plu tard va dir vos to, quem yo selectet.")
      wt_type("Telefona me in li hora del colation e yo va dir it a vos».")

      ' XXX TODO --

      wt_type_para("Dunc nu vu self deve trovar li clave.")

    case spanish%

      wt_type_para("Ya es medianoche. Menudo frío que hace.")

      wt_type_para("Y para colmo el Gafopelao te ha dejado solo.")
      wt_type("«Esconderé la llave en un tiesto»,")
      wt_type("te dijo ayer, de repente, durante el examen de mates,")
      wt_type("así por lo bajito, con su")
      wt_type("susurro de chicharra moribunda:")
      wt_type("«Pero ya te diré cuál he elegido.")
      wt_type("Llámame a la hora de la merienda y te lo digo».")

      wt_type_para("Pues ni a la hora de la merienda ni a la hora de la cena:")
      wt_type("Lo has llamado varias veces")
      wt_type("pero nadie respondió el teléfono en su casa.")
      wt_type("Seguro que le ha explotado el cerebro")
      wt_type("y lo han llevado al ambulatorio.")
      wt_type("Pero no será por estudiar mates,")
      wt_type("sino por pasarse el día programando su computadora.")
      wt_type("Se lo has dicho un montón de veces:")
      wt_type("«Pon algún juego de vez en cuando, Gafopelao,")
      wt_type("que te va a estallar la cabeza».")

      wt_type_para("Ahora te va a tocar buscar la llave.")

  end select

  text_pause
  wt_clear

end sub

' ==============================================================
' Init {{{1

sub init_once

  ' Note: Called only once, before the first game.

  init_screen

  make_vocabulary
  make_entities
  make_map

  let record_hours%=0.25
  let best_player_name$="Lutherus" ' XXX TODO -- Change.

end sub

sub init_screen

  wt_init
  let wt_rows%=21 ' XXX TODO -- Calculate.
  let wt_cols%=73 ' XXX TODO -- Calculate.
  let wt_indentation%=2 ' spaces at the start of a paragraph's first line
  let wt_paragraph_separation%=0 ' blank lines between paragraphs
  wt_clear

end sub

sub init_game

  ' Init needed before every game.

  local digit%,this_entity%,this_location%

  randomize

  ' Locations

  dim visits%(entities%) ' visit counters

  ' Actions

  dim done%(actions%,entities%) ' XXX TODO -- not used yet

  ' The protagonist

  let location%(the_protagonist%)=between%(the_outside_0%,the_outside_3%)

  let previous_location%=0 ' XXX TODO -- Generalize for all characters.
  let banished%=false

  ' The guard

  let guard_met%=false ' XXX  not used yet

  do
    let location%(the_guard%)=between%(the_outside_0%,the_outside_3%)
  loop while is_here(the_guard%)

  ' Choose a random location for most entities

  for this_entity%=1 to entities%
    if is_portable%(this_entity%) and not is_pot(this_entity%) then
      do
        let this_location%=between%(first_location,last_location)
      loop while is_outside(this_location%)
      let location%(this_entity%)=this_location%
    end if
  next this_entity%

  ' Make sure some entities are in some locations

  let location%(the_book%)=the_library% ' XXX needed? could be set in the original data
  select between%(0,2)
    case 0
      let location%(the_flashlight%)=the_reception%
    case 1
      let location%(the_flashlight%)=the_classroom%
    case 2
      let location%(the_flashlight%)=the_junk_room%
  end select
  let location%(the_key%)=the_limbo%

  ' The safe

  let location%(the_safe%)=the_office%
  let the_safe_is_open%=false
  for digit%=1 to safe_code_digits%
    let safe_code$=safe_code$+random_digit$
  next digit%

  ' Plot

  let light%=true ' XXX TODO -- Rewrite all the related code.
  let key_pot%=between%(the_pot_0%,the_pot_3%)
  let location%(the_key%)=key_pot%
  let examined_pots=0 ' counter
  let last_pot%=0 ' last pot manipulated by the protagonist
  let last_corridor%=0 ' last corridor location mentioned by the protagonist
  let last_outside%=0 ' last outside location mentioned by the protagonist
  let exam_copied%=false ' XXX old
  let marks_modifed%=false ' XXX old

  let first_playing_hour=tim/1000

end sub

' ==============================================================
' Debug tools {{{1

sub show_map

  ' XXX FIXME -- The sub freezes after printing direction 5.

  debug("in show_map")
  local this_direction%,this_entity%,this_entity_exit%

  for this_entity%=1 to entities
    if is_location%(this_entity%) then
      debug("this_entity% ("+str$(this_entity%)+") is a location")
      wt_type_para("Exits of entity "+str$(this_entity%)+" ("+name(this_entity%)+"):")
      for this_direction%=1 to max_exits%
        wt_cr
        debug("this_direction%= "+str$(this_direction%))
        this_entity_exit%=exit_location%(this_entity%,this_direction%)
        debug("this_entity_exit%= "+str$(this_entity_exit%))
        if this_entity_exit% then
          wt_type_para("- "+str$(this_entity_exit%)+" ("+name(this_entity_exit%)+")")
        else
          debug("no exit")
        end if
      next this_direction%
      pause
    end if
  next this_entity%

end sub

sub show_words

  local n%
  for n%=1 to words%
    print n%," ";word$(n%)
  next n%

end sub

' vim: filetype=tbas
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
















































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted src/lib/wt.bas.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
' =============================================================
' wt

' wt ("wrapping text") is a text output module
' for tbas.

' Project homepage:
' <http://programandala.net/en.program.wt.html>

' Version 0.2.1-dev.6+201912070112
' (after Semantic Versioning: http://semver.org)
' See change log at the end of the file

' =============================================================
' Author and license

' Author: Marcos Cruz (programandala.net), 2012, 2013, 2014,
' 2016, 2017, 2018, 2019.

' You may do whatever you want with this work, so long as you
' retain all copyright, authorship and credit notices and this
' license in all redistributed copies and derived works.  There
' is no warranty.

' =============================================================
' Main {{{1

sub wt_init

  ' Init the constants and variables of the module.

  clear

  ' Internal variables:

  let wt_cols%=vdu 1
  let wt_rows%=vdu 2
  let wt_free_cols%=wt_cols%
  let wt_free_rows%=wt_rows%

  let wt_blank_row_str$=""
  for n%=1 to wt_cols%
    let wt_blank_row_str$=wt_blank_row_str$+" "
  next n%

  ' User variables:

  let wt_reversed%=false ' flag: reverse the colors?
  let wt_foreground%=vdu 155 ' current foreground color
  let wt_background%=vdu 156 ' current background color
  let wt_indentation%=2 ' spaces before paragraph's first char
  let wt_paragraph_separation%=0 ' lines between paragraphs

  wt_home

end sub
  
sub wt_home

  ' Set the cursor at the top left position.

  print tab(0,0)
  let wt_free_cols%=wt_cols%
  let wt_free_rows%=wt_rows%

end sub

sub wt_clear

  ' Clear the screen.

  clear
  wt_home

end sub

sub wt_wipe

  ' Wipe the screen with the current color.

  local row%

  print tab(0,0)
  for row%=1 to wt_rows%
    wt_type_raw(blank_row$)
  next row%
  wt_home

end sub

sub wt_at_first_col

  ' Is the cursor at the first column?

  return wt_free_cols%=wt_cols%
end sub

sub wt_after_last_col

  ' Is the cursor after the last column?

  return (wt_free_cols%=0)
end sub

sub wt_at_first_row

  ' Is the cursor at the first row?

  return (wt_free_rows%=wt_rows%)
end sub

sub wt_at_home

  ' Is the cursor at the home position?

  return (wt_at_first_row and wt_at_first_col)
end sub

sub wt_do_cr

  ' Do a carriage return.

  print
  let wt_free_cols%=wt_cols%
  let wt_free_rows%=wt_free_rows%-1

end sub

sub wt_cr

  ' Do a carriage return, if needed.

  if wt_at_first_col then exit sub
  if wt_after_last_col then exit sub
  wt_do_cr

end sub

sub wt_type_raw(text$)

  ' Type raw text in the current colors, without updating any
  ' variables.

  if wt_reversed% then
    colour of wt_background% on wt_foreground%
  else
    colour of wt_foreground% on wt_background%
  end if
  print text$;

end sub

sub wt_type_line(text$)

  ' Print a text at the current cursor position; the text is
  ' not longer than the free space of the current row.

  wt_type_raw(text$)
  let wt_free_cols%=wt_free_cols%-len(text$)

end sub

sub wt_indent

  ' Do a carriage return and indent.

  wt_cr
  if not wt_at_home then
    wt_type_line(left$("        ",max(wt_indentation%,0)))
  end if

end sub

sub wt_type(text$)

  ' Print a text from the current cursor position.
  '
  ' Known issue: By design, all words of the text are supposed
  ' to be shorter than one row... In practice this is not a
  ' problem.

  local word%,words%,split_text$()

  dim split_text$(200) ' XXX TODO -- size
  let words%=split(text$," ",split_text$())

  for word%=0 to words%-1
    ' if wt_free_cols% and wt_free_cols%<len(split_text$(word%)) then
    if wt_free_cols%<len(split_text$(word%)) then
      wt_do_cr
    end if

    wt_type_line(split_text$(word%))
    if wt_free_cols% then
      wt_type_line(" ")
      if wt_free_cols%<0 then
        let wt_free_cols%=wt_cols%+wt_free_cols%
        let wt_free_rows%=wt_free_rows%-1
      end if
    end if
  next word%

end sub

sub wt_type_para(text$)

  ' Print a text on a new paragraph.

  local i%

  if not wt_at_home then
    for i%=1 to wt_paragraph_separation%+1
      wt_do_cr
    next i%
    wt_indent
  end if
  wt_type(text$)

end sub

' =============================================================
' Change log {{{2

' 2019-12-06: Start from the code of the current Matrix Brandy version
' of wt: 0.2.1-dev.6.

' vim: filetype=tbas
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<