/* TicTacSPOT v2.0 By Creepy Productions - David Lascelles. See doc for
   original copyright notices.
   $VER: TicTacSPOT v2.0 (13.06.95)
*/

TEMPDIR = 'T:'
options results
Address 'SPOT'

address command "rxlib rexxreqtools.library 0 -30"
NL = '0a'x
address command "rxlib rexxsupport.library 0 -30" 
address command "rxlib rexxarplib.library 0 -30 0"



'IsMessages'
If RC>0 Then Do
   'RequestNotify PROMPT "Use only from message window"'
   Exit
   End

'SaveAscii TO "'TEMPDIR'TicTacSPOT.temp" OVERWRITE NOHEADER NOORIGIN NOKLUDGES'

If ~Open('Inp',TEMPDIR'TicTacSPOT.temp','r') Then Do
   'RequestNotify PROMPT "Cannot open temporary file:'TEMPDIR'TicTacSPOT.temp"'
   Exit
   End

Do y=1 To 4
   Do x=1 To 3
      POS.x.y=' '
   End
End

Do Until Pos('* TicTacSpot',LINE)>0
   If Eof('Inp') Then Do
retqw=rtezrequest("Message contains no TicTacSpot data!","_Start New|Quit","You needed a FX430303 Scanner with a banana to do that ;).","rt_pubscrname=SPOT rt_reqpos=reqpos_centerscr rt_font=mfast.font/20")
      If retqw=1 Then Do
        Call Close('Inp')
        Signal PlayMove
      End
      Exit
   End
   If Exists('Ram:Plop') then Exit
   LINE=ReadLn('Inp')
End

Call Readln('Inp')
LINE.1=Readln('Inp')
Call Readln('Inp')
Call Readln('Inp')
LINE.2=Readln('Inp')
Call Readln('Inp')
Call Readln('Inp')
LINE.3=Readln('Inp')
deded=readln('Inp')
edwdkwdokwk=readln('Inp')
piece=readch('Inp')
if piece="o" then pw="x"
if piece="x" then pw="o"
piece=pw
Call Close('Inp')

Do y=1 To 3
  Parse var LINE.y POS1' | 'POS2' | 'POS3
  POS1=Right(POS1,2)
  POS2=Left(POS2,2)
  POS3=Left(POS3,2)
  If POS1='/\' Then POS.1.y='o'
  If POS1='\/' Then POS.1.y='x'
  If POS2='/\' Then POS.2.y='o'
  If POS2='\/' Then POS.2.y='x'
  If POS3='/\' Then POS.3.y='o'
  If POS3='\/' Then POS.3.y='x'
End
if upper(piece)="X" then signal ed
if upper(piece)="O" then signal ed
PlayMove:
RCDEA=rtezrequest("Will you be Os or Xs?","_O|_X","Hard descision - the round one or the non-round one ?","rt_pubscrname=SPOT rt_reqpos=reqpos_centerscr rt_font=chex.font/26",RCDEDA)
If RCDEA=0 Then PIECE='x'
If RCDEA=1 Then PIECE='o'
call bob
ed:
retoax=rtezrequest("In case you forgot, you are '"upper(piece)"'s","cool!","Bad memory ?","rt_pubscrname=FOOZLE rt_reqpos=reqpos_centerscr rt_font=emerald.font/17",RCDEDAA)
bob:
done=0
Do Until DONE=1
board=""upper(pos.1.1)" + "upper(pos.2.1)" + "upper(pos.3.1)" "
board2="++++++++++"
board3=""upper(pos.1.2)" + "upper(pos.2.2)" + "upper(pos.3.2)" "
board4="++++++++++"
board5=""upper(pos.1.3)" + "upper(pos.2.3)" + "upper(pos.3.3)" "

RCDE=rtezrequest("Row 1  =  "board"    You are now on the top"||NL||,
                    "          "board2"    row, select where to"||NL||,
                    "Row 2  =  "board3"    place  piece or click"||NL||,
                    "          "board4"    on Middle Row to go  "||NL||,
                    "Row 3  =  "board5"    to the middle row. :)"||NL||NL||,
                    "Click on Big for the large tactics screen! ;)"||NL||,
                    "","_Left|_Mid|_Right|M_iddle Row|_Big|_Exit","The high chain of command informs you that this is the top row!","rt_pubscrname=SPOT rt_reqpos=reqpos_centerscr rt_font=ruby.font/15",DW)

