'#!/usr/bin/env newlisp' Comment.Preproc
'\n'          Text.Whitespace

';; @module reversi.lsp' Comment.Single
'\n'          Text.Whitespace

';; @description a simple version of Reversi: you as white against newLISP as black' Comment.Single
'\n'          Text.Whitespace

';; @version 0.1 alpha August 2007' Comment.Single
'\n'          Text.Whitespace

';; @author cormullion' Comment.Single
'\n'          Text.Whitespace

';;'          Comment.Single
'\n'          Text.Whitespace

';; 2008-10-08 21:46:54' Comment.Single
'\n'          Text.Whitespace

';; updated for newLISP version 10. (changed nth-set to setf)' Comment.Single
'\n'          Text.Whitespace

';; this now does not work with newLISP version 9!' Comment.Single
'\n'          Text.Whitespace

';;'          Comment.Single
'\n'          Text.Whitespace

';; This is my first attempt at writing a simple application using newLISP-GS.' Comment.Single
'\n'          Text.Whitespace

';; The game algorithms are basically by ' Comment.Single
'\n'          Text.Whitespace

';; Peter Norvig http://norvig.com/paip/othello.lisp' Comment.Single
'\n'          Text.Whitespace

";; and all I've done is translate to newLISP and add the interface..." Comment.Single
'\n'          Text.Whitespace

';;'          Comment.Single
'\n'          Text.Whitespace

';; To-Do: work out how to handle the end of the game properly...' Comment.Single
'\n'          Text.Whitespace

';; To-Do: complete newlispdoc for the functions' Comment.Single
'\n\n'        Text.Whitespace

'('           Punctuation
'constant'    Keyword
' '           Text.Whitespace
"'"           Operator
'empty'       Literal.String.Symbol
' '           Text.Whitespace
'0'           Literal.String.Symbol
')'           Punctuation
' \n'         Text.Whitespace

'('           Punctuation
'constant'    Keyword
' '           Text.Whitespace
"'"           Operator
'black'       Literal.String.Symbol
' '           Text.Whitespace
'1'           Literal.String.Symbol
')'           Punctuation
' \n'         Text.Whitespace

'('           Punctuation
'constant'    Keyword
' '           Text.Whitespace
"'"           Operator
'white'       Literal.String.Symbol
' '           Text.Whitespace
'2'           Literal.String.Symbol
')'           Punctuation
'\n'          Text.Whitespace

'('           Punctuation
'constant'    Keyword
' '           Text.Whitespace
"'"           Operator
'outer'       Literal.String.Symbol
' '           Text.Whitespace
'3'           Literal.String.Symbol
')'           Punctuation
' '           Text.Whitespace
'; squares outside the 8x8 board' Comment.Single
'\n\n'        Text.Whitespace

'('           Punctuation
'set'         Keyword
' '           Text.Whitespace
"'"           Operator
'*'           Keyword
'board*'      Literal.String.Symbol
' '           Text.Whitespace
"'"           Operator
'('           Punctuation
')'           Punctuation
')'           Punctuation
' '           Text.Whitespace
'; the master board is a 100 element list' Comment.Single
'\n'          Text.Whitespace

'('           Punctuation
'set'         Keyword
' '           Text.Whitespace
"'"           Operator
'*'           Keyword
'moves*'      Literal.String.Symbol
' '           Text.Whitespace
"'"           Operator
'('           Punctuation
')'           Punctuation
')'           Punctuation
' '           Text.Whitespace
'; list of moves made' Comment.Single
'\n\n'        Text.Whitespace

'; these are the 8 different directions from a square on the board' Comment.Single
'\n\n'        Text.Whitespace

'('           Punctuation
'set'         Keyword
' '           Text.Whitespace
"'"           Operator
'all-directions' Literal.String.Symbol
' '           Text.Whitespace
"'"           Operator
'('           Punctuation
'-'           Keyword
'11'          Literal.String.Symbol
' '           Text.Whitespace
'-'           Keyword
'10'          Literal.String.Symbol
' '           Text.Whitespace
'-'           Keyword
'9'           Literal.String.Symbol
' '           Text.Whitespace
'-'           Keyword
'1'           Literal.String.Symbol
' '           Text.Whitespace
'1'           Literal.String.Symbol
' '           Text.Whitespace
'9'           Literal.String.Symbol
' '           Text.Whitespace
'10'          Literal.String.Symbol
' '           Text.Whitespace
'11'          Literal.String.Symbol
')'           Punctuation
')'           Punctuation
'\n\n'        Text.Whitespace

'; return a list of all the playable squares (the 8 by 8 grid inside the 10by10' Comment.Single
'\n\n'        Text.Whitespace

'('           Punctuation
'define'      Keyword
' '           Text.Whitespace
'('           Punctuation
'all-squares' Name.Variable
')'           Punctuation
'\n  '        Text.Whitespace
'('           Punctuation
'local'       Keyword
' '           Text.Whitespace
'('           Punctuation
'result'      Name.Variable
')'           Punctuation
'\n     '     Text.Whitespace
'('           Punctuation
'for'         Keyword
' '           Text.Whitespace
'('           Punctuation
'square'      Name.Variable
' '           Text.Whitespace
'11'          Literal.String.Symbol
' '           Text.Whitespace
'88'          Literal.String.Symbol
')'           Punctuation
'\n        '  Text.Whitespace
'('           Punctuation
'if'          Keyword
' '           Text.Whitespace
'('           Punctuation
'<='          Name.Variable
' '           Text.Whitespace
'1'           Literal.String.Symbol
' '           Text.Whitespace
'('           Punctuation
'mod'         Keyword
' '           Text.Whitespace
'square'      Literal.String.Symbol
' '           Text.Whitespace
'10'          Literal.String.Symbol
')'           Punctuation
' '           Text.Whitespace
'8'           Literal.String.Symbol
')'           Punctuation
'\n           ' Text.Whitespace
'('           Punctuation
'push'        Keyword
' '           Text.Whitespace
'square'      Literal.String.Symbol
' '           Text.Whitespace
'result'      Literal.String.Symbol
' '           Text.Whitespace
'-'           Keyword
'1'           Literal.String.Symbol
')'           Punctuation
')'           Punctuation
')'           Punctuation
'\n'          Text.Whitespace

'result'      Literal.String.Symbol
')'           Punctuation
')'           Punctuation
'\n\n'        Text.Whitespace

'; make a board' Comment.Single
'\n\n'        Text.Whitespace

'('           Punctuation
'define'      Keyword
' '           Text.Whitespace
'('           Punctuation
'make-board'  Name.Variable
')'           Punctuation
'\n  '        Text.Whitespace
'('           Punctuation
'set'         Keyword
' '           Text.Whitespace
"'"           Operator
'*'           Keyword
'board*'      Literal.String.Symbol
' '           Text.Whitespace
'('           Punctuation
'dup'         Keyword
' '           Text.Whitespace
'outer'       Literal.String.Symbol
' '           Text.Whitespace
'100'         Literal.String.Symbol
')'           Punctuation
')'           Punctuation
'\n  '        Text.Whitespace
'('           Punctuation
'dolist'      Keyword
' '           Text.Whitespace
'('           Punctuation
's'           Name.Variable
' '           Text.Whitespace
'('           Punctuation
'all-squares' Name.Variable
')'           Punctuation
')'           Punctuation
'\n     '     Text.Whitespace
'('           Punctuation
'setf'        Keyword
' '           Text.Whitespace
'('           Punctuation
'*'           Keyword
'board*'      Literal.String.Symbol
' '           Text.Whitespace
's'           Literal.String.Symbol
')'           Punctuation
' '           Text.Whitespace
'empty'       Literal.String.Symbol
')'           Punctuation
')'           Punctuation
')'           Punctuation
'\n\n'        Text.Whitespace

'; for testing and working at a terminal' Comment.Single
'\n\n'        Text.Whitespace

'('           Punctuation
'define'      Keyword
' '           Text.Whitespace
'('           Punctuation
'print'       Keyword
'-'           Keyword
'board'       Literal.String.Symbol
')'           Punctuation
'\n  '        Text.Whitespace
'('           Punctuation
'print'       Keyword
' '           Text.Whitespace
'{'           Literal.String
' '           Literal.String
'}'           Literal.String
')'           Punctuation
'\n  '        Text.Whitespace
'('           Punctuation
'for'         Keyword
' '           Text.Whitespace
'('           Punctuation
'c'           Name.Variable
' '           Text.Whitespace
'1'           Literal.String.Symbol
' '           Text.Whitespace
'8'           Literal.String.Symbol
')'           Punctuation
'\n     '     Text.Whitespace
'('           Punctuation
'print'       Keyword
' '           Text.Whitespace
'c'           Literal.String.Symbol
')'           Punctuation
')'           Punctuation
'\n  '        Text.Whitespace
'('           Punctuation
'set'         Keyword
' '           Text.Whitespace
"'"           Operator
'c'           Literal.String.Symbol
' '           Text.Whitespace
'0'           Literal.String.Symbol
')'           Punctuation
'\n  '        Text.Whitespace
'('           Punctuation
'for'         Keyword
' '           Text.Whitespace
'('           Punctuation
'i'           Name.Variable
' '           Text.Whitespace
'0'           Literal.String.Symbol
' '           Text.Whitespace
'99'          Literal.String.Symbol
')'           Punctuation
'\n     '     Text.Whitespace
'('           Punctuation
'cond'        Keyword
'\n        '  Text.Whitespace
'('           Punctuation
'('           Punctuation
'='           Name.Variable
' '           Text.Whitespace
'('           Punctuation
'*'           Keyword
'board*'      Literal.String.Symbol
' '           Text.Whitespace
'i'           Literal.String.Symbol
')'           Punctuation
' '           Text.Whitespace
'0'           Literal.String.Symbol
')'           Punctuation
' '           Text.Whitespace
'('           Punctuation
'print'       Keyword
' '           Text.Whitespace
'{'           Literal.String
'.'           Literal.String
'}'           Literal.String
')'           Punctuation
')'           Punctuation
'\n        '  Text.Whitespace
'('           Punctuation
'('           Punctuation
'='           Name.Variable
' '           Text.Whitespace
'('           Punctuation
'*'           Keyword
'board*'      Literal.String.Symbol
' '           Text.Whitespace
'i'           Literal.String.Symbol
')'           Punctuation
' '           Text.Whitespace
'1'           Literal.String.Symbol
')'           Punctuation
' '           Text.Whitespace
'('           Punctuation
'print'       Keyword
' '           Text.Whitespace
'{'           Literal.String
'b'           Literal.String
'}'           Literal.String
')'           Punctuation
')'           Punctuation
'\n        '  Text.Whitespace
'('           Punctuation
'('           Punctuation
'='           Name.Variable
' '           Text.Whitespace
'('           Punctuation
'*'           Keyword
'board*'      Literal.String.Symbol
' '           Text.Whitespace
'i'           Literal.String.Symbol
')'           Punctuation
' '           Text.Whitespace
'2'           Literal.String.Symbol
')'           Punctuation
' '           Text.Whitespace
'('           Punctuation
'print'       Keyword
' '           Text.Whitespace
'{'           Literal.String
'w'           Literal.String
'}'           Literal.String
')'           Punctuation
')'           Punctuation
')'           Punctuation
'\n     '     Text.Whitespace
'('           Punctuation
'if'          Keyword
' '           Text.Whitespace
'('           Punctuation
'and'         Keyword
' '           Text.Whitespace
'('           Punctuation
'<='          Name.Variable
' '           Text.Whitespace
'i'           Literal.String.Symbol
' '           Text.Whitespace
'88'          Literal.String.Symbol
')'           Punctuation
' '           Text.Whitespace
'('           Punctuation
'='           Name.Variable
' '           Text.Whitespace
'('           Punctuation
'mod'         Keyword
' '           Text.Whitespace
'('           Punctuation
'+'           Name.Variable
' '           Text.Whitespace
'i'           Literal.String.Symbol
' '           Text.Whitespace
'1'           Literal.String.Symbol
')'           Punctuation
' '           Text.Whitespace
'10'          Literal.String.Symbol
')'           Punctuation
' '           Text.Whitespace
'0'           Literal.String.Symbol
')'           Punctuation
')'           Punctuation
' '           Text.Whitespace
'; newline'   Comment.Single
'\n        '  Text.Whitespace
'('           Punctuation
'print'       Keyword
' '           Text.Whitespace
'"\\n"'       Literal.String
' '           Text.Whitespace
'('           Punctuation
'inc'         Keyword
' '           Text.Whitespace
'c'           Literal.String.Symbol
')'           Punctuation
')'           Punctuation
')'           Punctuation
')'           Punctuation
'\n  '        Text.Whitespace
'('           Punctuation
'println'     Keyword
' '           Text.Whitespace
'"\\n"'       Literal.String
')'           Punctuation
')'           Punctuation
'\n\n'        Text.Whitespace

