--- title: "Pipeline" id: 55865 type: "computer_media" slug: "pipeline" url: "http://localhost/computer_media/pipeline/" markdown_url: "http://localhost/computer_media/pipeline.md" published_at: "2024-07-06T17:27:01+00:00" modified_at: "2026-03-30T21:44:42+00:00" author: "David Anderson" featured_image: url: "http://localhost/wp-content/uploads/2024/07/SCR-20240705-mitv.png" excerpt: "A two-player pipe-laying strategy game with a built-in AI opponent, three pipe shapes drawn with PLOT/DRAW, and a machine code BASIC flow-tracer hidden in its own listing." category: - name: "Archived Media" slug: "archived-media" taxonomy: "category" url: "http://localhost/category/archived-media/" post_tag: - name: "Downloadable" slug: "downloadable" taxonomy: "post_tag" url: "http://localhost/tag/downloadable/" - name: "TS 2068" slug: "ts2068" taxonomy: "post_tag" url: "http://localhost/tag/ts2068/" model: - name: "Timex/Sinclair 2068" slug: "ts-2068" taxonomy: "model" url: "http://localhost/model/ts-2068/" genre: - name: "Game" slug: "game" taxonomy: "genre" url: "http://localhost/type/game/" - name: "Strategy" slug: "strategy" taxonomy: "genre" url: "http://localhost/type/strategy/" media_contents: - id: 55879 title: "ISTUG Public Domain Library 7" type: "computer_media" url: "http://localhost/computer_media/istug-public-domain-library-7/" media_type: "Program" download_url: "https://archive.org/download/timex-sinclair-software-archive/Pipeline%20%28198x%29%28TS2068%29%28US%29%28Program%29.zip" mediadate: "198x" images: - url: "http://localhost/wp-content/uploads/2024/07/SCR-20240705-mitv.png" - url: "http://localhost/wp-content/uploads/2024/07/SCR-20240705-mild.png" media_type_tags: "Game, Strategy" --- # Pipeline Pipeline is a two-player (or player-versus-computer) strategy board game in which players take turns laying one of three pipe segments to extend a shared pipeline, trying to finish the pipe in the upper-right corner or force the opponent off the board. The game uses a 2D array `b(15,15)` to track board state and a `d(4,3)` direction-mapping table loaded from DATA at line 9000 to compute how each pipe type redirects flow from each of four entry edges. Three pipe shapes are drawn using PLOT/DRAW: a straight pipe (subroutine 2000), a diagonal (subroutine 4000), and a reverse diagonal (subroutine 6000), all constructed with parametric loops scaled by `nn` and `lw`. Lines 9800–9980 contain a sophisticated machine code loader and a BASIC program flow-tracing utility, which POKEs Z80 machine code into high RAM at address 65218 and uses `RANDOMIZE USR` to execute it, walking the BASIC line-pointer structure to display GOTO/GOSUB relationships. *** ## Program Analysis ### Program Structure The program is divided into clearly separated functional zones by line number range: | Line Range | Purpose | | --- | --- | | 10–50 | Title screen, instructions, keypress wait | | 100–110 | Initialization: arrays, constants, RESTORE/READ direction table | | 1010–1180 | Board setup, border drawing, pipe-preview rendering, board array init | | 1190–1520 | Main game loop: move counter, player turn dispatch | | 2000–2080 | Subroutine: draw straight pipe segment | | 2500–2650 | Subroutine: menu, name/skill input, who-goes-first | | 3000–3094 | Computer player (player 1) logic | | 4000–4080 | Subroutine: draw diagonal pipe (positive slope) | | 5001–5999 | Human player (player 2) input and move dispatch | | 6000–6080 | Subroutine: draw diagonal pipe (negative slope) | | 7010–7520 | Subroutine: apply move, traverse pipeline, detect win/loss | | 8000–8120 | Advanced AI: lookup table–driven move selection | | 9000–9512 | DATA: direction table and AI strategy lookup tables | | 9800–9980 | Machine code loader and BASIC flow-trace utility | | 9998–9999 | SAVE and VERIFY | ### Board Representation The board is stored in array `b(15,15)`. The usable grid is indexed from `(2,2)` to `(bd+1,bd+1)`, where `bd` is the board dimension (either 12 or 13 depending on mode). The border cells are pre-filled with `-1` (walls) using the expression `-(i=1)-(j=1)-(i=bd+2)-(j=bd+2)`, which exploits the fact that boolean expressions evaluate to `-1` (true) or `0` (false) in Sinclair BASIC. The starting cell `b(2,2)` is set to `1`. ### Direction Table and Pipe Traversal The `d(4,3)` array, loaded from DATA at line 9000, encodes how each of the three pipe types (columns) redirects flow arriving from each of four directions (rows: 1=up, 2=down, 3=right, 4=left). The variables `A1` through `A4` hold values 1–4; these are read directly as numeric DATA entries, making the table self-referential. The pipeline traversal loop in subroutine 7000 uses `eg=d(eg,pla)` to chain direction through already-placed pipes until it hits an empty cell (win condition at corner), a boundary (`b<0`, off-board loss), or a wall. ### Graphics: Three Pipe Shapes Each pipe type is rendered by a dedicated subroutine using four PLOT/DRAW calls per iteration of a loop `i=1 TO 4`, producing a thick line effect. The pixel origin for each cell is computed as `iii=nn*(ii-1)+50` and `jjj=nn*(jj-1)+1`, where `nn` is the cell size in pixels. Subroutine `2000` draws a straight (horizontal/vertical) pipe; subroutine `4000` a positive-slope diagonal; and subroutine `6000` a negative-slope diagonal. Three sample pipes are also drawn in the left margin as a legend during setup (lines 1070–1120). ### AI: Beginner and Advanced Modes At skill level 1 (beginner), the computer’s move at line 3060 is determined by a complex arithmetic expression combining boundary position and current entry direction (`eg`), weighted by random factors using `RND<.5`. This produces a heuristic bias toward pipes that steer flow toward the goal corner. At skill level 2 (advanced), lines 8000–8120 use a lookup table in the `e(13,13)` array, loaded from one of several DATA blocks (9100–9512) selected by `RESTORE rst` where `rst` is computed from move number and the content of board cell `b(3,3)`. The AI then searches for the pipe type `pla` such that `d(eg,pla)=e(jj,ii)`, matching the desired exit direction from the lookup table. ### Turn Management The game uses a move counter `mv` (starting at 1, incremented to 2 at line 1190 before the first real turn). Player assignment is handled by checking `mv/2=INT(mv/2)` (even move = one player, odd = other), combined with `po` (who goes first). Lines 1500 and 1520 dispatch to either the computer (line 3000) or human (line 5000) section accordingly. ### Setup and Mode Selection Subroutine 2500 handles all game setup. Variable `s` selects mode (1 = vs. computer, 2 = two human players), `pl` selects skill level, `po` selects who moves first, and `y$`/`o$` hold player names. Input validation at line 2645 catches invalid entries with a combined boolean expression and loops back. In two-player mode (`s=2`), a name-swap at line 2642 ensures consistent assignment when player 1 requests to go second. ### Machine Code Loader and BASIC Flow Tracer Lines 9800–9980 form a self-contained development tool embedded in the program. Line 9810 uses `CLEAR 65217` to reserve high RAM, then POKEs 135 bytes of Z80 machine code (read from DATA lines 9825–9865) into addresses 65218–65352. The machine code is called via `RANDOMIZE USR 65218` and `USR 65261`/`USR 65345`. The flow tracer at line 9900 walks the BASIC line-pointer structure in memory, following `GOTO` (token `236`), `GOSUB` (token `237`), `IF...THEN` (token `250`), and `RETURN` (token `254`) tokens, printing a readable call graph. This utility would have been used during development to verify program flow without single-stepping. ### Notable Techniques and Idioms - Boolean arithmetic (`-(expr)`) for array boundary initialization at line 1160. - Computed `RESTORE` address (`rst`) at line 8040 for multi-table AI strategy selection. - `GO SUB 2000*pla` at line 7020 dynamically dispatches to subroutines 2000, 4000, or 6000 based on pipe type — an elegant computed-GOSUB pattern. - The `lw` and `nn` parameters allow the board geometry to scale between one-player and two-player modes. - DATA values use named variables `A1`–`A4` rather than literals, making the direction table readable as symbolic compass directions. ### Potential Bugs and Anomalies - DATA blocks at lines 9201–9213 and 9301–9412 and 9501–9512 are addressed by `RESTORE rst` but `rst` is computed only for values 9300, 9400, 9500 (line 8020) and 9100, 9200 (line 8030). Data lines 9201–9213 exist but the corresponding `rst=9200` path appears absent from line 8020’s logic, suggesting unused or unreachable strategy tables. - Line 9301 through 9312 has only 12 data rows per `bd`-sized read, but the advanced AI reads `bd` rows of `bd` columns — if `bd=12` this matches, but boundary conditions around `bd+2` indexing in `b()` vs. `e()` (dimensioned 13×13) could cause off-by-one reads in edge cases. - The variable `s` is used both as the INPUT target in subroutine 2500 (game mode selector) and as a numeric stack counter in the flow tracer at line 9902 (`LET s=0`), but since these are in entirely separate execution contexts this does not cause a conflict during normal play. ## Source Code ``` 10 BEEP .2,20: BORDER 7: INK 0: CLS : PRINT AT 1,12; BRIGHT 1;"PIPELINE" 20 PRINT ''" AIM: To finish the Pipeline by laying the last pipe in the upper right corner OR by forcing the opponent off the board." 30 PRINT ''" RULES:Players alternate moves by laying one of 3 pipes onto the end of the Pipeline. You may choose to play ME or the person beside you." 40 PRINT '''" PRESS ANY KEY TO CONTINUE" 50 IF INKEY$="" THEN GO TO 50 100 BEEP .2,30: CLS : DIM d(4,3): DIM e(13,13): LET A1=1: LET A2=2: LET A3=3: LET A4=4 110 RESTORE 9000: FOR i=1 TO 4: FOR j=1 TO 3 120 READ d(i,j): NEXT j: NEXT i 1010 PRINT INK 1; BRIGHT 1; INVERSE 1;AT 0,11;" PIPELINE ": GO SUB 2500 1012 BORDER 5: PRINT AT 0,11; INVERSE 1; INK 1;" PIPELINE " 1013 PRINT INK 4;AT 9,26; INVERSE 1;"PLEASE";AT 10,26;" WAIT ";AT 11,26;" FOR ";AT 12,26;"PROMPT" 1020 PLOT 49,0: DRAW 157,0: DRAW 0,157: DRAW -157,0: DRAW 0,-157 1030 LET nn=12+(pl<>po): LET lw=4+(pl<>po): LET bd=12+(pl=po) 1040 LET jj=1: LET ii=jj 1050 GO SUB 2000 1060 LET n=nn-1: LET hs=nn*(bd-1) 1061 PLOT 50+hs,hs+1: DRAW 0,n: DRAW n,0: DRAW 0,-n: DRAW -n,0 1070 PRINT INK 1; INVERSE 1;AT 2,0;"PIPE 1" 1080 LET jj=bd-1: LET ii=-2: GO SUB 2000 1090 PRINT INK 1; INVERSE 1;AT 8,0;"PIPE 2" 1100 LET jj=7: GO SUB 4000 1110 PRINT INK 1; INVERSE 1;AT 15,0;"PIPE 3" 1120 LET jj=2: GO SUB 6000 1130 LET ii=1: LET jj=ii 1140 DIM b(15,15) 1150 FOR i=1 TO bd+2: FOR j=1 TO bd+2 1160 LET b(i,j)=-(i=1)-(j=1)-(i=bd+2)-(j=bd+2) 1170 NEXT j: NEXT i 1180 LET b(2,2)=1: LET mv=1 1190 LET mv=mv+1 1500 IF (po=1 AND (mv/2=INT (mv/2))) OR (po=2 AND (mv/2<>INT (mv/2))) THEN GO TO 3000 1520 GO TO 5000 1999 STOP 2010 LET iii=nn*(ii-1)+50: LET jjj=nn*(jj-1)+1 2020 FOR i=1 TO 4 2030 PLOT iii+i-1,jjj: DRAW 0,4 2040 PLOT iii+i-1,jjj+lw+4: DRAW 0,4 2050 PLOT iii+lw+3+i,jjj: DRAW 0,4 2060 PLOT iii+lw+3+i,jjj+lw+4: DRAW 0,4 2070 NEXT i 2080 RETURN 2500 PRINT AT 18,4;"CHOOSE 1 OR 2:" 2505 INPUT " 1. Play against ME"'" 2. I'll be referree";TAB 0;s 2510 IF s=2 THEN LET pl=1: GO TO 2600 2550 INPUT "SKILL LEVEL ? 1. Beginner";TAB 15;"2. Advanced"';pl 2560 IF s=1 THEN GO TO 2620 2600 PRINT AT 18,4;"ENTER NAMES: " 2610 INPUT "Your Name? ";y$'"Opponent's? ";o$ 2620 PRINT AT 18,4;"WHO GOES FIRST ? (1 or 2)" 2630 IF s=1 THEN LET o$="ME": LET y$="YOU" 2635 PRINT AT 20,4;"1. ";o$;TAB 4;"2. ";y$ 2640 INPUT po 2642 IF s=2 AND po=1 THEN LET q$=o$: LET o$=y$: LET y$=q$: LET po=2 2645 IF s<>1 AND s<>2 OR pl<>1 AND pl<>2 OR po<>1 AND po<>2 THEN CLS : BEEP .7,0: PRINT AT 10,2;"Please enter valid answers": PAUSE 100: GO TO 2500 2650 CLS : RETURN 3000 IF s=2 THEN GO TO 3091 3010 IF pl=2 THEN GO TO 8000 3020 IF mv<>2 THEN GO TO 3060 3030 LET ii=1+(RND>.5): LET jj=3-ii 3050 LET eg=3-2*(jj=2) 3060 LET pla=((ii=1)*(eg=4)+(ii=bd)*(eg=3)+(jj=1)*(eg=2)+(jj=bd)*(eg=1))*(2+(RND<.5))+((ii=1)*(eg=1)+(jj=1)*(eg=3)+(ii=bd)*(eg=2)+(jj=bd)*(eg=4))*(1+(RND<.5))+((ii=1)*(eg=2)+(jj=1)*(eg=4)+(ii=bd)*(eg=1)+(jj=bd)*(eg=3))*(1+2*(RND<.5)) 3070 IF ii<>1 AND ii<>bd AND jj<>1 AND jj<>bd THEN LET pla=INT (1+RND*2.999) 3080 GO SUB 7000 3090 GO TO 1190 3091 PRINT AT 0,10; INK 0;o$;"'s TURN ": INPUT "WHICH PIPE ? (1,2 OR 3)";pla: IF pla<1 OR pla>3 THEN BEEP .7,0: GO TO 3091 3092 BEEP .2,30: IF mv<>2 THEN GO TO 3080 3093 LET ii=1+(RND>.5): LET jj=3-ii: LET eg=3-2*(jj=2) 3094 GO TO 3080 4010 LET iii=nn*(ii-1)+50: LET jjj=nn*(jj-1)+1 4020 FOR i=1 TO 4 4030 PLOT iii+i-1,jjj: DRAW nn-i,nn-i 4040 PLOT iii+i-1,jjj+nn: DRAW 1-i,1-i 4050 PLOT iii+lw+3+i,jjj: DRAW 4-i,4-i 4060 PLOT iii+lw+3+i,jjj+nn: DRAW -(nn-5+i),-(nn-5+i) 4070 NEXT i 4080 RETURN 5001 IF mv<>2 THEN GO TO 5015 5002 BEEP .2,20: INPUT "Which way? ( U=up R=right )";r$: IF r$<>"u" AND r$<>"r" THEN BEEP .7,0: GO TO 5002 5003 LET ii=2 5004 IF r$="u" THEN LET ii=1 5005 LET jj=3-ii: PRINT AT 2,27; INK 1; INVERSE 1;"PIPE";AT 3,27;"LINE" 5010 LET eg=3-2*(jj=2) 5015 IF y$<>"YOU" THEN PRINT AT 0,10; INK 0;y$;"'s TURN " 5017 INPUT "WHICH PIPE ? (1,2 OR 3) ";pla: IF pla<1 OR pla>3 THEN BEEP .7,0: GO TO 5017 5020 BEEP .2,30: GO SUB 7000 5999 GO TO 1190 6010 LET iii=nn*(ii-1)+50: LET jjj=nn*(jj-1)+1 6020 FOR i=1 TO 4 6030 PLOT iii+i-1,jjj: DRAW 1-i,i-1 6040 PLOT iii+i-1,jjj+nn: DRAW nn-i,-(nn-i) 6050 PLOT iii+lw+3+i,jjj: DRAW 5-nn-i,-(5-nn-i) 6060 PLOT iii+lw+3+i,jjj+nn: DRAW 4-i,i-4 6070 NEXT i 6080 RETURN 7010 LET b(jj+1,ii+1)=pla 7020 GO SUB 2000*pla 7030 LET eg=d(eg,pla) 7040 LET jj=jj+(eg=1)-(eg=2) 7050 LET ii=ii+(eg=3)-(eg=4) 7060 IF b(jj+1,ii+1)=0 THEN GO TO 7150 7070 IF b(jj+1,ii+1)<0 THEN GO TO 7100 7080 LET pla=b(jj+1,ii+1) 7090 GO TO 7030 7100 IF (((mv/2)=INT (mv/2)) AND (po=1)) OR (mv/2<>INT (mv/2) AND po=2) THEN GO TO 7130 7110 PRINT INK 2;AT 1,7; FLASH 1;" Too bad, ";y$;" lOST!" 7120 GO TO 7500 7130 PRINT INK 1;AT 1,7; FLASH 1;" Well done, ";y$;" won!" 7140 GO TO 7500 7150 IF jj<>bd OR ii<>bd THEN RETURN 7160 IF (((mv/2)=INT (mv/2)) AND (po=1)) OR (mv/2<>INT (mv/2) AND po=2) THEN GO TO 7130 7170 GO TO 7110 7500 INPUT "WOULD YOU LIKE TO TRY AGAIN?";r$ 7505 IF r$="n" THEN BEEP .7,0: STOP 7510 BEEP .2,30: CLS 7520 GO TO 1010 8000 IF mv=2 THEN GO TO 8100 8010 IF mv<>3 AND mv<>4 THEN GO TO 8070 8020 LET rst=9300+100*(b(3,3)=2)+200*(b(3,3)=3) 8030 IF mv=3 THEN LET rst=9100+100*(b(3,2)=0) 8040 RESTORE rst 8050 FOR i=1 TO bd: FOR j=1 TO bd 8060 READ e(i,j): NEXT j: NEXT i 8070 LET pla=1 8080 IF d(eg,pla)=e(jj,ii) THEN GO TO 8110 8090 LET pla=pla+1: GO TO 8080 8100 LET ii=1: LET jj=2: LET eg=ii: LET pla=jj 8110 GO SUB 7000 8120 GO TO 1190 9000 DATA 1,A3,A4,A2,A4,A3,A3,A1,A2,A4,A2,1 9100 DATA 1,A1,A1,A1,A1,A1,A1,A1,A1,A1,A1,A1,1 9101 DATA 2,A2,A2,A2,A2,A2,A2,A2,A2,A2,A2,A2,2 9102 DATA 1,A1,A1,A1,A1,A1,A1,A1,A1,A1,A1,A1,1 9103 DATA 2,A2,A2,A2,A2,A2,A2,A2,A2,A2,A2,A2,2 9104 DATA 1,A1,A1,A1,A1,A1,A1,A1,A1,A1,A1,A1,1 9105 DATA 2,A2,A2,A2,A2,A2,A2,A2,A2,A2,A2,A2,2 9106 DATA 1,A1,A1,A1,A1,A1,A1,A1,A1,A1,A1,A1,1 9107 DATA 2,A2,A2,A2,A2,A2,A2,A2,A2,A2,A2,A2,2 9108 DATA 1,A1,A1,A1,A1,A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2,A1,A2,A2,A2,A2,A2,A2,A2,A2,A2,2 9509 DATA 1,A2,A1,A1,A1,A1,A1,A1,A1,A1,A1,1 9510 DATA 2,A1,A2,A2,A2,A2,A2,A2,A2,A2,A2,2 9511 DATA 1,A2,A3,A4,A3,A4,A3,A4,A3,A4,A3,4 9512 DATA 2,A3,A4,A3,A4,A3,A4,A3,A4,A3,A4,3 9799 STOP 9805 REM MC loader 9807 IF PEEK 65350=201 THEN GO TO 9902 9810 CLEAR 65217 9812 PRINT "Please wait..."''"Machine Code Loading" 9815 RESTORE 9825 9820 FOR q=65218 TO 65352: READ a: POKE q,a: NEXT q 9823 REM data A: 9825 DATA 42,80,255,237,91,82,255,167,237,82,0,56,1,201,42,84,255,35,a,a,0,a,62,13,35,190,32,252,35,34,84,255,70,35,78,237,67,80,255,24,215,0,a 9830 REM data B: 9835 DATA 42,84,255,35,a,a,a,126,254,250,40,63,254,235,40,59,254,243,40,55,254,237,40,51,254,a,40,47,254,236,40,43,254,226,40,39,35,126,254,13,40,10,254,58,40,216,254,34,40,15,24,240 9840 REM data S13: 9845 DATA 35,34,84,255,70,35,78,237,67,80,255,24,191 9850 REM data SEE: 9855 DATA 1,0,2,35,62,34,237,177,24,217 9860 REM data OUT: 9865 DATA 6,0,78,34,86,255,201,0,a,42,84,255,24,203,201,0,a 9870 CLS 9900 REM Flow Utility 9901 IF PEEK 65350<>201 THEN PRINT "Machine Code not Loaded..."''"GOTO 9800": STOP 9902 DIM s(50): LET s=0: LET ll=s 9905 PRINT "Basic Program Flow:";AT 0,0; OVER 1;"_________ _________" 9907 INPUT "Starting Line Number? ";l 9910 IF l>=9800 THEN GO TO 9907 9912 LET l2=INT (l/256): LET l1=l-l2*256 9913 POKE 65362,l1: POKE 65363,l2 9914 POKE 65364,86: POKE 65365,104: POKE 65360,PEEK 26711: POKE 65361,PEEK 26710 9915 RANDOMIZE USR 65218: LET a=PEEK 65364+256*PEEK 65365: LET l=PEEK (a+1)+256*PEEK a 9916 LET c=USR 65261 9917 LET l=PEEK 65360+256*PEEK 65361: IF l>=9800 THEN PRINT "END of BASIC": STOP 9918 LET a=PEEK 65366+256*PEEK 65367 9919 IF c=250 THEN GO TO 9950 9921 IF l=ll THEN PRINT ": "; 9922 IF l<>ll THEN PRINT : PRINT l;" ";: LET ll=l 9923 IF c=254 THEN PRINT "RETURN";: LET l=s(s): LET s=s-1: GO TO 9912 9925 IF c=235 OR c=243 THEN PRINT CHR$ c;: GO TO 9980 9927 IF c=226 THEN PRINT "STOP": STOP 9930 LET a=a+1: LET g=PEEK a 9933 IF g<>14 THEN GO TO 9930 9935 LET a=a+3: LET g=PEEK a+256*PEEK (a+1) 9937 IF c=237 THEN PRINT "GOSUB ";: LET l=l+1: LET s=s+1: LET s(s)=l 9940 IF c=236 THEN PRINT "GOTO "; 9945 PRINT g;: LET l=g: GO TO 9912 9950 LET a=a+1: IF PEEK a<>203 THEN GO TO 9950 9952 LET c=PEEK (a+1) 9954 IF l<>ll THEN PRINT : LET ll=l 9955 PRINT l;" IF...THEN ";CHR$ c;: IF c=236 OR c=237 THEN GO TO 9960 9957 LET a=a+1: GO TO 9980 9960 LET a=a+1: LET g=PEEK a 9962 IF g<>14 THEN GO TO 9960 9965 LET a=a+3: LET g=PEEK a+256*PEEK (a+1): PRINT g;: LET a=a+1: GO TO 9980 9980 LET l2=INT (a/256): LET l1=a-l2*256: POKE 65364,l1: POKE 65365,l2: LET c=USR 65345: GO TO 9917 9998 CLEAR : SAVE "Pipeline" LINE 1 9999 VERIFY "" ```