if RCDE=1 Then If PoS.1.1='x'|Pos.1.1='o' then do;call exista;signal bob;end
If RCDE=1 Then do;If PoS.1.1=' ' Then DoNE=1;PoS.1.1=PIECE;signal ced;End
if RCDE=2 Then If PoS.2.1='x'|Pos.2.1='o' then do;call exista;signal bob;end
IF RCDE=2 Then If PoS.2.1=' ' Then Do;DoNE=1;PoS.2.1=PIECE;signal ced;End
if RCDE=3 Then If PoS.3.1='x'|Pos.3.1='o' then do;call exista;signal bob;end
If RCDE=3 Then If PoS.3.1=' ' Then Do;DoNE=1;pos.3.1=piece;signal ced;End
if RCDE=5 then call big
if RCDE=0 then exit 0

RCDE=rtezrequest("Row 1 = "board"    You are now in the middle"||NL||,
                    "        "board2"    row, select where to"||NL||,
                    "Row 2 = "board3"    place piece or click"||NL||,
                    "        "board4"    on Bottom Row to go :( "||NL||,
                    "Row 3 = "board5"    to the Bottom row :) "||NL||NL||,
                    "BIG will display a rather large board indeed!"||NL||,
                    "","_Left|_Mid|_Right|_Bottom Row|Bi_g|_Exit","Oi you! What you doing in the middle row, trying to cheat eh ? ","rt_pubscrname=SPOT rt_reqpos=reqpos_centerscr rt_font=ruby.font/15",DWSQ)
if RCDE=0 then exit 0
if RCDE=5 then call big
if RCDE=1 Then If PoS.1.2='x'|Pos.1.2='o' Then do;call exista;signal bob;end
If RCDE=1 Then If PoS.1.2=' ' Then Do;DoNE=1;PoS.1.2=PIECE;signal ced;End
if RCDE=2 Then If PoS.2.2='x'|Pos.2.2='o' then do;call exista;signal bob;end
If RCDE=2 Then If PoS.2.2=' ' Then Do;DoNE=1;PoS.2.2=PIECE;signal ced;End
if RCDE=3 Then If PoS.3.2='x'|Pos.3.1='o' then do;call exista;signal bob;end
If RCDE=3 Then If PoS.3.2=' ' Then Do;DoNE=1;PoS.3.2=PIECE;signal ced;End

retw=rtezrequest("Row 1 = "board"    You are now on the Bottom"||NL||,
                    "        "board2"    row, select where to"||NL||,
                    "Row 2 = "board3"    place piece or click"||NL||,
                    "        "board4"    on exit to go to back "||NL||,
                    "Row 3 = "board5"    to SPOT."||NL||NL||,
                    "This time BIG will display the same as before!"||NL||,
                    "","_Left|_Mid|_Right|_Big|_Top Row!!|_Exit","lowest of the low, scum of the earth - well the bottom row!","rt_pubscrname=SPOT rt_reqpos=reqpos_centerscr rt_font=ruby.font/15",DW)
If retw=0 Then exit 0
if retw=4 then call big
if retw=5 then signal bob
if retw=1 Then If PoS.1.3='x'|Pos.1.3='o' then do;call exista;signal bob;end
If retw=1 Then If PoS.1.3=' ' Then Do;DoNE=1;PoS.1.3=PIECE;signal ced;End
if retw=2 Then If PoS.2.3='x'|Pos.2.3='o' then do;call exista;signal bob;end
If retw=2 Then If PoS.2.3=' ' Then Do;DoNE=1;PoS.2.3=PIECE;signal ced;End
if retw=3 Then If PoS.3.3='x'|Pos.3.3='o' then do;call exista;signal bob;end
If retw=3 Then If PoS.3.3=' ' Then Do;DoNE=1;PoS.3.3=PIECE;signal ced;End
End
End
End

ced:
call Open('Oup',TEMPDIR'TicTacSPOT.temp','w')

LINE1=' >  '
LINE2=' >  '
LINE3=' >  '
LINE4=' >  '
LINE5=' >  '
LINE6=' >  '
If POS.1.1='x' Then Do
  LINE1=LINE1||'\/ |'
  LINE2=LINE2||'/\ |'
End
If POS.1.1='o' Then Do
  LINE1=LINE1||'/\ |'
  LINE2=LINE2||'\/ |'
End
If POS.1.1=' ' Then Do
  LINE1=LINE1||'   |'
  LINE2=LINE2||'   |'
End
If POS.2.1='x' Then Do
  LINE1=LINE1||' \/ |'
  LINE2=LINE2||' /\ |'
End
If POS.2.1='o' Then Do
  LINE1=LINE1||' /\ |'
  LINE2=LINE2||' \/ |'