'; the initial starting pattern' Comment.Single
'\n\n'        Text.Whitespace

'('           Punctuation
'define'      Keyword
' '           Text.Whitespace
'('           Punctuation
'initial-board' Name.Variable
')'           Punctuation
'\n  '        Text.Whitespace
'('           Punctuation
'make-board'  Name.Variable
')'           Punctuation
'\n  '        Text.Whitespace
'('           Punctuation
'setf'        Keyword
' '           Text.Whitespace
'('           Punctuation
'*'           Keyword
'board*'      Literal.String.Symbol
' '           Text.Whitespace
'44'          Literal.String.Symbol
')'           Punctuation
' '           Text.Whitespace
'white'       Literal.String.Symbol
')'           Punctuation
'\n  '        Text.Whitespace
'('           Punctuation
'setf'        Keyword
' '           Text.Whitespace
'('           Punctuation
'*'           Keyword
'board*'      Literal.String.Symbol
' '           Text.Whitespace
'55'          Literal.String.Symbol
')'           Punctuation
' '           Text.Whitespace
'white'       Literal.String.Symbol
')'           Punctuation
'\n  '        Text.Whitespace
'('           Punctuation
'setf'        Keyword
' '           Text.Whitespace
'('           Punctuation
'*'           Keyword
'board*'      Literal.String.Symbol
' '           Text.Whitespace
'45'          Literal.String.Symbol
')'           Punctuation
' '           Text.Whitespace
'black'       Literal.String.Symbol
')'           Punctuation
'\n  '        Text.Whitespace
'('           Punctuation
'setf'        Keyword
' '           Text.Whitespace
'('           Punctuation
'*'           Keyword
'board*'      Literal.String.Symbol
' '           Text.Whitespace
'54'          Literal.String.Symbol
')'           Punctuation
' '           Text.Whitespace
'black'       Literal.String.Symbol
')'           Punctuation
')'           Punctuation
'\n\n'        Text.Whitespace

'('           Punctuation
'define'      Keyword
' '           Text.Whitespace
'('           Punctuation
'opponent'    Name.Variable
' '           Text.Whitespace
'player'      Literal.String.Symbol
')'           Punctuation
'\n  '        Text.Whitespace
'('           Punctuation
'if'          Keyword
' '           Text.Whitespace
'('           Punctuation
'='           Name.Variable
' '           Text.Whitespace
'player'      Literal.String.Symbol
' '           Text.Whitespace
'black'       Literal.String.Symbol
')'           Punctuation
' '           Text.Whitespace
'white'       Literal.String.Symbol
' '           Text.Whitespace
'black'       Literal.String.Symbol
')'           Punctuation
')'           Punctuation
'\n\n'        Text.Whitespace

'('           Punctuation
'define'      Keyword
' '           Text.Whitespace
'('           Punctuation
'player-name' Name.Variable
' '           Text.Whitespace
'player'      Literal.String.Symbol
')'           Punctuation
'\n  '        Text.Whitespace
'('           Punctuation
'if'          Keyword
' '           Text.Whitespace
'('           Punctuation
'='           Name.Variable
' '           Text.Whitespace
'player'      Literal.String.Symbol
' '           Text.Whitespace
'white'       Literal.String.Symbol
')'           Punctuation
' '           Text.Whitespace
'"white"'     Literal.String
' '           Text.Whitespace
'"black"'     Literal.String
')'           Punctuation
')'           Punctuation
'\n  \n'      Text.Whitespace

'('           Punctuation
'define'      Keyword
' '           Text.Whitespace
'('           Punctuation
'valid-move?' Name.Variable
' '           Text.Whitespace
'move'        Literal.String.Symbol
')'           Punctuation
'\n  '        Text.Whitespace
'('           Punctuation
'and'         Keyword
' \n     '    Text.Whitespace
'('           Punctuation
'integer'     Keyword
'?'           Literal.String.Symbol
' '           Text.Whitespace
'move'        Literal.String.Symbol
')'           Punctuation
'\n     '     Text.Whitespace
'('           Punctuation
'<='          Name.Variable
' '           Text.Whitespace
'11'          Literal.String.Symbol
' '           Text.Whitespace
'move'        Literal.String.Symbol
' '           Text.Whitespace
'88'          Literal.String.Symbol
')'           Punctuation
'\n     '     Text.Whitespace
'('           Punctuation
'<='          Name.Variable
' '           Text.Whitespace
'1'           Literal.String.Symbol
' '           Text.Whitespace
'('           Punctuation
'mod'         Keyword
' '           Text.Whitespace
'move'        Literal.String.Symbol
' '           Text.Whitespace
'10'          Literal.String.Symbol
')'           Punctuation
' '           Text.Whitespace
'8'           Literal.String.Symbol
')'           Punctuation
')'           Punctuation
')'           Punctuation
'\n\n'        Text.Whitespace

'('           Punctuation
'define'      Keyword
' '           Text.Whitespace
'('           Punctuation
'empty-square?' Name.Variable
' '           Text.Whitespace
'square'      Literal.String.Symbol
')'           Punctuation
'\n  '        Text.Whitespace
'('           Punctuation
'and'         Keyword
'\n     '     Text.Whitespace
'('           Punctuation
'valid-move?' Name.Variable
' '           Text.Whitespace
'square'      Literal.String.Symbol
')'           Punctuation
'\n     '     Text.Whitespace
'('           Punctuation
'='           Name.Variable
' '           Text.Whitespace
'('           Punctuation
'*'           Keyword
'board*'      Literal.String.Symbol
' '           Text.Whitespace
'square'      Literal.String.Symbol
')'           Punctuation
' '           Text.Whitespace
'empty'       Literal.String.Symbol
')'           Punctuation
')'           Punctuation
')'           Punctuation
'\n     \n'   Text.Whitespace

'; test whether a move is legal. The square must be empty' Comment.Single
'\n'          Text.Whitespace

"; and it must flip at least one of the opponent's piece" Comment.Single
'\n\n'        Text.Whitespace

'('           Punctuation
'define'      Keyword
' '           Text.Whitespace
'('           Punctuation
'legal-move?' Name.Variable
' '           Text.Whitespace
'move'        Literal.String.Symbol
' '           Text.Whitespace
'player'      Literal.String.Symbol
')'           Punctuation
'\n  '        Text.Whitespace
'('           Punctuation
'and'         Keyword
' \n     '    Text.Whitespace
'('           Punctuation
'empty-square?' Name.Variable
' '           Text.Whitespace
'move'        Literal.String.Symbol
')'           Punctuation
'\n     '     Text.Whitespace
'('           Punctuation
'exists'      Keyword
' '           Text.Whitespace
'('           Punctuation
'fn'          Keyword
' '           Text.Whitespace
'('           Punctuation
'dir'         Name.Variable
')'           Punctuation
' '           Text.Whitespace
'('           Punctuation
'would-flip?' Name.Variable
' '           Text.Whitespace
'move'        Literal.String.Symbol
' '           Text.Whitespace
'player'      Literal.String.Symbol
' '           Text.Whitespace
'dir'         Literal.String.Symbol
')'           Punctuation
')'           Punctuation
' '           Text.Whitespace
'all-directions' Literal.String.Symbol
')'           Punctuation
')'           Punctuation
')'           Punctuation
'\n\n'        Text.Whitespace

'; would this move by player result in any flips in the given direction?' Comment.Single
'\n'          Text.Whitespace

"; if so, return the number of the 'opposite' (bracketing) piece's square" Comment.Single
'\n\n'        Text.Whitespace

'('           Punctuation
'define'      Keyword
' '           Text.Whitespace
'('           Punctuation
'would-flip?' Name.Variable
' '           Text.Whitespace
'move'        Literal.String.Symbol
' '           Text.Whitespace
'player'      Literal.String.Symbol
' '           Text.Whitespace
'dir'         Literal.String.Symbol
')'           Punctuation
' \n  '       Text.Whitespace
'('           Punctuation
'let'         Keyword
' \n     '    Text.Whitespace
'('           Punctuation
'('           Punctuation
'c'           Name.Variable
' '           Text.Whitespace
'('           Punctuation
'+'           Name.Variable
' '           Text.Whitespace
'move'        Literal.String.Symbol
' '           Text.Whitespace
'dir'         Literal.String.Symbol
')'           Punctuation
')'           Punctuation
')'           Punctuation
'\n     '     Text.Whitespace
'('           Punctuation
'and'         Keyword
' \n        ' Text.Whitespace
'('           Punctuation
'='           Name.Variable
' '           Text.Whitespace
'('           Punctuation
'*'           Keyword
'board*'      Literal.String.Symbol
' '           Text.Whitespace
'c'           Literal.String.Symbol
')'           Punctuation
' '           Text.Whitespace
'('           Punctuation
'opponent'    Name.Variable
' '           Text.Whitespace
'player'      Literal.String.Symbol
')'           Punctuation
')'           Punctuation
'\n        '  Text.Whitespace
'('           Punctuation
'find'        Keyword
'-'           Keyword
'bracketing-piece' Literal.String.Symbol
' '           Text.Whitespace
'('           Punctuation
'+'           Name.Variable
' '           Text.Whitespace
'c'           Literal.String.Symbol
' '           Text.Whitespace
'dir'         Literal.String.Symbol
')'           Punctuation
' '           Text.Whitespace
'player'      Literal.String.Symbol
' '           Text.Whitespace
'dir'         Literal.String.Symbol
')'           Punctuation
')'           Punctuation
')'           Punctuation
')'           Punctuation
'\n  \n'      Text.Whitespace

