Home » Recent acquisitions » Acorn ADFS disks » adfs_AcornUser_199801_2.adf » Regulars2 » StarInfo/Fletcher/!Setup/Files/Disc1/Program/Games/!NetC4/!RunImage

StarInfo/Fletcher/!Setup/Files/Disc1/Program/Games/!NetC4/!RunImage

This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.

Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.

Tape/disk: Home » Recent acquisitions » Acorn ADFS disks » adfs_AcornUser_199801_2.adf » Regulars2
Filename: StarInfo/Fletcher/!Setup/Files/Disc1/Program/Games/!NetC4/!RunImage
Read OK:
File size: 3844 bytes
Load address: 0000
Exec address: 0000
File contents
   10REM >!RunImage
   20testing%=FALSE
   30LIBRARY "<BasicLibrary$File>":PROCinitlibrary
   40LIBRARY "<HeapLibrary$File>":PROCinitheap
   50LIBRARY "<NetGameLibrary$File>"
   60ON ERROR PROCclosemessages:PROCeerror:IF testing%=TRUE THENOSCLI("Spool"):END ELSE END
   70IF testing%=TRUE THEN*Spool Spooled
   80IF testing%=TRUE THENTRACE ON:TRACE PROC
   90REM Appname$ is used for task manager & Appname$Dir
  100REM shortname$ is used for iconbar name and should usually be null
  110REM longname$ is used for info window
  120REM AppURL$ is used to for clicks on the version icon
  130Appname$="NetC4":version$="1.02 (17 Jun 1997)"
  140shortname$="":longname$="Connect 4 (port xxxx)"
  150Appdir$=FNsystemvar(Appname$+"$Dir")
  160AppURL$="http://users.essex.ac.uk/users/gerph/acorn/internet.html#netc4"
  170PROCinitwimp:PROCinitprog
  180quit%=FALSE
  190ON ERROR PROCerror
  200WHILE quit%=FALSE
  210 PROCPoll
  220ENDWHILE
  230PROCnetgame_final
  240SYS "Wimp_CloseDown"
  250PROCclosemessages
  260IF testing%=TRUE THEN*SPOOL
  270END
  280REM quit%=-1 for user quit, -2 for taskmanager quit
  290:
  300DEFPROCPoll
  310t=50:IF falling<>-1 THENt=fallspeed
  320SYS "Wimp_PollIdle",0,b%,TIME+t TO reason%
  330CASE reason% OF
  340 WHEN 0:REM Null poll
  350  REM Do a fall if we need to
  360  IF TIME>falltime+fallspeed THENPROCFalling
  370  REM Check if the network game has to do anything
  380  PROCnetgame_poll
  390 REM 1 = Redraw window
  400 WHEN 2:SYS "Wimp_OpenWindow",,b%
  410 WHEN 3:SYS "Wimp_CloseWindow",,b%
  420 WHEN 6:PROCmouseclick(b%!8,b%!12,b%!16)
  430 REM 7 = Drag box dropped on another task
  440 WHEN 8:PROCprocesskey(b%!0,b%!4,b%!24)
  450 WHEN 9:PROCmenuchoice
  460 WHEN 17,18:PROCreceive(b%!16)
  470 WHEN 19:PROCreceiveack(b%!16)
  480ENDCASE
  490ENDPROC
  500:
  510REM Buttons : 1 = Adjust, 2 = Menu, 4 = Select
  520DEFPROCmouseclick(but,win,icon)
  530CASE win OF
  540 WHEN -2
  550  CASE but OF
  560   WHEN 2:PROCibmenu
  570   WHEN 1,4
  580    IF theirhost$="" THEN
  590     PROCopenconnect:REM Not connected, so open connect window
  600    ELSE
  610     PROCopenwin(mainwin%):REM Connected, so open main window
  620    ENDIF
  630  ENDCASE
  640 WHEN infobox%
  650  CASE icon OF
  660   WHEN 1:PROCshowfree
  670   WHEN 3:PROCFetchPage("http://users.essex.ac.uk/users/gerph/")
  680   WHEN 4:PROCFetchPage(AppURL$)
  690  ENDCASE
  700 WHEN connectwin%
  710  CASE icon OF
  720   WHEN 5:PROCmenu(FNnetgame_sitesmenu,-1,-1):REM Sites list
  730   WHEN 4:PROCtryconnect
  740  ENDCASE
  750 WHEN mainwin%
  760  CASE but OF
  770   WHEN 1,4
  780    IF icon>=0+ibase% AND icon<9*8+ibase% AND falling=-1 AND winner=p_none AND theirhost$<>"" AND weare=player THEN
  790     IF grid$((icon-ibase%) MOD 8,7)="" THEN
  800      falltime=TIME
  810      falling=(icon-ibase%) MOD 8:fallheight=7
  820      PROCnetgame_send(STR$falling)
  830     ENDIF
  840    ELSE
  850     CASE icon OF
  860      WHEN 6:REM Clear
  870       PROCclear_board(TRUE)
  880      WHEN 5:REM Message
  890       PROCopenwin(sendwin%)
  900       PROCsetcaretend(sendwin%,0)
  910     ENDCASE
  920    ENDIF
  930   WHEN 2
  940    PROCmenushade(mainmenu%,0,winner=p_none OR theirhost$="")
  950    PROCmenushade(mainmenu%,1,theirhost$="")
  960    PROCmenu(mainmenu%,-1,-1)
  970  ENDCASE
  980 WHEN sendwin%
  990  CASE icon OF
 1000   WHEN 2:REM Cancel - clear text and close
 1010    PROCseticontext(sendwin%,0,"")
 1020    PROCclosewin(sendwin%)
 1030   WHEN 1:REM Send
 1040    PROCsendmessage
 1050  ENDCASE
 1060 WHEN msgwin%
 1070  CASE icon OF
 1080   WHEN 2:REM Reply
 1090    PROCopenreply
 1100   WHEN 1:REM Ok
 1110    PROCclosewin(win)
 1120  ENDCASE
 1130ENDCASE
 1140ENDPROC
 1150:
 1160DEFPROCretick
 1170PROCmenutick(fallmenu%,0,fallspeed=fall_fast)
 1180PROCmenutick(fallmenu%,1,fallspeed=fall_medium)
 1190PROCmenutick(fallmenu%,2,fallspeed=fall_slow)
 1200PROCmenutick(fallmenu%,3,fallspeed=fall_none)
 1210ENDPROC
 1220:
 1230DEFPROCprocesskey(win,icon,key)
 1240LOCAL keydone:keydone=FALSE
 1250CASE win OF
 1260 WHEN connectwin%
 1270  CASE key OF
 1280   WHEN 13:REM Return
 1290    PROCtryconnect:keydone=TRUE
 1300  ENDCASE
 1310 WHEN sendwin%
 1320  CASE key OF
 1330   WHEN 27:REM Escape - close window
 1340    PROCclosewin(sendwin%):keydone=TRUE
 1350   WHEN 13:REM Return
 1360    PROCsendmessage:keydone=TRUE
 1370  ENDCASE
 1380 WHEN msgwin%
 1390  CASE key OF
 1400   WHEN 27,13:REM Escape, Return - close window
 1410    PROCclosewin(msgwin%)
 1420   WHEN ASC("R")-64:REM Reply (ctrl-R) cancel
 1430    PROCopenreply
 1440  ENDCASE
 1450ENDCASE
 1460IF NOT keydone THENSYS "Wimp_ProcessKey",key
 1470ENDPROC
 1480:
 1490DEFPROCopenreply
 1500PROCclosewin(msgwin%)
 1510PROCopenwin(sendwin%)
 1520PROCsetcaretend(sendwin%,0)
 1530ENDPROC
 1540:
 1550DEFPROCmenuchoice
 1560SYS"Wimp_GetPointerInfo",,message_buffer%:mbut%=message_buffer%!8
 1570m$=FNdecodemenu(curmenu%)
 1580CASE curmenu% OF
 1590 WHEN FNnetgame_sitesmenu:REM The sites menu, so select it
 1600  PROCnetgame_selectsite(!b%,connectwin%,1,3,-1)
 1610  curmenu%=FNnetgame_sitesmenu:REM In case it's been re-created
 1620 OTHERWISE
 1630  CASE m$ OF
 1640   WHEN "Quit":quit%=TRUE
 1650   WHEN "Sites...":PROCnetgame_editsites(2050):REM Editing time
 1660   WHEN "Clear board":PROCclear_board(TRUE)
 1670   WHEN "Disconnect":PROCdisconnect
 1680   WHEN "Fall speed.Fast":fallspeed=fall_fast:PROCretick
 1690   WHEN "Fall speed.Medium":fallspeed=fall_medium:PROCretick
 1700   WHEN "Fall speed.Slow":fallspeed=fall_slow:PROCretick
 1710   WHEN "Fall speed.No falling":fallspeed=fall_none:PROCretick
 1720  ENDCASE
 1730ENDCASE
 1740IF (mbut%AND1)=1 THENPROCrecreatemenu ELSEcurmenu%=-1
 1750ENDPROC
 1760:
 1770DEFPROCreceive(mess)
 1780CASE mess OF
 1790 REM &400C1 = mode change
 1800 REM &400C2 = task start up
 1810 REM &400C3 = task shut down
 1820 WHEN &90281:REM Sites file has been updated
 1830  PROCnetgame_readsites
 1840 WHEN 0:quit%=TRUE*2
 1850 WHEN &502:PROCHelp(b%!32,b%!36,b%!4)
 1860 WHEN 10:PROCdesktopsave(b%!20)
 1870ENDCASE
 1880ENDPROC
 1890:
 1900DEFPROCreceiveack(mess)
 1910CASE mess OF
 1920ENDCASE
 1930ENDPROC
 1940:
 1950DEFPROCdesktopsave(file%)
 1960LOCAL ERROR
 1970ON ERROR LOCAL b%!12=b%!8:SYS "Wimp_SendMessage",19,b%,b%!4:RESTORE ERROR:ENDPROC
 1980REM The above line acknowledges the message if an error occurs
 1990REM aborting the desktop save.
 2000BPUT#file%,"Run "+Appdir$
 2010ENDPROC
 2020:
 2030REM Any messages to be received MUST be noted
 2040DEFPROCinitwimp
 2050DIM messagelist% 256:messptr%=0
 2060PROCnotemessage(&502):PROCnotemessage(10)
 2070PROCnotemessage(0)
 2080SYS "Wimp_Initialise",310,&4B534154,Appname$,messagelist% TO wimpversion,taskhandle
 2090indl%=1024:menul%=1024:DIM b% 2048,ind% indl%,menu% menul%,wspc% &800
 2100curmenu%=-1
 2110PROCopenmessages
 2120sprites%=FNloadsprites(Appdir$+".Sprites")
 2130infobox%=FNloadtemplate("Info",1)
 2140mainwin%=FNloadtemplate("Main",sprites%)
 2150connectwin%=FNloadtemplate("connect",1)
 2160sendwin%=FNloadtemplate("send",1)
 2170msgwin%=FNloadtemplate("message",1)
 2180PROCseticontext(infobox%,1,Appname$)
 2190PROCseticontext(infobox%,2,longname$)
 2200PROCseticontext(infobox%,4,version$)
 2210fallmenu%=FNcreatemenu("Speed|Fast|Medium|Slow]D|No falling")
 2220mainmenu%=FNcreatemenu("Connect 4|Clear board|Disconnect|Fall speed]>fallmenu%")
 2230ibhandle=FNCreateIconBarIcon("!"+Appname$,shortname$,1)
 2240ibmenu%=FNcreatemenu(Appname$+"|Info]>infobox%|Sites...|Quit")
 2250iboptions%=options%
 2260ENDPROC
 2270:
 2280DEFPROCinitprog
 2290REM Initialise the network game library
 2300port=FNnetgame_init(2050)
 2310REM Read the sites from the file
 2320PROCnetgame_readsites
 2330REM Set up the infobox and connect window
 2340PROCseticontext(infobox%,2,">Info:"+STR$port)
 2350PROCseticontext(connectwin%,3,STR$port)
 2360REM Now initialise the board
 2370!b%=mainwin%:SYS "Wimp_GetWindowInfo",,b%:REM Read all the icons
 2380ibase%=b%!88
 2390REM Initialise the window
 2400FORy=0 TO7
 2410 FORx=0 TO7
 2420  dummy=FNcreateicon(mainwin%,x*41*2,-(7-y)*41*2,41*2,41*2,"","Sempty",&17,0,3,%0011000)
 2430 NEXT
 2440NEXT
 2450FORx=0 TO7
 2460 dummy=FNcreateicon(mainwin%,x*41*2,14*2,41*2,14*2,"","Stop",&17,0,3,%0011000)
 2470NEXT
 2480REM Now the variables
 2490DIM grid$(7,7),wins%(1)
 2500REM Player variables
 2510p_none=-1:p_draw=-2:p_red=0:p_blue=1:player=p_red:weare=p_red
 2520falling=-1:REM Nothing is falling yet
 2530fallheight=7:REM The height of the fall
 2540pieces=0:REM Number of pieces placed
 2550:
 2560REM Netgame stuff
 2570theirhost$=""
 2580REM Fall speeds
 2590fall_none=0:fall_fast=5:fall_medium=15:fall_slow=25
 2600falltime=0:REM The time it last fell
 2610fallspeed=fall_fast:REM The number of cs between falling units
 2620winner=p_none:REM No-one has won
 2630PROCretick:REM Put a tick on the speed menu
 2640PROCiconshade(mainwin%,6,1):REM Shade the 'clear' icon
 2650ENDPROC
 2660:
 2670DEFPROCHelp(win,icon,to)
 2680RESTORE +1:PROCreadhelp(win,icon,to)
 2690ENDPROC
 2700REM Windows
 2710DATA infobox%,">HInfobox"
 2720DATA 3,">HInfobox3"
 2730DATA 4,">HInfobox4"
 2740DATA mainwin%,">HMainwin"
 2750DATA 2,">HOurScore"
 2760DATA 4,">HTheirScore"
 2770DATA 5,">HMessage"
 2780DATA 6,">HMClear_board"
 2790DATA sendwin%,">HSendwin"
 2800DATA 2,">HSCancel"
 2810DATA 3,">HSSend"
 2820DATA msgwin%,">HMsgwin"
 2830DATA 2,">HReply"
 2840DATA 1,">HOk"
 2850DATA connectwin%,">HConnectwin"
 2860DATA 4,">HCOk"
 2870DATA -2,">HIconbar"
 2880DATA -1,-1
 2890REM Menus
 2900DATA -2,-2,-2,-2
 2910:
 2920REM tell% = flag to say if we should tell the other end...
 2930DEFPROCclear_board(tell%)
 2940LOCAL I
 2950grid$()="":pieces=0
 2960FORI=0TO63
 2970 PROCchangevalid(mainwin%,I+ibase%,"Sempty")
 2980NEXT
 2990winner=p_none:REM No-one has won
 3000falling=-1:REM Nothing is falling
 3010PROCiconshade(mainwin%,6,1):REM Shade the 'clear' icon
 3020REM We'd better tell them we've cleared it
 3030IF tell% THENPROCnetgame_send("Clear")
 3040ENDPROC
 3050:
 3060DEFPROCFetchPage(f$)
 3070REM XURI_Dispatch - this protocol is still being decided !
 3080SYS &6E381,%000,f$+CHR$0
 3090ENDPROC
 3100:
 3110DEFPROCupdatescores
 3120PROCseticontext(mainwin%,2,STR$(wins%(weare)))
 3130PROCseticontext(mainwin%,4,STR$(wins%(1-weare)))
 3140ENDPROC
 3150:
 3160DEFPROCupdatetitle
 3170LOCAL a$
 3180IF theirhost$="" THENplayer=p_none
 3190IF weare=player THENa$="Us" ELSEa$="Them"
 3200CASE player OF
 3210 WHEN p_red:PROCwindowtitle(mainwin%,">"+a$+":Red")
 3220 WHEN p_blue:PROCwindowtitle(mainwin%,">"+a$+":Blue")
 3230 WHEN p_draw:PROCwindowtitle(mainwin%,">Draw"
 3240 WHEN p_none:PROCwindowtitle(mainwin%,">NotConnected")
 3250ENDCASE
 3260ENDPROC
 3270:
 3280REM Change validation without flickering (I hope)
 3290DEFPROCchangevalid(win%,icon%,text$)
 3300b%!0=win%:b%!4=icon%:SYS "Wimp_GetIconState",,b%
 3310IF ((b%!24) AND &100)=0 THEN ERROR &803,"Icon isn't indirected (#"+STR$icon%+")"
 3320$(b%!32)=text$
 3330b%!8=0:b%!12=0:SYS "Wimp_SetIconState",,b%
 3340ENDPROC
 3350:
 3360DEFPROCFalling
 3370LOCAL a$,stop
 3380IF falling<>-1 THEN
 3390 IF player=p_red THENa$="red" ELSEa$="blue"
 3400 IF fallspeed<>fall_none THEN
 3410  IF fallheight<>7 THEN
 3420   PROCchangevalid(mainwin%,8+8*fallheight+falling+ibase%,"Sempty")
 3430  ENDIF
 3440  PROCchangevalid(mainwin%,8*fallheight+falling+ibase%,"S"+a$)
 3450 ENDIF
 3460 fallheight-=1
 3470 IF fallheight<>-1 THEN
 3480  stop=grid$(falling,fallheight)<>""
 3490 ELSE
 3500  stop=TRUE
 3510 ENDIF
 3520 IF stop THEN
 3530  pieces+=1
 3540  IF fallspeed=fall_none THEN
 3550   PROCchangevalid(mainwin%,8+8*fallheight+falling+ibase%,"S"+a$)
 3560  ENDIF
 3570  grid$(falling,fallheight+1)=STR$(player)
 3580  winner=FNcheckwin(falling,fallheight+1):falling=-1
 3590  IF winner=p_none THEN
 3600   IF player=p_red THENplayer=p_blue ELSEplayer=p_red
 3610   PROCupdatetitle
 3620  ELSE
 3630   IF winner=p_draw THEN
 3640    reply=FNerrorbox(">Message",">WinNone",%10001)
 3650   ELSE
 3660    IF player=weare THEN
 3670     reply=FNerrorbox(">Message",">WinUs",%10001)
 3680    ELSE
 3690     reply=FNerrorbox(">Message",">WinThem",%10001)
 3700    ENDIF
 3710   ENDIF
 3720   wins%(player)+=1
 3730   PROCupdatescores
 3740   PROCiconshade(mainwin%,6,0):REM Unshade the 'clear' icon
 3750  ENDIF
 3760 ENDIF
 3770ENDIF
 3780ENDPROC
 3790:
 3800DEFFNcheckwin(x,y)
 3810LOCAL llen,win,c$
 3820IF pieces=64 THEN=p_draw
 3830win=FALSE:c$=STR$(player)
 3840llen=0
 3850FORI=0TO7
 3860 IF grid$(I,y)<>c$ THENllen=0 ELSEllen+=1
 3870 IF llen=4 THENwin=TRUE
 3880NEXT
 3890IF NOT win THEN
 3900 llen=0
 3910 FORI=0TO7
 3920  IF grid$(x,I)<>c$ THENllen=0 ELSEllen+=1
 3930  IF llen=4 THENwin=TRUE
 3940 NEXT
 3950 IF NOT win THEN
 3960  llen=0
 3970  FORI=-6TO6
 3980   IF x+I>=0 AND y+I>=0 AND x+I<8 AND y+I<8 THEN
 3990    IF grid$(x+I,y+I)<>c$ THENllen=0 ELSEllen+=1
 4000    IF llen=4 THENwin=TRUE
 4010   ENDIF
 4020  NEXT
 4030  IF NOT win THEN
 4040   llen=0
 4050   FORI=-6TO6
 4060    IF x+I>=0 AND y-I>=0 AND x+I<8 AND y-I<8 THEN
 4070     IF grid$(x+I,y-I)<>c$ THENllen=0 ELSEllen+=1
 4080     IF llen=4 THENwin=TRUE
 4090    ENDIF
 4100   NEXT
 4110  ENDIF
 4120 ENDIF
 4130ENDIF
 4140IF win THENwin=player ELSEwin=-1
 4150=win
 4160:
 4170REM ******************** NetGame routines ******************
 4180:
 4190REM Gerph Software, Justin speaking; how can I help you ?
 4200DEFPROCconnected(host$,type)
 4210REM We know where you live
 4220theirhost$=host$
 4230IF type=ngs_originate THEN
 4240 REM We rang them, so we play first ;-)
 4250 weare=p_red
 4260ELSE
 4270 REM They rang us, they go first
 4280 weare=p_blue
 4290ENDIF
 4300player=p_red
 4310REM Wipe the board for a new game
 4320PROCclear_board(FALSE):REM But don't tell them
 4330REM Unshade the buttons
 4340PROCiconshade(mainwin%,5,0):REM Unshade Message
 4350REM Nobody's won anything yet
 4360wins%()=0
 4370REM Update the scores too ;-)
 4380PROCupdate_scores
 4390REM Update the titlebar
 4400PROCupdatetitle
 4410REM Open the window in the middle
 4420PROCopenwincentre(mainwin%)
 4430REM And close the connect window
 4440PROCclosewin(connectwin%)
 4450ENDPROC
 4460:
 4470REM They go bye-bye
 4480DEFPROCdisconnected(type)
 4490LOCAL reply
 4500CASE type OF
 4510 WHEN ngs_dead:REM Bad little boy, dropped connection
 4520  reply=FNerrorbox(">Message",">Closed",%10001)
 4530 WHEN ngs_going:REM Mr Flibble says 'Game Over', boys
 4540  reply=FNerrorbox(">Message",">GameOver",%10001)
 4550 WHEN ngs_failed:REM Couldn't get a connection
 4560  reply=FNerrorbox(">Message",">NoConnect",%10001)
 4570  PROCopenconnect
 4580ENDCASE
 4590REM Hey, they've gone !
 4600theirhost$=""
 4610PROCmenushade(mainmenu%,0,1):REM Shade the menu item
 4620PROCmenushade(mainmenu%,1,1):REM Shade the menu item
 4630PROCiconshade(mainwin%,5,1):REM Shade Message
 4640PROCiconshade(mainwin%,6,1):REM Shade Clear
 4650REM Update the titlebar
 4660PROCupdatetitle
 4670ENDPROC
 4680:
 4690REM Incoming wooooonded
 4700DEFPROCincoming(msg$)
 4710CASE LEFT$(msg$,1) OF
 4720 WHEN "M"
 4730  REM Oh, a message ? for me ? you are sweet !
 4740  PROCseticontext(msgwin%,0,MID$(msg$,2,39))
 4750  PROCopenwin(msgwin%)
 4760  PROCsetcaretpos(msgwin%,-1,-1)
 4770 WHEN "C"
 4780  REM Clear the board
 4790  IF winner<>p_none THENPROCclear_board(FALSE)
 4800 OTHERWISE
 4810  IF player=weare AND falling=-1 THEN
 4820   REM Hang on, it's our go and they're trying to go...
 4830   PROCnetgame_disconnect
 4840   theirhost$=""
 4850  ELSE
 4860   REM If there's one falling then let it fall, albeit quickly
 4870   WHILE falling<>-1:PROCFalling:ENDWHILE
 4880   REM and at this point someone may have won !
 4890   IF winner=p_none THEN
 4900    falling=VAL(msg$):fallheight=7
 4910    falltime=TIME
 4920   ENDIF
 4930  ENDIF
 4940ENDCASE
 4950ENDPROC
 4960:
 4970REM ********************** Other routines **********************
 4980:
 4990REM Attempt a connection using the 'connect' window as host
 5000DEFPROCtryconnect
 5010LOCAL host$,port
 5020host$=FNgeticontext(connectwin%,1)
 5030IF host$="" THENENDPROC
 5040REM Read the service number
 5050port=FNinet_getservbyname(FNgeticontext(connectwin%,3),"tcp")
 5060REM Now do the connection
 5070ok=FNnetgame_connect(host$,port)
 5080IF NOT ok THEN
 5090 REM We couldn't connect so tell them
 5100 reply=FNerrorbox(">Message",">NoConnect",%10001)
 5110ELSE
 5120 PROCclosewin(connectwin%)
 5130ENDIF
 5140ENDPROC
 5150:
 5160REM Open the 'connect' window
 5170DEFPROCopenconnect
 5180PROCopenwincentre(connectwin%)
 5190PROCsetcaretend(connectwin%,1)
 5200ENDPROC
 5210:
 5220REM Update the scores in the main window
 5230DEFPROCupdate_scores
 5240PROCseticontext(mainwin%,2,STR$(wins%(weare)))
 5250PROCseticontext(mainwin%,4,STR$(wins%(weare EORp_red EORp_blue)))
 5260ENDPROC
 5270:
 5280REM Disconnect us from them
 5290DEFPROCdisconnect
 5300PROCmenushade(mainmenu%,0,1):REM Shade the clear board item
 5310PROCmenushade(mainmenu%,1,1):REM Shade the disconnect item
 5320PROCiconshade(mainwin%,5,1):REM Shade Message
 5330PROCiconshade(mainwin%,6,1):REM Shade Clear
 5340REM Disconnect us
 5350PROCnetgame_disconnect
 5360REM We don't know them any more
 5370theirhost$=""
 5380REM And update the title
 5390PROCupdatetitle
 5400ENDPROC
 5410:
 5420REM Send the message in the 'send' window
 5430DEFPROCsendmessage
 5440LOCAL a$:a$=FNgeticontext(sendwin%,0)
 5450REM Send the message
 5460PROCnetgame_send("M"+a$)
 5470REM Clear the text and close the window
 5480PROCseticontext(sendwin%,0,"")
 5490PROCclosewin(sendwin%)
 5500ENDPROC