End
If POS.2.1=' ' Then Do
  LINE1=LINE1||'    |'
  LINE2=LINE2||'    |'
End
If POS.3.1='x' Then Do
  LINE1=LINE1||' \/'
  LINE2=LINE2||' /\'
End
If POS.3.1='o' Then Do
  LINE1=LINE1||' /\'
  LINE2=LINE2||' \/'
End

If POS.1.2='x' Then Do
  LINE3=LINE3||'\/ |'
  LINE4=LINE4||'/\ |'
End
If POS.1.2='o' Then Do
  LINE3=LINE3||'/\ |'
  LINE4=LINE4||'\/ |'
End
If POS.1.2=' ' Then Do
  LINE3=LINE3||'   |'
  LINE4=LINE4||'   |'
End
If POS.2.2='x' Then Do
  LINE3=LINE3||' \/ |'
  LINE4=LINE4||' /\ |'
End
If POS.2.2='o' Then Do
  LINE3=LINE3||' /\ |'
  LINE4=LINE4||' \/ |'
End
If POS.2.2=' ' Then Do
  LINE3=LINE3||'    |'
  LINE4=LINE4||'    |'
End
If POS.3.2='x' Then Do
  LINE3=LINE3||' \/'
  LINE4=LINE4||' /\'
End
If POS.3.2='o' Then Do
  LINE3=LINE3||' /\'
  LINE4=LINE4||' \/'
End
If POS.1.3='x' Then Do
  LINE5=LINE5||'\/ |'
  LINE6=LINE6||'/\ |'
End
If POS.1.3='o' Then Do
  LINE5=LINE5||'/\ |'
  LINE6=LINE6||'\/ |'
End
If POS.1.3=' ' Then Do
  LINE5=LINE5||'   |'
  LINE6=LINE6||'   |'
End
If POS.2.3='x' Then Do
  LINE5=LINE5||' \/ |'
  LINE6=LINE6||' /\ |'
End
If POS.2.3='o' Then Do
  LINE5=LINE5||' /\ |'
  LINE6=LINE6||' \/ |'
End
If POS.2.3=' ' Then Do
  LINE5=LINE5||'    |'
  LINE6=LINE6||'    |'
End
If POS.3.3='x' Then Do
  LINE5=LINE5||' \/'
  LINE6=LINE6||' /\'
End
If POS.3.3='o' Then Do
  LINE5=LINE5||' /\'
  LINE6=LINE6||' \/'
End

  call Writeln('Oup',' ')
  Call Writeln('Oup',' > * TicTacSpot v2.0 Updated By Creepy')
  Call Writeln('Oup',' >')
  Call Writeln('Oup',LINE1)
  Call Writeln('Oup',LINE2)
  Call Writeln('Oup',' > ----+----+----')
  Call Writeln('Oup',LINE3)
  Call Writeln('Oup',LINE4)
  Call Writeln('Oup',' > ----+----+----')
  Call Writeln('Oup',LINE5)
  Call Writeln('Oup',LINE6)
  Call Writeln('Oup',' ')  
  Call Writeln('Oup',piece)
Call Close('Oup')




'GetFrom'
FROM=Result
RCDE=rtezrequest("Do you want to edit the message ?","_Yes|_No","Edit Message or eat it ?","rt_pubscrname=SPOT rt_reqpos=reqpos_centerscr rt_font=sapphire.font/19")
If RCDE=1 Then 'Write TO "'FROM'" SUBJECT "TicTacSPOT" FILE "'TEMPDIR'TicTacSPOT.temp" NOGUI'
If RCDE=0 Then 'Write TO "'FROM'" SUBJECT "TicTacSPOT" FILE "'TEMPDIR'TicTacSPOT.temp" NOEDIT NOGUI'
exit 0

exista:
retaa=rtezrequest("Sorry - Piece already there","_Return","And where is the brain today!!","rt_pubscrname=SPOT rt_reqpos=reqpos_centerscr rt_font=coop.font/24",re)
return

INFo:

RCDE=rtezrequest("Welcome to Creepys TicTacToe whether you be a Foozle owner    "||NL||,
       "or a SPOT one, I salute you ;) I hope you like this script  "||NL||,
       "as it took three of us a while to write (the other two being "||NL||,
       "Paul and John, who were respectivly responsible for the    "||NL||,
       "original code and for the message reading part in the SPOT  "||NL||,                                                                                    
       "code.) I also hope you like this new GUI interface and only   "||NL||,                                                                                    
       "appologise for the amount of fonts you had to download to    "||NL||,
       "use it! If you want a chat or just grab some files, then    "||NL||,
       "why not logon to Creepys Amiga BBS - +44(0)191 3832181 24Hrs  "||NL||,
       "its well worth a vist! Also if you use this proggy I would "||NL||,
       "be grateful for a hello note to one of the addresses below!    "||NL||,
       "okay dokay - Bye For Now!                    "||NL||,
       "                                                               "||NL||,
       "          ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿            "||NL||,
       "          ³ Regards, ÚÄ ÚÄ     ³ ³  2:256/503.0   ³            "||NL||,
       "          ³  ÚÄÄ Ú¿  ÃÄ ÃÄ ÚÄ¿ ÀÂÙ  69:101/11.0   ³            "||NL||,
       "          ³  ÀÄÄ ÃÁ¿ ÀÄ ÀÄ ÃÄÙ  ³   240:360/306   ³            "||NL||,
       "          ³                ³    ³   39:131/11.0   ³            "||NL||,
       "          ³ David.Lascelles@Creepys.nemesis.co.uk ³            "||NL||,
       "          ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ            ","And back please!|Can I see it again!","Creepys Amazing Info!","rt_pubscrname=SPOT rt_reqpos=reqpos_centerscr rt_font=cleanibm.font/8",re)
                                 
if RCDE=1 then signal begin
if RCDE=0 then signal info       

exit 0

big:
do g=1 to 3
do f=1 to 3
say g.f.1
if pos.g.f="o" then do
de.g.f.1=" oooo "
de.g.f.2="o    o"
de.g.f.3="o    o"
de.g.f.4=" oooo "
end
if pos.g.f="x" then do
de.g.f.1="\   / "
de.g.f.2=" \_/  "
de.g.f.3=" / \  "
de.g.f.4="/   \ "
end
if pos.g.f=' ' then do
de.g.f.1="      "
de.g.f.2="      "
de.g.f.3="      "
de.g.f.4="      "
end
end
end
board.1="                        #####          #####         "                       
board.2="               "de.1.1.1"   #####  "de.2.1.1"  #####  "de.3.1.1"           "
board.3="               "de.1.1.2"   #####  "de.2.1.2"  #####  "de.3.1.2"           "
board.4="               "de.1.1.3"   #####  "de.2.1.3"  #####  "de.3.1.3"           "
board.5="               "de.1.1.4"   #####  "de.2.1.4"  #####  "de.3.1.4"           "
board.6="                        #####          #####             "
board.7="            ###########################################   "
board.8="            ###########################################   "
board.9="                        #####          #####         "                       
board.10="               "de.1.2.1"   #####  "de.2.2.1"  #####  "de.1.3.1"           "
board.11="               "de.1.2.2"   #####  "de.2.2.2"  #####  "de.1.3.2"           "
board.12="               "de.1.2.3"   #####  "de.2.2.3"  #####  "de.1.3.3"           "
board.13="               "de.1.2.4"   #####  "de.2.2.4"  #####  "de.1.3.4"           "
board.14="                        #####          #####             "
board.15="            ###########################################   "
board.16="            ###########################################   "
board.17="                        #####          #####         "                       
board.18="               "de.1.3.1"   #####  "de.2.3.1"  #####  "de.3.3.1"           "
board.19="               "de.1.3.2"   #####  "de.2.3.2"  #####  "de.3.3.2"           "
board.20="               "de.1.3.3"   #####  "de.2.3.3"  #####  "de.3.3.3"           "
board.21="               "de.1.3.4"   #####  "de.2.3.4"  #####  "de.3.3.4"           "
board.22="                        #####          #####             "

fr=rtezrequest(""board.1||NL||,
               ""board.2||NL||,
               ""board.3||NL||,
               ""board.4||NL||,
               ""board.5||NL||,
               ""board.6||NL||,
               ""board.7||NL||,
               ""board.8||NL||,
               ""board.9||NL||,
               ""board.10||NL||,
               ""board.11||NL||,
               ""board.12||NL||,
               ""board.13||NL||,
               ""board.14||NL||,
               ""board.15||NL||,
               ""board.16||NL||,
               ""board.17||NL||,
               ""board.18||NL||,
               ""board.19||NL||,
               ""board.20||NL||,
               ""board.21||NL||,
               ""board.22||NL||,
               ""||NL||,
               ""||NL||,
               "","_Sooo|_What|_Tactics|_Are|_You|_Going|_To|_Employ ?","Nice screen dork ;)","rt_pubscrname=SPOT rt_reqpos=reqpos_centerscr rt_font=cleanibm.font/8")
call bob