'('           Punctuation
'define'      Keyword
' '           Text.Whitespace
'('           Punctuation
'find'        Keyword
'-'           Keyword
'bracketing-piece' Literal.String.Symbol
' '           Text.Whitespace
'square'      Literal.String.Symbol
' '           Text.Whitespace
'player'      Literal.String.Symbol
' '           Text.Whitespace
'dir'         Literal.String.Symbol
')'           Punctuation
'\n  '        Text.Whitespace
'; return the square of the bracketing piece, if any' Comment.Single
'\n  '        Text.Whitespace
'('           Punctuation
'cond'        Keyword
'\n     '     Text.Whitespace
'('           Punctuation
'('           Punctuation
'='           Name.Variable
' '           Text.Whitespace
'('           Punctuation
'*'           Keyword
'board*'      Literal.String.Symbol
' '           Text.Whitespace
'square'      Literal.String.Symbol
')'           Punctuation
' '           Text.Whitespace
'player'      Literal.String.Symbol
')'           Punctuation
' '           Text.Whitespace
'square'      Literal.String.Symbol
')'           Punctuation
'\n     '     Text.Whitespace
'('           Punctuation
'('           Punctuation
'='           Name.Variable
' '           Text.Whitespace
'('           Punctuation
'*'           Keyword
'board*'      Literal.String.Symbol
' '           Text.Whitespace
'square'      Literal.String.Symbol
')'           Punctuation
' '           Text.Whitespace
'('           Punctuation
'opponent'    Name.Variable
' '           Text.Whitespace
'player'      Literal.String.Symbol
')'           Punctuation
')'           Punctuation
'\n        '  Text.Whitespace
'('           Punctuation
'find'        Keyword
'-'           Keyword
'bracketing-piece' Literal.String.Symbol
' '           Text.Whitespace
'('           Punctuation
'+'           Name.Variable
' '           Text.Whitespace
'square'      Literal.String.Symbol
' '           Text.Whitespace
'dir'         Literal.String.Symbol
')'           Punctuation
' '           Text.Whitespace
'player'      Literal.String.Symbol
' '           Text.Whitespace
'dir'         Literal.String.Symbol
')'           Punctuation
')'           Punctuation
'\n     '     Text.Whitespace
'('           Punctuation
'true'        Keyword
' '           Text.Whitespace
'nil'         Keyword
')'           Punctuation
')'           Punctuation
')'           Punctuation
'\n\n'        Text.Whitespace

'('           Punctuation
'define'      Keyword
' '           Text.Whitespace
'('           Punctuation
'make-flips'  Name.Variable
' '           Text.Whitespace
'move'        Literal.String.Symbol
' '           Text.Whitespace
'player'      Literal.String.Symbol
' '           Text.Whitespace
'dir'         Literal.String.Symbol
')'           Punctuation
'\n  '        Text.Whitespace
'('           Punctuation
'let'         Keyword
' \n     '    Text.Whitespace
'('           Punctuation
'('           Punctuation
'bracketer'   Name.Variable
' '           Text.Whitespace
'('           Punctuation
'would-flip?' Name.Variable
' '           Text.Whitespace
'move'        Literal.String.Symbol
' '           Text.Whitespace
'player'      Literal.String.Symbol
' '           Text.Whitespace
'dir'         Literal.String.Symbol
')'           Punctuation
')'           Punctuation
'\n      '    Text.Whitespace
'('           Punctuation
'c'           Name.Variable
' '           Text.Whitespace
'('           Punctuation
'+'           Name.Variable
' '           Text.Whitespace
'move'        Literal.String.Symbol
' '           Text.Whitespace
'dir'         Literal.String.Symbol
')'           Punctuation
')'           Punctuation
')'           Punctuation
'\n  '        Text.Whitespace
'('           Punctuation
'if'          Keyword
' '           Text.Whitespace
'bracketer'   Literal.String.Symbol
'\n     '     Text.Whitespace
'('           Punctuation
'do-until'    Keyword
' '           Text.Whitespace
'('           Punctuation
'='           Name.Variable
' '           Text.Whitespace
'c'           Literal.String.Symbol
' '           Text.Whitespace
'bracketer'   Literal.String.Symbol
')'           Punctuation
'\n        '  Text.Whitespace
'('           Punctuation
'setf'        Keyword
' '           Text.Whitespace
'('           Punctuation
'*'           Keyword
'board*'      Literal.String.Symbol
' '           Text.Whitespace
'c'           Literal.String.Symbol
')'           Punctuation
' '           Text.Whitespace
'player'      Literal.String.Symbol
')'           Punctuation
'\n        '  Text.Whitespace
'('           Punctuation
'push'        Keyword
' '           Text.Whitespace
'c'           Literal.String.Symbol
' '           Text.Whitespace
'*'           Keyword
'flips*'      Literal.String.Symbol
' '           Text.Whitespace
'-'           Keyword
'1'           Literal.String.Symbol
')'           Punctuation
'\n        '  Text.Whitespace
'('           Punctuation
'inc'         Keyword
' '           Text.Whitespace
'c'           Literal.String.Symbol
' '           Text.Whitespace
'dir'         Literal.String.Symbol
')'           Punctuation
')'           Punctuation
')'           Punctuation
')'           Punctuation
')'           Punctuation
'\n\n'        Text.Whitespace

'; make the move on the master game board, not yet visually' Comment.Single
'\n\n'        Text.Whitespace

'('           Punctuation
'define'      Keyword
' '           Text.Whitespace
'('           Punctuation
'make-move'   Name.Variable
' '           Text.Whitespace
'move'        Literal.String.Symbol
' '           Text.Whitespace
'player'      Literal.String.Symbol
')'           Punctuation
'\n  '        Text.Whitespace
'('           Punctuation
'setf'        Keyword
' '           Text.Whitespace
'('           Punctuation
'*'           Keyword
'board*'      Literal.String.Symbol
' '           Text.Whitespace
'move'        Literal.String.Symbol
')'           Punctuation
' '           Text.Whitespace
'player'      Literal.String.Symbol
')'           Punctuation
'\n  '        Text.Whitespace
'('           Punctuation
'push'        Keyword
' '           Text.Whitespace
'move'        Literal.String.Symbol
' '           Text.Whitespace
'*'           Keyword
'moves*'      Literal.String.Symbol
' '           Text.Whitespace
'-'           Keyword
'1'           Literal.String.Symbol
')'           Punctuation
'\n  '        Text.Whitespace
'('           Punctuation
'set'         Keyword
' '           Text.Whitespace
"'"           Operator
'*'           Keyword
'flips*'      Literal.String.Symbol
' '           Text.Whitespace
"'"           Operator
'('           Punctuation
')'           Punctuation
')'           Punctuation
' '           Text.Whitespace
"; we're going to keep a record of the flips made" Comment.Single
'\n  '        Text.Whitespace
'('           Punctuation
'dolist'      Keyword
' '           Text.Whitespace
'('           Punctuation
'dir'         Name.Variable
' '           Text.Whitespace
'all-directions' Literal.String.Symbol
')'           Punctuation
'\n     '     Text.Whitespace
'('           Punctuation
'make-flips'  Name.Variable
' '           Text.Whitespace
'move'        Literal.String.Symbol
' '           Text.Whitespace
'player'      Literal.String.Symbol
' '           Text.Whitespace
'dir'         Literal.String.Symbol
')'           Punctuation
')'           Punctuation
')'           Punctuation
'\n\n'        Text.Whitespace

'('           Punctuation
'define'      Keyword
' '           Text.Whitespace
'('           Punctuation
'next-to-play' Name.Variable
' '           Text.Whitespace
'previous-player' Literal.String.Symbol
')'           Punctuation
'\n  '        Text.Whitespace
'('           Punctuation
'let'         Keyword
' '           Text.Whitespace
'('           Punctuation
'('           Punctuation
'opp'         Name.Variable
' '           Text.Whitespace
'('           Punctuation
'opponent'    Name.Variable
' '           Text.Whitespace
'previous-player' Literal.String.Symbol
')'           Punctuation
')'           Punctuation
')'           Punctuation
'\n     '     Text.Whitespace
'('           Punctuation
'cond'        Keyword
'\n        '  Text.Whitespace
'('           Punctuation
'('           Punctuation
'any-legal-move?' Name.Variable
' '           Text.Whitespace
'opp'         Literal.String.Symbol
')'           Punctuation
' '           Text.Whitespace
'opp'         Literal.String.Symbol
')'           Punctuation
'\n        '  Text.Whitespace
'('           Punctuation
'('           Punctuation
'any-legal-move?' Name.Variable
' '           Text.Whitespace
'previous-player' Literal.String.Symbol
')'           Punctuation
'\n           ' Text.Whitespace
'('           Punctuation
'println'     Keyword
' '           Text.Whitespace
'('           Punctuation
'player-name' Name.Variable
' '           Text.Whitespace
'opp'         Literal.String.Symbol
')'           Punctuation
' '           Text.Whitespace
'" has no moves"' Literal.String
')'           Punctuation
'\n           ' Text.Whitespace
'previous-player' Literal.String.Symbol
')'           Punctuation
'\n        '  Text.Whitespace
'('           Punctuation
'true'        Keyword
' '           Text.Whitespace
'nil'         Keyword
')'           Punctuation
')'           Punctuation
')'           Punctuation
')'           Punctuation
'\n        \n' Text.Whitespace

'; are there any legal moves (returns first) for this player?' Comment.Single
'\n'          Text.Whitespace

'('           Punctuation
'define'      Keyword
' '           Text.Whitespace
'('           Punctuation
'any-legal-move?' Name.Variable
' '           Text.Whitespace
'player'      Literal.String.Symbol
')'           Punctuation
'\n  '        Text.Whitespace
'('           Punctuation
'exists'      Keyword
' '           Text.Whitespace
'('           Punctuation
'fn'          Keyword
' '           Text.Whitespace
'('           Punctuation
'move'        Name.Variable
')'           Punctuation
' '           Text.Whitespace
'('           Punctuation
'legal-move?' Name.Variable
' '           Text.Whitespace
'move'        Literal.String.Symbol
' '           Text.Whitespace
'player'      Literal.String.Symbol
')'           Punctuation
')'           Punctuation
' \n     '    Text.Whitespace
'('           Punctuation
'all-squares' Name.Variable
')'           Punctuation
')'           Punctuation
')'           Punctuation
'\n\n'        Text.Whitespace

'; a list of all legal moves might be useful' Comment.Single
'\n'          Text.Whitespace

'('           Punctuation
'define'      Keyword
' '           Text.Whitespace
'('           Punctuation
'legal-moves' Name.Variable
' '           Text.Whitespace
'player'      Literal.String.Symbol
')'           Punctuation
'\n  '        Text.Whitespace
'('           Punctuation
'let'         Keyword
' '           Text.Whitespace
'('           Punctuation
'('           Punctuation
'result'      Name.Variable
' '           Text.Whitespace
"'"           Operator
'('           Punctuation
')'           Punctuation
')'           Punctuation
')'           Punctuation
'\n     '     Text.Whitespace
'('           Punctuation
'dolist'      Keyword
' '           Text.Whitespace
'('           Punctuation
'move'        Name.Variable
' '           Text.Whitespace
'('           Punctuation
'all-squares' Name.Variable
')'           Punctuation
')'           Punctuation
'\n        '  Text.Whitespace
'('           Punctuation
'if'          Keyword
' '           Text.Whitespace
'('           Punctuation
'legal-move?' Name.Variable
' '           Text.Whitespace
'move'        Literal.String.Symbol
' '           Text.Whitespace
'player'      Literal.String.Symbol
')'           Punctuation
'\n           ' Text.Whitespace
'('           Punctuation
'push'        Keyword
' '           Text.Whitespace
'move'        Literal.String.Symbol
' '           Text.Whitespace
'result'      Literal.String.Symbol
')'           Punctuation
')'           Punctuation
')'           Punctuation
'\n  '        Text.Whitespace
'('           Punctuation
'unique'      Keyword
' '           Text.Whitespace
'result'      Literal.String.Symbol
')'           Punctuation
')'           Punctuation
')'           Punctuation
'\n\n'        Text.Whitespace