� >!RunImage
testing%=�
)ț "<BasicLibrary$File>":�initlibrary
(%ț "<HeapLibrary$File>":�initheap
2ț "<NetGameLibrary$File>"
<=� � �closemessages:�eerror:� testing%=� ��("Spool"):� � �
F � testing%=� �*Spool Spooled
P� testing%=� �� �:� �
Z5� Appname$ is used for task manager & Appname$Dir
dD� shortname$ is used for iconbar name and should usually be null
n'� longname$ is used for info window
x7� AppURL$ is used to for clicks on the version icon
�2Appname$="NetC4":version$="1.02 (17 Jun 1997)"
�3shortname$="":longname$="Connect 4 (port xxxx)"
�'Appdir$=�systemvar(Appname$+"$Dir")
�LAppURL$="http://users.essex.ac.uk/users/gerph/acorn/internet.html#netc4"
��initwimp:�initprog
�quit%=�
�� � �error
�ȕ quit%=�
�
 �Poll
��
��netgame_final
�ș "Wimp_CloseDown"
��closemessages
� testing%=� �*SPOOL
�
5� quit%=-1 for user quit, -2 for taskmanager quit
":
,
��Poll
6#t=50:� falling<>-1 �t=fallspeed
@)ș "Wimp_PollIdle",0,b%,�+t � reason%
JȎ reason% �
T � 0:� Null poll
^  � Do a fall if we need to
h&  � �>falltime+fallspeed ��Falling
r4  � Check if the network game has to do anything
|  �netgame_poll
� � 1 = Redraw window
�! � 2:ș "Wimp_OpenWindow",,b%
�" � 3:ș "Wimp_CloseWindow",,b%
�& � 6:�mouseclick(b%!8,b%!12,b%!16)
�+ � 7 = Drag box dropped on another task
�% � 8:�processkey(b%!0,b%!4,b%!24)
� � 9:�menuchoice
� � 17,18:�receive(b%!16)
� � 19:�receiveack(b%!16)
��
��
�:
�0� Buttons : 1 = Adjust, 2 = Menu, 4 = Select
��mouseclick(but,win,icon)
Ȏ win �
	 � -2
&  Ȏ but �
0   � 2:�ibmenu
:   � 1,4
D    � theirhost$="" �
N=     �openconnect:� Not connected, so open connect window
X	    �
b<     �openwin(mainwin%):� Connected, so open main window
l	    �
v  �
� � infobox%
�  Ȏ icon �
�   � 1:�showfree
�>   � 3:�FetchPage("http://users.essex.ac.uk/users/gerph/")
�   � 4:�FetchPage(AppURL$)
�  �
� � connectwin%
�  Ȏ icon �
�7   � 5:�menu(�netgame_sitesmenu,-1,-1):� Sites list
�   � 4:�tryconnect
�  �
� � mainwin%
�  Ȏ but �
   � 1,4
i    � icon>=0+ibase% � icon<9*8+ibase% � falling=-1 � winner=p_none � theirhost$<>"" � weare=player �
*     � grid$((icon-ibase%) � 8,7)="" �
       falltime=�
*0      falling=(icon-ibase%) � 8:fallheight=7
4!      �netgame_send(�falling)
>
     �
H	    �
R     Ȏ icon �
\      � 6:� Clear
f       �clear_board(�)
p      � 5:� Message
z       �openwin(sendwin%)
�#       �setcaretend(sendwin%,0)
�
     �
�	    �
�
   � 2
�=    �menushade(mainmenu%,0,winner=p_none � theirhost$="")
�-    �menushade(mainmenu%,1,theirhost$="")
�    �menu(mainmenu%,-1,-1)
�  �
� � sendwin%
�  Ȏ icon �
�*   � 2:� Cancel - clear text and close
�#    �seticontext(sendwin%,0,"")
�    �closewin(sendwin%)
   � 1:� Send
    �sendmessage
  �
$ � msgwin%
.  Ȏ icon �
8   � 2:� Reply
B    �openreply
L   � 1:� Ok
V    �closewin(win)
`  �
j�
t�
~:
���retick
�.�menutick(fallmenu%,0,fallspeed=fall_fast)
�0�menutick(fallmenu%,1,fallspeed=fall_medium)
�.�menutick(fallmenu%,2,fallspeed=fall_slow)
�.�menutick(fallmenu%,3,fallspeed=fall_none)
��
�:
���processkey(win,icon,key)
�� keydone:keydone=�
�Ȏ win �
� � connectwin%
�  Ȏ key �
   � 13:� Return

    �tryconnect:keydone=�
  �
 � sendwin%
(  Ȏ key �
2#   � 27:� Escape - close window
<%    �closewin(sendwin%):keydone=�
F   � 13:� Return
P    �sendmessage:keydone=�
Z  �
d � msgwin%
n  Ȏ key �
x.   � 27,13:� Escape, Return - close window
�    �closewin(msgwin%)
�*   � �("R")-64:� Reply (ctrl-R) cancel
�    �openreply
�  �
��
�)� � keydone �ș "Wimp_ProcessKey",key
��
�:
���openreply
��closewin(msgwin%)
��openwin(sendwin%)
��setcaretend(sendwin%,0)
��
:
��menuchoice
Dș"Wimp_GetPointerInfo",,message_buffer%:mbut%=message_buffer%!8
"m$=�decodemenu(curmenu%)
,Ȏ curmenu% �
68 � �netgame_sitesmenu:� The sites menu, so select it
@1  �netgame_selectsite(!b%,connectwin%,1,3,-1)
J@  curmenu%=�netgame_sitesmenu:� In case it's been re-created
T 
^
  Ȏ m$ �
h   � "Quit":quit%=�
r;   � "Sites...":�netgame_editsites(2050):� Editing time
|&   � "Clear board":�clear_board(�)
�!   � "Disconnect":�disconnect
�6   � "Fall speed.Fast":fallspeed=fall_fast:�retick
�:   � "Fall speed.Medium":fallspeed=fall_medium:�retick
�6   � "Fall speed.Slow":fallspeed=fall_slow:�retick
�<   � "Fall speed.No falling":fallspeed=fall_none:�retick
�  �
��
�-� (mbut%�1)=1 ��recreatemenu �curmenu%=-1
��
�:
���receive(mess)
�
Ȏ mess �
� � &400C1 = mode change
 � &400C2 = task start up
 � &400C3 = task shut down
+ � &90281:� Sites file has been updated
&  �netgame_readsites
0 � 0:quit%=�*2
:# � &502:�Help(b%!32,b%!36,b%!4)
D � 10:�desktopsave(b%!20)
N�
X�
b:
l��receiveack(mess)
v
Ȏ mess �
��
��
�:
���desktopsave(file%)
�� �
�;� � � b%!12=b%!8:ș "Wimp_SendMessage",19,b%,b%!4:� �:�
�@� The above line acknowledges the message if an error occurs
� � aborting the desktop save.
��#file%,"Run "+Appdir$
��
�:
�/� Any messages to be received MUST be noted
���initwimp
!� messagelist% 256:messptr%=0
'�notemessage(&502):�notemessage(10)
�notemessage(0)
 Uș "Wimp_Initialise",310,&4B534154,Appname$,messagelist% � wimpversion,taskhandle
*Gindl%=1024:menul%=1024:� b% 2048,ind% indl%,menu% menul%,wspc% &800
4curmenu%=-1
>�openmessages
H-sprites%=�loadsprites(Appdir$+".Sprites")
R$infobox%=�loadtemplate("Info",1)
\+mainwin%=�loadtemplate("Main",sprites%)
f*connectwin%=�loadtemplate("connect",1)
p$sendwin%=�loadtemplate("send",1)
z&msgwin%=�loadtemplate("message",1)
�%�seticontext(infobox%,1,Appname$)
�&�seticontext(infobox%,2,longname$)
�%�seticontext(infobox%,4,version$)
�@fallmenu%=�createmenu("Speed|Fast|Medium|Slow]D|No falling")
�Smainmenu%=�createmenu("Connect 4|Clear board|Disconnect|Fall speed]>fallmenu%")
�:ibhandle=�CreateIconBarIcon("!"+Appname$,shortname$,1)
�Aibmenu%=�createmenu(Appname$+"|Info]>infobox%|Sites...|Quit")
�iboptions%=options%
��
�:
���initprog
�)� Initialise the network game library
�port=�netgame_init(2050)
	"� Read the sites from the file
	�netgame_readsites
	+� Set up the infobox and connect window
	$+�seticontext(infobox%,2,">Info:"+�port)
	.%�seticontext(connectwin%,3,�port)
	8� Now initialise the board
	BA!b%=mainwin%:ș "Wimp_GetWindowInfo",,b%:� Read all the icons
	Libase%=b%!88
	V� Initialise the window
	`�y=0 �7
	j �x=0 �7
	t[  dummy=�createicon(mainwin%,x*41*2,-(7-y)*41*2,41*2,41*2,"","Sempty",&17,0,3,%0011000)
	~ �
	��
	��x=0 �7
	�Q dummy=�createicon(mainwin%,x*41*2,14*2,41*2,14*2,"","Stop",&17,0,3,%0011000)
	��
	�� Now the variables
	�� grid$(7,7),wins%(1)
	�� Player variables
	�Ap_none=-1:p_draw=-2:p_red=0:p_blue=1:player=p_red:weare=p_red
	�'falling=-1:� Nothing is falling yet
	�)fallheight=7:� The height of the fall
	�&pieces=0:� Number of pieces placed
	�:
� Netgame stuff

