C STRATEGO C Copyright (c) 1984. No copies of this text may be distributed without C written permission of the author or Hughes SCG/PWB department. C C Permission is hereby granted to distribute executable images throughout C the DECUS community and Hughes Aircraft. Source modules are released C to DECUS members and Hughes Aircraft employees only. This software is C subject to change without notice. Neither the author nor Hughes C Aircraft Co. assumes any liabilities for the performance of this C software C C Author: Gordon Howell C Hughes Aircraft Space and Communications C PO Box 92919 C Bldg S50/X342 C Los Angeles, CA C 213-419-0254 C C Stratego.INC ---- Include file for most STRATEGO modules. C includes data structures, common block allocations and common C parameters. C IMPLICIT INTEGER (A-Z) C Piece Data PARAMETER (Max_Pieces = 40) !number of pieces in the game PARAMETER (Enemy=-1, !represents all enemy pieces + Empty=0, !empty square value + Marshal= Empty+1, !Marshal Value + Miner= Marshal+7, + Scout= Miner+1, + Spy= Scout+1, + Bomb= Spy+1, + Flag= Bomb+1, + Impasse= Empty+15) !impassable "quicksand" squares INTEGER Me,Him !flags denoting who's who CHARACTER*10 Name(Empty:Impasse) !piece names DATA Name/'Empty','Marshal','General','Colonel','Major','Captain', + 'Lieutenant','Sergeant','Miner','Scout','Spy', + 'Bomb','Flag',' ',' ','Quicksand'/ C---Piece symbols on board CHARACTER*1 Symbol(-Impasse:Impasse), Enemy_symbol DATA Symbol/'#','x','x','F','@','S','9','8','7','6','5','4', + '3','2','1','-','1','2','3','4','5','6','7','8','9','S', + '@','F','x','x','#'/ DATA Enemy_symbol/'*'/ INTEGER Piece_Count(Marshal:Flag) !distribution of pieces DATA Piece_Count/1,1,2,3,4,4,4,5,8,1,6,1/ LOGICAL First_Player !The player who invoked game first COMMON /Sides/ Me,Him,Piece_Count,First_player C Screen stuff PARAMETER (None = 0, !null attribute + Bold = 1, !bold character + Reverse = 2, !reverse video + Blink = 4, !blinking characters + Underline = 8, !underlined characters + Default = -1) !flag denoting default value to be used C--Screen locations (in standard VT-100 row/column numbering system) PARAMETER (Row_0 = 3, Col_0 = 3, !board extents + Last_Row = 12, Last_Col = 21) PARAMETER (P_Row_0 = 3, P_Col_0 = 25, P_Indent = 3) !Prison PARAMETER (Turn_Row = 8, Turn_Col = 37) !turn number goes here PARAMETER (Turn_Text_Row = 8, Turn_Text_Col = 24) !text "forturn PARAMETER (Wait_Row = 12, Wait_Col = 24) !waiting message here PARAMETER (Cursor_Wait_Row = 1, Cursor_Wait_Col = 1) !cursor waits here PARAMETER (Setup_Row = 13, Setup_Col = 24) !Mode text goes here PARAMETER (Error_Row = 15, Error_Col = 2) !error messages here PARAMETER (Name_Row = 11, Name_Col = 24) !player's name PARAMETER (screen_length = 18) !board area PARAMETER (Start_Scroll = Screen_Length + 1, !Begin of scroll area + End_Scroll = 23, !end scroll area + Scroll_Length = End_Scroll - Start_Scroll + 1) !num. lines INTEGER Curr_Row, Curr_Col !current cursor loc C--Parameters to be used in setting video and terminal attributes PARAMETER (Graphics_Off = 0, + Graphics_On = 1, + Double = 2, + Single = 3, + Cursor_key_on = 4, + Cursor_key_off = 5, + Application_pad = 6, + Numeric_pad = 7, + Bell = 8, + Normal_screen = 9, + Siren = 10, + Underscore_On = 11, + No_Video = 12, + Reverse_Screen = 13) CHARACTER*5 Code(Graphics_Off:Reverse_screen) !ANSI escape codes C--Prison information PARAMETER (Max_Prisoners = 39) !prison capacity INTEGER Prisoners !prisoners interred CHARACTER*1 Prison(Max_Prisoners+1) !actual prisoners DATA Prison/Max_Prisoners*' ',' '/ C--Screen Modes LOGICAL Error_Set !is an error message displayed? LOGICAL SetUp_Mode !Are we still setting up? COMMON/Screen_Info/Curr_Row,Curr_Col,Error_Set,Prisoners, +SetUp_Mode,Code C--Scrolling area information PARAMETER (Max_Lines = 40) !size scrolling buffer CHARACTER*80 Text_Line(0:Max_Lines) !scrolling buffer INTEGER Curr_Line !current output line INTEGER Ptr_Line !topmost output line INTEGER Window_Size !size of scrolling window LOGICAL Scrolled !is screen scrolled? LOGICAL Buffer_Full !is current buffer size>scrol area size COMMON/Scroll/Scroll_Line,Curr_Line,Ptr_Line,Buffer_Full, +Scrolled,Window_Size,Text_Line C Logical Units PARAMETER (MesFil=20, !messages in this file + ScrnFil=30, !text file describing screen + HlpFil=40, !help files + My_MailBx=21, !mailboxes + His_MailBx=31) C Logical & descriptive names CHARACTER*14 Mbx_Name !base name for mailboxes CHARACTER*15 EF_Cluster !name of group event flag cluster CHARACTER*15 My_MailBx_Name,His_MailBx_Name !names of mailboxes CHARACTER*15 Gbl_Sect !name of global section CHARACTER*15 HisName,MyName !player's names C---Common block contains character data COMMON/Names/EF_Cluster,Gbl_Sect,Name,Symbol,MyName,HisName, + Enemy_symbol,Prison,My_MailBx_Name,His_MailBx_name,Mbx_Name C Event flags PARAMETER (Cluster_2 = 64, Cluster_3 = 96) PARAMETER (Wait_EF = Cluster_2 + 1, !base for personal wait flags + Abort_EF= Wait_EF + 2, !set if game terminates + Gbl_EF = Cluster_3, !used to determine other player + Gbl_EF1 = Gbl_EF + 1, !my global event flag + NoSet = 0) !used as placeholder INTEGER His_Wait_Flag,My_Wait_Flag !the flag actually waited for C Event flag masks (to compare in READEF) PARAMETER (Wait_Msk = 2**(Wait_EF - Cluster_2), + Abort_Msk= 2**(Abort_EF- Cluster_2), + Gbl_Msk = 2**(Gbl_EF - Cluster_3)) C---I/O Channels assigned to terminal and mailboxes and other goodies INTEGER Exit_Block(1:4) !exit handler info INTEGER Status !system service status return INTEGER IOChan !terminal I/O channel INTEGER TermChan !I/O channel # for TINPUT INTEGER MyChan, HisChan !mailbox channel no.s INTEGER MailChan !global mailbox channel no. INTEGER N_Processes !number of STRATEGO processes COMMON/Channels/His_Wait_Flag,My_Wait_Flag,IOChan,TermChan, + MyChan,HisChan,MailChan,Status,N_Processes,Exit_Block C---ASTs Out-of-band ASTs PARAMETER (Redraw_Screen = 23) !^W PARAMETER (Back_Scroll = 8) !^H (backspace) PARAMETER (Forward_Scroll = 10) !^J (line feed) PARAMETER (Home_Scroll = 7) !^G PARAMETER (Make_Note = 14) !^N PARAMETER (Send_Message = 2) !^B PARAMETER (Ask_Help = 1) !^A PARAMETER (Full_Help = 4) !^D PARAMETER (Spawn_DCL = 3) !^C(parameter not used) C Timer requests REAL EF_Wait_Time !time interval to wait for EF PARAMETER (EF_Wait_ID = 17, !timer ID number for EF wait + EF_Wait_Time = 0.7) !in seconds C Message file parameters and variables PARAMETER (YouCap = 1 - 1, + YouLost = 13 - 1, + BothLost = 25 - 1) PARAMETER (First_Msg=35) !marker to first "general" message PARAMETER (IWin = First_Msg, + ILose = IWin+1, + YouWin = ILose+1, + YouLose = YouWin+1, + AllDone = YouLose+1, + Suicide = AllDone+1, + IStrike = Suicide+1, + OKMove = IStrike+1, + Not_Yours = OKMove+1, + Immoveable = Not_Yours+1, + No_Piece = Immoveable+1, + No_Place = No_Piece+1, + Pick_Piece = No_Place+1, + Pick_Dest = Pick_Piece+1, + Own_Piece = Pick_Dest+1, + Non_Adj = Own_Piece+1, + Ill_Scout = Non_Adj+1, + Bad_Scout = Ill_Scout+1, + Your_Turn = Bad_Scout+1, + Move_First = Your_turn+1, + Move_Second = Move_First+1, + IQuit = Move_Second+1, + ISurrender = IQuit+1, + Null_Message = ISurrender+1 ) CHARACTER*80 Msg !a common message buffer CHARACTER*80 Message(Null_Message) !standard messages COMMON /texts/ Msg,Message C System services C *NOTE* All system services are in the modules KEYQIO and WELCOME C All services are referenced as integer functions and return status C INTEGER SYS$QIOW !queues I/O request to system :WELCOME,KEYQIO INTEGER SYS$DCLEXH !declares an exit-handler :KEYQIO INTEGER SYS$CANEXH !cancels declared exit-handler :KEYQIO INTEGER SYS$CANCEL !cancels I/O on channel :KEYQIO INTEGER SYS$WAITFR !wait for an event flag :KEYQIO INTEGER SYS$CLREF !clear an event flag :KEYQIO INTEGER SYS$SETEF !sets an event flag :KEYQIO INTEGER SYS$READEF !reads an event flag cluster :KEYQIO INTEGER SYS$SETIMR !queues a timer request :KEYQIO INTEGER SYS$BINTIM !converts ASCII time to binary :KEYQIO INTEGER SYS$CANTIM !cancels a timer request :KEYQIO INTEGER SYS$ASCEFC !create/map event flag cluster :WELCOME INTEGER SYS$ASSIGN !assign an I/O channel :WELCOME INTEGER SYS$CREMBX !create/map to process mailbox :WELCOME INTEGER SYS$GETTIM !get system binary time :WELCOME INTEGER SYS$CRMPSC !create/map global data section :WELCOME C Board Data PARAMETER (MinRow=0, MinCol=0, !size of board + MaxRow=9, MaxCol=9) C---the Pad_Board stuff is to insure that there is no overlap in the block C---of data that is mapped to the global section (fills it out to 512 bytes) PARAMETER (Pad_length = 12) !number of 4-byte spaces to pad INTEGER Old_Row,Old_Col,New_Row,New_Col !the most recent move INTEGER Piece_Lost !The value of the piece lost INTEGER Turn,First_Turn !the turn no. & who moves first INTEGER Last_Data !marks end of useful data INTEGER Board(MinRow:MaxRow, MinCol:MaxCol) !the board values INTEGER Pad_Board(pad_length) !used to fill section page CHARACTER*15 Name1,Name2 !the players' names LOGICAL*1 Surrender !did someone surrender? LOGICAL*1 Exit_Flag !did one's process die? C--This common block is the one that is mapped to global memory COMMON /Shared/Board,Old_row,Old_Col,New_Row,New_Col,Piece_Lost, + Turn,First_turn,Name1,Name2,Surrender,Exit_Flag,Last_data, + Pad_Board