'; define any number of strategies that can be called on to calculate' Comment.Single
'\n'          Text.Whitespace

"; the next computer move. This is the only one I've done... - make " Comment.Single
'\n'          Text.Whitespace

'; any legal move at random!' Comment.Single
'\n\n'        Text.Whitespace

'('           Punctuation
'define'      Keyword
' '           Text.Whitespace
'('           Punctuation
'random'      Keyword
'-'           Keyword
'strategy'    Literal.String.Symbol
' '           Text.Whitespace
'player'      Literal.String.Symbol
')'           Punctuation
'\n  '        Text.Whitespace
'('           Punctuation
'seed'        Keyword
' '           Text.Whitespace
'('           Punctuation
'date-value'  Keyword
')'           Punctuation
')'           Punctuation
'\n  '        Text.Whitespace
'('           Punctuation
'apply'       Keyword
' '           Text.Whitespace
'amb'         Keyword
' '           Text.Whitespace
'('           Punctuation
'legal-moves' Name.Variable
' '           Text.Whitespace
'player'      Literal.String.Symbol
')'           Punctuation
')'           Punctuation
')'           Punctuation
'\n\n'        Text.Whitespace

'; get the next move using a particular strategy' Comment.Single
'\n\n'        Text.Whitespace

'('           Punctuation
'define'      Keyword
' '           Text.Whitespace
'('           Punctuation
'get-move'    Name.Variable
' '           Text.Whitespace
'strategy'    Literal.String.Symbol
' '           Text.Whitespace
'player'      Literal.String.Symbol
')'           Punctuation
'\n '         Text.Whitespace
'('           Punctuation
'let'         Keyword
' '           Text.Whitespace
'('           Punctuation
'('           Punctuation
'move'        Name.Variable
' '           Text.Whitespace
'('           Punctuation
'apply'       Keyword
' '           Text.Whitespace
'strategy'    Literal.String.Symbol
' '           Text.Whitespace
'('           Punctuation
'list'        Keyword
' '           Text.Whitespace
'player'      Literal.String.Symbol
')'           Punctuation
')'           Punctuation
')'           Punctuation
')'           Punctuation
'\n  '        Text.Whitespace
'('           Punctuation
'cond'        Keyword
'\n     '     Text.Whitespace
'('           Punctuation
'('           Punctuation
'and'         Keyword
'\n        '  Text.Whitespace
'('           Punctuation
'valid-move?' Name.Variable
' '           Text.Whitespace
'move'        Literal.String.Symbol
')'           Punctuation
'\n        '  Text.Whitespace
'('           Punctuation
'legal-move?' Name.Variable
' '           Text.Whitespace
'move'        Literal.String.Symbol
' '           Text.Whitespace
'player'      Literal.String.Symbol
')'           Punctuation
')'           Punctuation
'\n            ' Text.Whitespace
'('           Punctuation
'make-move'   Name.Variable
' '           Text.Whitespace
'move'        Literal.String.Symbol
' '           Text.Whitespace
'player'      Literal.String.Symbol
')'           Punctuation
')'           Punctuation
'\n     '     Text.Whitespace
'('           Punctuation
'true'        Keyword
'  \n        ' Text.Whitespace
'('           Punctuation
'println'     Keyword
' '           Text.Whitespace
'"no valid or legal move for "' Literal.String
' '           Text.Whitespace
'('           Punctuation
'player-name' Name.Variable
' '           Text.Whitespace
'player'      Literal.String.Symbol
')'           Punctuation
' '           Text.Whitespace
')'           Punctuation
'\n        '  Text.Whitespace
'nil'         Keyword
')'           Punctuation
')'           Punctuation
'\n  '        Text.Whitespace
'move'        Literal.String.Symbol
')'           Punctuation
')'           Punctuation
'\n\n'        Text.Whitespace

"; that's about all the game algorithms for now" Comment.Single
'\n'          Text.Whitespace

'; now for the interface' Comment.Single
'\n\n'        Text.Whitespace

'('           Punctuation
'if'          Keyword
' '           Text.Whitespace
'('           Punctuation
'='           Name.Variable
' '           Text.Whitespace
'ostype'      Keyword
' '           Text.Whitespace
'"Win32"'     Literal.String
')'           Punctuation
'\n   '       Text.Whitespace
'('           Punctuation
'load'        Keyword
' '           Text.Whitespace
'('           Punctuation
'string'      Keyword
' '           Text.Whitespace
'('           Punctuation
'env'         Keyword
' '           Text.Whitespace
'"PROGRAMFILES"' Literal.String
')'           Punctuation
' '           Text.Whitespace
'"/newlisp/guiserver.lsp"' Literal.String
')'           Punctuation
')'           Punctuation
'\n   '       Text.Whitespace
'('           Punctuation
'load'        Keyword
' '           Text.Whitespace
'"/usr/share/newlisp/guiserver.lsp"' Literal.String
')'           Punctuation
'\n'          Text.Whitespace

')'           Punctuation
'\n\n'        Text.Whitespace

'('           Punctuation
'gs'          Name.Variable
':'           Operator
'init'        Literal.String.Symbol
')'           Punctuation
'\n'          Text.Whitespace

'('           Punctuation
'map'         Keyword
' '           Text.Whitespace
'set'         Keyword
' '           Text.Whitespace
"'"           Operator
'('           Punctuation
'screen-width' Name.Variable
' '           Text.Whitespace
'screen-height' Literal.String.Symbol
')'           Punctuation
' '           Text.Whitespace
'('           Punctuation
'gs'          Name.Variable
':'           Operator
'get-screen'  Literal.String.Symbol
')'           Punctuation
')'           Punctuation
'\n'          Text.Whitespace

'('           Punctuation
'set'         Keyword
' '           Text.Whitespace
"'"           Operator
'board-width' Literal.String.Symbol
' '           Text.Whitespace
'540'         Literal.String.Symbol
')'           Punctuation
'\n'          Text.Whitespace

'; center on screen' Comment.Single
'\n'          Text.Whitespace

'('           Punctuation
'gs'          Name.Variable
':'           Operator
'frame'       Literal.String.Symbol
' '           Text.Whitespace
"'"           Operator
'Reversi'     Literal.String.Symbol
' '           Text.Whitespace
'('           Punctuation
'-'           Name.Variable
' '           Text.Whitespace
'('           Punctuation
'/'           Name.Variable
' '           Text.Whitespace
'screen-width' Literal.String.Symbol
' '           Text.Whitespace
'2'           Literal.String.Symbol
')'           Punctuation
' '           Text.Whitespace
'('           Punctuation
'/'           Name.Variable
' '           Text.Whitespace
'board-width' Literal.String.Symbol
' '           Text.Whitespace
'2'           Literal.String.Symbol
')'           Punctuation
')'           Punctuation
' '           Text.Whitespace
'60'          Literal.String.Symbol
' '           Text.Whitespace
'board-width' Literal.String.Symbol
' '           Text.Whitespace
'660'         Literal.String.Symbol
' '           Text.Whitespace
'"Reversi"'   Literal.String
')'           Punctuation
'\n'          Text.Whitespace

'('           Punctuation
'gs'          Name.Variable
':'           Operator
'set'         Keyword
'-'           Keyword
'border-layout' Literal.String.Symbol
' '           Text.Whitespace
"'"           Operator
'Reversi'     Literal.String.Symbol
')'           Punctuation
'\n\n'        Text.Whitespace

'('           Punctuation
'gs'          Name.Variable
':'           Operator
'canvas'      Literal.String.Symbol
' '           Text.Whitespace
"'"           Operator
'MyCanvas'    Literal.String.Symbol
' '           Text.Whitespace
"'"           Operator
'Reversi'     Literal.String.Symbol
')'           Punctuation
'\n  '        Text.Whitespace
'('           Punctuation
'gs'          Name.Variable
':'           Operator
'set'         Keyword
'-'           Keyword
'background'  Literal.String.Symbol
' '           Text.Whitespace
"'"           Operator
'MyCanvas'    Literal.String.Symbol
' '           Text.Whitespace
"'"           Operator
'('           Punctuation
'.8'          Name.Variable
' '           Text.Whitespace
'.9'          Literal.String.Symbol
' '           Text.Whitespace
'.7'          Literal.String.Symbol
' '           Text.Whitespace
'.8'          Literal.String.Symbol
')'           Punctuation
')'           Punctuation
'\n  '        Text.Whitespace
'('           Punctuation
'gs'          Name.Variable
':'           Operator
'mouse-released' Literal.String.Symbol
' '           Text.Whitespace
"'"           Operator
'MyCanvas'    Literal.String.Symbol
' '           Text.Whitespace
"'"           Operator
'mouse-released-action' Literal.String.Symbol
' '           Text.Whitespace
'true'        Keyword
')'           Punctuation
'\n\n'        Text.Whitespace

'('           Punctuation
'gs'          Name.Variable
':'           Operator
'panel'       Literal.String.Symbol
' '           Text.Whitespace
"'"           Operator
'Controls'    Literal.String.Symbol
')'           Punctuation
'\n  '        Text.Whitespace
'('           Punctuation
'gs'          Name.Variable
':'           Operator
'button'      Literal.String.Symbol
' '           Text.Whitespace
"'"           Operator
'Start'       Literal.String.Symbol
' '           Text.Whitespace
"'"           Operator
'start-game'  Literal.String.Symbol
' '           Text.Whitespace
'"Start"'     Literal.String
')'           Punctuation
'\n\n'        Text.Whitespace

'('           Punctuation
'gs'          Name.Variable
':'           Operator
'panel'       Literal.String.Symbol
' '           Text.Whitespace
"'"           Operator
'Lower'       Literal.String.Symbol
')'           Punctuation
'\n  '        Text.Whitespace
'('           Punctuation
'gs'          Name.Variable
':'           Operator
'label'       Literal.String.Symbol
' '           Text.Whitespace
"'"           Operator
'WhiteScore'  Literal.String.Symbol
' '           Text.Whitespace
'""'          Literal.String
')'           Punctuation
'\n  '        Text.Whitespace
'('           Punctuation
'gs'          Name.Variable
':'           Operator
'label'       Literal.String.Symbol
' '           Text.Whitespace
"'"           Operator
'BlackScore'  Literal.String.Symbol
' '           Text.Whitespace
'""'          Literal.String
')'           Punctuation
'\n\n'        Text.Whitespace

'('           Punctuation
'gs'          Name.Variable
':'           Operator
'add'         Keyword
'-'           Keyword
'to'          Literal.String.Symbol
' '           Text.Whitespace
"'"           Operator
'Controls'    Literal.String.Symbol
' '           Text.Whitespace
"'"           Operator
'Start'       Literal.String.Symbol
' '           Text.Whitespace
')'           Punctuation
'\n'          Text.Whitespace

'('           Punctuation
'gs'          Name.Variable
':'           Operator
'add'         Keyword
'-'           Keyword
'to'          Literal.String.Symbol
' '           Text.Whitespace
"'"           Operator
'Lower'       Literal.String.Symbol
' '           Text.Whitespace
"'"           Operator
'WhiteScore'  Literal.String.Symbol
' '           Text.Whitespace
"'"           Operator
'BlackScore'  Literal.String.Symbol
')'           Punctuation
'\n'          Text.Whitespace

