1
<HTML><HEAD><TITLE>Answer to Exercise 8</TITLE></HEAD>
2
<BODY BGCOLOR="#FFFFFF">
3
<TABLE><TR><TD Valign="top"><IMG SRC="../icons/exercise.gif" ALT="??"><TD bgcolor="#FAA89B"><B>ANSWER TO EXERCISE 8</B><TR><TD><TD>
6
This is a prime candidate for using variable strings
7
<TT>@nn</TT>. Briefly: at the head of the source, define
9
Lowstring east_str "east"; Lowstring west_str "west";
12
and then add two more routines to the game,
14
[ NormalWorld; String 0 east_str; String 1 west_str; ];
15
[ ReversedWorld; String 0 west_str; String 1 east_str; ];
18
where <TT>NormalWorld</TT> is called in <TT>Initialise</TT> or to go back to
19
normal, and <TT>ReversedWorld</TT> when the reflection happens. Write
20
<TT>@00</TT> in place of <TT>east</TT> in any double-quoted printable string,
21
and similarly <TT>@01</TT> for <TT>west</TT>. It will be printed as whichever
22
is currently set. (Inform provides up to 32 such variable strings.)
24
<HR>Back to <A HREF="../section10.html#ex8">the exercise in section 10</A><HR>
25
<SMALL><I>Mechanically translated to HTML from third edition as revised 16 May 1997. Copyright © Graham Nelson 1993, 1994, 1995, 1996, 1997: all rights reserved.</I></SMALL></BODY></HTML>