// Copyright Neil Ramsden 2005-2006. All rights reserved.

// Doubling <f>, <l>, <s> or <z> checker flowchart definition
// Neil Ramsden
// double.js
// 28 Dec 05 -> 27 Feb 05

//---------------------------------------------------------------------------

/* Global variables
*/

//string constants

var /*const*/ _flsz = '&lt;f&gt;, &lt;l&gt;, &lt;s&gt; or &lt;z&gt;'

//advice constants

var /*const*/ _double = new Advice('double the ' + _flsz);
var /*const*/ _no_double = new Advice('don\'t double the ' + _flsz);

//flow chart

var /*const*/ flowChart = new Choice(
    [
      { text: 'the word has only one vowel letter',
        action: new Choice(
        [

          /*intervening letter
          */
          { text: 'there is a letter between that vowel and the final ' + _flsz,
            action: _no_double
          },

          /*final letter <f>
          */
          { text: 'the final letter is &lt;f&gt;',
            action: new Choice(
            [
              { text: 'the final &lt;f&gt; sounds like /v/',
                action: _no_double
              },
              { text: 'the word is &lt;if&gt;',
                action: _no_double
              },
              { text: 'the final &lt;f&gt; doesn\'t sound like /v/ and the word isn\'t &lt;if&gt;',
                action: _double
              }
            ])
          },

          /*final letter <s>
          */
          { text: 'the final letter is &lt;s&gt;',
            action: new Choice(
            [
              { text: 'the final &lt;s&gt; sounds like /z/',
                action: _no_double
              },
              { text: 'it\'s in this list:<ul><li>this</li><li>us</li><li>bus</li><li>gas</li></ul>',
                action: _no_double
              },
              { text: 'the final &lt;s&gt; doesn\'t sound like /z/ and the word isn\'t in this list',
                action: _double
              }
            ])
          },

          /*final letter <l>
          */
          { text: 'the final letter is &lt;l&gt;',
            action: _double
          },

          /*final letter <z>
          */
          { text: 'the final letter is &lt;z&gt;',
            action: new Choice(
            [
              { text: 'the word is &lt;quiz&gt;',
                action: _no_double
              },
              { text: 'the word isn\'t &lt;quiz&gt;',
                action: _double
              }
            ])
          }

        ])
      },

      { text: 'the word has more than one vowel',
        action: _no_double
      }

    ]);