'('           Punctuation
'gs'          Name.Variable
':'           Operator
'add'         Keyword
'-'           Keyword
'to'          Literal.String.Symbol
' '           Text.Whitespace
"'"           Operator
'Reversi'     Literal.String.Symbol
' '           Text.Whitespace
"'"           Operator
'MyCanvas'    Literal.String.Symbol
' '           Text.Whitespace
'"center"'    Literal.String
' '           Text.Whitespace
"'"           Operator
'Controls'    Literal.String.Symbol
' '           Text.Whitespace
'"north"'     Literal.String
' '           Text.Whitespace
"'"           Operator
'Lower'       Literal.String.Symbol
' '           Text.Whitespace
'"south"'     Literal.String
')'           Punctuation
'\n\n'        Text.Whitespace

'('           Punctuation
'gs'          Name.Variable
':'           Operator
'set'         Keyword
'-'           Keyword
'anti-aliasing' Literal.String.Symbol
' '           Text.Whitespace
'true'        Keyword
')'           Punctuation
'\n'          Text.Whitespace

'('           Punctuation
'gs'          Name.Variable
':'           Operator
'set'         Keyword
'-'           Keyword
'visible'     Literal.String.Symbol
' '           Text.Whitespace
"'"           Operator
'Reversi'     Literal.String.Symbol
' '           Text.Whitespace
'true'        Keyword
')'           Punctuation
'\n\n'        Text.Whitespace

'; size of board square, and radius/width of counter' Comment.Single
'\n'          Text.Whitespace

'('           Punctuation
'set'         Keyword
' '           Text.Whitespace
"'"           Operator
'size'        Literal.String.Symbol
' '           Text.Whitespace
'60'          Literal.String.Symbol
' '           Text.Whitespace
"'"           Operator
'width'       Literal.String.Symbol
' '           Text.Whitespace
'30'          Literal.String.Symbol
')'           Punctuation
'\n\n'        Text.Whitespace

'; initialize the master board' Comment.Single
'\n\n'        Text.Whitespace

'('           Punctuation
'define'      Keyword
' '           Text.Whitespace
'('           Punctuation
'initial-board' Name.Variable
')'           Punctuation
'\n  '        Text.Whitespace
'('           Punctuation
'make-board'  Name.Variable
')'           Punctuation
'\n  '        Text.Whitespace
'('           Punctuation
'setf'        Keyword
' '           Text.Whitespace
'('           Punctuation
'*'           Keyword
'board*'      Literal.String.Symbol
' '           Text.Whitespace
'44'          Literal.String.Symbol
')'           Punctuation
' '           Text.Whitespace
'white'       Literal.String.Symbol
')'           Punctuation
'\n  '        Text.Whitespace
'('           Punctuation
'setf'        Keyword
' '           Text.Whitespace
'('           Punctuation
'*'           Keyword
'board*'      Literal.String.Symbol
' '           Text.Whitespace
'55'          Literal.String.Symbol
')'           Punctuation
' '           Text.Whitespace
'white'       Literal.String.Symbol
')'           Punctuation
'\n  '        Text.Whitespace
'('           Punctuation
'setf'        Keyword
' '           Text.Whitespace
'('           Punctuation
'*'           Keyword
'board*'      Literal.String.Symbol
' '           Text.Whitespace
'45'          Literal.String.Symbol
')'           Punctuation
' '           Text.Whitespace
'black'       Literal.String.Symbol
')'           Punctuation
'\n  '        Text.Whitespace
'('           Punctuation
'setf'        Keyword
' '           Text.Whitespace
'('           Punctuation
'*'           Keyword
'board*'      Literal.String.Symbol
' '           Text.Whitespace
'54'          Literal.String.Symbol
')'           Punctuation
' '           Text.Whitespace
'black'       Literal.String.Symbol
')'           Punctuation
'  \n'        Text.Whitespace

')'           Punctuation
'\n\n'        Text.Whitespace

'; draw a graphical repesentation of the board' Comment.Single
'\n\n'        Text.Whitespace

'('           Punctuation
'define'      Keyword
' '           Text.Whitespace
'('           Punctuation
'draw-board'  Name.Variable
')'           Punctuation
'\n  '        Text.Whitespace
'('           Punctuation
'local'       Keyword
' '           Text.Whitespace
'('           Punctuation
'x'           Name.Variable
' '           Text.Whitespace
'y'           Literal.String.Symbol
')'           Punctuation
'\n     '     Text.Whitespace
'('           Punctuation
'dolist'      Keyword
' '           Text.Whitespace
'('           Punctuation
'i'           Name.Variable
' '           Text.Whitespace
'('           Punctuation
'all-squares' Name.Variable
')'           Punctuation
')'           Punctuation
'\n        '  Text.Whitespace
'('           Punctuation
'map'         Keyword
' '           Text.Whitespace
'set'         Keyword
' '           Text.Whitespace
"'"           Operator
'('           Punctuation
'x'           Name.Variable
' '           Text.Whitespace
'y'           Literal.String.Symbol
')'           Punctuation
' '           Text.Whitespace
'('           Punctuation
'square-to-xy' Name.Variable
' '           Text.Whitespace
'i'           Literal.String.Symbol
')'           Punctuation
')'           Punctuation
'\n        '  Text.Whitespace
'('           Punctuation
'gs'          Name.Variable
':'           Operator
'draw-rect'   Literal.String.Symbol
' \n           ' Text.Whitespace
'('           Punctuation
'string'      Keyword
' '           Text.Whitespace
'x'           Literal.String.Symbol
' '           Text.Whitespace
'y'           Literal.String.Symbol
')'           Punctuation
' \n           ' Text.Whitespace
'('           Punctuation
'-'           Name.Variable
' '           Text.Whitespace
'('           Punctuation
'*'           Name.Variable
' '           Text.Whitespace
'y'           Literal.String.Symbol
' '           Text.Whitespace
'size'        Literal.String.Symbol
')'           Punctuation
' '           Text.Whitespace
'width'       Literal.String.Symbol
' '           Text.Whitespace
')'           Punctuation
' '           Text.Whitespace
'; !!!!!!'    Comment.Single
'\n           ' Text.Whitespace
'('           Punctuation
'-'           Name.Variable
' '           Text.Whitespace
'('           Punctuation
'*'           Name.Variable
' '           Text.Whitespace
'x'           Literal.String.Symbol
' '           Text.Whitespace
'size'        Literal.String.Symbol
')'           Punctuation
' '           Text.Whitespace
'width'       Literal.String.Symbol
' '           Text.Whitespace
')'           Punctuation
'\n           ' Text.Whitespace
'('           Punctuation
'*'           Name.Variable
' '           Text.Whitespace
'width'       Literal.String.Symbol
' '           Text.Whitespace
'2'           Literal.String.Symbol
')'           Punctuation
'\n           ' Text.Whitespace
'('           Punctuation
'*'           Name.Variable
' '           Text.Whitespace
'width'       Literal.String.Symbol
' '           Text.Whitespace
'2'           Literal.String.Symbol
')'           Punctuation
'\n           ' Text.Whitespace
'gs'          Literal.String.Symbol
':'           Operator
'white'       Literal.String.Symbol
')'           Punctuation
')'           Punctuation
')'           Punctuation
')'           Punctuation
'\n\n'        Text.Whitespace

'('           Punctuation
'define'      Keyword
' '           Text.Whitespace
'('           Punctuation
'draw-first-four-pieces' Name.Variable
')'           Punctuation
'\n  '        Text.Whitespace
'('           Punctuation
'draw-piece'  Name.Variable
' '           Text.Whitespace
'44'          Literal.String.Symbol
' '           Text.Whitespace
'"white"'     Literal.String
')'           Punctuation
'\n  '        Text.Whitespace
'('           Punctuation
'draw-piece'  Name.Variable
' '           Text.Whitespace
'55'          Literal.String.Symbol
' '           Text.Whitespace
'"white"'     Literal.String
')'           Punctuation
'\n  '        Text.Whitespace
'('           Punctuation
'draw-piece'  Name.Variable
' '           Text.Whitespace
'45'          Literal.String.Symbol
' '           Text.Whitespace
'"black"'     Literal.String
')'           Punctuation
'\n  '        Text.Whitespace
'('           Punctuation
'draw-piece'  Name.Variable
' '           Text.Whitespace
'54'          Literal.String.Symbol
' '           Text.Whitespace
'"black"'     Literal.String
')'           Punctuation
')'           Punctuation
'\n\n'        Text.Whitespace

'; this next function can mark the legal moves available to a player' Comment.Single
'\n\n'        Text.Whitespace

'('           Punctuation
'define'      Keyword
' '           Text.Whitespace
'('           Punctuation
'show-legal-moves' Name.Variable
' '           Text.Whitespace
'player'      Literal.String.Symbol
')'           Punctuation
'\n  '        Text.Whitespace
'('           Punctuation
'local'       Keyword
' '           Text.Whitespace
'('           Punctuation
'legal-move-list' Name.Variable
' '           Text.Whitespace
'x'           Literal.String.Symbol
' '           Text.Whitespace
'y'           Literal.String.Symbol
')'           Punctuation
'\n     '     Text.Whitespace
'('           Punctuation
'set'         Keyword
' '           Text.Whitespace
"'"           Operator
'legal-move-list' Literal.String.Symbol
' '           Text.Whitespace
'('           Punctuation
'legal-moves' Name.Variable
' '           Text.Whitespace
'player'      Literal.String.Symbol
')'           Punctuation
')'           Punctuation
'\n     '     Text.Whitespace
'('           Punctuation
'dolist'      Keyword
' '           Text.Whitespace
'('           Punctuation
'm'           Name.Variable
' '           Text.Whitespace
'('           Punctuation
'all-squares' Name.Variable
')'           Punctuation
')'           Punctuation
'\n        '  Text.Whitespace
'('           Punctuation
'map'         Keyword
' '           Text.Whitespace
'set'         Keyword
' '           Text.Whitespace
"'"           Operator
'('           Punctuation
'x'           Name.Variable
' '           Text.Whitespace
'y'           Literal.String.Symbol
')'           Punctuation
' '           Text.Whitespace
'('           Punctuation
'square-to-xy' Name.Variable
' '           Text.Whitespace
'm'           Literal.String.Symbol
')'           Punctuation
')'           Punctuation
'\n        '  Text.Whitespace
'('           Punctuation
'gs'          Name.Variable
':'           Operator
'draw-rect'   Literal.String.Symbol
' \n           ' Text.Whitespace
'('           Punctuation
'string'      Keyword
' '           Text.Whitespace
'x'           Literal.String.Symbol
' '           Text.Whitespace
'y'           Literal.String.Symbol
')'           Punctuation
' \n           ' Text.Whitespace
'('           Punctuation
'-'           Name.Variable
' '           Text.Whitespace
'('           Punctuation
'*'           Name.Variable
' '           Text.Whitespace
'y'           Literal.String.Symbol
' '           Text.Whitespace
'size'        Literal.String.Symbol
')'           Punctuation
' '           Text.Whitespace
'width'       Literal.String.Symbol
' '           Text.Whitespace
')'           Punctuation
' '           Text.Whitespace
'; !!!!!!'    Comment.Single
'\n           ' Text.Whitespace
'('           Punctuation
'-'           Name.Variable
' '           Text.Whitespace
'('           Punctuation
'*'           Name.Variable
' '           Text.Whitespace
'x'           Literal.String.Symbol
' '           Text.Whitespace
'size'        Literal.String.Symbol
')'           Punctuation
' '           Text.Whitespace
'width'       Literal.String.Symbol
' '           Text.Whitespace
')'           Punctuation
'\n           ' Text.Whitespace
'('           Punctuation
'*'           Name.Variable
' '           Text.Whitespace
'width'       Literal.String.Symbol
' '           Text.Whitespace
'2'           Literal.String.Symbol
')'           Punctuation
'\n           ' Text.Whitespace
'('           Punctuation
'*'           Name.Variable
' '           Text.Whitespace
'width'       Literal.String.Symbol
' '           Text.Whitespace
'2'           Literal.String.Symbol
')'           Punctuation
'\n           ' Text.Whitespace
'('           Punctuation
'if'          Keyword
' '           Text.Whitespace
'('           Punctuation
'find'        Keyword
' '           Text.Whitespace
'm'           Literal.String.Symbol
' '           Text.Whitespace
'legal-move-list' Literal.String.Symbol
')'           Punctuation
' '           Text.Whitespace
'gs'          Literal.String.Symbol
':'           Operator
'blue'        Literal.String.Symbol
' '           Text.Whitespace
'gs'          Literal.String.Symbol
':'           Operator
'white'       Literal.String.Symbol
')'           Punctuation
'\n        '  Text.Whitespace
')'           Punctuation
'\n     '     Text.Whitespace
')'           Punctuation
'\n  '        Text.Whitespace
')'           Punctuation
'\n'          Text.Whitespace