theirhost$=""
� Fall speeds
7fall_none=0:fall_fast=5:fall_medium=15:fall_slow=25
(&falltime=0:� The time it last fell
2@fallspeed=fall_fast:� The number of cs between falling units
<"winner=p_none:� No-one has won
F*�retick:� Put a tick on the speed menu
P5�iconshade(mainwin%,6,1):� Shade the 'clear' icon
Z�
d:
n��Help(win,icon,to)
x� +1:�readhelp(win,icon,to)
��
�
� Windows
�� infobox%,">HInfobox"
�� 3,">HInfobox3"
�� 4,">HInfobox4"
�� mainwin%,">HMainwin"
�� 2,">HOurScore"
�� 4,">HTheirScore"
�� 5,">HMessage"
�� 6,">HMClear_board"
�� sendwin%,">HSendwin"
�� 2,">HSCancel"
�� 3,">HSSend"
� msgwin%,">HMsgwin"
� 2,">HReply"
� 1,">HOk"
" � connectwin%,">HConnectwin"
,� 4,">HCOk"
6� -2,">HIconbar"
@� -1,-1
J� Menus
T� -2,-2,-2,-2
^:
h<� tell% = flag to say if we should tell the other end...
r��clear_board(tell%)
|� I
�grid$()="":pieces=0
��I=0�63
�- �changevalid(mainwin%,I+ibase%,"Sempty")
��
�"winner=p_none:� No-one has won
�#falling=-1:� Nothing is falling
�5�iconshade(mainwin%,6,1):� Shade the 'clear' icon
�,� We'd better tell them we've cleared it
�#� tell% ��netgame_send("Clear")
��
�:
���FetchPage(f$)
�<� XURI_Dispatch - this protocol is still being decided !
ș &6E381,%000,f$+�0
�
:
&��updatescores
0,�seticontext(mainwin%,2,�(wins%(weare)))
:.�seticontext(mainwin%,4,�(wins%(1-weare)))
D�
N:
X��updatetitle
b� a$
l"� theirhost$="" �player=p_none
v&� weare=player �a$="Us" �a$="Them"
�Ȏ player �
�1 � p_red:�windowtitle(mainwin%,">"+a$+":Red")
�3 � p_blue:�windowtitle(mainwin%,">"+a$+":Blue")
�+ � p_draw:�windowtitle(mainwin%,">Draw"
�4 � p_none:�windowtitle(mainwin%,">NotConnected")
��
��
�:
�3� Change validation without flickering (I hope)
�#��changevalid(win%,icon%,text$)
�3b%!0=win%:b%!4=icon%:ș "Wimp_GetIconState",,b%
�G� ((b%!24) � &100)=0 � � &803,"Icon isn't indirected (#"+�icon%+")"
�$(b%!32)=text$

-b%!8=0:b%!12=0:ș "Wimp_SetIconState",,b%

�

:

 
��Falling

*
� a$,stop

4� falling<>-1 �

>( � player=p_red �a$="red" �a$="blue"

H � fallspeed<>fall_none �

R  � fallheight<>7 �

\D   �changevalid(mainwin%,8+8*fallheight+falling+ibase%,"Sempty")

f  �

p?  �changevalid(mainwin%,8*fallheight+falling+ibase%,"S"+a$)

z �

� fallheight-=1

� � fallheight<>-1 �

�(  stop=grid$(falling,fallheight)<>""

� �

�  stop=�

� �

�
 � stop �

�  pieces+=1

�  � fallspeed=fall_none �

�B   �changevalid(mainwin%,8+8*fallheight+falling+ibase%,"S"+a$)

�  �

�+  grid$(falling,fallheight+1)=�(player)

�7  winner=�checkwin(falling,fallheight+1):falling=-1
  � winner=p_none �
2   � player=p_red �player=p_blue �player=p_red
   �updatetitle
$  �
.   � winner=p_draw �
85    reply=�errorbox(">Message",">WinNone",%10001)
B   �
L    � player=weare �
V4     reply=�errorbox(">Message",">WinUs",%10001)
`	    �
j6     reply=�errorbox(">Message",">WinThem",%10001)
t	    �
~   �
�   wins%(player)+=1
�   �updatescores
�:   �iconshade(mainwin%,6,0):� Unshade the 'clear' icon
�  �
� �
��
��
�:
�ݤcheckwin(x,y)
�� llen,win,c$
�� pieces=64 �=p_draw
�win=�:c$=�(player)

llen=0


�I=0�7
& � grid$(I,y)<>c$ �llen=0 �llen+=1
 � llen=4 �win=�
(�
2
� � win �
< llen=0
F �I=0�7
P'  � grid$(x,I)<>c$ �llen=0 �llen+=1
Z  � llen=4 �win=�
d �
n � � win �
x  llen=0
�
  �I=-6�6
�*   � x+I>=0 � y+I>=0 � x+I<8 � y+I<8 �
�-    � grid$(x+I,y+I)<>c$ �llen=0 �llen+=1
�    � llen=4 �win=�
�   �
�  �
�  � � win �
�
   llen=0
�   �I=-6�6
�+    � x+I>=0 � y-I>=0 � x+I<8 � y-I<8 �
�.     � grid$(x+I,y-I)<>c$ �llen=0 �llen+=1
�     � llen=4 �win=�
�	    �
   �
  �
 �
"�
,� win �win=player �win=-1
6=win
@:
J>� ******************** NetGame routines ******************
T:
^;� Gerph Software, Justin speaking; how can I help you ?
h��connected(host$,type)
r� We know where you live
|theirhost$=host$
�� type=ngs_originate �
�) � We rang them, so we play first ;-)
� weare=p_red
��
�" � They rang us, they go first
� weare=p_blue
��
�player=p_red
�#� Wipe the board for a new game
�)�clear_board(�):� But don't tell them
�� Unshade the buttons
�.�iconshade(mainwin%,5,0):� Unshade Message
�� Nobody's won anything yet

wins%()=0
� Update the scores too ;-)
�update_scores
&� Update the titlebar
0�updatetitle
:#� Open the window in the middle
D�openwincentre(mainwin%)
N"� And close the connect window
X�closewin(connectwin%)
b�
l:
v� They go bye-bye
���disconnected(type)
�� reply
�
Ȏ type �
�4 � ngs_dead:� Bad little boy, dropped connection
�2  reply=�errorbox(">Message",">Closed",%10001)
�4 � ngs_going:� Mr Flibble says 'Game Over', boys
�4  reply=�errorbox(">Message",">GameOver",%10001)
�- � ngs_failed:� Couldn't get a connection
�5  reply=�errorbox(">Message",">NoConnect",%10001)
�  �openconnect
��
�� Hey, they've gone !
�theirhost$=""
3�menushade(mainmenu%,0,1):� Shade the menu item
3�menushade(mainmenu%,1,1):� Shade the menu item
,�iconshade(mainwin%,5,1):� Shade Message
 *�iconshade(mainwin%,6,1):� Shade Clear
*� Update the titlebar
4�updatetitle
>�
H:
R� Incoming wooooonded
\��incoming(msg$)
fȎ �msg$,1) �
p
 � "M"
z0  � Oh, a message ? for me ? you are sweet !
�)  �seticontext(msgwin%,0,�msg$,2,39))
�  �openwin(msgwin%)
�!  �setcaretpos(msgwin%,-1,-1)
�
 � "C"
�  � Clear the board
�'  � winner<>p_none ��clear_board(�)
� 
�#  � player=weare � falling=-1 �
�9   � Hang on, it's our go and they're trying to go...
�   �netgame_disconnect
�   theirhost$=""
�  �
�@   � If there's one falling then let it fall, albeit quickly
    ȕ falling<>-1:�Falling:�
1   � and at this point someone may have won !
   � winner=p_none �
$$    falling=�(msg$):fallheight=7
.    falltime=�
8   �
B  �
L�
V�
`:
jB� ********************** Other routines **********************
t:
~=� Attempt a connection using the 'connect' window as host
���tryconnect
�� host$,port
�%host$=�geticontext(connectwin%,1)
�� host$="" ��
�� Read the service number
�?port=�inet_getservbyname(�geticontext(connectwin%,3),"tcp")
�� Now do the connection
�#ok=�netgame_connect(host$,port)
�� � ok �
�' � We couldn't connect so tell them
�4 reply=�errorbox(">Message",">NoConnect",%10001)
��
 �closewin(connectwin%)

�
�
:
(� Open the 'connect' window
2��openconnect
<�openwincentre(connectwin%)
F�setcaretend(connectwin%,1)
P�
Z:
d*� Update the scores in the main window
n��update_scores
x,�seticontext(mainwin%,2,�(wins%(weare)))
�;�seticontext(mainwin%,4,�(wins%(weare �p_red �p_blue)))
��
�:
�� Disconnect us from them
���disconnect
�:�menushade(mainmenu%,0,1):� Shade the clear board item
�9�menushade(mainmenu%,1,1):� Shade the disconnect item
�,�iconshade(mainwin%,5,1):� Shade Message
�*�iconshade(mainwin%,6,1):� Shade Clear
�� Disconnect us
��netgame_disconnect
�!� We don't know them any more
�theirhost$=""
� And update the title
�updatetitle
�
":
,+� Send the message in the 'send' window
6��sendmessage
@$� a$:a$=�geticontext(sendwin%,0)
J� Send the message
T�netgame_send("M"+a$)
^)� Clear the text and close the window
h�seticontext(sendwin%,0,"")
r�closewin(sendwin%)
|�
�
00000000  0d 00 0a 10 f4 20 3e 21  52 75 6e 49 6d 61 67 65  |..... >!RunImage|
00000010  0d 00 14 0e 74 65 73 74  69 6e 67 25 3d a3 0d 00  |....testing%=...|
00000020  1e 29 c8 9b 20 22 3c 42  61 73 69 63 4c 69 62 72  |.).. "<BasicLibr|
00000030  61 72 79 24 46 69 6c 65  3e 22 3a f2 69 6e 69 74  |ary$File>":.init|
00000040  6c 69 62 72 61 72 79 0d  00 28 25 c8 9b 20 22 3c  |library..(%.. "<|
00000050  48 65 61 70 4c 69 62 72  61 72 79 24 46 69 6c 65  |HeapLibrary$File|
00000060  3e 22 3a f2 69 6e 69 74  68 65 61 70 0d 00 32 1e  |>":.initheap..2.|
00000070  c8 9b 20 22 3c 4e 65 74  47 61 6d 65 4c 69 62 72  |.. "<NetGameLibr|
00000080  61 72 79 24 46 69 6c 65  3e 22 0d 00 3c 3d ee 20  |ary$File>"..<=. |
00000090  85 20 f2 63 6c 6f 73 65  6d 65 73 73 61 67 65 73  |. .closemessages|
000000a0  3a f2 65 65 72 72 6f 72  3a e7 20 74 65 73 74 69  |:.eerror:. testi|
000000b0  6e 67 25 3d b9 20 8c ff  28 22 53 70 6f 6f 6c 22  |ng%=. ..("Spool"|
000000c0  29 3a e0 20 8b 20 e0 0d  00 46 20 e7 20 74 65 73  |):. . ...F . tes|
000000d0  74 69 6e 67 25 3d b9 20  8c 2a 53 70 6f 6f 6c 20  |ting%=. .*Spool |
000000e0  53 70 6f 6f 6c 65 64 0d  00 50 19 e7 20 74 65 73  |Spooled..P.. tes|
000000f0  74 69 6e 67 25 3d b9 20  8c fc 20 ee 3a fc 20 f2  |ting%=. .. .:. .|
00000100  0d 00 5a 35 f4 20 41 70  70 6e 61 6d 65 24 20 69  |..Z5. Appname$ i|
00000110  73 20 75 73 65 64 20 66  6f 72 20 74 61 73 6b 20  |s used for task |
00000120  6d 61 6e 61 67 65 72 20  26 20 41 70 70 6e 61 6d  |manager & Appnam|
00000130  65 24 44 69 72 0d 00 64  44 f4 20 73 68 6f 72 74  |e$Dir..dD. short|
00000140  6e 61 6d 65 24 20 69 73  20 75 73 65 64 20 66 6f  |name$ is used fo|
00000150  72 20 69 63 6f 6e 62 61  72 20 6e 61 6d 65 20 61  |r iconbar name a|
00000160  6e 64 20 73 68 6f 75 6c  64 20 75 73 75 61 6c 6c  |nd should usuall|
00000170  79 20 62 65 20 6e 75 6c  6c 0d 00 6e 27 f4 20 6c  |y be null..n'. l|
00000180  6f 6e 67 6e 61 6d 65 24  20 69 73 20 75 73 65 64  |ongname$ is used|
00000190  20 66 6f 72 20 69 6e 66  6f 20 77 69 6e 64 6f 77  | for info window|
000001a0  0d 00 78 37 f4 20 41 70  70 55 52 4c 24 20 69 73  |..x7. AppURL$ is|
000001b0  20 75 73 65 64 20 74 6f  20 66 6f 72 20 63 6c 69  | used to for cli|
000001c0  63 6b 73 20 6f 6e 20 74  68 65 20 76 65 72 73 69  |cks on the versi|
000001d0  6f 6e 20 69 63 6f 6e 0d  00 82 32 41 70 70 6e 61  |on icon...2Appna|
000001e0  6d 65 24 3d 22 4e 65 74  43 34 22 3a 76 65 72 73  |me$="NetC4":vers|
000001f0  69 6f 6e 24 3d 22 31 2e  30 32 20 28 31 37 20 4a  |ion$="1.02 (17 J|
00000200  75 6e 20 31 39 39 37 29  22 0d 00 8c 33 73 68 6f  |un 1997)"...3sho|
00000210  72 74 6e 61 6d 65 24 3d  22 22 3a 6c 6f 6e 67 6e  |rtname$="":longn|
00000220  61 6d 65 24 3d 22 43 6f  6e 6e 65 63 74 20 34 20  |ame$="Connect 4 |
00000230  28 70 6f 72 74 20 78 78  78 78 29 22 0d 00 96 27  |(port xxxx)"...'|
00000240  41 70 70 64 69 72 24 3d  a4 73 79 73 74 65 6d 76  |Appdir$=.systemv|
00000250  61 72 28 41 70 70 6e 61  6d 65 24 2b 22 24 44 69  |ar(Appname$+"$Di|
00000260  72 22 29 0d 00 a0 4c 41  70 70 55 52 4c 24 3d 22  |r")...LAppURL$="|
00000270  68 74 74 70 3a 2f 2f 75  73 65 72 73 2e 65 73 73  |http://users.ess|
00000280  65 78 2e 61 63 2e 75 6b  2f 75 73 65 72 73 2f 67  |ex.ac.uk/users/g|
00000290  65 72 70 68 2f 61 63 6f  72 6e 2f 69 6e 74 65 72  |erph/acorn/inter|
000002a0  6e 65 74 2e 68 74 6d 6c  23 6e 65 74 63 34 22 0d  |net.html#netc4".|
000002b0  00 aa 17 f2 69 6e 69 74  77 69 6d 70 3a f2 69 6e  |....initwimp:.in|
000002c0  69 74 70 72 6f 67 0d 00  b4 0b 71 75 69 74 25 3d  |itprog....quit%=|
000002d0  a3 0d 00 be 0e ee 20 85  20 f2 65 72 72 6f 72 0d  |...... . .error.|
000002e0  00 c8 0e c8 95 20 71 75  69 74 25 3d a3 0d 00 d2  |..... quit%=....|
000002f0  0a 20 f2 50 6f 6c 6c 0d  00 dc 05 ce 0d 00 e6 12  |. .Poll.........|
00000300  f2 6e 65 74 67 61 6d 65  5f 66 69 6e 61 6c 0d 00  |.netgame_final..|
00000310  f0 17 c8 99 20 22 57 69  6d 70 5f 43 6c 6f 73 65  |.... "Wimp_Close|
00000320  44 6f 77 6e 22 0d 00 fa  12 f2 63 6c 6f 73 65 6d  |Down".....closem|
00000330  65 73 73 61 67 65 73 0d  01 04 18 e7 20 74 65 73  |essages..... tes|
00000340  74 69 6e 67 25 3d b9 20  8c 2a 53 50 4f 4f 4c 0d  |ting%=. .*SPOOL.|
00000350  01 0e 05 e0 0d 01 18 35  f4 20 71 75 69 74 25 3d  |.......5. quit%=|
00000360  2d 31 20 66 6f 72 20 75  73 65 72 20 71 75 69 74  |-1 for user quit|
00000370  2c 20 2d 32 20 66 6f 72  20 74 61 73 6b 6d 61 6e  |, -2 for taskman|
00000380  61 67 65 72 20 71 75 69  74 0d 01 22 05 3a 0d 01  |ager quit..".:..|
00000390  2c 0a dd f2 50 6f 6c 6c  0d 01 36 23 74 3d 35 30  |,...Poll..6#t=50|
000003a0  3a e7 20 66 61 6c 6c 69  6e 67 3c 3e 2d 31 20 8c  |:. falling<>-1 .|
000003b0  74 3d 66 61 6c 6c 73 70  65 65 64 0d 01 40 29 c8  |t=fallspeed..@).|
000003c0  99 20 22 57 69 6d 70 5f  50 6f 6c 6c 49 64 6c 65  |. "Wimp_PollIdle|
000003d0  22 2c 30 2c 62 25 2c 91  2b 74 20 b8 20 72 65 61  |",0,b%,.+t . rea|
000003e0  73 6f 6e 25 0d 01 4a 10  c8 8e 20 72 65 61 73 6f  |son%..J... reaso|
000003f0  6e 25 20 ca 0d 01 54 14  20 c9 20 30 3a f4 20 4e  |n% ...T. . 0:. N|
00000400  75 6c 6c 20 70 6f 6c 6c  0d 01 5e 1f 20 20 f4 20  |ull poll..^.  . |
00000410  44 6f 20 61 20 66 61 6c  6c 20 69 66 20 77 65 20  |Do a fall if we |
00000420  6e 65 65 64 20 74 6f 0d  01 68 26 20 20 e7 20 91  |need to..h&  . .|
00000430  3e 66 61 6c 6c 74 69 6d  65 2b 66 61 6c 6c 73 70  |>falltime+fallsp|
00000440  65 65 64 20 8c f2 46 61  6c 6c 69 6e 67 0d 01 72  |eed ..Falling..r|
00000450  34 20 20 f4 20 43 68 65  63 6b 20 69 66 20 74 68  |4  . Check if th|
00000460  65 20 6e 65 74 77 6f 72  6b 20 67 61 6d 65 20 68  |e network game h|
00000470  61 73 20 74 6f 20 64 6f  20 61 6e 79 74 68 69 6e  |as to do anythin|
00000480  67 0d 01 7c 13 20 20 f2  6e 65 74 67 61 6d 65 5f  |g..|.  .netgame_|
00000490  70 6f 6c 6c 0d 01 86 18  20 f4 20 31 20 3d 20 52  |poll.... . 1 = R|
000004a0  65 64 72 61 77 20 77 69  6e 64 6f 77 0d 01 90 21  |edraw window...!|
000004b0  20 c9 20 32 3a c8 99 20  22 57 69 6d 70 5f 4f 70  | . 2:.. "Wimp_Op|
000004c0  65 6e 57 69 6e 64 6f 77  22 2c 2c 62 25 0d 01 9a  |enWindow",,b%...|
000004d0  22 20 c9 20 33 3a c8 99  20 22 57 69 6d 70 5f 43  |" . 3:.. "Wimp_C|
000004e0  6c 6f 73 65 57 69 6e 64  6f 77 22 2c 2c 62 25 0d  |loseWindow",,b%.|
000004f0  01 a4 26 20 c9 20 36 3a  f2 6d 6f 75 73 65 63 6c  |..& . 6:.mousecl|
00000500  69 63 6b 28 62 25 21 38  2c 62 25 21 31 32 2c 62  |ick(b%!8,b%!12,b|
00000510  25 21 31 36 29 0d 01 ae  2b 20 f4 20 37 20 3d 20  |%!16)...+ . 7 = |
00000520  44 72 61 67 20 62 6f 78  20 64 72 6f 70 70 65 64  |Drag box dropped|
00000530  20 6f 6e 20 61 6e 6f 74  68 65 72 20 74 61 73 6b  | on another task|
00000540  0d 01 b8 25 20 c9 20 38  3a f2 70 72 6f 63 65 73  |...% . 8:.proces|
00000550  73 6b 65 79 28 62 25 21  30 2c 62 25 21 34 2c 62  |skey(b%!0,b%!4,b|
00000560  25 21 32 34 29 0d 01 c2  14 20 c9 20 39 3a f2 6d  |%!24).... . 9:.m|
00000570  65 6e 75 63 68 6f 69 63  65 0d 01 cc 1c 20 c9 20  |enuchoice.... . |
00000580  31 37 2c 31 38 3a f2 72  65 63 65 69 76 65 28 62  |17,18:.receive(b|
00000590  25 21 31 36 29 0d 01 d6  1c 20 c9 20 31 39 3a f2  |%!16).... . 19:.|
000005a0  72 65 63 65 69 76 65 61  63 6b 28 62 25 21 31 36  |receiveack(b%!16|
000005b0  29 0d 01 e0 05 cb 0d 01  ea 05 e1 0d 01 f4 05 3a  |)..............:|
000005c0  0d 01 fe 30 f4 20 42 75  74 74 6f 6e 73 20 3a 20  |...0. Buttons : |
000005d0  31 20 3d 20 41 64 6a 75  73 74 2c 20 32 20 3d 20  |1 = Adjust, 2 = |
000005e0  4d 65 6e 75 2c 20 34 20  3d 20 53 65 6c 65 63 74  |Menu, 4 = Select|
000005f0  0d 02 08 1e dd f2 6d 6f  75 73 65 63 6c 69 63 6b  |......mouseclick|
00000600  28 62 75 74 2c 77 69 6e  2c 69 63 6f 6e 29 0d 02  |(but,win,icon)..|
00000610  12 0c c8 8e 20 77 69 6e  20 ca 0d 02 1c 09 20 c9  |.... win ..... .|
00000620  20 2d 32 0d 02 26 0e 20  20 c8 8e 20 62 75 74 20  | -2..&.  .. but |
00000630  ca 0d 02 30 12 20 20 20  c9 20 32 3a f2 69 62 6d  |...0.   . 2:.ibm|
00000640  65 6e 75 0d 02 3a 0c 20  20 20 c9 20 31 2c 34 0d  |enu..:.   . 1,4.|
00000650  02 44 19 20 20 20 20 e7  20 74 68 65 69 72 68 6f  |.D.    . theirho|
00000660  73 74 24 3d 22 22 20 8c  0d 02 4e 3d 20 20 20 20  |st$="" ...N=    |
00000670  20 f2 6f 70 65 6e 63 6f  6e 6e 65 63 74 3a f4 20  | .openconnect:. |
00000680  4e 6f 74 20 63 6f 6e 6e  65 63 74 65 64 2c 20 73  |Not connected, s|
00000690  6f 20 6f 70 65 6e 20 63  6f 6e 6e 65 63 74 20 77  |o open connect w|
000006a0  69 6e 64 6f 77 0d 02 58  09 20 20 20 20 cc 0d 02  |indow..X.    ...|
000006b0  62 3c 20 20 20 20 20 f2  6f 70 65 6e 77 69 6e 28  |b<     .openwin(|
000006c0  6d 61 69 6e 77 69 6e 25  29 3a f4 20 43 6f 6e 6e  |mainwin%):. Conn|
000006d0  65 63 74 65 64 2c 20 73  6f 20 6f 70 65 6e 20 6d  |ected, so open m|
000006e0  61 69 6e 20 77 69 6e 64  6f 77 0d 02 6c 09 20 20  |ain window..l.  |
000006f0  20 20 cd 0d 02 76 07 20  20 cb 0d 02 80 0f 20 c9  |  ...v.  ..... .|
00000700  20 69 6e 66 6f 62 6f 78  25 0d 02 8a 0f 20 20 c8  | infobox%....  .|
00000710  8e 20 69 63 6f 6e 20 ca  0d 02 94 14 20 20 20 c9  |. icon .....   .|
00000720  20 31 3a f2 73 68 6f 77  66 72 65 65 0d 02 9e 3e  | 1:.showfree...>|
00000730  20 20 20 c9 20 33 3a f2  46 65 74 63 68 50 61 67  |   . 3:.FetchPag|
00000740  65 28 22 68 74 74 70 3a  2f 2f 75 73 65 72 73 2e  |e("http://users.|
00000750  65 73 73 65 78 2e 61 63  2e 75 6b 2f 75 73 65 72  |essex.ac.uk/user|
00000760  73 2f 67 65 72 70 68 2f  22 29 0d 02 a8 1e 20 20  |s/gerph/")....  |
00000770  20 c9 20 34 3a f2 46 65  74 63 68 50 61 67 65 28  | . 4:.FetchPage(|
00000780  41 70 70 55 52 4c 24 29  0d 02 b2 07 20 20 cb 0d  |AppURL$)....  ..|
00000790  02 bc 12 20 c9 20 63 6f  6e 6e 65 63 74 77 69 6e  |... . connectwin|
000007a0  25 0d 02 c6 0f 20 20 c8  8e 20 69 63 6f 6e 20 ca  |%....  .. icon .|
000007b0  0d 02 d0 37 20 20 20 c9  20 35 3a f2 6d 65 6e 75  |...7   . 5:.menu|
000007c0  28 a4 6e 65 74 67 61 6d  65 5f 73 69 74 65 73 6d  |(.netgame_sitesm|
000007d0  65 6e 75 2c 2d 31 2c 2d  31 29 3a f4 20 53 69 74  |enu,-1,-1):. Sit|
000007e0  65 73 20 6c 69 73 74 0d  02 da 16 20 20 20 c9 20  |es list....   . |
000007f0  34 3a f2 74 72 79 63 6f  6e 6e 65 63 74 0d 02 e4  |4:.tryconnect...|
00000800  07 20 20 cb 0d 02 ee 0f  20 c9 20 6d 61 69 6e 77  |.  ..... . mainw|
00000810  69 6e 25 0d 02 f8 0e 20  20 c8 8e 20 62 75 74 20  |in%....  .. but |
00000820  ca 0d 03 02 0c 20 20 20  c9 20 31 2c 34 0d 03 0c  |.....   . 1,4...|
00000830  69 20 20 20 20 e7 20 69  63 6f 6e 3e 3d 30 2b 69  |i    . icon>=0+i|
00000840  62 61 73 65 25 20 80 20  69 63 6f 6e 3c 39 2a 38  |base% . icon<9*8|
00000850  2b 69 62 61 73 65 25 20  80 20 66 61 6c 6c 69 6e  |+ibase% . fallin|
00000860  67 3d 2d 31 20 80 20 77  69 6e 6e 65 72 3d 70 5f  |g=-1 . winner=p_|
00000870  6e 6f 6e 65 20 80 20 74  68 65 69 72 68 6f 73 74  |none . theirhost|
00000880  24 3c 3e 22 22 20 80 20  77 65 61 72 65 3d 70 6c  |$<>"" . weare=pl|
00000890  61 79 65 72 20 8c 0d 03  16 2a 20 20 20 20 20 e7  |ayer ....*     .|
000008a0  20 67 72 69 64 24 28 28  69 63 6f 6e 2d 69 62 61  | grid$((icon-iba|
000008b0  73 65 25 29 20 83 20 38  2c 37 29 3d 22 22 20 8c  |se%) . 8,7)="" .|
000008c0  0d 03 20 14 20 20 20 20  20 20 66 61 6c 6c 74 69  |.. .      fallti|
000008d0  6d 65 3d 91 0d 03 2a 30  20 20 20 20 20 20 66 61  |me=...*0      fa|
000008e0  6c 6c 69 6e 67 3d 28 69  63 6f 6e 2d 69 62 61 73  |lling=(icon-ibas|
000008f0  65 25 29 20 83 20 38 3a  66 61 6c 6c 68 65 69 67  |e%) . 8:fallheig|
00000900  68 74 3d 37 0d 03 34 21  20 20 20 20 20 20 f2 6e  |ht=7..4!      .n|
00000910  65 74 67 61 6d 65 5f 73  65 6e 64 28 c3 66 61 6c  |etgame_send(.fal|
00000920  6c 69 6e 67 29 0d 03 3e  0a 20 20 20 20 20 cd 0d  |ling)..>.     ..|
00000930  03 48 09 20 20 20 20 cc  0d 03 52 12 20 20 20 20  |.H.    ...R.    |
00000940  20 c8 8e 20 69 63 6f 6e  20 ca 0d 03 5c 15 20 20  | .. icon ...\.  |
00000950  20 20 20 20 c9 20 36 3a  f4 20 43 6c 65 61 72 0d  |    . 6:. Clear.|
00000960  03 66 1a 20 20 20 20 20  20 20 f2 63 6c 65 61 72  |.f.       .clear|
00000970  5f 62 6f 61 72 64 28 b9  29 0d 03 70 17 20 20 20  |_board(.)..p.   |
00000980  20 20 20 c9 20 35 3a f4  20 4d 65 73 73 61 67 65  |   . 5:. Message|
00000990  0d 03 7a 1d 20 20 20 20  20 20 20 f2 6f 70 65 6e  |..z.       .open|
000009a0  77 69 6e 28 73 65 6e 64  77 69 6e 25 29 0d 03 84  |win(sendwin%)...|
000009b0  23 20 20 20 20 20 20 20  f2 73 65 74 63 61 72 65  |#       .setcare|
000009c0  74 65 6e 64 28 73 65 6e  64 77 69 6e 25 2c 30 29  |tend(sendwin%,0)|
000009d0  0d 03 8e 0a 20 20 20 20  20 cb 0d 03 98 09 20 20  |....     .....  |
000009e0  20 20 cd 0d 03 a2 0a 20  20 20 c9 20 32 0d 03 ac  |  .....   . 2...|
000009f0  3d 20 20 20 20 f2 6d 65  6e 75 73 68 61 64 65 28  |=    .menushade(|
00000a00  6d 61 69 6e 6d 65 6e 75  25 2c 30 2c 77 69 6e 6e  |mainmenu%,0,winn|
00000a10  65 72 3d 70 5f 6e 6f 6e  65 20 84 20 74 68 65 69  |er=p_none . thei|
00000a20  72 68 6f 73 74 24 3d 22  22 29 0d 03 b6 2d 20 20  |rhost$="")...-  |
00000a30  20 20 f2 6d 65 6e 75 73  68 61 64 65 28 6d 61 69  |  .menushade(mai|
00000a40  6e 6d 65 6e 75 25 2c 31  2c 74 68 65 69 72 68 6f  |nmenu%,1,theirho|
00000a50  73 74 24 3d 22 22 29 0d  03 c0 1e 20 20 20 20 f2  |st$="")....    .|
00000a60  6d 65 6e 75 28 6d 61 69  6e 6d 65 6e 75 25 2c 2d  |menu(mainmenu%,-|
00000a70  31 2c 2d 31 29 0d 03 ca  07 20 20 cb 0d 03 d4 0f  |1,-1)....  .....|
00000a80  20 c9 20 73 65 6e 64 77  69 6e 25 0d 03 de 0f 20  | . sendwin%.... |
00000a90  20 c8 8e 20 69 63 6f 6e  20 ca 0d 03 e8 2a 20 20  | .. icon ....*  |
00000aa0  20 c9 20 32 3a f4 20 43  61 6e 63 65 6c 20 2d 20  | . 2:. Cancel - |
00000ab0  63 6c 65 61 72 20 74 65  78 74 20 61 6e 64 20 63  |clear text and c|
00000ac0  6c 6f 73 65 0d 03 f2 23  20 20 20 20 f2 73 65 74  |lose...#    .set|
00000ad0  69 63 6f 6e 74 65 78 74  28 73 65 6e 64 77 69 6e  |icontext(sendwin|
00000ae0  25 2c 30 2c 22 22 29 0d  03 fc 1b 20 20 20 20 f2  |%,0,"")....    .|
00000af0  63 6c 6f 73 65 77 69 6e  28 73 65 6e 64 77 69 6e  |closewin(sendwin|
00000b00  25 29 0d 04 06 11 20 20  20 c9 20 31 3a f4 20 53  |%)....   . 1:. S|
00000b10  65 6e 64 0d 04 10 14 20  20 20 20 f2 73 65 6e 64  |end....    .send|
00000b20  6d 65 73 73 61 67 65 0d  04 1a 07 20 20 cb 0d 04  |message....  ...|
00000b30  24 0e 20 c9 20 6d 73 67  77 69 6e 25 0d 04 2e 0f  |$. . msgwin%....|
00000b40  20 20 c8 8e 20 69 63 6f  6e 20 ca 0d 04 38 12 20  |  .. icon ...8. |
00000b50  20 20 c9 20 32 3a f4 20  52 65 70 6c 79 0d 04 42  |  . 2:. Reply..B|
00000b60  12 20 20 20 20 f2 6f 70  65 6e 72 65 70 6c 79 0d  |.    .openreply.|
00000b70  04 4c 0f 20 20 20 c9 20  31 3a f4 20 4f 6b 0d 04  |.L.   . 1:. Ok..|
00000b80  56 16 20 20 20 20 f2 63  6c 6f 73 65 77 69 6e 28  |V.    .closewin(|
00000b90  77 69 6e 29 0d 04 60 07  20 20 cb 0d 04 6a 05 cb  |win)..`.  ...j..|
00000ba0  0d 04 74 05 e1 0d 04 7e  05 3a 0d 04 88 0c dd f2  |..t....~.:......|
00000bb0  72 65 74 69 63 6b 0d 04  92 2e f2 6d 65 6e 75 74  |retick.....menut|
00000bc0  69 63 6b 28 66 61 6c 6c  6d 65 6e 75 25 2c 30 2c  |ick(fallmenu%,0,|
00000bd0  66 61 6c 6c 73 70 65 65  64 3d 66 61 6c 6c 5f 66  |fallspeed=fall_f|
00000be0  61 73 74 29 0d 04 9c 30  f2 6d 65 6e 75 74 69 63  |ast)...0.menutic|
00000bf0  6b 28 66 61 6c 6c 6d 65  6e 75 25 2c 31 2c 66 61  |k(fallmenu%,1,fa|
00000c00  6c 6c 73 70 65 65 64 3d  66 61 6c 6c 5f 6d 65 64  |llspeed=fall_med|
00000c10  69 75 6d 29 0d 04 a6 2e  f2 6d 65 6e 75 74 69 63  |ium).....menutic|
00000c20  6b 28 66 61 6c 6c 6d 65  6e 75 25 2c 32 2c 66 61  |k(fallmenu%,2,fa|
00000c30  6c 6c 73 70 65 65 64 3d  66 61 6c 6c 5f 73 6c 6f  |llspeed=fall_slo|
00000c40  77 29 0d 04 b0 2e f2 6d  65 6e 75 74 69 63 6b 28  |w).....menutick(|
00000c50  66 61 6c 6c 6d 65 6e 75  25 2c 33 2c 66 61 6c 6c  |fallmenu%,3,fall|
00000c60  73 70 65 65 64 3d 66 61  6c 6c 5f 6e 6f 6e 65 29  |speed=fall_none)|
00000c70  0d 04 ba 05 e1 0d 04 c4  05 3a 0d 04 ce 1e dd f2  |.........:......|
00000c80  70 72 6f 63 65 73 73 6b  65 79 28 77 69 6e 2c 69  |processkey(win,i|
00000c90  63 6f 6e 2c 6b 65 79 29  0d 04 d8 17 ea 20 6b 65  |con,key)..... ke|
00000ca0  79 64 6f 6e 65 3a 6b 65  79 64 6f 6e 65 3d a3 0d  |ydone:keydone=..|
00000cb0  04 e2 0c c8 8e 20 77 69  6e 20 ca 0d 04 ec 12 20  |..... win ..... |
00000cc0  c9 20 63 6f 6e 6e 65 63  74 77 69 6e 25 0d 04 f6  |. connectwin%...|
00000cd0  0e 20 20 c8 8e 20 6b 65  79 20 ca 0d 05 00 14 20  |.  .. key ..... |
00000ce0  20 20 c9 20 31 33 3a f4  20 52 65 74 75 72 6e 0d  |  . 13:. Return.|
00000cf0  05 0a 1d 20 20 20 20 f2  74 72 79 63 6f 6e 6e 65  |...    .tryconne|
00000d00  63 74 3a 6b 65 79 64 6f  6e 65 3d b9 0d 05 14 07  |ct:keydone=.....|
00000d10  20 20 cb 0d 05 1e 0f 20  c9 20 73 65 6e 64 77 69  |  ..... . sendwi|
00000d20  6e 25 0d 05 28 0e 20 20  c8 8e 20 6b 65 79 20 ca  |n%..(.  .. key .|
00000d30  0d 05 32 23 20 20 20 c9  20 32 37 3a f4 20 45 73  |..2#   . 27:. Es|
00000d40  63 61 70 65 20 2d 20 63  6c 6f 73 65 20 77 69 6e  |cape - close win|
00000d50  64 6f 77 0d 05 3c 25 20  20 20 20 f2 63 6c 6f 73  |dow..<%    .clos|
00000d60  65 77 69 6e 28 73 65 6e  64 77 69 6e 25 29 3a 6b  |ewin(sendwin%):k|
00000d70  65 79 64 6f 6e 65 3d b9  0d 05 46 14 20 20 20 c9  |eydone=...F.   .|
00000d80  20 31 33 3a f4 20 52 65  74 75 72 6e 0d 05 50 1e  | 13:. Return..P.|
00000d90  20 20 20 20 f2 73 65 6e  64 6d 65 73 73 61 67 65  |    .sendmessage|
00000da0  3a 6b 65 79 64 6f 6e 65  3d b9 0d 05 5a 07 20 20  |:keydone=...Z.  |
00000db0  cb 0d 05 64 0e 20 c9 20  6d 73 67 77 69 6e 25 0d  |...d. . msgwin%.|
00000dc0  05 6e 0e 20 20 c8 8e 20  6b 65 79 20 ca 0d 05 78  |.n.  .. key ...x|
00000dd0  2e 20 20 20 c9 20 32 37  2c 31 33 3a f4 20 45 73  |.   . 27,13:. Es|
00000de0  63 61 70 65 2c 20 52 65  74 75 72 6e 20 2d 20 63  |cape, Return - c|
00000df0  6c 6f 73 65 20 77 69 6e  64 6f 77 0d 05 82 1a 20  |lose window.... |
00000e00  20 20 20 f2 63 6c 6f 73  65 77 69 6e 28 6d 73 67  |   .closewin(msg|
00000e10  77 69 6e 25 29 0d 05 8c  2a 20 20 20 c9 20 97 28  |win%)...*   . .(|
00000e20  22 52 22 29 2d 36 34 3a  f4 20 52 65 70 6c 79 20  |"R")-64:. Reply |
00000e30  28 63 74 72 6c 2d 52 29  20 63 61 6e 63 65 6c 0d  |(ctrl-R) cancel.|
00000e40  05 96 12 20 20 20 20 f2  6f 70 65 6e 72 65 70 6c  |...    .openrepl|
00000e50  79 0d 05 a0 07 20 20 cb  0d 05 aa 05 cb 0d 05 b4  |y....  .........|
00000e60  29 e7 20 ac 20 6b 65 79  64 6f 6e 65 20 8c c8 99  |). . keydone ...|
00000e70  20 22 57 69 6d 70 5f 50  72 6f 63 65 73 73 4b 65  | "Wimp_ProcessKe|
00000e80  79 22 2c 6b 65 79 0d 05  be 05 e1 0d 05 c8 05 3a  |y",key.........:|
00000e90  0d 05 d2 0f dd f2 6f 70  65 6e 72 65 70 6c 79 0d  |......openreply.|
00000ea0  05 dc 16 f2 63 6c 6f 73  65 77 69 6e 28 6d 73 67  |....closewin(msg|
00000eb0  77 69 6e 25 29 0d 05 e6  16 f2 6f 70 65 6e 77 69  |win%).....openwi|
00000ec0  6e 28 73 65 6e 64 77 69  6e 25 29 0d 05 f0 1c f2  |n(sendwin%).....|
00000ed0  73 65 74 63 61 72 65 74  65 6e 64 28 73 65 6e 64  |setcaretend(send|
00000ee0  77 69 6e 25 2c 30 29 0d  05 fa 05 e1 0d 06 04 05  |win%,0).........|
00000ef0  3a 0d 06 0e 10 dd f2 6d  65 6e 75 63 68 6f 69 63  |:......menuchoic|
00000f00  65 0d 06 18 44 c8 99 22  57 69 6d 70 5f 47 65 74  |e...D.."Wimp_Get|
00000f10  50 6f 69 6e 74 65 72 49  6e 66 6f 22 2c 2c 6d 65  |PointerInfo",,me|
00000f20  73 73 61 67 65 5f 62 75  66 66 65 72 25 3a 6d 62  |ssage_buffer%:mb|
00000f30  75 74 25 3d 6d 65 73 73  61 67 65 5f 62 75 66 66  |ut%=message_buff|
00000f40  65 72 25 21 38 0d 06 22  1c 6d 24 3d a4 64 65 63  |er%!8..".m$=.dec|
00000f50  6f 64 65 6d 65 6e 75 28  63 75 72 6d 65 6e 75 25  |odemenu(curmenu%|
00000f60  29 0d 06 2c 11 c8 8e 20  63 75 72 6d 65 6e 75 25  |)..,... curmenu%|
00000f70  20 ca 0d 06 36 38 20 c9  20 a4 6e 65 74 67 61 6d  | ...68 . .netgam|
00000f80  65 5f 73 69 74 65 73 6d  65 6e 75 3a f4 20 54 68  |e_sitesmenu:. Th|
00000f90  65 20 73 69 74 65 73 20  6d 65 6e 75 2c 20 73 6f  |e sites menu, so|
00000fa0  20 73 65 6c 65 63 74 20  69 74 0d 06 40 31 20 20  | select it..@1  |
00000fb0  f2 6e 65 74 67 61 6d 65  5f 73 65 6c 65 63 74 73  |.netgame_selects|
00000fc0  69 74 65 28 21 62 25 2c  63 6f 6e 6e 65 63 74 77  |ite(!b%,connectw|
00000fd0  69 6e 25 2c 31 2c 33 2c  2d 31 29 0d 06 4a 40 20  |in%,1,3,-1)..J@ |
00000fe0  20 63 75 72 6d 65 6e 75  25 3d a4 6e 65 74 67 61  | curmenu%=.netga|
00000ff0  6d 65 5f 73 69 74 65 73  6d 65 6e 75 3a f4 20 49  |me_sitesmenu:. I|
00001000  6e 20 63 61 73 65 20 69  74 27 73 20 62 65 65 6e  |n case it's been|
00001010  20 72 65 2d 63 72 65 61  74 65 64 0d 06 54 06 20  | re-created..T. |
00001020  7f 0d 06 5e 0d 20 20 c8  8e 20 6d 24 20 ca 0d 06  |...^.  .. m$ ...|
00001030  68 17 20 20 20 c9 20 22  51 75 69 74 22 3a 71 75  |h.   . "Quit":qu|
00001040  69 74 25 3d b9 0d 06 72  3b 20 20 20 c9 20 22 53  |it%=...r;   . "S|
00001050  69 74 65 73 2e 2e 2e 22  3a f2 6e 65 74 67 61 6d  |ites...":.netgam|
00001060  65 5f 65 64 69 74 73 69  74 65 73 28 32 30 35 30  |e_editsites(2050|
00001070  29 3a f4 20 45 64 69 74  69 6e 67 20 74 69 6d 65  |):. Editing time|
00001080  0d 06 7c 26 20 20 20 c9  20 22 43 6c 65 61 72 20  |..|&   . "Clear |
00001090  62 6f 61 72 64 22 3a f2  63 6c 65 61 72 5f 62 6f  |board":.clear_bo|
000010a0  61 72 64 28 b9 29 0d 06  86 21 20 20 20 c9 20 22  |ard(.)...!   . "|
000010b0  44 69 73 63 6f 6e 6e 65  63 74 22 3a f2 64 69 73  |Disconnect":.dis|
000010c0  63 6f 6e 6e 65 63 74 0d  06 90 36 20 20 20 c9 20  |connect...6   . |
000010d0  22 46 61 6c 6c 20 73 70  65 65 64 2e 46 61 73 74  |"Fall speed.Fast|
000010e0  22 3a 66 61 6c 6c 73 70  65 65 64 3d 66 61 6c 6c  |":fallspeed=fall|
000010f0  5f 66 61 73 74 3a f2 72  65 74 69 63 6b 0d 06 9a  |_fast:.retick...|
00001100  3a 20 20 20 c9 20 22 46  61 6c 6c 20 73 70 65 65  |:   . "Fall spee|
00001110  64 2e 4d 65 64 69 75 6d  22 3a 66 61 6c 6c 73 70  |d.Medium":fallsp|
00001120  65 65 64 3d 66 61 6c 6c  5f 6d 65 64 69 75 6d 3a  |eed=fall_medium:|
00001130  f2 72 65 74 69 63 6b 0d  06 a4 36 20 20 20 c9 20  |.retick...6   . |
00001140  22 46 61 6c 6c 20 73 70  65 65 64 2e 53 6c 6f 77  |"Fall speed.Slow|
00001150  22 3a 66 61 6c 6c 73 70  65 65 64 3d 66 61 6c 6c  |":fallspeed=fall|
00001160  5f 73 6c 6f 77 3a f2 72  65 74 69 63 6b 0d 06 ae  |_slow:.retick...|
00001170  3c 20 20 20 c9 20 22 46  61 6c 6c 20 73 70 65 65  |<   . "Fall spee|
00001180  64 2e 4e 6f 20 66 61 6c  6c 69 6e 67 22 3a 66 61  |d.No falling":fa|
00001190  6c 6c 73 70 65 65 64 3d  66 61 6c 6c 5f 6e 6f 6e  |llspeed=fall_non|
000011a0  65 3a f2 72 65 74 69 63  6b 0d 06 b8 07 20 20 cb  |e:.retick....  .|
000011b0  0d 06 c2 05 cb 0d 06 cc  2d e7 20 28 6d 62 75 74  |........-. (mbut|
000011c0  25 80 31 29 3d 31 20 8c  f2 72 65 63 72 65 61 74  |%.1)=1 ..recreat|
000011d0  65 6d 65 6e 75 20 8b 63  75 72 6d 65 6e 75 25 3d  |emenu .curmenu%=|
000011e0  2d 31 0d 06 d6 05 e1 0d  06 e0 05 3a 0d 06 ea 13  |-1.........:....|
000011f0  dd f2 72 65 63 65 69 76  65 28 6d 65 73 73 29 0d  |..receive(mess).|
00001200  06 f4 0d c8 8e 20 6d 65  73 73 20 ca 0d 06 fe 1b  |..... mess .....|
00001210  20 f4 20 26 34 30 30 43  31 20 3d 20 6d 6f 64 65  | . &400C1 = mode|
00001220  20 63 68 61 6e 67 65 0d  07 08 1d 20 f4 20 26 34  | change.... . &4|
00001230  30 30 43 32 20 3d 20 74  61 73 6b 20 73 74 61 72  |00C2 = task star|
00001240  74 20 75 70 0d 07 12 1e  20 f4 20 26 34 30 30 43  |t up.... . &400C|
00001250  33 20 3d 20 74 61 73 6b  20 73 68 75 74 20 64 6f  |3 = task shut do|
00001260  77 6e 0d 07 1c 2b 20 c9  20 26 39 30 32 38 31 3a  |wn...+ . &90281:|
00001270  f4 20 53 69 74 65 73 20  66 69 6c 65 20 68 61 73  |. Sites file has|
00001280  20 62 65 65 6e 20 75 70  64 61 74 65 64 0d 07 26  | been updated..&|
00001290  18 20 20 f2 6e 65 74 67  61 6d 65 5f 72 65 61 64  |.  .netgame_read|
000012a0  73 69 74 65 73 0d 07 30  12 20 c9 20 30 3a 71 75  |sites..0. . 0:qu|
000012b0  69 74 25 3d b9 2a 32 0d  07 3a 23 20 c9 20 26 35  |it%=.*2..:# . &5|
000012c0  30 32 3a f2 48 65 6c 70  28 62 25 21 33 32 2c 62  |02:.Help(b%!32,b|
000012d0  25 21 33 36 2c 62 25 21  34 29 0d 07 44 1d 20 c9  |%!36,b%!4)..D. .|
000012e0  20 31 30 3a f2 64 65 73  6b 74 6f 70 73 61 76 65  | 10:.desktopsave|
000012f0  28 62 25 21 32 30 29 0d  07 4e 05 cb 0d 07 58 05  |(b%!20)..N....X.|
00001300  e1 0d 07 62 05 3a 0d 07  6c 16 dd f2 72 65 63 65  |...b.:..l...rece|
00001310  69 76 65 61 63 6b 28 6d  65 73 73 29 0d 07 76 0d  |iveack(mess)..v.|
00001320  c8 8e 20 6d 65 73 73 20  ca 0d 07 80 05 cb 0d 07  |.. mess ........|
00001330  8a 05 e1 0d 07 94 05 3a  0d 07 9e 18 dd f2 64 65  |.......:......de|
00001340  73 6b 74 6f 70 73 61 76  65 28 66 69 6c 65 25 29  |sktopsave(file%)|
00001350  0d 07 a8 07 ea 20 85 0d  07 b2 3b ee 20 85 20 ea  |..... ....;. . .|
00001360  20 62 25 21 31 32 3d 62  25 21 38 3a c8 99 20 22  | b%!12=b%!8:.. "|
00001370  57 69 6d 70 5f 53 65 6e  64 4d 65 73 73 61 67 65  |Wimp_SendMessage|
00001380  22 2c 31 39 2c 62 25 2c  62 25 21 34 3a f7 20 85  |",19,b%,b%!4:. .|
00001390  3a e1 0d 07 bc 40 f4 20  54 68 65 20 61 62 6f 76  |:....@. The abov|
000013a0  65 20 6c 69 6e 65 20 61  63 6b 6e 6f 77 6c 65 64  |e line acknowled|
000013b0  67 65 73 20 74 68 65 20  6d 65 73 73 61 67 65 20  |ges the message |
000013c0  69 66 20 61 6e 20 65 72  72 6f 72 20 6f 63 63 75  |if an error occu|
000013d0  72 73 0d 07 c6 20 f4 20  61 62 6f 72 74 69 6e 67  |rs... . aborting|
000013e0  20 74 68 65 20 64 65 73  6b 74 6f 70 20 73 61 76  | the desktop sav|
000013f0  65 2e 0d 07 d0 1a d5 23  66 69 6c 65 25 2c 22 52  |e......#file%,"R|
00001400  75 6e 20 22 2b 41 70 70  64 69 72 24 0d 07 da 05  |un "+Appdir$....|
00001410  e1 0d 07 e4 05 3a 0d 07  ee 2f f4 20 41 6e 79 20  |.....:.../. Any |
00001420  6d 65 73 73 61 67 65 73  20 74 6f 20 62 65 20 72  |messages to be r|
00001430  65 63 65 69 76 65 64 20  4d 55 53 54 20 62 65 20  |eceived MUST be |
00001440  6e 6f 74 65 64 0d 07 f8  0e dd f2 69 6e 69 74 77  |noted......initw|
00001450  69 6d 70 0d 08 02 21 de  20 6d 65 73 73 61 67 65  |imp...!. message|
00001460  6c 69 73 74 25 20 32 35  36 3a 6d 65 73 73 70 74  |list% 256:messpt|
00001470  72 25 3d 30 0d 08 0c 27  f2 6e 6f 74 65 6d 65 73  |r%=0...'.notemes|
00001480  73 61 67 65 28 26 35 30  32 29 3a f2 6e 6f 74 65  |sage(&502):.note|
00001490  6d 65 73 73 61 67 65 28  31 30 29 0d 08 16 13 f2  |message(10).....|
000014a0  6e 6f 74 65 6d 65 73 73  61 67 65 28 30 29 0d 08  |notemessage(0)..|
000014b0  20 55 c8 99 20 22 57 69  6d 70 5f 49 6e 69 74 69  | U.. "Wimp_Initi|
000014c0  61 6c 69 73 65 22 2c 33  31 30 2c 26 34 42 35 33  |alise",310,&4B53|
000014d0  34 31 35 34 2c 41 70 70  6e 61 6d 65 24 2c 6d 65  |4154,Appname$,me|
000014e0  73 73 61 67 65 6c 69 73  74 25 20 b8 20 77 69 6d  |ssagelist% . wim|
000014f0  70 76 65 72 73 69 6f 6e  2c 74 61 73 6b 68 61 6e  |pversion,taskhan|
00001500  64 6c 65 0d 08 2a 47 69  6e 64 6c 25 3d 31 30 32  |dle..*Gindl%=102|
00001510  34 3a 6d 65 6e 75 6c 25  3d 31 30 32 34 3a de 20  |4:menul%=1024:. |
00001520  62 25 20 32 30 34 38 2c  69 6e 64 25 20 69 6e 64  |b% 2048,ind% ind|
00001530  6c 25 2c 6d 65 6e 75 25  20 6d 65 6e 75 6c 25 2c  |l%,menu% menul%,|
00001540  77 73 70 63 25 20 26 38  30 30 0d 08 34 0f 63 75  |wspc% &800..4.cu|
00001550  72 6d 65 6e 75 25 3d 2d  31 0d 08 3e 11 f2 6f 70  |rmenu%=-1..>..op|
00001560  65 6e 6d 65 73 73 61 67  65 73 0d 08 48 2d 73 70  |enmessages..H-sp|
00001570  72 69 74 65 73 25 3d a4  6c 6f 61 64 73 70 72 69  |rites%=.loadspri|
00001580  74 65 73 28 41 70 70 64  69 72 24 2b 22 2e 53 70  |tes(Appdir$+".Sp|
00001590  72 69 74 65 73 22 29 0d  08 52 24 69 6e 66 6f 62  |rites")..R$infob|
000015a0  6f 78 25 3d a4 6c 6f 61  64 74 65 6d 70 6c 61 74  |ox%=.loadtemplat|
000015b0  65 28 22 49 6e 66 6f 22  2c 31 29 0d 08 5c 2b 6d  |e("Info",1)..\+m|
000015c0  61 69 6e 77 69 6e 25 3d  a4 6c 6f 61 64 74 65 6d  |ainwin%=.loadtem|
000015d0  70 6c 61 74 65 28 22 4d  61 69 6e 22 2c 73 70 72  |plate("Main",spr|
000015e0  69 74 65 73 25 29 0d 08  66 2a 63 6f 6e 6e 65 63  |ites%)..f*connec|
000015f0  74 77 69 6e 25 3d a4 6c  6f 61 64 74 65 6d 70 6c  |twin%=.loadtempl|
00001600  61 74 65 28 22 63 6f 6e  6e 65 63 74 22 2c 31 29  |ate("connect",1)|
00001610  0d 08 70 24 73 65 6e 64  77 69 6e 25 3d a4 6c 6f  |..p$sendwin%=.lo|
00001620  61 64 74 65 6d 70 6c 61  74 65 28 22 73 65 6e 64  |adtemplate("send|
00001630  22 2c 31 29 0d 08 7a 26  6d 73 67 77 69 6e 25 3d  |",1)..z&msgwin%=|
00001640  a4 6c 6f 61 64 74 65 6d  70 6c 61 74 65 28 22 6d  |.loadtemplate("m|
00001650  65 73 73 61 67 65 22 2c  31 29 0d 08 84 25 f2 73  |essage",1)...%.s|
00001660  65 74 69 63 6f 6e 74 65  78 74 28 69 6e 66 6f 62  |eticontext(infob|
00001670  6f 78 25 2c 31 2c 41 70  70 6e 61 6d 65 24 29 0d  |ox%,1,Appname$).|
00001680  08 8e 26 f2 73 65 74 69  63 6f 6e 74 65 78 74 28  |..&.seticontext(|
00001690  69 6e 66 6f 62 6f 78 25  2c 32 2c 6c 6f 6e 67 6e  |infobox%,2,longn|
000016a0  61 6d 65 24 29 0d 08 98  25 f2 73 65 74 69 63 6f  |ame$)...%.setico|
000016b0  6e 74 65 78 74 28 69 6e  66 6f 62 6f 78 25 2c 34  |ntext(infobox%,4|
000016c0  2c 76 65 72 73 69 6f 6e  24 29 0d 08 a2 40 66 61  |,version$)...@fa|
000016d0  6c 6c 6d 65 6e 75 25 3d  a4 63 72 65 61 74 65 6d  |llmenu%=.createm|
000016e0  65 6e 75 28 22 53 70 65  65 64 7c 46 61 73 74 7c  |enu("Speed|Fast||
000016f0  4d 65 64 69 75 6d 7c 53  6c 6f 77 5d 44 7c 4e 6f  |Medium|Slow]D|No|
00001700  20 66 61 6c 6c 69 6e 67  22 29 0d 08 ac 53 6d 61  | falling")...Sma|
00001710  69 6e 6d 65 6e 75 25 3d  a4 63 72 65 61 74 65 6d  |inmenu%=.createm|
00001720  65 6e 75 28 22 43 6f 6e  6e 65 63 74 20 34 7c 43  |enu("Connect 4|C|
00001730  6c 65 61 72 20 62 6f 61  72 64 7c 44 69 73 63 6f  |lear board|Disco|
00001740  6e 6e 65 63 74 7c 46 61  6c 6c 20 73 70 65 65 64  |nnect|Fall speed|
00001750  5d 3e 66 61 6c 6c 6d 65  6e 75 25 22 29 0d 08 b6  |]>fallmenu%")...|
00001760  3a 69 62 68 61 6e 64 6c  65 3d a4 43 72 65 61 74  |:ibhandle=.Creat|
00001770  65 49 63 6f 6e 42 61 72  49 63 6f 6e 28 22 21 22  |eIconBarIcon("!"|
00001780  2b 41 70 70 6e 61 6d 65  24 2c 73 68 6f 72 74 6e  |+Appname$,shortn|
00001790  61 6d 65 24 2c 31 29 0d  08 c0 41 69 62 6d 65 6e  |ame$,1)...Aibmen|
000017a0  75 25 3d a4 63 72 65 61  74 65 6d 65 6e 75 28 41  |u%=.createmenu(A|
000017b0  70 70 6e 61 6d 65 24 2b  22 7c 49 6e 66 6f 5d 3e  |ppname$+"|Info]>|
000017c0  69 6e 66 6f 62 6f 78 25  7c 53 69 74 65 73 2e 2e  |infobox%|Sites..|
000017d0  2e 7c 51 75 69 74 22 29  0d 08 ca 17 69 62 6f 70  |.|Quit")....ibop|
000017e0  74 69 6f 6e 73 25 3d 6f  70 74 69 6f 6e 73 25 0d  |tions%=options%.|
000017f0  08 d4 05 e1 0d 08 de 05  3a 0d 08 e8 0e dd f2 69  |........:......i|
00001800  6e 69 74 70 72 6f 67 0d  08 f2 29 f4 20 49 6e 69  |nitprog...). Ini|
00001810  74 69 61 6c 69 73 65 20  74 68 65 20 6e 65 74 77  |tialise the netw|
00001820  6f 72 6b 20 67 61 6d 65  20 6c 69 62 72 61 72 79  |ork game library|
00001830  0d 08 fc 1c 70 6f 72 74  3d a4 6e 65 74 67 61 6d  |....port=.netgam|
00001840  65 5f 69 6e 69 74 28 32  30 35 30 29 0d 09 06 22  |e_init(2050)..."|
00001850  f4 20 52 65 61 64 20 74  68 65 20 73 69 74 65 73  |. Read the sites|
00001860  20 66 72 6f 6d 20 74 68  65 20 66 69 6c 65 0d 09  | from the file..|
00001870  10 16 f2 6e 65 74 67 61  6d 65 5f 72 65 61 64 73  |...netgame_reads|
00001880  69 74 65 73 0d 09 1a 2b  f4 20 53 65 74 20 75 70  |ites...+. Set up|
00001890  20 74 68 65 20 69 6e 66  6f 62 6f 78 20 61 6e 64  | the infobox and|
000018a0  20 63 6f 6e 6e 65 63 74  20 77 69 6e 64 6f 77 0d  | connect window.|
000018b0  09 24 2b f2 73 65 74 69  63 6f 6e 74 65 78 74 28  |.$+.seticontext(|
000018c0  69 6e 66 6f 62 6f 78 25  2c 32 2c 22 3e 49 6e 66  |infobox%,2,">Inf|
000018d0  6f 3a 22 2b c3 70 6f 72  74 29 0d 09 2e 25 f2 73  |o:"+.port)...%.s|
000018e0  65 74 69 63 6f 6e 74 65  78 74 28 63 6f 6e 6e 65  |eticontext(conne|
000018f0  63 74 77 69 6e 25 2c 33  2c c3 70 6f 72 74 29 0d  |ctwin%,3,.port).|
00001900  09 38 1e f4 20 4e 6f 77  20 69 6e 69 74 69 61 6c  |.8.. Now initial|
00001910  69 73 65 20 74 68 65 20  62 6f 61 72 64 0d 09 42  |ise the board..B|
00001920  41 21 62 25 3d 6d 61 69  6e 77 69 6e 25 3a c8 99  |A!b%=mainwin%:..|
00001930  20 22 57 69 6d 70 5f 47  65 74 57 69 6e 64 6f 77  | "Wimp_GetWindow|
00001940  49 6e 66 6f 22 2c 2c 62  25 3a f4 20 52 65 61 64  |Info",,b%:. Read|
00001950  20 61 6c 6c 20 74 68 65  20 69 63 6f 6e 73 0d 09  | all the icons..|
00001960  4c 10 69 62 61 73 65 25  3d 62 25 21 38 38 0d 09  |L.ibase%=b%!88..|
00001970  56 1b f4 20 49 6e 69 74  69 61 6c 69 73 65 20 74  |V.. Initialise t|
00001980  68 65 20 77 69 6e 64 6f  77 0d 09 60 0b e3 79 3d  |he window..`..y=|
00001990  30 20 b8 37 0d 09 6a 0c  20 e3 78 3d 30 20 b8 37  |0 .7..j. .x=0 .7|
000019a0  0d 09 74 5b 20 20 64 75  6d 6d 79 3d a4 63 72 65  |..t[  dummy=.cre|
000019b0  61 74 65 69 63 6f 6e 28  6d 61 69 6e 77 69 6e 25  |ateicon(mainwin%|
000019c0  2c 78 2a 34 31 2a 32 2c  2d 28 37 2d 79 29 2a 34  |,x*41*2,-(7-y)*4|
000019d0  31 2a 32 2c 34 31 2a 32  2c 34 31 2a 32 2c 22 22  |1*2,41*2,41*2,""|
000019e0  2c 22 53 65 6d 70 74 79  22 2c 26 31 37 2c 30 2c  |,"Sempty",&17,0,|
000019f0  33 2c 25 30 30 31 31 30  30 30 29 0d 09 7e 06 20  |3,%0011000)..~. |
00001a00  ed 0d 09 88 05 ed 0d 09  92 0b e3 78 3d 30 20 b8  |...........x=0 .|
00001a10  37 0d 09 9c 51 20 64 75  6d 6d 79 3d a4 63 72 65  |7...Q dummy=.cre|
00001a20  61 74 65 69 63 6f 6e 28  6d 61 69 6e 77 69 6e 25  |ateicon(mainwin%|
00001a30  2c 78 2a 34 31 2a 32 2c  31 34 2a 32 2c 34 31 2a  |,x*41*2,14*2,41*|
00001a40  32 2c 31 34 2a 32 2c 22  22 2c 22 53 74 6f 70 22  |2,14*2,"","Stop"|
00001a50  2c 26 31 37 2c 30 2c 33  2c 25 30 30 31 31 30 30  |,&17,0,3,%001100|
00001a60  30 29 0d 09 a6 05 ed 0d  09 b0 17 f4 20 4e 6f 77  |0).......... Now|
00001a70  20 74 68 65 20 76 61 72  69 61 62 6c 65 73 0d 09  | the variables..|
00001a80  ba 19 de 20 67 72 69 64  24 28 37 2c 37 29 2c 77  |... grid$(7,7),w|
00001a90  69 6e 73 25 28 31 29 0d  09 c4 16 f4 20 50 6c 61  |ins%(1)..... Pla|
00001aa0  79 65 72 20 76 61 72 69  61 62 6c 65 73 0d 09 ce  |yer variables...|
00001ab0  41 70 5f 6e 6f 6e 65 3d  2d 31 3a 70 5f 64 72 61  |Ap_none=-1:p_dra|
00001ac0  77 3d 2d 32 3a 70 5f 72  65 64 3d 30 3a 70 5f 62  |w=-2:p_red=0:p_b|
00001ad0  6c 75 65 3d 31 3a 70 6c  61 79 65 72 3d 70 5f 72  |lue=1:player=p_r|
00001ae0  65 64 3a 77 65 61 72 65  3d 70 5f 72 65 64 0d 09  |ed:weare=p_red..|
00001af0  d8 27 66 61 6c 6c 69 6e  67 3d 2d 31 3a f4 20 4e  |.'falling=-1:. N|
00001b00  6f 74 68 69 6e 67 20 69  73 20 66 61 6c 6c 69 6e  |othing is fallin|
00001b10  67 20 79 65 74 0d 09 e2  29 66 61 6c 6c 68 65 69  |g yet...)fallhei|
00001b20  67 68 74 3d 37 3a f4 20  54 68 65 20 68 65 69 67  |ght=7:. The heig|
00001b30  68 74 20 6f 66 20 74 68  65 20 66 61 6c 6c 0d 09  |ht of the fall..|
00001b40  ec 26 70 69 65 63 65 73  3d 30 3a f4 20 4e 75 6d  |.&pieces=0:. Num|
00001b50  62 65 72 20 6f 66 20 70  69 65 63 65 73 20 70 6c  |ber of pieces pl|
00001b60  61 63 65 64 0d 09 f6 05  3a 0d 0a 00 13 f4 20 4e  |aced....:..... N|
00001b70  65 74 67 61 6d 65 20 73  74 75 66 66 0d 0a 0a 11  |etgame stuff....|
00001b80  74 68 65 69 72 68 6f 73  74 24 3d 22 22 0d 0a 14  |theirhost$=""...|
00001b90  11 f4 20 46 61 6c 6c 20  73 70 65 65 64 73 0d 0a  |.. Fall speeds..|
00001ba0  1e 37 66 61 6c 6c 5f 6e  6f 6e 65 3d 30 3a 66 61  |.7fall_none=0:fa|
00001bb0  6c 6c 5f 66 61 73 74 3d  35 3a 66 61 6c 6c 5f 6d  |ll_fast=5:fall_m|
00001bc0  65 64 69 75 6d 3d 31 35  3a 66 61 6c 6c 5f 73 6c  |edium=15:fall_sl|
00001bd0  6f 77 3d 32 35 0d 0a 28  26 66 61 6c 6c 74 69 6d  |ow=25..(&falltim|
00001be0  65 3d 30 3a f4 20 54 68  65 20 74 69 6d 65 20 69  |e=0:. The time i|
00001bf0  74 20 6c 61 73 74 20 66  65 6c 6c 0d 0a 32 40 66  |t last fell..2@f|
00001c00  61 6c 6c 73 70 65 65 64  3d 66 61 6c 6c 5f 66 61  |allspeed=fall_fa|
00001c10  73 74 3a f4 20 54 68 65  20 6e 75 6d 62 65 72 20  |st:. The number |
00001c20  6f 66 20 63 73 20 62 65  74 77 65 65 6e 20 66 61  |of cs between fa|
00001c30  6c 6c 69 6e 67 20 75 6e  69 74 73 0d 0a 3c 22 77  |lling units..<"w|
00001c40  69 6e 6e 65 72 3d 70 5f  6e 6f 6e 65 3a f4 20 4e  |inner=p_none:. N|
00001c50  6f 2d 6f 6e 65 20 68 61  73 20 77 6f 6e 0d 0a 46  |o-one has won..F|
00001c60  2a f2 72 65 74 69 63 6b  3a f4 20 50 75 74 20 61  |*.retick:. Put a|
00001c70  20 74 69 63 6b 20 6f 6e  20 74 68 65 20 73 70 65  | tick on the spe|
00001c80  65 64 20 6d 65 6e 75 0d  0a 50 35 f2 69 63 6f 6e  |ed menu..P5.icon|
00001c90  73 68 61 64 65 28 6d 61  69 6e 77 69 6e 25 2c 36  |shade(mainwin%,6|
00001ca0  2c 31 29 3a f4 20 53 68  61 64 65 20 74 68 65 20  |,1):. Shade the |
00001cb0  27 63 6c 65 61 72 27 20  69 63 6f 6e 0d 0a 5a 05  |'clear' icon..Z.|
00001cc0  e1 0d 0a 64 05 3a 0d 0a  6e 17 dd f2 48 65 6c 70  |...d.:..n...Help|
00001cd0  28 77 69 6e 2c 69 63 6f  6e 2c 74 6f 29 0d 0a 78  |(win,icon,to)..x|
00001ce0  1f f7 20 2b 31 3a f2 72  65 61 64 68 65 6c 70 28  |.. +1:.readhelp(|
00001cf0  77 69 6e 2c 69 63 6f 6e  2c 74 6f 29 0d 0a 82 05  |win,icon,to)....|
00001d00  e1 0d 0a 8c 0d f4 20 57  69 6e 64 6f 77 73 0d 0a  |...... Windows..|
00001d10  96 1a dc 20 69 6e 66 6f  62 6f 78 25 2c 22 3e 48  |... infobox%,">H|
00001d20  49 6e 66 6f 62 6f 78 22  0d 0a a0 14 dc 20 33 2c  |Infobox"..... 3,|
00001d30  22 3e 48 49 6e 66 6f 62  6f 78 33 22 0d 0a aa 14  |">HInfobox3"....|
00001d40  dc 20 34 2c 22 3e 48 49  6e 66 6f 62 6f 78 34 22  |. 4,">HInfobox4"|
00001d50  0d 0a b4 1a dc 20 6d 61  69 6e 77 69 6e 25 2c 22  |..... mainwin%,"|
00001d60  3e 48 4d 61 69 6e 77 69  6e 22 0d 0a be 14 dc 20  |>HMainwin"..... |
00001d70  32 2c 22 3e 48 4f 75 72  53 63 6f 72 65 22 0d 0a  |2,">HOurScore"..|
00001d80  c8 16 dc 20 34 2c 22 3e  48 54 68 65 69 72 53 63  |... 4,">HTheirSc|
00001d90  6f 72 65 22 0d 0a d2 13  dc 20 35 2c 22 3e 48 4d  |ore"..... 5,">HM|
00001da0  65 73 73 61 67 65 22 0d  0a dc 18 dc 20 36 2c 22  |essage"..... 6,"|
00001db0  3e 48 4d 43 6c 65 61 72  5f 62 6f 61 72 64 22 0d  |>HMClear_board".|
00001dc0  0a e6 1a dc 20 73 65 6e  64 77 69 6e 25 2c 22 3e  |.... sendwin%,">|
00001dd0  48 53 65 6e 64 77 69 6e  22 0d 0a f0 13 dc 20 32  |HSendwin"..... 2|
00001de0  2c 22 3e 48 53 43 61 6e  63 65 6c 22 0d 0a fa 11  |,">HSCancel"....|
00001df0  dc 20 33 2c 22 3e 48 53  53 65 6e 64 22 0d 0b 04  |. 3,">HSSend"...|
00001e00  18 dc 20 6d 73 67 77 69  6e 25 2c 22 3e 48 4d 73  |.. msgwin%,">HMs|
00001e10  67 77 69 6e 22 0d 0b 0e  11 dc 20 32 2c 22 3e 48  |gwin"..... 2,">H|
00001e20  52 65 70 6c 79 22 0d 0b  18 0e dc 20 31 2c 22 3e  |Reply"..... 1,">|
00001e30  48 4f 6b 22 0d 0b 22 20  dc 20 63 6f 6e 6e 65 63  |HOk".." . connec|
00001e40  74 77 69 6e 25 2c 22 3e  48 43 6f 6e 6e 65 63 74  |twin%,">HConnect|
00001e50  77 69 6e 22 0d 0b 2c 0f  dc 20 34 2c 22 3e 48 43  |win"..,.. 4,">HC|
00001e60  4f 6b 22 0d 0b 36 14 dc  20 2d 32 2c 22 3e 48 49  |Ok"..6.. -2,">HI|
00001e70  63 6f 6e 62 61 72 22 0d  0b 40 0b dc 20 2d 31 2c  |conbar"..@.. -1,|
00001e80  2d 31 0d 0b 4a 0b f4 20  4d 65 6e 75 73 0d 0b 54  |-1..J.. Menus..T|
00001e90  11 dc 20 2d 32 2c 2d 32  2c 2d 32 2c 2d 32 0d 0b  |.. -2,-2,-2,-2..|
00001ea0  5e 05 3a 0d 0b 68 3c f4  20 74 65 6c 6c 25 20 3d  |^.:..h<. tell% =|
00001eb0  20 66 6c 61 67 20 74 6f  20 73 61 79 20 69 66 20  | flag to say if |
00001ec0  77 65 20 73 68 6f 75 6c  64 20 74 65 6c 6c 20 74  |we should tell t|
00001ed0  68 65 20 6f 74 68 65 72  20 65 6e 64 2e 2e 2e 0d  |he other end....|
00001ee0  0b 72 18 dd f2 63 6c 65  61 72 5f 62 6f 61 72 64  |.r...clear_board|
00001ef0  28 74 65 6c 6c 25 29 0d  0b 7c 07 ea 20 49 0d 0b  |(tell%)..|.. I..|
00001f00  86 17 67 72 69 64 24 28  29 3d 22 22 3a 70 69 65  |..grid$()="":pie|
00001f10  63 65 73 3d 30 0d 0b 90  0b e3 49 3d 30 b8 36 33  |ces=0.....I=0.63|
00001f20  0d 0b 9a 2d 20 f2 63 68  61 6e 67 65 76 61 6c 69  |...- .changevali|
00001f30  64 28 6d 61 69 6e 77 69  6e 25 2c 49 2b 69 62 61  |d(mainwin%,I+iba|
00001f40  73 65 25 2c 22 53 65 6d  70 74 79 22 29 0d 0b a4  |se%,"Sempty")...|
00001f50  05 ed 0d 0b ae 22 77 69  6e 6e 65 72 3d 70 5f 6e  |....."winner=p_n|
00001f60  6f 6e 65 3a f4 20 4e 6f  2d 6f 6e 65 20 68 61 73  |one:. No-one has|
00001f70  20 77 6f 6e 0d 0b b8 23  66 61 6c 6c 69 6e 67 3d  | won...#falling=|
00001f80  2d 31 3a f4 20 4e 6f 74  68 69 6e 67 20 69 73 20  |-1:. Nothing is |
00001f90  66 61 6c 6c 69 6e 67 0d  0b c2 35 f2 69 63 6f 6e  |falling...5.icon|
00001fa0  73 68 61 64 65 28 6d 61  69 6e 77 69 6e 25 2c 36  |shade(mainwin%,6|
00001fb0  2c 31 29 3a f4 20 53 68  61 64 65 20 74 68 65 20  |,1):. Shade the |
00001fc0  27 63 6c 65 61 72 27 20  69 63 6f 6e 0d 0b cc 2c  |'clear' icon...,|
00001fd0  f4 20 57 65 27 64 20 62  65 74 74 65 72 20 74 65  |. We'd better te|
00001fe0  6c 6c 20 74 68 65 6d 20  77 65 27 76 65 20 63 6c  |ll them we've cl|
00001ff0  65 61 72 65 64 20 69 74  0d 0b d6 23 e7 20 74 65  |eared it...#. te|
00002000  6c 6c 25 20 8c f2 6e 65  74 67 61 6d 65 5f 73 65  |ll% ..netgame_se|
00002010  6e 64 28 22 43 6c 65 61  72 22 29 0d 0b e0 05 e1  |nd("Clear").....|
00002020  0d 0b ea 05 3a 0d 0b f4  13 dd f2 46 65 74 63 68  |....:......Fetch|
00002030  50 61 67 65 28 66 24 29  0d 0b fe 3c f4 20 58 55  |Page(f$)...<. XU|
00002040  52 49 5f 44 69 73 70 61  74 63 68 20 2d 20 74 68  |RI_Dispatch - th|
00002050  69 73 20 70 72 6f 74 6f  63 6f 6c 20 69 73 20 73  |is protocol is s|
00002060  74 69 6c 6c 20 62 65 69  6e 67 20 64 65 63 69 64  |till being decid|
00002070  65 64 20 21 0d 0c 08 18  c8 99 20 26 36 45 33 38  |ed !...... &6E38|
00002080  31 2c 25 30 30 30 2c 66  24 2b bd 30 0d 0c 12 05  |1,%000,f$+.0....|
00002090  e1 0d 0c 1c 05 3a 0d 0c  26 12 dd f2 75 70 64 61  |.....:..&...upda|
000020a0  74 65 73 63 6f 72 65 73  0d 0c 30 2c f2 73 65 74  |tescores..0,.set|
000020b0  69 63 6f 6e 74 65 78 74  28 6d 61 69 6e 77 69 6e  |icontext(mainwin|
000020c0  25 2c 32 2c c3 28 77 69  6e 73 25 28 77 65 61 72  |%,2,.(wins%(wear|
000020d0  65 29 29 29 0d 0c 3a 2e  f2 73 65 74 69 63 6f 6e  |e)))..:..seticon|
000020e0  74 65 78 74 28 6d 61 69  6e 77 69 6e 25 2c 34 2c  |text(mainwin%,4,|
000020f0  c3 28 77 69 6e 73 25 28  31 2d 77 65 61 72 65 29  |.(wins%(1-weare)|
00002100  29 29 0d 0c 44 05 e1 0d  0c 4e 05 3a 0d 0c 58 11  |))..D....N.:..X.|
00002110  dd f2 75 70 64 61 74 65  74 69 74 6c 65 0d 0c 62  |..updatetitle..b|
00002120  08 ea 20 61 24 0d 0c 6c  22 e7 20 74 68 65 69 72  |.. a$..l". their|
00002130  68 6f 73 74 24 3d 22 22  20 8c 70 6c 61 79 65 72  |host$="" .player|
00002140  3d 70 5f 6e 6f 6e 65 0d  0c 76 26 e7 20 77 65 61  |=p_none..v&. wea|
00002150  72 65 3d 70 6c 61 79 65  72 20 8c 61 24 3d 22 55  |re=player .a$="U|
00002160  73 22 20 8b 61 24 3d 22  54 68 65 6d 22 0d 0c 80  |s" .a$="Them"...|
00002170  0f c8 8e 20 70 6c 61 79  65 72 20 ca 0d 0c 8a 31  |... player ....1|
00002180  20 c9 20 70 5f 72 65 64  3a f2 77 69 6e 64 6f 77  | . p_red:.window|
00002190  74 69 74 6c 65 28 6d 61  69 6e 77 69 6e 25 2c 22  |title(mainwin%,"|
000021a0  3e 22 2b 61 24 2b 22 3a  52 65 64 22 29 0d 0c 94  |>"+a$+":Red")...|
000021b0  33 20 c9 20 70 5f 62 6c  75 65 3a f2 77 69 6e 64  |3 . p_blue:.wind|
000021c0  6f 77 74 69 74 6c 65 28  6d 61 69 6e 77 69 6e 25  |owtitle(mainwin%|
000021d0  2c 22 3e 22 2b 61 24 2b  22 3a 42 6c 75 65 22 29  |,">"+a$+":Blue")|
000021e0  0d 0c 9e 2b 20 c9 20 70  5f 64 72 61 77 3a f2 77  |...+ . p_draw:.w|
000021f0  69 6e 64 6f 77 74 69 74  6c 65 28 6d 61 69 6e 77  |indowtitle(mainw|
00002200  69 6e 25 2c 22 3e 44 72  61 77 22 0d 0c a8 34 20  |in%,">Draw"...4 |
00002210  c9 20 70 5f 6e 6f 6e 65  3a f2 77 69 6e 64 6f 77  |. p_none:.window|
00002220  74 69 74 6c 65 28 6d 61  69 6e 77 69 6e 25 2c 22  |title(mainwin%,"|
00002230  3e 4e 6f 74 43 6f 6e 6e  65 63 74 65 64 22 29 0d  |>NotConnected").|
00002240  0c b2 05 cb 0d 0c bc 05  e1 0d 0c c6 05 3a 0d 0c  |.............:..|
00002250  d0 33 f4 20 43 68 61 6e  67 65 20 76 61 6c 69 64  |.3. Change valid|
00002260  61 74 69 6f 6e 20 77 69  74 68 6f 75 74 20 66 6c  |ation without fl|
00002270  69 63 6b 65 72 69 6e 67  20 28 49 20 68 6f 70 65  |ickering (I hope|
00002280  29 0d 0c da 23 dd f2 63  68 61 6e 67 65 76 61 6c  |)...#..changeval|
00002290  69 64 28 77 69 6e 25 2c  69 63 6f 6e 25 2c 74 65  |id(win%,icon%,te|
000022a0  78 74 24 29 0d 0c e4 33  62 25 21 30 3d 77 69 6e  |xt$)...3b%!0=win|
000022b0  25 3a 62 25 21 34 3d 69  63 6f 6e 25 3a c8 99 20  |%:b%!4=icon%:.. |
000022c0  22 57 69 6d 70 5f 47 65  74 49 63 6f 6e 53 74 61  |"Wimp_GetIconSta|
000022d0  74 65 22 2c 2c 62 25 0d  0c ee 47 e7 20 28 28 62  |te",,b%...G. ((b|
000022e0  25 21 32 34 29 20 80 20  26 31 30 30 29 3d 30 20  |%!24) . &100)=0 |
000022f0  8c 20 85 20 26 38 30 33  2c 22 49 63 6f 6e 20 69  |. . &803,"Icon i|
00002300  73 6e 27 74 20 69 6e 64  69 72 65 63 74 65 64 20  |sn't indirected |
00002310  28 23 22 2b c3 69 63 6f  6e 25 2b 22 29 22 0d 0c  |(#"+.icon%+")"..|
00002320  f8 12 24 28 62 25 21 33  32 29 3d 74 65 78 74 24  |..$(b%!32)=text$|
00002330  0d 0d 02 2d 62 25 21 38  3d 30 3a 62 25 21 31 32  |...-b%!8=0:b%!12|
00002340  3d 30 3a c8 99 20 22 57  69 6d 70 5f 53 65 74 49  |=0:.. "Wimp_SetI|
00002350  63 6f 6e 53 74 61 74 65  22 2c 2c 62 25 0d 0d 0c  |conState",,b%...|
00002360  05 e1 0d 0d 16 05 3a 0d  0d 20 0d dd f2 46 61 6c  |......:.. ...Fal|
00002370  6c 69 6e 67 0d 0d 2a 0d  ea 20 61 24 2c 73 74 6f  |ling..*.. a$,sto|
00002380  70 0d 0d 34 13 e7 20 66  61 6c 6c 69 6e 67 3c 3e  |p..4.. falling<>|
00002390  2d 31 20 8c 0d 0d 3e 28  20 e7 20 70 6c 61 79 65  |-1 ...>( . playe|
000023a0  72 3d 70 5f 72 65 64 20  8c 61 24 3d 22 72 65 64  |r=p_red .a$="red|
000023b0  22 20 8b 61 24 3d 22 62  6c 75 65 22 0d 0d 48 1d  |" .a$="blue"..H.|
000023c0  20 e7 20 66 61 6c 6c 73  70 65 65 64 3c 3e 66 61  | . fallspeed<>fa|
000023d0  6c 6c 5f 6e 6f 6e 65 20  8c 0d 0d 52 17 20 20 e7  |ll_none ...R.  .|
000023e0  20 66 61 6c 6c 68 65 69  67 68 74 3c 3e 37 20 8c  | fallheight<>7 .|
000023f0  0d 0d 5c 44 20 20 20 f2  63 68 61 6e 67 65 76 61  |..\D   .changeva|
00002400  6c 69 64 28 6d 61 69 6e  77 69 6e 25 2c 38 2b 38  |lid(mainwin%,8+8|
00002410  2a 66 61 6c 6c 68 65 69  67 68 74 2b 66 61 6c 6c  |*fallheight+fall|
00002420  69 6e 67 2b 69 62 61 73  65 25 2c 22 53 65 6d 70  |ing+ibase%,"Semp|
00002430  74 79 22 29 0d 0d 66 07  20 20 cd 0d 0d 70 3f 20  |ty")..f.  ...p? |
00002440  20 f2 63 68 61 6e 67 65  76 61 6c 69 64 28 6d 61  | .changevalid(ma|
00002450  69 6e 77 69 6e 25 2c 38  2a 66 61 6c 6c 68 65 69  |inwin%,8*fallhei|
00002460  67 68 74 2b 66 61 6c 6c  69 6e 67 2b 69 62 61 73  |ght+falling+ibas|
00002470  65 25 2c 22 53 22 2b 61  24 29 0d 0d 7a 06 20 cd  |e%,"S"+a$)..z. .|
00002480  0d 0d 84 12 20 66 61 6c  6c 68 65 69 67 68 74 2d  |.... fallheight-|
00002490  3d 31 0d 0d 8e 17 20 e7  20 66 61 6c 6c 68 65 69  |=1.... . fallhei|
000024a0  67 68 74 3c 3e 2d 31 20  8c 0d 0d 98 28 20 20 73  |ght<>-1 ....(  s|
000024b0  74 6f 70 3d 67 72 69 64  24 28 66 61 6c 6c 69 6e  |top=grid$(fallin|
000024c0  67 2c 66 61 6c 6c 68 65  69 67 68 74 29 3c 3e 22  |g,fallheight)<>"|
000024d0  22 0d 0d a2 06 20 cc 0d  0d ac 0c 20 20 73 74 6f  |".... .....  sto|
000024e0  70 3d b9 0d 0d b6 06 20  cd 0d 0d c0 0d 20 e7 20  |p=..... ..... . |
000024f0  73 74 6f 70 20 8c 0d 0d  ca 0f 20 20 70 69 65 63  |stop .....  piec|
00002500  65 73 2b 3d 31 0d 0d d4  1d 20 20 e7 20 66 61 6c  |es+=1....  . fal|
00002510  6c 73 70 65 65 64 3d 66  61 6c 6c 5f 6e 6f 6e 65  |lspeed=fall_none|
00002520  20 8c 0d 0d de 42 20 20  20 f2 63 68 61 6e 67 65  | ....B   .change|
00002530  76 61 6c 69 64 28 6d 61  69 6e 77 69 6e 25 2c 38  |valid(mainwin%,8|
00002540  2b 38 2a 66 61 6c 6c 68  65 69 67 68 74 2b 66 61  |+8*fallheight+fa|
00002550  6c 6c 69 6e 67 2b 69 62  61 73 65 25 2c 22 53 22  |lling+ibase%,"S"|
00002560  2b 61 24 29 0d 0d e8 07  20 20 cd 0d 0d f2 2b 20  |+a$)....  ....+ |
00002570  20 67 72 69 64 24 28 66  61 6c 6c 69 6e 67 2c 66  | grid$(falling,f|
00002580  61 6c 6c 68 65 69 67 68  74 2b 31 29 3d c3 28 70  |allheight+1)=.(p|
00002590  6c 61 79 65 72 29 0d 0d  fc 37 20 20 77 69 6e 6e  |layer)...7  winn|
000025a0  65 72 3d a4 63 68 65 63  6b 77 69 6e 28 66 61 6c  |er=.checkwin(fal|
000025b0  6c 69 6e 67 2c 66 61 6c  6c 68 65 69 67 68 74 2b  |ling,fallheight+|
000025c0  31 29 3a 66 61 6c 6c 69  6e 67 3d 2d 31 0d 0e 06  |1):falling=-1...|
000025d0  17 20 20 e7 20 77 69 6e  6e 65 72 3d 70 5f 6e 6f  |.  . winner=p_no|
000025e0  6e 65 20 8c 0d 0e 10 32  20 20 20 e7 20 70 6c 61  |ne ....2   . pla|
000025f0  79 65 72 3d 70 5f 72 65  64 20 8c 70 6c 61 79 65  |yer=p_red .playe|
00002600  72 3d 70 5f 62 6c 75 65  20 8b 70 6c 61 79 65 72  |r=p_blue .player|
00002610  3d 70 5f 72 65 64 0d 0e  1a 13 20 20 20 f2 75 70  |=p_red....   .up|
00002620  64 61 74 65 74 69 74 6c  65 0d 0e 24 07 20 20 cc  |datetitle..$.  .|
00002630  0d 0e 2e 18 20 20 20 e7  20 77 69 6e 6e 65 72 3d  |....   . winner=|
00002640  70 5f 64 72 61 77 20 8c  0d 0e 38 35 20 20 20 20  |p_draw ...85    |
00002650  72 65 70 6c 79 3d a4 65  72 72 6f 72 62 6f 78 28  |reply=.errorbox(|
00002660  22 3e 4d 65 73 73 61 67  65 22 2c 22 3e 57 69 6e  |">Message",">Win|
00002670  4e 6f 6e 65 22 2c 25 31  30 30 30 31 29 0d 0e 42  |None",%10001)..B|
00002680  08 20 20 20 cc 0d 0e 4c  18 20 20 20 20 e7 20 70  |.   ...L.    . p|
00002690  6c 61 79 65 72 3d 77 65  61 72 65 20 8c 0d 0e 56  |layer=weare ...V|
000026a0  34 20 20 20 20 20 72 65  70 6c 79 3d a4 65 72 72  |4     reply=.err|
000026b0  6f 72 62 6f 78 28 22 3e  4d 65 73 73 61 67 65 22  |orbox(">Message"|
000026c0  2c 22 3e 57 69 6e 55 73  22 2c 25 31 30 30 30 31  |,">WinUs",%10001|
000026d0  29 0d 0e 60 09 20 20 20  20 cc 0d 0e 6a 36 20 20  |)..`.    ...j6  |
000026e0  20 20 20 72 65 70 6c 79  3d a4 65 72 72 6f 72 62  |   reply=.errorb|
000026f0  6f 78 28 22 3e 4d 65 73  73 61 67 65 22 2c 22 3e  |ox(">Message",">|
00002700  57 69 6e 54 68 65 6d 22  2c 25 31 30 30 30 31 29  |WinThem",%10001)|
00002710  0d 0e 74 09 20 20 20 20  cd 0d 0e 7e 08 20 20 20  |..t.    ...~.   |
00002720  cd 0d 0e 88 17 20 20 20  77 69 6e 73 25 28 70 6c  |.....   wins%(pl|
00002730  61 79 65 72 29 2b 3d 31  0d 0e 92 14 20 20 20 f2  |ayer)+=1....   .|
00002740  75 70 64 61 74 65 73 63  6f 72 65 73 0d 0e 9c 3a  |updatescores...:|
00002750  20 20 20 f2 69 63 6f 6e  73 68 61 64 65 28 6d 61  |   .iconshade(ma|
00002760  69 6e 77 69 6e 25 2c 36  2c 30 29 3a f4 20 55 6e  |inwin%,6,0):. Un|
00002770  73 68 61 64 65 20 74 68  65 20 27 63 6c 65 61 72  |shade the 'clear|
00002780  27 20 69 63 6f 6e 0d 0e  a6 07 20 20 cd 0d 0e b0  |' icon....  ....|
00002790  06 20 cd 0d 0e ba 05 cd  0d 0e c4 05 e1 0d 0e ce  |. ..............|
000027a0  05 3a 0d 0e d8 13 dd a4  63 68 65 63 6b 77 69 6e  |.:......checkwin|
000027b0  28 78 2c 79 29 0d 0e e2  11 ea 20 6c 6c 65 6e 2c  |(x,y)..... llen,|
000027c0  77 69 6e 2c 63 24 0d 0e  ec 18 e7 20 70 69 65 63  |win,c$..... piec|
000027d0  65 73 3d 36 34 20 8c 3d  70 5f 64 72 61 77 0d 0e  |es=64 .=p_draw..|
000027e0  f6 16 77 69 6e 3d a3 3a  63 24 3d c3 28 70 6c 61  |..win=.:c$=.(pla|
000027f0  79 65 72 29 0d 0f 00 0a  6c 6c 65 6e 3d 30 0d 0f  |yer)....llen=0..|
00002800  0a 0a e3 49 3d 30 b8 37  0d 0f 14 26 20 e7 20 67  |...I=0.7...& . g|
00002810  72 69 64 24 28 49 2c 79  29 3c 3e 63 24 20 8c 6c  |rid$(I,y)<>c$ .l|
00002820  6c 65 6e 3d 30 20 8b 6c  6c 65 6e 2b 3d 31 0d 0f  |len=0 .llen+=1..|
00002830  1e 14 20 e7 20 6c 6c 65  6e 3d 34 20 8c 77 69 6e  |.. . llen=4 .win|
00002840  3d b9 0d 0f 28 05 ed 0d  0f 32 0d e7 20 ac 20 77  |=...(....2.. . w|
00002850  69 6e 20 8c 0d 0f 3c 0b  20 6c 6c 65 6e 3d 30 0d  |in ...<. llen=0.|
00002860  0f 46 0b 20 e3 49 3d 30  b8 37 0d 0f 50 27 20 20  |.F. .I=0.7..P'  |
00002870  e7 20 67 72 69 64 24 28  78 2c 49 29 3c 3e 63 24  |. grid$(x,I)<>c$|
00002880  20 8c 6c 6c 65 6e 3d 30  20 8b 6c 6c 65 6e 2b 3d  | .llen=0 .llen+=|
00002890  31 0d 0f 5a 15 20 20 e7  20 6c 6c 65 6e 3d 34 20  |1..Z.  . llen=4 |
000028a0  8c 77 69 6e 3d b9 0d 0f  64 06 20 ed 0d 0f 6e 0e  |.win=...d. ...n.|
000028b0  20 e7 20 ac 20 77 69 6e  20 8c 0d 0f 78 0c 20 20  | . . win ...x.  |
000028c0  6c 6c 65 6e 3d 30 0d 0f  82 0d 20 20 e3 49 3d 2d  |llen=0....  .I=-|
000028d0  36 b8 36 0d 0f 8c 2a 20  20 20 e7 20 78 2b 49 3e  |6.6...*   . x+I>|
000028e0  3d 30 20 80 20 79 2b 49  3e 3d 30 20 80 20 78 2b  |=0 . y+I>=0 . x+|
000028f0  49 3c 38 20 80 20 79 2b  49 3c 38 20 8c 0d 0f 96  |I<8 . y+I<8 ....|
00002900  2d 20 20 20 20 e7 20 67  72 69 64 24 28 78 2b 49  |-    . grid$(x+I|
00002910  2c 79 2b 49 29 3c 3e 63  24 20 8c 6c 6c 65 6e 3d  |,y+I)<>c$ .llen=|
00002920  30 20 8b 6c 6c 65 6e 2b  3d 31 0d 0f a0 17 20 20  |0 .llen+=1....  |
00002930  20 20 e7 20 6c 6c 65 6e  3d 34 20 8c 77 69 6e 3d  |  . llen=4 .win=|
00002940  b9 0d 0f aa 08 20 20 20  cd 0d 0f b4 07 20 20 ed  |.....   .....  .|
00002950  0d 0f be 0f 20 20 e7 20  ac 20 77 69 6e 20 8c 0d  |....  . . win ..|
00002960  0f c8 0d 20 20 20 6c 6c  65 6e 3d 30 0d 0f d2 0e  |...   llen=0....|
00002970  20 20 20 e3 49 3d 2d 36  b8 36 0d 0f dc 2b 20 20  |   .I=-6.6...+  |
00002980  20 20 e7 20 78 2b 49 3e  3d 30 20 80 20 79 2d 49  |  . x+I>=0 . y-I|
00002990  3e 3d 30 20 80 20 78 2b  49 3c 38 20 80 20 79 2d  |>=0 . x+I<8 . y-|
000029a0  49 3c 38 20 8c 0d 0f e6  2e 20 20 20 20 20 e7 20  |I<8 .....     . |
000029b0  67 72 69 64 24 28 78 2b  49 2c 79 2d 49 29 3c 3e  |grid$(x+I,y-I)<>|
000029c0  63 24 20 8c 6c 6c 65 6e  3d 30 20 8b 6c 6c 65 6e  |c$ .llen=0 .llen|
000029d0  2b 3d 31 0d 0f f0 18 20  20 20 20 20 e7 20 6c 6c  |+=1....     . ll|
000029e0  65 6e 3d 34 20 8c 77 69  6e 3d b9 0d 0f fa 09 20  |en=4 .win=..... |
000029f0  20 20 20 cd 0d 10 04 08  20 20 20 ed 0d 10 0e 07  |   .....   .....|
00002a00  20 20 cd 0d 10 18 06 20  cd 0d 10 22 05 cd 0d 10  |  ..... ..."....|
00002a10  2c 1d e7 20 77 69 6e 20  8c 77 69 6e 3d 70 6c 61  |,.. win .win=pla|
00002a20  79 65 72 20 8b 77 69 6e  3d 2d 31 0d 10 36 08 3d  |yer .win=-1..6.=|
00002a30  77 69 6e 0d 10 40 05 3a  0d 10 4a 3e f4 20 2a 2a  |win..@.:..J>. **|
00002a40  2a 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  |****************|
00002a50  2a 2a 20 4e 65 74 47 61  6d 65 20 72 6f 75 74 69  |** NetGame routi|
00002a60  6e 65 73 20 2a 2a 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  |nes ************|
00002a70  2a 2a 2a 2a 2a 2a 0d 10  54 05 3a 0d 10 5e 3b f4  |******..T.:..^;.|
00002a80  20 47 65 72 70 68 20 53  6f 66 74 77 61 72 65 2c  | Gerph Software,|
00002a90  20 4a 75 73 74 69 6e 20  73 70 65 61 6b 69 6e 67  | Justin speaking|
00002aa0  3b 20 68 6f 77 20 63 61  6e 20 49 20 68 65 6c 70  |; how can I help|
00002ab0  20 79 6f 75 20 3f 0d 10  68 1b dd f2 63 6f 6e 6e  | you ?..h...conn|
00002ac0  65 63 74 65 64 28 68 6f  73 74 24 2c 74 79 70 65  |ected(host$,type|
00002ad0  29 0d 10 72 1c f4 20 57  65 20 6b 6e 6f 77 20 77  |)..r.. We know w|
00002ae0  68 65 72 65 20 79 6f 75  20 6c 69 76 65 0d 10 7c  |here you live..||
00002af0  14 74 68 65 69 72 68 6f  73 74 24 3d 68 6f 73 74  |.theirhost$=host|
00002b00  24 0d 10 86 1a e7 20 74  79 70 65 3d 6e 67 73 5f  |$..... type=ngs_|
00002b10  6f 72 69 67 69 6e 61 74  65 20 8c 0d 10 90 29 20  |originate ....) |
00002b20  f4 20 57 65 20 72 61 6e  67 20 74 68 65 6d 2c 20  |. We rang them, |
00002b30  73 6f 20 77 65 20 70 6c  61 79 20 66 69 72 73 74  |so we play first|
00002b40  20 3b 2d 29 0d 10 9a 10  20 77 65 61 72 65 3d 70  | ;-).... weare=p|
00002b50  5f 72 65 64 0d 10 a4 05  cc 0d 10 ae 22 20 f4 20  |_red........" . |
00002b60  54 68 65 79 20 72 61 6e  67 20 75 73 2c 20 74 68  |They rang us, th|
00002b70  65 79 20 67 6f 20 66 69  72 73 74 0d 10 b8 11 20  |ey go first.... |
00002b80  77 65 61 72 65 3d 70 5f  62 6c 75 65 0d 10 c2 05  |weare=p_blue....|
00002b90  cd 0d 10 cc 10 70 6c 61  79 65 72 3d 70 5f 72 65  |.....player=p_re|
00002ba0  64 0d 10 d6 23 f4 20 57  69 70 65 20 74 68 65 20  |d...#. Wipe the |
00002bb0  62 6f 61 72 64 20 66 6f  72 20 61 20 6e 65 77 20  |board for a new |
00002bc0  67 61 6d 65 0d 10 e0 29  f2 63 6c 65 61 72 5f 62  |game...).clear_b|
00002bd0  6f 61 72 64 28 a3 29 3a  f4 20 42 75 74 20 64 6f  |oard(.):. But do|
00002be0  6e 27 74 20 74 65 6c 6c  20 74 68 65 6d 0d 10 ea  |n't tell them...|
00002bf0  19 f4 20 55 6e 73 68 61  64 65 20 74 68 65 20 62  |.. Unshade the b|
00002c00  75 74 74 6f 6e 73 0d 10  f4 2e f2 69 63 6f 6e 73  |uttons.....icons|
00002c10  68 61 64 65 28 6d 61 69  6e 77 69 6e 25 2c 35 2c  |hade(mainwin%,5,|
00002c20  30 29 3a f4 20 55 6e 73  68 61 64 65 20 4d 65 73  |0):. Unshade Mes|
00002c30  73 61 67 65 0d 10 fe 1f  f4 20 4e 6f 62 6f 64 79  |sage..... Nobody|
00002c40  27 73 20 77 6f 6e 20 61  6e 79 74 68 69 6e 67 20  |'s won anything |
00002c50  79 65 74 0d 11 08 0d 77  69 6e 73 25 28 29 3d 30  |yet....wins%()=0|
00002c60  0d 11 12 1f f4 20 55 70  64 61 74 65 20 74 68 65  |..... Update the|
00002c70  20 73 63 6f 72 65 73 20  74 6f 6f 20 3b 2d 29 0d  | scores too ;-).|
00002c80  11 1c 12 f2 75 70 64 61  74 65 5f 73 63 6f 72 65  |....update_score|
00002c90  73 0d 11 26 19 f4 20 55  70 64 61 74 65 20 74 68  |s..&.. Update th|
00002ca0  65 20 74 69 74 6c 65 62  61 72 0d 11 30 10 f2 75  |e titlebar..0..u|
00002cb0  70 64 61 74 65 74 69 74  6c 65 0d 11 3a 23 f4 20  |pdatetitle..:#. |
00002cc0  4f 70 65 6e 20 74 68 65  20 77 69 6e 64 6f 77 20  |Open the window |
00002cd0  69 6e 20 74 68 65 20 6d  69 64 64 6c 65 0d 11 44  |in the middle..D|
00002ce0  1c f2 6f 70 65 6e 77 69  6e 63 65 6e 74 72 65 28  |..openwincentre(|
00002cf0  6d 61 69 6e 77 69 6e 25  29 0d 11 4e 22 f4 20 41  |mainwin%)..N". A|
00002d00  6e 64 20 63 6c 6f 73 65  20 74 68 65 20 63 6f 6e  |nd close the con|
00002d10  6e 65 63 74 20 77 69 6e  64 6f 77 0d 11 58 1a f2  |nect window..X..|
00002d20  63 6c 6f 73 65 77 69 6e  28 63 6f 6e 6e 65 63 74  |closewin(connect|
00002d30  77 69 6e 25 29 0d 11 62  05 e1 0d 11 6c 05 3a 0d  |win%)..b....l.:.|
00002d40  11 76 15 f4 20 54 68 65  79 20 67 6f 20 62 79 65  |.v.. They go bye|
00002d50  2d 62 79 65 0d 11 80 18  dd f2 64 69 73 63 6f 6e  |-bye......discon|
00002d60  6e 65 63 74 65 64 28 74  79 70 65 29 0d 11 8a 0b  |nected(type)....|
00002d70  ea 20 72 65 70 6c 79 0d  11 94 0d c8 8e 20 74 79  |. reply...... ty|
00002d80  70 65 20 ca 0d 11 9e 34  20 c9 20 6e 67 73 5f 64  |pe ....4 . ngs_d|
00002d90  65 61 64 3a f4 20 42 61  64 20 6c 69 74 74 6c 65  |ead:. Bad little|
00002da0  20 62 6f 79 2c 20 64 72  6f 70 70 65 64 20 63 6f  | boy, dropped co|
00002db0  6e 6e 65 63 74 69 6f 6e  0d 11 a8 32 20 20 72 65  |nnection...2  re|
00002dc0  70 6c 79 3d a4 65 72 72  6f 72 62 6f 78 28 22 3e  |ply=.errorbox(">|
00002dd0  4d 65 73 73 61 67 65 22  2c 22 3e 43 6c 6f 73 65  |Message",">Close|
00002de0  64 22 2c 25 31 30 30 30  31 29 0d 11 b2 34 20 c9  |d",%10001)...4 .|
00002df0  20 6e 67 73 5f 67 6f 69  6e 67 3a f4 20 4d 72 20  | ngs_going:. Mr |
00002e00  46 6c 69 62 62 6c 65 20  73 61 79 73 20 27 47 61  |Flibble says 'Ga|
00002e10  6d 65 20 4f 76 65 72 27  2c 20 62 6f 79 73 0d 11  |me Over', boys..|
00002e20  bc 34 20 20 72 65 70 6c  79 3d a4 65 72 72 6f 72  |.4  reply=.error|
00002e30  62 6f 78 28 22 3e 4d 65  73 73 61 67 65 22 2c 22  |box(">Message","|
00002e40  3e 47 61 6d 65 4f 76 65  72 22 2c 25 31 30 30 30  |>GameOver",%1000|
00002e50  31 29 0d 11 c6 2d 20 c9  20 6e 67 73 5f 66 61 69  |1)...- . ngs_fai|
00002e60  6c 65 64 3a f4 20 43 6f  75 6c 64 6e 27 74 20 67  |led:. Couldn't g|
00002e70  65 74 20 61 20 63 6f 6e  6e 65 63 74 69 6f 6e 0d  |et a connection.|
00002e80  11 d0 35 20 20 72 65 70  6c 79 3d a4 65 72 72 6f  |..5  reply=.erro|
00002e90  72 62 6f 78 28 22 3e 4d  65 73 73 61 67 65 22 2c  |rbox(">Message",|
00002ea0  22 3e 4e 6f 43 6f 6e 6e  65 63 74 22 2c 25 31 30  |">NoConnect",%10|
00002eb0  30 30 31 29 0d 11 da 12  20 20 f2 6f 70 65 6e 63  |001)....  .openc|
00002ec0  6f 6e 6e 65 63 74 0d 11  e4 05 cb 0d 11 ee 19 f4  |onnect..........|
00002ed0  20 48 65 79 2c 20 74 68  65 79 27 76 65 20 67 6f  | Hey, they've go|
00002ee0  6e 65 20 21 0d 11 f8 11  74 68 65 69 72 68 6f 73  |ne !....theirhos|
00002ef0  74 24 3d 22 22 0d 12 02  33 f2 6d 65 6e 75 73 68  |t$=""...3.menush|
00002f00  61 64 65 28 6d 61 69 6e  6d 65 6e 75 25 2c 30 2c  |ade(mainmenu%,0,|
00002f10  31 29 3a f4 20 53 68 61  64 65 20 74 68 65 20 6d  |1):. Shade the m|
00002f20  65 6e 75 20 69 74 65 6d  0d 12 0c 33 f2 6d 65 6e  |enu item...3.men|
00002f30  75 73 68 61 64 65 28 6d  61 69 6e 6d 65 6e 75 25  |ushade(mainmenu%|
00002f40  2c 31 2c 31 29 3a f4 20  53 68 61 64 65 20 74 68  |,1,1):. Shade th|
00002f50  65 20 6d 65 6e 75 20 69  74 65 6d 0d 12 16 2c f2  |e menu item...,.|
00002f60  69 63 6f 6e 73 68 61 64  65 28 6d 61 69 6e 77 69  |iconshade(mainwi|
00002f70  6e 25 2c 35 2c 31 29 3a  f4 20 53 68 61 64 65 20  |n%,5,1):. Shade |
00002f80  4d 65 73 73 61 67 65 0d  12 20 2a f2 69 63 6f 6e  |Message.. *.icon|
00002f90  73 68 61 64 65 28 6d 61  69 6e 77 69 6e 25 2c 36  |shade(mainwin%,6|
00002fa0  2c 31 29 3a f4 20 53 68  61 64 65 20 43 6c 65 61  |,1):. Shade Clea|
00002fb0  72 0d 12 2a 19 f4 20 55  70 64 61 74 65 20 74 68  |r..*.. Update th|
00002fc0  65 20 74 69 74 6c 65 62  61 72 0d 12 34 10 f2 75  |e titlebar..4..u|
00002fd0  70 64 61 74 65 74 69 74  6c 65 0d 12 3e 05 e1 0d  |pdatetitle..>...|
00002fe0  12 48 05 3a 0d 12 52 19  f4 20 49 6e 63 6f 6d 69  |.H.:..R.. Incomi|
00002ff0  6e 67 20 77 6f 6f 6f 6f  6f 6e 64 65 64 0d 12 5c  |ng wooooonded..\|
00003000  14 dd f2 69 6e 63 6f 6d  69 6e 67 28 6d 73 67 24  |...incoming(msg$|
00003010  29 0d 12 66 11 c8 8e 20  c0 6d 73 67 24 2c 31 29  |)..f... .msg$,1)|
00003020  20 ca 0d 12 70 0a 20 c9  20 22 4d 22 0d 12 7a 30  | ...p. . "M"..z0|
00003030  20 20 f4 20 4f 68 2c 20  61 20 6d 65 73 73 61 67  |  . Oh, a messag|
00003040  65 20 3f 20 66 6f 72 20  6d 65 20 3f 20 79 6f 75  |e ? for me ? you|
00003050  20 61 72 65 20 73 77 65  65 74 20 21 0d 12 84 29  | are sweet !...)|
00003060  20 20 f2 73 65 74 69 63  6f 6e 74 65 78 74 28 6d  |  .seticontext(m|
00003070  73 67 77 69 6e 25 2c 30  2c c1 6d 73 67 24 2c 32  |sgwin%,0,.msg$,2|
00003080  2c 33 39 29 29 0d 12 8e  17 20 20 f2 6f 70 65 6e  |,39))....  .open|
00003090  77 69 6e 28 6d 73 67 77  69 6e 25 29 0d 12 98 21  |win(msgwin%)...!|
000030a0  20 20 f2 73 65 74 63 61  72 65 74 70 6f 73 28 6d  |  .setcaretpos(m|
000030b0  73 67 77 69 6e 25 2c 2d  31 2c 2d 31 29 0d 12 a2  |sgwin%,-1,-1)...|
000030c0  0a 20 c9 20 22 43 22 0d  12 ac 17 20 20 f4 20 43  |. . "C"....  . C|
000030d0  6c 65 61 72 20 74 68 65  20 62 6f 61 72 64 0d 12  |lear the board..|
000030e0  b6 27 20 20 e7 20 77 69  6e 6e 65 72 3c 3e 70 5f  |.'  . winner<>p_|
000030f0  6e 6f 6e 65 20 8c f2 63  6c 65 61 72 5f 62 6f 61  |none ..clear_boa|
00003100  72 64 28 a3 29 0d 12 c0  06 20 7f 0d 12 ca 23 20  |rd(.).... ....# |
00003110  20 e7 20 70 6c 61 79 65  72 3d 77 65 61 72 65 20  | . player=weare |
00003120  80 20 66 61 6c 6c 69 6e  67 3d 2d 31 20 8c 0d 12  |. falling=-1 ...|
00003130  d4 39 20 20 20 f4 20 48  61 6e 67 20 6f 6e 2c 20  |.9   . Hang on, |
00003140  69 74 27 73 20 6f 75 72  20 67 6f 20 61 6e 64 20  |it's our go and |
00003150  74 68 65 79 27 72 65 20  74 72 79 69 6e 67 20 74  |they're trying t|
00003160  6f 20 67 6f 2e 2e 2e 0d  12 de 1a 20 20 20 f2 6e  |o go.......   .n|
00003170  65 74 67 61 6d 65 5f 64  69 73 63 6f 6e 6e 65 63  |etgame_disconnec|
00003180  74 0d 12 e8 14 20 20 20  74 68 65 69 72 68 6f 73  |t....   theirhos|
00003190  74 24 3d 22 22 0d 12 f2  07 20 20 cc 0d 12 fc 40  |t$=""....  ....@|
000031a0  20 20 20 f4 20 49 66 20  74 68 65 72 65 27 73 20  |   . If there's |
000031b0  6f 6e 65 20 66 61 6c 6c  69 6e 67 20 74 68 65 6e  |one falling then|
000031c0  20 6c 65 74 20 69 74 20  66 61 6c 6c 2c 20 61 6c  | let it fall, al|
000031d0  62 65 69 74 20 71 75 69  63 6b 6c 79 0d 13 06 20  |beit quickly... |
000031e0  20 20 20 c8 95 20 66 61  6c 6c 69 6e 67 3c 3e 2d  |   .. falling<>-|
000031f0  31 3a f2 46 61 6c 6c 69  6e 67 3a ce 0d 13 10 31  |1:.Falling:....1|
00003200  20 20 20 f4 20 61 6e 64  20 61 74 20 74 68 69 73  |   . and at this|
00003210  20 70 6f 69 6e 74 20 73  6f 6d 65 6f 6e 65 20 6d  | point someone m|
00003220  61 79 20 68 61 76 65 20  77 6f 6e 20 21 0d 13 1a  |ay have won !...|
00003230  18 20 20 20 e7 20 77 69  6e 6e 65 72 3d 70 5f 6e  |.   . winner=p_n|
00003240  6f 6e 65 20 8c 0d 13 24  24 20 20 20 20 66 61 6c  |one ...$$    fal|
00003250  6c 69 6e 67 3d bb 28 6d  73 67 24 29 3a 66 61 6c  |ling=.(msg$):fal|
00003260  6c 68 65 69 67 68 74 3d  37 0d 13 2e 12 20 20 20  |lheight=7....   |
00003270  20 66 61 6c 6c 74 69 6d  65 3d 91 0d 13 38 08 20  | falltime=...8. |
00003280  20 20 cd 0d 13 42 07 20  20 cd 0d 13 4c 05 cb 0d  |  ...B.  ...L...|
00003290  13 56 05 e1 0d 13 60 05  3a 0d 13 6a 42 f4 20 2a  |.V....`.:..jB. *|
000032a0  2a 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  |****************|
000032b0  2a 2a 2a 2a 2a 20 4f 74  68 65 72 20 72 6f 75 74  |***** Other rout|
000032c0  69 6e 65 73 20 2a 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  |ines ***********|
000032d0  2a 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 0d 13 74 05 3a  |***********..t.:|
000032e0  0d 13 7e 3d f4 20 41 74  74 65 6d 70 74 20 61 20  |..~=. Attempt a |
000032f0  63 6f 6e 6e 65 63 74 69  6f 6e 20 75 73 69 6e 67  |connection using|
00003300  20 74 68 65 20 27 63 6f  6e 6e 65 63 74 27 20 77  | the 'connect' w|
00003310  69 6e 64 6f 77 20 61 73  20 68 6f 73 74 0d 13 88  |indow as host...|
00003320  10 dd f2 74 72 79 63 6f  6e 6e 65 63 74 0d 13 92  |...tryconnect...|
00003330  10 ea 20 68 6f 73 74 24  2c 70 6f 72 74 0d 13 9c  |.. host$,port...|
00003340  25 68 6f 73 74 24 3d a4  67 65 74 69 63 6f 6e 74  |%host$=.geticont|
00003350  65 78 74 28 63 6f 6e 6e  65 63 74 77 69 6e 25 2c  |ext(connectwin%,|
00003360  31 29 0d 13 a6 11 e7 20  68 6f 73 74 24 3d 22 22  |1)..... host$=""|
00003370  20 8c e1 0d 13 b0 1d f4  20 52 65 61 64 20 74 68  | ....... Read th|
00003380  65 20 73 65 72 76 69 63  65 20 6e 75 6d 62 65 72  |e service number|
00003390  0d 13 ba 3f 70 6f 72 74  3d a4 69 6e 65 74 5f 67  |...?port=.inet_g|
000033a0  65 74 73 65 72 76 62 79  6e 61 6d 65 28 a4 67 65  |etservbyname(.ge|
000033b0  74 69 63 6f 6e 74 65 78  74 28 63 6f 6e 6e 65 63  |ticontext(connec|
000033c0  74 77 69 6e 25 2c 33 29  2c 22 74 63 70 22 29 0d  |twin%,3),"tcp").|
000033d0  13 c4 1b f4 20 4e 6f 77  20 64 6f 20 74 68 65 20  |.... Now do the |
000033e0  63 6f 6e 6e 65 63 74 69  6f 6e 0d 13 ce 23 6f 6b  |connection...#ok|
000033f0  3d a4 6e 65 74 67 61 6d  65 5f 63 6f 6e 6e 65 63  |=.netgame_connec|
00003400  74 28 68 6f 73 74 24 2c  70 6f 72 74 29 0d 13 d8  |t(host$,port)...|
00003410  0c e7 20 ac 20 6f 6b 20  8c 0d 13 e2 27 20 f4 20  |.. . ok ....' . |
00003420  57 65 20 63 6f 75 6c 64  6e 27 74 20 63 6f 6e 6e  |We couldn't conn|
00003430  65 63 74 20 73 6f 20 74  65 6c 6c 20 74 68 65 6d  |ect so tell them|
00003440  0d 13 ec 34 20 72 65 70  6c 79 3d a4 65 72 72 6f  |...4 reply=.erro|
00003450  72 62 6f 78 28 22 3e 4d  65 73 73 61 67 65 22 2c  |rbox(">Message",|
00003460  22 3e 4e 6f 43 6f 6e 6e  65 63 74 22 2c 25 31 30  |">NoConnect",%10|
00003470  30 30 31 29 0d 13 f6 05  cc 0d 14 00 1b 20 f2 63  |001)......... .c|
00003480  6c 6f 73 65 77 69 6e 28  63 6f 6e 6e 65 63 74 77  |losewin(connectw|
00003490  69 6e 25 29 0d 14 0a 05  cd 0d 14 14 05 e1 0d 14  |in%)............|
000034a0  1e 05 3a 0d 14 28 1f f4  20 4f 70 65 6e 20 74 68  |..:..(.. Open th|
000034b0  65 20 27 63 6f 6e 6e 65  63 74 27 20 77 69 6e 64  |e 'connect' wind|
000034c0  6f 77 0d 14 32 11 dd f2  6f 70 65 6e 63 6f 6e 6e  |ow..2...openconn|
000034d0  65 63 74 0d 14 3c 1f f2  6f 70 65 6e 77 69 6e 63  |ect..<..openwinc|
000034e0  65 6e 74 72 65 28 63 6f  6e 6e 65 63 74 77 69 6e  |entre(connectwin|
000034f0  25 29 0d 14 46 1f f2 73  65 74 63 61 72 65 74 65  |%)..F..setcarete|
00003500  6e 64 28 63 6f 6e 6e 65  63 74 77 69 6e 25 2c 31  |nd(connectwin%,1|
00003510  29 0d 14 50 05 e1 0d 14  5a 05 3a 0d 14 64 2a f4  |)..P....Z.:..d*.|
00003520  20 55 70 64 61 74 65 20  74 68 65 20 73 63 6f 72  | Update the scor|
00003530  65 73 20 69 6e 20 74 68  65 20 6d 61 69 6e 20 77  |es in the main w|
00003540  69 6e 64 6f 77 0d 14 6e  13 dd f2 75 70 64 61 74  |indow..n...updat|
00003550  65 5f 73 63 6f 72 65 73  0d 14 78 2c f2 73 65 74  |e_scores..x,.set|
00003560  69 63 6f 6e 74 65 78 74  28 6d 61 69 6e 77 69 6e  |icontext(mainwin|
00003570  25 2c 32 2c c3 28 77 69  6e 73 25 28 77 65 61 72  |%,2,.(wins%(wear|
00003580  65 29 29 29 0d 14 82 3b  f2 73 65 74 69 63 6f 6e  |e)))...;.seticon|
00003590  74 65 78 74 28 6d 61 69  6e 77 69 6e 25 2c 34 2c  |text(mainwin%,4,|
000035a0  c3 28 77 69 6e 73 25 28  77 65 61 72 65 20 82 70  |.(wins%(weare .p|
000035b0  5f 72 65 64 20 82 70 5f  62 6c 75 65 29 29 29 0d  |_red .p_blue))).|
000035c0  14 8c 05 e1 0d 14 96 05  3a 0d 14 a0 1d f4 20 44  |........:..... D|
000035d0  69 73 63 6f 6e 6e 65 63  74 20 75 73 20 66 72 6f  |isconnect us fro|
000035e0  6d 20 74 68 65 6d 0d 14  aa 10 dd f2 64 69 73 63  |m them......disc|
000035f0  6f 6e 6e 65 63 74 0d 14  b4 3a f2 6d 65 6e 75 73  |onnect...:.menus|
00003600  68 61 64 65 28 6d 61 69  6e 6d 65 6e 75 25 2c 30  |hade(mainmenu%,0|
00003610  2c 31 29 3a f4 20 53 68  61 64 65 20 74 68 65 20  |,1):. Shade the |
00003620  63 6c 65 61 72 20 62 6f  61 72 64 20 69 74 65 6d  |clear board item|
00003630  0d 14 be 39 f2 6d 65 6e  75 73 68 61 64 65 28 6d  |...9.menushade(m|
00003640  61 69 6e 6d 65 6e 75 25  2c 31 2c 31 29 3a f4 20  |ainmenu%,1,1):. |
00003650  53 68 61 64 65 20 74 68  65 20 64 69 73 63 6f 6e  |Shade the discon|
00003660  6e 65 63 74 20 69 74 65  6d 0d 14 c8 2c f2 69 63  |nect item...,.ic|
00003670  6f 6e 73 68 61 64 65 28  6d 61 69 6e 77 69 6e 25  |onshade(mainwin%|
00003680  2c 35 2c 31 29 3a f4 20  53 68 61 64 65 20 4d 65  |,5,1):. Shade Me|
00003690  73 73 61 67 65 0d 14 d2  2a f2 69 63 6f 6e 73 68  |ssage...*.iconsh|
000036a0  61 64 65 28 6d 61 69 6e  77 69 6e 25 2c 36 2c 31  |ade(mainwin%,6,1|
000036b0  29 3a f4 20 53 68 61 64  65 20 43 6c 65 61 72 0d  |):. Shade Clear.|
000036c0  14 dc 13 f4 20 44 69 73  63 6f 6e 6e 65 63 74 20  |.... Disconnect |
000036d0  75 73 0d 14 e6 17 f2 6e  65 74 67 61 6d 65 5f 64  |us.....netgame_d|
000036e0  69 73 63 6f 6e 6e 65 63  74 0d 14 f0 21 f4 20 57  |isconnect...!. W|
000036f0  65 20 64 6f 6e 27 74 20  6b 6e 6f 77 20 74 68 65  |e don't know the|
00003700  6d 20 61 6e 79 20 6d 6f  72 65 0d 14 fa 11 74 68  |m any more....th|
00003710  65 69 72 68 6f 73 74 24  3d 22 22 0d 15 04 1a f4  |eirhost$="".....|
00003720  20 41 6e 64 20 75 70 64  61 74 65 20 74 68 65 20  | And update the |
00003730  74 69 74 6c 65 0d 15 0e  10 f2 75 70 64 61 74 65  |title.....update|
00003740  74 69 74 6c 65 0d 15 18  05 e1 0d 15 22 05 3a 0d  |title.......".:.|
00003750  15 2c 2b f4 20 53 65 6e  64 20 74 68 65 20 6d 65  |.,+. Send the me|
00003760  73 73 61 67 65 20 69 6e  20 74 68 65 20 27 73 65  |ssage in the 'se|
00003770  6e 64 27 20 77 69 6e 64  6f 77 0d 15 36 11 dd f2  |nd' window..6...|
00003780  73 65 6e 64 6d 65 73 73  61 67 65 0d 15 40 24 ea  |sendmessage..@$.|
00003790  20 61 24 3a 61 24 3d a4  67 65 74 69 63 6f 6e 74  | a$:a$=.geticont|
000037a0  65 78 74 28 73 65 6e 64  77 69 6e 25 2c 30 29 0d  |ext(sendwin%,0).|
000037b0  15 4a 16 f4 20 53 65 6e  64 20 74 68 65 20 6d 65  |.J.. Send the me|
000037c0  73 73 61 67 65 0d 15 54  19 f2 6e 65 74 67 61 6d  |ssage..T..netgam|
000037d0  65 5f 73 65 6e 64 28 22  4d 22 2b 61 24 29 0d 15  |e_send("M"+a$)..|
000037e0  5e 29 f4 20 43 6c 65 61  72 20 74 68 65 20 74 65  |^). Clear the te|
000037f0  78 74 20 61 6e 64 20 63  6c 6f 73 65 20 74 68 65  |xt and close the|
00003800  20 77 69 6e 64 6f 77 0d  15 68 1f f2 73 65 74 69  | window..h..seti|
00003810  63 6f 6e 74 65 78 74 28  73 65 6e 64 77 69 6e 25  |context(sendwin%|
00003820  2c 30 2c 22 22 29 0d 15  72 17 f2 63 6c 6f 73 65  |,0,"")..r..close|
00003830  77 69 6e 28 73 65 6e 64  77 69 6e 25 29 0d 15 7c  |win(sendwin%)..||
00003840  05 e1 0d ff                                       |....|
00003844