')'           Punctuation
'\n\n'        Text.Whitespace

'; convert the number of a square on the master board to coordinates' Comment.Single
'\n\n'        Text.Whitespace

'('           Punctuation
'define'      Keyword
' '           Text.Whitespace
'('           Punctuation
'square-to-xy' Name.Variable
' '           Text.Whitespace
'square'      Literal.String.Symbol
')'           Punctuation
' \n  '       Text.Whitespace
'('           Punctuation
'list'        Keyword
' '           Text.Whitespace
'('           Punctuation
'/'           Name.Variable
' '           Text.Whitespace
'square'      Literal.String.Symbol
' '           Text.Whitespace
'10'          Literal.String.Symbol
')'           Punctuation
' '           Text.Whitespace
'('           Punctuation
'mod'         Keyword
' '           Text.Whitespace
'square'      Literal.String.Symbol
' '           Text.Whitespace
'10'          Literal.String.Symbol
')'           Punctuation
')'           Punctuation
')'           Punctuation
'\n\n'        Text.Whitespace

'; draw one of the pieces' Comment.Single
'\n\n'        Text.Whitespace

'('           Punctuation
'define'      Keyword
' '           Text.Whitespace
'('           Punctuation
'draw-piece'  Name.Variable
' '           Text.Whitespace
'square'      Literal.String.Symbol
' '           Text.Whitespace
'colour'      Literal.String.Symbol
')'           Punctuation
'\n  '        Text.Whitespace
'('           Punctuation
'local'       Keyword
' '           Text.Whitespace
'('           Punctuation
'x'           Name.Variable
' '           Text.Whitespace
'y'           Literal.String.Symbol
')'           Punctuation
'\n  '        Text.Whitespace
'('           Punctuation
'map'         Keyword
' '           Text.Whitespace
'set'         Keyword
' '           Text.Whitespace
"'"           Operator
'('           Punctuation
'x'           Name.Variable
' '           Text.Whitespace
'y'           Literal.String.Symbol
')'           Punctuation
' '           Text.Whitespace
'('           Punctuation
'square-to-xy' Name.Variable
' '           Text.Whitespace
'square'      Literal.String.Symbol
')'           Punctuation
')'           Punctuation
'\n  '        Text.Whitespace
'('           Punctuation
'cond'        Keyword
' \n     '    Text.Whitespace
'('           Punctuation
'('           Punctuation
'='           Name.Variable
' '           Text.Whitespace
'colour'      Literal.String.Symbol
' '           Text.Whitespace
'"white"'     Literal.String
')'           Punctuation
' \n        ' Text.Whitespace
'('           Punctuation
'gs'          Name.Variable
':'           Operator
'fill-circle' Literal.String.Symbol
' \n           ' Text.Whitespace
'('           Punctuation
'string'      Keyword
' '           Text.Whitespace
'x'           Literal.String.Symbol
' '           Text.Whitespace
'y'           Literal.String.Symbol
')'           Punctuation
' \n           ' Text.Whitespace
'('           Punctuation
'*'           Name.Variable
' '           Text.Whitespace
'y'           Literal.String.Symbol
' '           Text.Whitespace
'size'        Literal.String.Symbol
')'           Punctuation
'  '          Text.Whitespace
'; !!!!!!! y first, cos y is x ;-)' Comment.Single
'\n           ' Text.Whitespace
'('           Punctuation
'*'           Name.Variable
' '           Text.Whitespace
'x'           Literal.String.Symbol
' '           Text.Whitespace
'size'        Literal.String.Symbol
')'           Punctuation
' \n           ' Text.Whitespace
'width'       Literal.String.Symbol
'\n           ' Text.Whitespace
'gs'          Literal.String.Symbol
':'           Operator
'white'       Literal.String.Symbol
')'           Punctuation
')'           Punctuation
'\n     \n     ' Text.Whitespace
'('           Punctuation
'('           Punctuation
'='           Name.Variable
' '           Text.Whitespace
'colour'      Literal.String.Symbol
' '           Text.Whitespace
'"black"'     Literal.String
')'           Punctuation
' \n        ' Text.Whitespace
'('           Punctuation
'gs'          Name.Variable
':'           Operator
'fill-circle' Literal.String.Symbol
' \n           ' Text.Whitespace
'('           Punctuation
'string'      Keyword
' '           Text.Whitespace
'x'           Literal.String.Symbol
' '           Text.Whitespace
'y'           Literal.String.Symbol
')'           Punctuation
' \n           ' Text.Whitespace
'('           Punctuation
'*'           Name.Variable
' '           Text.Whitespace
'y'           Literal.String.Symbol
' '           Text.Whitespace
'size'        Literal.String.Symbol
')'           Punctuation
' \n           ' Text.Whitespace
'('           Punctuation
'*'           Name.Variable
' '           Text.Whitespace
'x'           Literal.String.Symbol
' '           Text.Whitespace
'size'        Literal.String.Symbol
')'           Punctuation
' \n           ' Text.Whitespace
'width'       Literal.String.Symbol
'\n           ' Text.Whitespace
'gs'          Literal.String.Symbol
':'           Operator
'black'       Literal.String.Symbol
')'           Punctuation
')'           Punctuation
'\n     \n     ' Text.Whitespace
'('           Punctuation
'('           Punctuation
'='           Name.Variable
' '           Text.Whitespace
'colour'      Literal.String.Symbol
' '           Text.Whitespace
'"empty"'     Literal.String
')'           Punctuation
' \n        ' Text.Whitespace
'('           Punctuation
'gs'          Name.Variable
':'           Operator
'draw-rect'   Literal.String.Symbol
' \n           ' Text.Whitespace
'('           Punctuation
'string'      Keyword
' '           Text.Whitespace
'x'           Literal.String.Symbol
' '           Text.Whitespace
'y'           Literal.String.Symbol
')'           Punctuation
' \n           ' Text.Whitespace
'('           Punctuation
'-'           Name.Variable
' '           Text.Whitespace
'('           Punctuation
'*'           Name.Variable
' '           Text.Whitespace
'y'           Literal.String.Symbol
' '           Text.Whitespace
'size'        Literal.String.Symbol
')'           Punctuation
' '           Text.Whitespace
'width'       Literal.String.Symbol
' '           Text.Whitespace
')'           Punctuation
' \n           ' Text.Whitespace
'('           Punctuation
'-'           Name.Variable
' '           Text.Whitespace
'('           Punctuation
'*'           Name.Variable
' '           Text.Whitespace
'x'           Literal.String.Symbol
' '           Text.Whitespace
'size'        Literal.String.Symbol
')'           Punctuation
' '           Text.Whitespace
'width'       Literal.String.Symbol
' '           Text.Whitespace
')'           Punctuation
'\n           ' Text.Whitespace
'('           Punctuation
'*'           Name.Variable
' '           Text.Whitespace
'width'       Literal.String.Symbol
' '           Text.Whitespace
'2'           Literal.String.Symbol
')'           Punctuation
'\n           ' Text.Whitespace
'('           Punctuation
'*'           Name.Variable
' '           Text.Whitespace
'width'       Literal.String.Symbol
' '           Text.Whitespace
'2'           Literal.String.Symbol
')'           Punctuation
'\n           ' Text.Whitespace
'gs'          Literal.String.Symbol
':'           Operator
'white'       Literal.String.Symbol
')'           Punctuation
')'           Punctuation
'\n  '        Text.Whitespace
')'           Punctuation
')'           Punctuation
')'           Punctuation
'\n\n'        Text.Whitespace

'; animate the pieces flipping' Comment.Single
'\n\n'        Text.Whitespace

'('           Punctuation
'define'      Keyword
' '           Text.Whitespace
'('           Punctuation
'flip-piece'  Name.Variable
' '           Text.Whitespace
'square'      Literal.String.Symbol
' '           Text.Whitespace
'player'      Literal.String.Symbol
')'           Punctuation
'\n'          Text.Whitespace

'; flip by drawing thinner and fatter ellipses ' Comment.Single
'\n'          Text.Whitespace

'; go from full disk in opposite colour to invisible' Comment.Single
'\n'          Text.Whitespace

'; then from invisible to full disk in true colour' Comment.Single
'\n  '        Text.Whitespace
'('           Punctuation
'local'       Keyword
' '           Text.Whitespace
'('           Punctuation
'x'           Name.Variable
' '           Text.Whitespace
'y'           Literal.String.Symbol
' '           Text.Whitespace
'colour'      Literal.String.Symbol
')'           Punctuation
'\n     '     Text.Whitespace
'('           Punctuation
'map'         Keyword
' '           Text.Whitespace
'set'         Keyword
' '           Text.Whitespace
"'"           Operator
'('           Punctuation
'x'           Name.Variable
' '           Text.Whitespace
'y'           Literal.String.Symbol
')'           Punctuation
' '           Text.Whitespace
'('           Punctuation
'square-to-xy' Name.Variable
' '           Text.Whitespace
'square'      Literal.String.Symbol
')'           Punctuation
')'           Punctuation
'\n     '     Text.Whitespace
'; delete original piece' Comment.Single
'\n     '     Text.Whitespace
'('           Punctuation
'gs'          Name.Variable
':'           Operator
'delete'      Keyword
'-'           Keyword
'tag'         Literal.String.Symbol
' '           Text.Whitespace
'('           Punctuation
'string'      Keyword
' '           Text.Whitespace
'x'           Literal.String.Symbol
' '           Text.Whitespace
'y'           Literal.String.Symbol
')'           Punctuation
')'           Punctuation
'\n     '     Text.Whitespace
'('           Punctuation
'set'         Keyword
' '           Text.Whitespace
"'"           Operator
'colour'      Literal.String.Symbol
' '           Text.Whitespace
'('           Punctuation
'if'          Keyword
' '           Text.Whitespace
'('           Punctuation
'='           Name.Variable
' '           Text.Whitespace
'player'      Literal.String.Symbol
' '           Text.Whitespace
'2'           Literal.String.Symbol
')'           Punctuation
' '           Text.Whitespace
'gs'          Literal.String.Symbol
':'           Operator
'black'       Literal.String.Symbol
' '           Text.Whitespace
'gs'          Literal.String.Symbol
':'           Operator
'white'       Literal.String.Symbol
' '           Text.Whitespace
')'           Punctuation
')'           Punctuation
' \n     '    Text.Whitespace
'('           Punctuation
'for'         Keyword
' '           Text.Whitespace
'('           Punctuation
'i'           Name.Variable
' '           Text.Whitespace
'width'       Literal.String.Symbol
'  '          Text.Whitespace
'1'           Literal.String.Symbol
' '           Text.Whitespace
'-'           Keyword
'3'           Literal.String.Symbol
')'           Punctuation
'\n        '  Text.Whitespace
'('           Punctuation
'gs'          Name.Variable
':'           Operator
'fill-ellipse' Literal.String.Symbol
' \n           ' Text.Whitespace
'('           Punctuation
'string'      Keyword
' '           Text.Whitespace
'x'           Literal.String.Symbol
' '           Text.Whitespace
'y'           Literal.String.Symbol
' '           Text.Whitespace
'{'           Literal.String
'flip'        Literal.String
'}'           Literal.String
' '           Text.Whitespace
'i'           Literal.String.Symbol
')'           Punctuation
' \n           ' Text.Whitespace
'('           Punctuation
'*'           Name.Variable
' '           Text.Whitespace
'y'           Literal.String.Symbol
' '           Text.Whitespace
'size'        Literal.String.Symbol
')'           Punctuation
' '           Text.Whitespace
'; y first :-) !!! ' Comment.Single
'\n           ' Text.Whitespace
'('           Punctuation
'*'           Name.Variable
' '           Text.Whitespace
'x'           Literal.String.Symbol
' '           Text.Whitespace
'size'        Literal.String.Symbol
')'           Punctuation
' \n           ' Text.Whitespace
'i'           Literal.String.Symbol
' \n           ' Text.Whitespace
'width'       Literal.String.Symbol
'\n           ' Text.Whitespace
'colour'      Literal.String.Symbol
')'           Punctuation
'\n        '  Text.Whitespace
'('           Punctuation
'sleep'       Keyword
' '           Text.Whitespace
'20'          Literal.String.Symbol
')'           Punctuation
'  '          Text.Whitespace
'; this might need adjusting...' Comment.Single
'\n        '  Text.Whitespace
'('           Punctuation
'gs'          Name.Variable
':'           Operator
'delete'      Keyword
'-'           Keyword
'tag'         Literal.String.Symbol
' '           Text.Whitespace
'('           Punctuation
'string'      Keyword
' '           Text.Whitespace
'x'           Literal.String.Symbol
' '           Text.Whitespace
'y'           Literal.String.Symbol
' '           Text.Whitespace
'{'           Literal.String
'flip'        Literal.String
'}'           Literal.String
' '           Text.Whitespace
'i'           Literal.String.Symbol
')'           Punctuation
')'           Punctuation
'\n     '     Text.Whitespace
')'           Punctuation
'\n     '     Text.Whitespace
'('           Punctuation
'set'         Keyword
' '           Text.Whitespace
"'"           Operator
'colour'      Literal.String.Symbol
' '           Text.Whitespace
'('           Punctuation
'if'          Keyword
' '           Text.Whitespace
'('           Punctuation
'='           Name.Variable
' '           Text.Whitespace
'player'      Literal.String.Symbol
' '           Text.Whitespace
'2'           Literal.String.Symbol
')'           Punctuation
' '           Text.Whitespace
'gs'          Literal.String.Symbol
':'           Operator
'white'       Literal.String.Symbol
' '           Text.Whitespace
'gs'          Literal.String.Symbol
':'           Operator
'black'       Literal.String.Symbol
')'           Punctuation
')'           Punctuation
'\n     '     Text.Whitespace
'('           Punctuation
'for'         Keyword
' '           Text.Whitespace
'('           Punctuation
'i'           Name.Variable
' '           Text.Whitespace
'1'           Literal.String.Symbol
' '           Text.Whitespace
'width'       Literal.String.Symbol
' '           Text.Whitespace
'3'           Literal.String.Symbol
')'           Punctuation
'\n        '  Text.Whitespace
'('           Punctuation
'gs'          Name.Variable
':'           Operator
'fill-ellipse' Literal.String.Symbol
' \n           ' Text.Whitespace
'('           Punctuation
'string'      Keyword
' '           Text.Whitespace
'x'           Literal.String.Symbol
' '           Text.Whitespace
'y'           Literal.String.Symbol
' '           Text.Whitespace
'{'           Literal.String
'flip'        Literal.String
'}'           Literal.String
' '           Text.Whitespace
'i'           Literal.String.Symbol
')'           Punctuation
' \n           ' Text.Whitespace
'('           Punctuation
'*'           Name.Variable
' '           Text.Whitespace
'y'           Literal.String.Symbol
' '           Text.Whitespace
'size'        Literal.String.Symbol
')'           Punctuation
' '           Text.Whitespace
'; :-) !!! '  Comment.Single
'\n           ' Text.Whitespace
'('           Punctuation
'*'           Name.Variable
' '           Text.Whitespace
'x'           Literal.String.Symbol
' '           Text.Whitespace
'size'        Literal.String.Symbol
')'           Punctuation
' \n           ' Text.Whitespace
'i'           Literal.String.Symbol
' \n           ' Text.Whitespace
'width'       Literal.String.Symbol
'\n           ' Text.Whitespace
'colour'      Literal.String.Symbol
')'           Punctuation
'\n        '  Text.Whitespace
'('           Punctuation
'sleep'       Keyword
' '           Text.Whitespace
'20'          Literal.String.Symbol
')'           Punctuation
'  \n        ' Text.Whitespace
'('           Punctuation
'gs'          Name.Variable
':'           Operator
'delete'      Keyword
'-'           Keyword
'tag'         Literal.String.Symbol
' '           Text.Whitespace
'('           Punctuation
'string'      Keyword
' '           Text.Whitespace
'x'           Literal.String.Symbol
' '           Text.Whitespace
'y'           Literal.String.Symbol
' '           Text.Whitespace
'{'           Literal.String
'flip'        Literal.String
'}'           Literal.String
' '           Text.Whitespace
'i'           Literal.String.Symbol
')'           Punctuation
')'           Punctuation
'\n     '     Text.Whitespace
')'           Punctuation
'\n     '     Text.Whitespace
'; draw the piece again' Comment.Single
'\n     '     Text.Whitespace
'('           Punctuation
'gs'          Name.Variable
':'           Operator
'fill-circle' Literal.String.Symbol
' \n           ' Text.Whitespace
'('           Punctuation
'string'      Keyword
' '           Text.Whitespace
'x'           Literal.String.Symbol
' '           Text.Whitespace
'y'           Literal.String.Symbol
')'           Punctuation
' \n           ' Text.Whitespace
'('           Punctuation
'*'           Name.Variable
' '           Text.Whitespace
'y'           Literal.String.Symbol
' '           Text.Whitespace
'size'        Literal.String.Symbol
')'           Punctuation
'\n           ' Text.Whitespace
'('           Punctuation
'*'           Name.Variable
' '           Text.Whitespace
'x'           Literal.String.Symbol
' '           Text.Whitespace
'size'        Literal.String.Symbol
')'           Punctuation
' \n           ' Text.Whitespace
'width'       Literal.String.Symbol
'\n           ' Text.Whitespace
'colour'      Literal.String.Symbol
')'           Punctuation
'\n  '        Text.Whitespace
')'           Punctuation
'\n'          Text.Whitespace

')'           Punctuation
'\n\n'        Text.Whitespace

'('           Punctuation
'define'      Keyword
' '           Text.Whitespace
'('           Punctuation
'do-move'     Name.Variable
' '           Text.Whitespace
'move'        Literal.String.Symbol
' '           Text.Whitespace
'player'      Literal.String.Symbol
')'           Punctuation
'\n  '        Text.Whitespace
'('           Punctuation
'cond'        Keyword
' \n     '    Text.Whitespace
'; check if the move is good ...' Comment.Single
'\n     '     Text.Whitespace
'('           Punctuation
'('           Punctuation
'and'         Keyword
' '           Text.Whitespace
'('           Punctuation
'!='          Name.Variable
' '           Text.Whitespace
'player'      Literal.String.Symbol
' '           Text.Whitespace
'nil'         Keyword
')'           Punctuation
'\n           ' Text.Whitespace
'('           Punctuation
'valid-move?' Name.Variable
' '           Text.Whitespace
'move'        Literal.String.Symbol
')'           Punctuation
'\n           ' Text.Whitespace
'('           Punctuation
'legal-move?' Name.Variable
' '           Text.Whitespace
'move'        Literal.String.Symbol
' '           Text.Whitespace
'player'      Literal.String.Symbol
')'           Punctuation
')'           Punctuation
'\n           \n           ' Text.Whitespace
'; ... play it' Comment.Single
'\n              ' Text.Whitespace
'; make move on board' Comment.Single
'\n              ' Text.Whitespace
'('           Punctuation
'make-move'   Name.Variable
' '           Text.Whitespace
'move'        Literal.String.Symbol
' '           Text.Whitespace
'player'      Literal.String.Symbol
')'           Punctuation
'\n              ' Text.Whitespace
'; and on screen' Comment.Single
'\n              ' Text.Whitespace
'('           Punctuation
'draw-piece'  Name.Variable
' '           Text.Whitespace
'move'        Literal.String.Symbol
' '           Text.Whitespace
'('           Punctuation
'player-name' Name.Variable
' '           Text.Whitespace
'player'      Literal.String.Symbol
')'           Punctuation
')'           Punctuation
'\n              ' Text.Whitespace
'('           Punctuation
'gs'          Name.Variable
':'           Operator
'update'      Literal.String.Symbol
')'           Punctuation
'\n              ' Text.Whitespace
'; do flipping stuff' Comment.Single
'\n              \n              ' Text.Whitespace
'; wait for a while' Comment.Single
'\n              ' Text.Whitespace
'('           Punctuation
'sleep'       Keyword
' '           Text.Whitespace
'1000'        Literal.String.Symbol
')'           Punctuation
'\n  \n              ' Text.Whitespace
'; then do flipping' Comment.Single
'\n              ' Text.Whitespace
'('           Punctuation
'dolist'      Keyword
' '           Text.Whitespace
'('           Punctuation
'f'           Name.Variable
' '           Text.Whitespace
'*'           Keyword
'flips*'      Literal.String.Symbol
')'           Punctuation
'\n                 ' Text.Whitespace
'('           Punctuation
'flip-piece'  Name.Variable
' '           Text.Whitespace
'f'           Literal.String.Symbol
' '           Text.Whitespace
'player'      Literal.String.Symbol
')'           Punctuation
')'           Punctuation
'\n              \n              ' Text.Whitespace
'('           Punctuation
'inc'         Keyword
' '           Text.Whitespace
'*'           Keyword
'move-number*' Literal.String.Symbol
')'           Punctuation
'\n              ' Text.Whitespace
'('           Punctuation
'draw-piece'  Name.Variable
' '           Text.Whitespace
'move'        Literal.String.Symbol
' '           Text.Whitespace
'('           Punctuation
'player-name' Name.Variable
' '           Text.Whitespace
'player'      Literal.String.Symbol
')'           Punctuation
')'           Punctuation
'\n              ' Text.Whitespace
'('           Punctuation
'gs'          Name.Variable
':'           Operator
'update'      Literal.String.Symbol
')'           Punctuation
'\n\n              ' Text.Whitespace
'; update scores' Comment.Single
'\n              ' Text.Whitespace
'('           Punctuation
'gs'          Name.Variable
':'           Operator
'set'         Keyword
'-'           Keyword
'text'        Literal.String.Symbol
' '           Text.Whitespace
"'"           Operator
'WhiteScore'  Literal.String.Symbol
' \n                 ' Text.Whitespace
'('           Punctuation
'string'      Keyword
' '           Text.Whitespace
'"White: "'   Literal.String
' '           Text.Whitespace
'('           Punctuation
'first'       Keyword
' '           Text.Whitespace
'('           Punctuation
'count'       Keyword
' '           Text.Whitespace
'('           Punctuation
'list'        Keyword
' '           Text.Whitespace
'white'       Literal.String.Symbol
')'           Punctuation
' '           Text.Whitespace
'*'           Keyword
'board*'      Literal.String.Symbol
')'           Punctuation
')'           Punctuation
')'           Punctuation
')'           Punctuation
'\n              ' Text.Whitespace
'('           Punctuation
'gs'          Name.Variable
':'           Operator
'set'         Keyword
'-'           Keyword
'text'        Literal.String.Symbol
' '           Text.Whitespace
"'"           Operator
'BlackScore'  Literal.String.Symbol
'\n                 ' Text.Whitespace
'('           Punctuation
'string'      Keyword
' '           Text.Whitespace
'"Black: "'   Literal.String
' '           Text.Whitespace
'('           Punctuation
'first'       Keyword
' '           Text.Whitespace
'('           Punctuation
'count'       Keyword
' '           Text.Whitespace
'('           Punctuation
'list'        Keyword
' '           Text.Whitespace
'black'       Literal.String.Symbol
')'           Punctuation
' '           Text.Whitespace
'*'           Keyword
'board*'      Literal.String.Symbol
')'           Punctuation
')'           Punctuation
')'           Punctuation
')'           Punctuation
'\n              ' Text.Whitespace
')'           Punctuation
'\n     '     Text.Whitespace
'; or return nil' Comment.Single
'\n     '     Text.Whitespace
'('           Punctuation
'true'        Keyword
' \n           ' Text.Whitespace
'nil'         Keyword
')'           Punctuation
')'           Punctuation
')'           Punctuation
'\n\n'        Text.Whitespace

'; the game is driven by the mouse clicks of the user' Comment.Single
'\n'          Text.Whitespace

'; in reply, the computer plays a black piece' Comment.Single
'\n'          Text.Whitespace

'; premature clicking is possible and possibly a bad thing...' Comment.Single
'\n\n'        Text.Whitespace

'('           Punctuation
'define'      Keyword
' '           Text.Whitespace
'('           Punctuation
'mouse-released-action' Name.Variable
' '           Text.Whitespace
'x'           Literal.String.Symbol
' '           Text.Whitespace
'y'           Literal.String.Symbol
' '           Text.Whitespace
'button'      Literal.String.Symbol
' '           Text.Whitespace
'modifiers'   Literal.String.Symbol
' '           Text.Whitespace
'tags'        Literal.String.Symbol
')'           Punctuation
'\n  '        Text.Whitespace
'; extract the tag of the clicked square' Comment.Single
'\n  '        Text.Whitespace
'('           Punctuation
'set'         Keyword
' '           Text.Whitespace
"'"           Operator
'move'        Literal.String.Symbol
' '           Text.Whitespace
'('           Punctuation
'int'         Keyword
' '           Text.Whitespace
'('           Punctuation
'string'      Keyword
' '           Text.Whitespace
'('           Punctuation
'first'       Keyword
' '           Text.Whitespace
'tags'        Literal.String.Symbol
')'           Punctuation
')'           Punctuation
' '           Text.Whitespace
'0'           Literal.String.Symbol
' '           Text.Whitespace
'10'          Literal.String.Symbol
')'           Punctuation
')'           Punctuation
'\n  '        Text.Whitespace
'('           Punctuation
'if'          Keyword
' '           Text.Whitespace
'('           Punctuation
'do-move'     Name.Variable
' '           Text.Whitespace
'move'        Literal.String.Symbol
' '           Text.Whitespace
'player'      Literal.String.Symbol
')'           Punctuation
'\n     '     Text.Whitespace
'('           Punctuation
'begin'       Keyword
'\n        '  Text.Whitespace
'('           Punctuation
'set'         Keyword
' '           Text.Whitespace
"'"           Operator
'player'      Literal.String.Symbol
' '           Text.Whitespace
'('           Punctuation
'next-to-play' Name.Variable
' '           Text.Whitespace
'player'      Literal.String.Symbol
')'           Punctuation
')'           Punctuation
'\n        '  Text.Whitespace
'; there is a training mode - legal squares are highlighted' Comment.Single
'\n        '  Text.Whitespace
'; you can uncomment the next line...' Comment.Single
'\n        '  Text.Whitespace
'; (show-legal-moves player)' Comment.Single
'\n        '  Text.Whitespace
'('           Punctuation
'gs'          Name.Variable
':'           Operator
'update'      Literal.String.Symbol
')'           Punctuation
'\n        \n        ' Text.Whitespace
"; wait for black's reply" Comment.Single
'\n        '  Text.Whitespace
'('           Punctuation
'gs'          Name.Variable
':'           Operator
'set'         Keyword
'-'           Keyword
'cursor'      Literal.String.Symbol
' '           Text.Whitespace
"'"           Operator
'Reversi'     Literal.String.Symbol
' '           Text.Whitespace
'"wait"'      Literal.String
')'           Punctuation
'\n        '  Text.Whitespace
'('           Punctuation
'gs'          Name.Variable
':'           Operator
'set'         Keyword
'-'           Keyword
'text'        Literal.String.Symbol
' '           Text.Whitespace
"'"           Operator
'Start'       Literal.String.Symbol
' '           Text.Whitespace
'"black\'s move - thinking..."' Literal.String
')'           Punctuation
'\n        '  Text.Whitespace
'; give the illusion of Deep Thought...' Comment.Single
'\n        '  Text.Whitespace
'('           Punctuation
'sleep'       Keyword
' '           Text.Whitespace
'2000'        Literal.String.Symbol
')'           Punctuation
'\n        '  Text.Whitespace
"; black's reply" Comment.Single
'\n        '  Text.Whitespace
'; currently only the random strategy has been defined...' Comment.Single
'\n        '  Text.Whitespace
'('           Punctuation
'set'         Keyword
' '           Text.Whitespace
"'"           Operator
'strategy'    Literal.String.Symbol
' '           Text.Whitespace
'random'      Keyword
'-'           Keyword
'strategy'    Literal.String.Symbol
')'           Punctuation
'\n        '  Text.Whitespace
'('           Punctuation
'set'         Keyword
' '           Text.Whitespace
"'"           Operator
'move'        Literal.String.Symbol
' '           Text.Whitespace
'('           Punctuation
'apply'       Keyword
' '           Text.Whitespace
'strategy'    Literal.String.Symbol
' '           Text.Whitespace
'('           Punctuation
'list'        Keyword
' '           Text.Whitespace
'player'      Literal.String.Symbol
')'           Punctuation
')'           Punctuation
')'           Punctuation
'\n        '  Text.Whitespace
'('           Punctuation
'do-move'     Name.Variable
' '           Text.Whitespace
'move'        Literal.String.Symbol
' '           Text.Whitespace
'player'      Literal.String.Symbol
')'           Punctuation
'\n        '  Text.Whitespace
'('           Punctuation
'set'         Keyword
' '           Text.Whitespace
"'"           Operator
'player'      Literal.String.Symbol
' '           Text.Whitespace
'('           Punctuation
'next-to-play' Name.Variable
' '           Text.Whitespace
'player'      Literal.String.Symbol
')'           Punctuation
')'           Punctuation
'\n        '  Text.Whitespace
"; (show-legal-moves player) ; to see black's moves" Comment.Single
'\n        '  Text.Whitespace
'('           Punctuation
'gs'          Name.Variable
':'           Operator
'set'         Keyword
'-'           Keyword
'text'        Literal.String.Symbol
' '           Text.Whitespace
"'"           Operator
'Start'       Literal.String.Symbol
' '           Text.Whitespace
'"your move"' Literal.String
')'           Punctuation
'\n        '  Text.Whitespace
'('           Punctuation
'gs'          Name.Variable
':'           Operator
'set'         Keyword
'-'           Keyword
'cursor'      Literal.String.Symbol
' '           Text.Whitespace
"'"           Operator
'Reversi'     Literal.String.Symbol
' '           Text.Whitespace
'"default"'   Literal.String
')'           Punctuation
'\n        '  Text.Whitespace
'('           Punctuation
'gs'          Name.Variable
':'           Operator
'update'      Literal.String.Symbol
')'           Punctuation
')'           Punctuation
')'           Punctuation
')'           Punctuation
'\n\n'        Text.Whitespace

'('           Punctuation
'define'      Keyword
' '           Text.Whitespace
'('           Punctuation
'start-game'  Name.Variable
')'           Punctuation
'\n  '        Text.Whitespace
'('           Punctuation
'gs'          Name.Variable
':'           Operator
'set'         Keyword
'-'           Keyword
'text'        Literal.String.Symbol
' '           Text.Whitespace
"'"           Operator
'Start'       Literal.String.Symbol
' '           Text.Whitespace
'"Click a square to place a piece!"' Literal.String
')'           Punctuation
'\n  '        Text.Whitespace
'('           Punctuation
'gs'          Name.Variable
':'           Operator
'disable'     Literal.String.Symbol
' '           Text.Whitespace
"'"           Operator
'Start'       Literal.String.Symbol
')'           Punctuation
'\n  '        Text.Whitespace
'('           Punctuation
'set'         Keyword
' '           Text.Whitespace
"'"           Operator
'player'      Literal.String.Symbol
' '           Text.Whitespace
'white'       Literal.String.Symbol
')'           Punctuation
')'           Punctuation
'\n\n'        Text.Whitespace

'('           Punctuation
'define'      Keyword
' '           Text.Whitespace
'('           Punctuation
'start'       Name.Variable
')'           Punctuation
'\n  '        Text.Whitespace
'('           Punctuation
'gs'          Name.Variable
':'           Operator
'set'         Keyword
'-'           Keyword
'text'        Literal.String.Symbol
' '           Text.Whitespace
"'"           Operator
'Start'       Literal.String.Symbol
' '           Text.Whitespace
'"Start"'     Literal.String
')'           Punctuation
'\n  '        Text.Whitespace
'('           Punctuation
'gs'          Name.Variable
':'           Operator
'enable'      Literal.String.Symbol
' '           Text.Whitespace
"'"           Operator
'Start'       Literal.String.Symbol
')'           Punctuation
'\n  '        Text.Whitespace
'('           Punctuation
'set'         Keyword
'  '          Text.Whitespace
"'"           Operator
'*'           Keyword
'move-number*' Literal.String.Symbol
' '           Text.Whitespace
'1'           Literal.String.Symbol
'\n        '  Text.Whitespace
"'"           Operator
'*'           Keyword
'flips*'      Literal.String.Symbol
' '           Text.Whitespace
"'"           Operator
'('           Punctuation
')'           Punctuation
')'           Punctuation
'\n  '        Text.Whitespace
'('           Punctuation
'initial-board' Name.Variable
')'           Punctuation
'\n  '        Text.Whitespace
'('           Punctuation
'draw-board'  Name.Variable
')'           Punctuation
'\n  '        Text.Whitespace
'('           Punctuation
'draw-first-four-pieces' Name.Variable
')'           Punctuation
')'           Punctuation
'\n\n'        Text.Whitespace

'('           Punctuation
'start'       Name.Variable
')'           Punctuation
'\n\n'        Text.Whitespace

'('           Punctuation
'gs'          Name.Variable
':'           Operator
'listen'      Literal.String.Symbol
')'           Punctuation
'\n'          Text.Whitespace
