; ============================================================================
; $0200-$04FF - solo trainer playbook (track 29 sectors 6-8), loaded by the trainer setup overlay at $ECAA
; ============================================================================
; Five canned opening plays; the trainer setup code copies a 150-byte slice into the AI's group and
; destination tables. It overwrites the tile rule table and the first page of the scratch area.

        .setcpu "6502"
        .include "c64.inc"
        .include "zeropage.inc"

        .org $0200


; $0200-$04FF - the solo trainer's playbook: five canned opening plays of 150 bytes each (750 bytes
; used, 18 left over).  Track 29 sectors 6-8, read in one piece by initTrainerAi in
; game/trainerSetupEC00: $ECA6 points the fast loader at $0200 with setLoadDest and $ECB3 asks for
; three sectors from track 29 sector 6.  THE BOMB (game type 2) is the one solo game that never loads
; it - $EC69 jumps past the load because both sides own nothing but a comcen.
; There is no code in this file and nothing reaches these bytes by name: the only reader is the copy
; loop at $ECF3-$ED03, which walks them through three zero-page pointers built at $ECD2-$ECF0
; (mapCellPtr $48 = group ids, fillEndPtr $4A = columns, planRowPtr $4C = rows).  Every label below,
; and every 'from' line XREF.txt lists for $0200-$04FE, belongs to one of the other three tenants of
; these two pages: the terrain contour rules and start-up code of game/tileRules0200 ($0200-$0388),
; the 'ea' boot file (boot/eaBootFile, $02A8-$030B) and the manual-check answer table plus checksum
; routine of game/scratchAndMessages0400 ($0400-$04AD).  The 'from game/trainerPlaybook0200' lines
; XREF.txt shows for $0400/$047A/$047C/$0481/$0484/$048C/$04A0 are that same overlap seen from the
; other side - the code doing the referencing is the checksum routine in game/scratchAndMessages0400,
; not anything here. Record n starts at $0200 + 150*n ($ECD2-$ECDB: 150 x n through multiply8x8, then
; +$0200 from the two INYs), n = the AI plan number kept in $8966.  A record is three parallel
; 50-entry arrays indexed by AI slot 0-49, i.e. unit 50-99 - the trainer always plays side 1: +$00
; group id, +$32 destination column, +$64 destination row.  The copy loop runs slot 49 down to 0 and
; writes aiUnitGroup ($8832+slot), unitDestCol[50+slot] ($F802) and unitDestRow[50+slot] ($F866).  The
; five records are at $0200, $0296, $032C, $03C2 and $0458. The plan number comes from the game type
; ($0BA3 bits 0-2) at $EC4A-$EC93: 0 SCRIMAGE -> play 0, 1 QB SNEAK -> play 1, 3 FACE-OFF -> play 2, 4
; SLUGGERS -> play 3, 5 FULL WAR and 6 DEFENDER -> play 4.  The same number indexes the three 5-byte
; tables at the head of the setup overlay: mainGroupByPlanTable $EC00 = FF,FF,04,04,04 (spearhead
; group), groupCountByPlanTable $EC05 = 0A,0A,04,04,04 (highest group id) and aiPlanParamTable $EC0A =
; FF,FF,08,0C,0C (drone detonation score threshold). Values: a group id is 0-10, or $FF = 'in no
; group'.  Group 0 is the comcen on its own - slot 49 is 0 in all five plays.  Plays 0 and 1 hand out
; ten one-unit groups 1-10; plays 2-4 use groups 1-3 (four riders in a 2x2 block with that group's spy
; scouting one row in front) plus group 4, the spearhead.  Columns and rows are plain cell coordinates
; 0-39 with bits 6-7 clear, so the engine reads them as a live order rather than 'arrived'; side 1
; owns rows 6-19, so every row byte in the file is $06-$13 and every column byte $04-$24. How the
; plays were built (checked byte for byte against the unit start templates on track 18 s8-14): each
; destination array starts as an exact copy of the side-1 half of the template that the same game type
; selects (play 0/1 -> template 2 $F320, play 2 -> template 1 $F190, play 3 -> template 3 $F4B0, play
; 4 -> template 0 $F000), and only the slots that matter were edited.  An entry for a slot that holds
; no unit in that roster is therefore just the cell that unit would have started on - a don't-care.
; The $FF group ids line up exactly with the $FF ('not in play') entries of the matching template's
; unit-type array, which is why the `ldx aiUnitGroup,y` at $EDDC can never hand $8902 an index of $FF.
; Only plays 0 and 1 are used as written.  $ED05-$ED0A sends plans 2-4 through the group scatter at
; $ED12-$ED58, which re-aims every group at a random column 4-35 inside an 8-row band and translates
; the whole group there (shiftAiGroupDestinations $EF00), so for those three plays only the shape of
; each group and its membership survive; even the comcen's own destination is replaced at $ED4E-$ED56
; by the spearhead group's random target. Lifetime: microseconds.  rebuildAiGroupTables ($ED8E) writes
; the twelve group sum high bytes over $0464-$046F, $0478-$0483, $048C-$0497 and $04A0-$04AB before
; the setup overlay even returns; the resident trainer then keeps unitThreatWeight in $0464-$04C7
; ($E7B2) and a flag in $0400 ($E6EC/$E7A7); and the first unit picture drawn in the info panel
; unpacks 512 RLE bytes over $0200-$03FF (showUnitPictureSprites $CD0A, read back at $CD15).  Nothing
; ever reads the playbook again, so every byte here is write-once data. trainerPlay0 - play 0, used by
; SCRIMAGE (game type 0).  Roster: unit start template 2 ($F320) - 5 GRUNTs, 5 RIDERs and the comcen a
; side, so AI slots 0-9 and 49 hold units and slots 10-48 are empty.  Companion scalars: no spearhead
; group ($EC00[0] = $FF), 11 group slots ($EC05[0] = $0A, so $8954 = 11) and no drone score threshold
; ($EC0A[0] = $FF = never detonate).  A home-guard group 1-3 is still drawn at $EC9C.  The plan number
; is below 2, so the destinations in this record reach the engine exactly as they stand.
; $0200-$0231 - play 0 group ids, 50 bytes, one per AI slot.  Every live unit is its own one-unit
; group: slot 0 -> group 5, 1 -> 6, 2 -> 7, 3 -> 8, 4 -> 9, 5 -> 10, 6 -> 4, 7 -> 3, 8 -> 2, 9 -> 1,
; and slot 49 (the comcen) -> group 0.  Slots 10-48 are $FF.  Ten separate groups is what makes a
; SCRIMAGE look like ten independent skirmishers: the AI's group loops at $E6A5/$E960/$EB3C run over
; all 11 slots.
trainerPlay0:
        .byte   $05                     ; 0200  play 0 group id, AI slot 0 = unit 50 (RIDER): group 5 - one of the ten one-unit groups of this play
        .byte   $06,$07,$08,$09,$0A,$04,$03,$02; 0201  ........
        .byte   $01                     ; 0209  .
        .byte   $FF                     ; 020A  play 0 group id, AI slot 10: $FF = in no group - unit 60 is not in play in the SCRIMAGE roster either
        .byte   $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF; 020B  ........
        .byte   $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF; 0213  ........
        .byte   $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF; 021B  ........
        .byte   $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF; 0223  ........
        .byte   $FF,$FF,$FF,$FF,$FF,$FF ; 022B  ......
        .byte   $00                     ; 0231  play 0 group id, AI slot 49 = unit 99, the AI comcen: group 0, which is the comcen on its own in every play

; $0232-$0263 - play 0 destination columns, one per AI slot, copied to unitDestCol[50+slot] ($F802) at
; $ECF8-$ECFA.  The ten skirmishers are fanned across the field at columns $21,$19,$18,$14,$10,$0F,$07
; (slots 0-6) with slots 7-9 at $14,$15,$13; only slots 1,2,4,5,8 and 9 actually differ from template
; 2's start columns.  Slots 10-48 still hold template 2's start columns for units that do not exist in
; a SCRIMAGE and are never acted on.
trainerPlay0DestCol:
        .byte   $21                     ; 0232  play 0 destination column, AI slot 0 = unit 50 (RIDER): $21 = column 33 (unchanged: the cell it starts on)
        .byte   $19,$18,$14,$10,$0F,$07,$14,$15; 0233  ........
        .byte   $13,$1B,$16,$13,$14,$21,$13,$04; 023B  .....!..
        .byte   $24,$14,$23,$22,$21,$20,$15,$05; 0243  $.#"! ..
        .byte   $14,$05,$14,$22,$21,$14,$13,$14; 024B  ..."!...
        .byte   $22,$21,$05,$05,$06,$06,$13,$13; 0253  "!......
        .byte   $23,$21,$15,$04,$06,$22,$14,$05; 025B  #!..."..
        .byte   $14                     ; 0263  play 0 destination column, AI slot 49 = unit 99 (COMCEN): $14 = column 20 (unchanged: the cell it starts on) - the AI comcen

; $0264-$0295 - play 0 destination rows, copied to unitDestRow[50+slot] ($F866) at $ECFD-$ECFF.  Slots
; 0-6 are ordered to row $12 = 18, the last row but one of the AI's own half of the map (side 1 owns
; rows 6-19, the player rows 20-33); slot 7 goes to $10 and slots 8-9 to $0F.  Only slots 8 and 9
; differ from template 2's start rows ($0E), so play 0 barely moves anyone - it is really a
; group-numbering play, and the comcen is left standing on its start cell, column $14 row $0E.
trainerPlay0DestRow:
        .byte   $12                     ; 0264  play 0 destination row, AI slot 0 = unit 50 (RIDER): $12 = row 18 (unchanged: the cell it starts on)
        .byte   $12,$12,$12,$12,$12,$12,$10,$0F; 0265  ........
        .byte   $0F,$13,$0C,$0D,$0C,$0D,$0C,$0C; 026D  ........
        .byte   $0C,$06,$0C,$0C,$0C,$0C,$0D,$0D; 0275  ........
        .byte   $0E,$0E,$0D,$09,$09,$08,$09,$09; 027D  ........
        .byte   $08,$08,$09,$08,$09,$08,$08,$0B; 0285  ........
        .byte   $0B,$0B,$0B,$0B,$0B,$10,$10,$10; 028D  ........
        .byte   $0E                     ; 0295  play 0 destination row, AI slot 49 = unit 99 (COMCEN): $0E = row 14 (unchanged: the cell it starts on) - the AI comcen

; trainerPlay1 - play 1, used by QB SNEAK (game type 1).  Same roster as play 0 (template 2), but
; applyGameTypeDefaults removes absolute units 0-6 at $7C89/$7CA0, i.e. the *player's* first seven
; slots: the human is left with three riders and a comcen while the trainer keeps all ten units and
; its comcen.  $EC98-$EC9A also leaves the home-guard group at $FF for this plan alone, so the AI
; holds nothing back.  Companions: no spearhead, 11 group slots, drone threshold $FF.  Like play 0 it
; skips the group scatter, so these cells are used as written.
; $0296-$02C7 - play 1 group ids.  The same ten one-unit groups as play 0, but numbered straight down:
; slot 0 -> group 10, 1 -> 9, 2 -> 8, 3 -> 7, 4 -> 6, 5 -> 5, 6 -> 4, 7 -> 3, 8 -> 2, 9 -> 1, slot 49
; -> group 0.  Slots 10-48 are $FF.  The array runs from $0296 to $02C7, straight across the BASIC
; line and KERNAL-LOAD code of the 'ea' boot file, which occupied $02A8-$030B before the game started.
trainerPlay1:
        .byte   $0A                     ; 0296  play 1 group id, AI slot 0 = unit 50 (RIDER): group 10 - one of the ten one-unit groups of this play
        .byte   $09,$08,$07,$06,$05,$04,$03,$02; 0297  ........
        .byte   $01                     ; 029F  .
        .byte   $FF                     ; 02A0  play 1 group id, AI slot 10: $FF = in no group - unit 60 is not in play in the QB SNEAK roster either
        .byte   $FF                     ; 02A1  .
play1Grp12:
        .byte   $FF                     ; 02A2  play 1 group id, AI slot 12: $FF = in no group - unit 62 is not in play in the QB SNEAK roster either
play1Grp13:
        .byte   $FF                     ; 02A3  play 1 group id, AI slot 13: $FF = in no group - unit 63 is not in play in the QB SNEAK roster either
        .byte   $FF,$FF,$FF,$FF,$FF,$FF,$FF; 02A4  .......
play1Grp21:
        .byte   $FF                     ; 02AB  play 1 group id, AI slot 21: $FF = in no group - unit 71 is not in play in the QB SNEAK roster either
        .byte   $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF; 02AC  ........
        .byte   $FF,$FF,$FF,$FF         ; 02B4  ....
play1Grp34:
        .byte   $FF                     ; 02B8  play 1 group id, AI slot 34: $FF = in no group - unit 84 is not in play in the QB SNEAK roster either
        .byte   $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF; 02B9  ........
        .byte   $FF,$FF,$FF,$FF,$FF,$FF ; 02C1  ......
        .byte   $00                     ; 02C7  play 1 group id, AI slot 49 = unit 99, the AI comcen: group 0, which is the comcen on its own in every play

; $02C8-$02F9 - play 1 destination columns.  The ten defenders are spread into a picket line right
; across the battlefield: slots 0-6 at columns $24,$1C,$18,$14,$10,$0C,$04 (eight cells apart at the
; edges), slot 7 in the middle at $14 and slots 8-9 pushed out to the flanks at $20 and $08.  Eight of
; the ten differ from their template start columns - the widest spread of any play.  The comcen keeps
; column $14.
trainerPlay1DestCol:
        .byte   $24                     ; 02C8  play 1 destination column, AI slot 0 = unit 50 (RIDER): $24 = column 36 (starts on $21)
        .byte   $1C,$18,$14,$10,$0C,$04,$14,$20; 02C9  ....... 
        .byte   $08,$1B,$16,$13         ; 02D1  ....
play1Col13:
        .byte   $14                     ; 02D5  play 1 dest column, AI slot 13 (unit 63 is not in play here): template 2's own start column $14, a don't-care
        .byte   $21,$13,$04,$24,$14,$23,$22,$21; 02D6  !..$.#"!
        .byte   $20,$15,$05,$14,$05,$14,$22,$21; 02DE   ....."!
        .byte   $14,$13,$14,$22,$21,$05 ; 02E6  ..."!.
play1Col36:
        .byte   $05,$06,$06,$13         ; 02EC  play 1 dest column, AI slot 36 (unit 86 is not in play here): template 2's own start column $05, a don't-care
        .byte   $13,$23,$21,$15,$04,$06,$22,$14; 02F0  .#!...".
        .byte   $05                     ; 02F8  .
        .byte   $14                     ; 02F9  play 1 destination column, AI slot 49 = unit 99 (COMCEN): $14 = column 20 (unchanged: the cell it starts on) - the AI comcen

; $02FA-$032B - play 1 destination rows.  Nine of the ten pickets stand on row $12 (slot 7 on $10),
; and the comcen is ordered forward from its start row $0E to $0C - the only comcen advance either of
; the two small plays makes, and the reason this is the 'sneak' play.  The array runs on through
; $0300-$032B, where the tile-rules start-up code and several map-generator variables live in the
; units that share this page - that is what chops the listing here into single bytes.
trainerPlay1DestRow:
        .byte   $12                     ; 02FA  play 1 destination row, AI slot 0 = unit 50 (RIDER): $12 = row 18 (unchanged: the cell it starts on)
        .byte   $12,$12,$12,$12,$12     ; 02FB  .....
play1Row06:
        .byte   $12                     ; 0300  play 1 destination row, AI slot 6 = unit 56 (RIDER): $12 = row 18 (unchanged: the cell it starts on)
play1Row07:
        .byte   $10                     ; 0301  play 1 destination row, AI slot 7 = unit 57 (RIDER): $10 = row 16 (unchanged: the cell it starts on)
play1Row08:
        .byte   $12                     ; 0302  play 1 destination row, AI slot 8 = unit 58 (RIDER): $12 = row 18 (starts on $0E)
        .byte   $12                     ; 0303  .
play1Row10:
        .byte   $13                     ; 0304  play 1 dest row, AI slot 10 (unit 60 is not in play here): template 2's own start row $13, a don't-care
        .byte   $0C,$0D                 ; 0305  ..
play1Row13:
        .byte   $0C                     ; 0307  play 1 dest row, AI slot 13 (unit 63 is not in play here): template 2's own start row $0C, a don't-care
        .byte   $0D,$0C,$0C,$0C,$06,$0C,$0C; 0308  .......
play1Row21:
        .byte   $0C                     ; 030F  play 1 dest row, AI slot 21 (unit 71 is not in play here): template 2's own start row $0C, a don't-care
play1Row22:
        .byte   $0C                     ; 0310  play 1 dest row, AI slot 22 (unit 72 is not in play here): template 2's own start row $0C, a don't-care
play1Row23:
        .byte   $0D                     ; 0311  play 1 dest row, AI slot 23 (unit 73 is not in play here): template 2's own start row $0D, a don't-care
play1Row24:
        .byte   $0D                     ; 0312  play 1 dest row, AI slot 24 (unit 74 is not in play here): template 2's own start row $0D, a don't-care
play1Row25:
        .byte   $0E                     ; 0313  play 1 dest row, AI slot 25 (unit 75 is not in play here): template 2's own start row $0E, a don't-care
play1Row26:
        .byte   $0E                     ; 0314  play 1 dest row, AI slot 26 (unit 76 is not in play here): template 2's own start row $0E, a don't-care
        .byte   $0D,$09,$09,$08,$09,$09 ; 0315  ......
play1Row33:
        .byte   $08                     ; 031B  play 1 dest row, AI slot 33 (unit 83 is not in play here): template 2's own start row $08, a don't-care
play1Row34:
        .byte   $08                     ; 031C  play 1 dest row, AI slot 34 (unit 84 is not in play here): template 2's own start row $08, a don't-care
        .byte   $09,$08,$09,$08,$08,$0B,$0B; 031D  .......
play1Row42:
        .byte   $0B                     ; 0324  play 1 dest row, AI slot 42 (unit 92 is not in play here): template 2's own start row $0B, a don't-care
play1Row43:
        .byte   $0B                     ; 0325  play 1 dest row, AI slot 43 (unit 93 is not in play here): template 2's own start row $0B, a don't-care
        .byte   $0B,$0B,$10             ; 0326  ...
play1Row47:
        .byte   $10                     ; 0329  play 1 dest row, AI slot 47 (unit 97 is not in play here): template 2's own start row $10, a don't-care
        .byte   $10                     ; 032A  .
        .byte   $0C                     ; 032B  play 1 destination row, AI slot 49 = unit 99 (COMCEN): $0C = row 12 (starts on $0E) - the AI comcen

; trainerPlay2 - play 2, used by FACE-OFF (game type 3).  Roster: unit start template 1 ($F190) - 28
; RIDERs, 3 SPYs and the comcen a side (AI slots 0-27, 46-48 and 49; slots 28-45 are marked 'not in
; play').  Companions: spearhead group 4 ($EC00[2]), 5 group slots ($EC05[2] = 4, so $8954 = 5) and a
; drone detonation score threshold of 8 ($EC0A[2]).  The plan number is >= 2, so $ED12-$ED58 re-aims
; each group at a random point afterwards and only the formation shape below survives.
; $032C-$035D - play 2 group ids.  Group 1 = slots 0-3 with spy 48, group 2 = slots 12-15 with spy 47,
; group 3 = slots 24-27 with spy 46, group 4 (the spearhead) = the sixteen riders of slots 4-11 and
; 16-23, group 0 = the comcen alone.  Slots 28-45 are $FF and hold no unit in this roster.  This array
; occupies the same addresses as the one-shot start-up code at $0300-$0388 of game/tileRules0200,
; which is why it is cut into so many fragments.
trainerPlay2:
        .byte   $01                     ; 032C  play 2 group id, AI slot 0 = unit 50 (RIDER): group 1 - one of the three flank groups, any of which $EC9C may pick as the home guard
play2Grp01:
        .byte   $01                     ; 032D  play 2 group id, AI slot 1 = unit 51 (RIDER): group 1 - one of the three flank groups, any of which $EC9C may pick as the home guard
play2Grp02:
        .byte   $01                     ; 032E  play 2 group id, AI slot 2 = unit 52 (RIDER): group 1 - one of the three flank groups, any of which $EC9C may pick as the home guard
        .byte   $01                     ; 032F  .
        .byte   $04                     ; 0330  play 2 group id, AI slot 4 = unit 54 (RIDER): group 4 - the spearhead group named by mainGroupByPlanTable ($EC00)
        .byte   $04                     ; 0331  .
play2Grp06:
        .byte   $04                     ; 0332  play 2 group id, AI slot 6 = unit 56 (RIDER): group 4 - the spearhead group named by mainGroupByPlanTable ($EC00)
        .byte   $04,$04,$04,$04,$04     ; 0333  .....
        .byte   $02                     ; 0338  play 2 group id, AI slot 12 = unit 62 (RIDER): group 2 - one of the three flank groups, any of which $EC9C may pick as the home guard
play2Grp13:
        .byte   $02                     ; 0339  play 2 group id, AI slot 13 = unit 63 (RIDER): group 2 - one of the three flank groups, any of which $EC9C may pick as the home guard
        .byte   $02,$02,$04,$04,$04,$04,$04,$04; 033A  ........
        .byte   $04                     ; 0342  .
play2Grp23:
        .byte   $04                     ; 0343  play 2 group id, AI slot 23 = unit 73 (RIDER): group 4 - the spearhead group named by mainGroupByPlanTable ($EC00)
        .byte   $03                     ; 0344  play 2 group id, AI slot 24 = unit 74 (RIDER): group 3 - one of the three flank groups, any of which $EC9C may pick as the home guard
        .byte   $03,$03,$03             ; 0345  ...
        .byte   $FF                     ; 0348  play 2 group id, AI slot 28: $FF = in no group - unit 78 is not in play in the FACE-OFF roster either
        .byte   $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF; 0349  ........
        .byte   $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF; 0351  ........
        .byte   $FF                     ; 0359  .
        .byte   $03                     ; 035A  play 2 group id, AI slot 46 = unit 96 (SPY): group 3 - one of the three flank groups, any of which $EC9C may pick as the home guard
        .byte   $02,$01                 ; 035B  ..
        .byte   $00                     ; 035D  play 2 group id, AI slot 49 = unit 99, the AI comcen: group 0, which is the comcen on its own in every play

; $035E-$038F - play 2 destination columns.  The three flank groups keep the columns template 1
; started them on - group 1 on $10/$11, group 2 on $19/$1A, group 3 on $22/$23 - while the sixteen
; spearhead riders (slots 4-11, 16-23) are pulled in from the template's evenly spaced blocks
; ($13-$1F) into one solid mass on columns $16-$1D.  17 of the 50 entries differ from the template
; start columns.
trainerPlay2DestCol:
        .byte   $11                     ; 035E  play 2 destination column, AI slot 0 = unit 50 (RIDER): $11 = column 17 (unchanged: the cell it starts on)
        .byte   $10,$11,$10             ; 035F  ...
play2Col04:
        .byte   $17                     ; 0362  play 2 destination column, AI slot 4 = unit 54 (RIDER): $17 = column 23 (starts on $14)
        .byte   $16,$17,$16,$19,$18,$19,$18,$1A; 0363  ........
        .byte   $19,$1A,$19,$1B,$1A,$1B,$1A,$1D; 036B  ........
play2Col21:
        .byte   $1C                     ; 0373  play 2 destination column, AI slot 21 = unit 71 (RIDER): $1C = column 28 (starts on $1F)
        .byte   $1D,$1C,$23,$22,$23,$22,$22,$06; 0374  ..#"#"".
        .byte   $12,$15,$16,$13,$14,$21,$13,$04; 037C  .....!..
        .byte   $24,$14,$23,$22,$21,$20,$15,$05; 0384  $.#"! ..
        .byte   $22,$1A,$10             ; 038C  "..
        .byte   $19                     ; 038F  play 2 destination column, AI slot 49 = unit 99 (COMCEN): $19 = column 25 (unchanged: the cell it starts on) - the AI comcen; plans 2-4 discard this order at $ED4E-$ED56 and send group 0 after the spearhead instead

; $0390-$03C1 - play 2 destination rows.  Each of the three flank groups forms a 2x2 block on rows
; $10/$11 with its spy one row in front on $12; the spearhead sits on rows $0F-$11 with its leading
; pair at $0F.  The comcen entry ($03C1) orders one row forward, from start row $0E to $0F, but for
; plans 2-4 that order is thrown away again at $ED4E-$ED56 in favour of the spearhead's random target.
trainerPlay2DestRow:
        .byte   $11,$11,$10,$10,$10,$10,$0F,$0F,$11,$11; 0390  ..........  play 2 destination row, AI slot 0 = unit 50 (RIDER): $11 = row 17 (unchanged: the cell it starts on)
        .byte   $10,$10,$11,$11,$10,$10,$11,$11,$10,$10; 039A  ..........
        .byte   $10,$10,$0F,$0F,$11,$11,$10,$10,$0D,$0C; 03A4  ..........
        .byte   $0C,$0C,$0C,$0D,$0C,$0D,$0C,$0C,$0C,$06; 03AE  ..........
        .byte   $0C,$0C,$0C,$0C,$0D,$0D,$12,$12,$12; 03B8  .........
        .byte   $0F                     ; 03C1  play 2 destination row, AI slot 49 = unit 99 (COMCEN): $0F = row 15 (starts on $0E) - the AI comcen; plans 2-4 discard this order at $ED4E-$ED56 and send group 0 after the spearhead instead

; trainerPlay3 - play 3, used by SLUGGERS (game type 4).  Roster: unit start template 3 ($F4B0) - 12
; GRUNTs, 12 RIDERs, 4 BOOMERs, 3 SPYs and the comcen a side (AI slots 0-27, 46-48, 49; slots 28-45
; are not in play).  Companions: spearhead group 4, 5 group slots and a drone detonation threshold of
; $0C.  Plan >= 2, so the groups are scattered to random points afterwards.
; $03C2-$03F3 - play 3 group ids.  Group 4, the spearhead, takes the twelve GRUNTs (slots 0-11) and
; the four BOOMERs (slots 24-27); groups 3, 2 and 1 take the three rider quartets - slots 12-15, 16-19
; and 20-23 - each with one spy (46, 47, 48); group 0 is the comcen.  Slots 28-45 are $FF.  So
; SLUGGERS puts the sluggers (grunts and boomers) in one mass and screens them with three rider
; groups.
trainerPlay3:
        .byte   $04,$04,$04,$04,$04,$04,$04,$04,$04,$04; 03C2  ..........  play 3 group id, AI slot 0 = unit 50 (GRUNT): group 4 - the spearhead group named by mainGroupByPlanTable ($EC00)
        .byte   $04,$04                 ; 03CC  ..
        .byte   $03                     ; 03CE  play 3 group id, AI slot 12 = unit 62 (RIDER): group 3 - one of the three flank groups, any of which $EC9C may pick as the home guard
        .byte   $03,$03,$03,$02,$02,$02,$02,$01; 03CF  ........
        .byte   $01,$01,$01             ; 03D7  ...
        .byte   $04                     ; 03DA  play 3 group id, AI slot 24 = unit 74 (BOOMER): group 4 - the spearhead group named by mainGroupByPlanTable ($EC00)
        .byte   $04,$04,$04             ; 03DB  ...
        .byte   $FF                     ; 03DE  play 3 group id, AI slot 28: $FF = in no group - unit 78 is not in play in the SLUGGERS roster either
        .byte   $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF; 03DF  ........
        .byte   $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF; 03E7  ........
        .byte   $FF,$03,$02,$01         ; 03EF  ....
        .byte   $00                     ; 03F3  play 3 group id, AI slot 49 = unit 99, the AI comcen: group 0, which is the comcen on its own in every play

; $03F4-$0425 - play 3 destination columns.  Every one of the 50 bytes is identical to template 3's
; side-1 start columns: SLUGGERS is the one play that never sidesteps anybody, it only pushes them
; forward (see the row array).  The array crosses the page boundary into $0400, where the manual-check
; answer table and the boot checksum routine of game/scratchAndMessages0400 live, so from here on the
; listing is broken up by that file's labels.
trainerPlay3DestCol:
        .byte   $14,$13,$14,$13,$16,$15,$16,$15,$12,$11,$12,$11; 03F4  ............  play 3 destination column, AI slot 0 = unit 50 (GRUNT): $14 = column 20 (unchanged: the cell it starts on)
play3Col12:
        .byte   $1E                     ; 0400  play 3 destination column, AI slot 12 = unit 62 (RIDER): $1E = column 30 (unchanged: the cell it starts on)
play3Col13:
        .byte   $1D                     ; 0401  play 3 destination column, AI slot 13 = unit 63 (RIDER): $1D = column 29 (unchanged: the cell it starts on)
        .byte   $1E,$1D,$14,$13,$14,$13,$0A,$09; 0402  ........
        .byte   $0A,$09,$14,$13,$14,$13 ; 040A  ......
play3Col28:
        .byte   $22                     ; 0410  play 3 dest column, AI slot 28 (unit 78 is not in play here): template 3's own start column $22, a don't-care
        .byte   $06,$12,$15,$16,$13,$14,$21,$13; 0411  ......!.
        .byte   $04,$24,$14,$23,$22,$21,$20; 0419  .$.#"! 
play3Col44:
        .byte   $15                     ; 0420  play 3 dest column, AI slot 44 (unit 94 is not in play here): template 3's own start column $15, a don't-care
        .byte   $05,$1E,$13,$09         ; 0421  ....
        .byte   $13                     ; 0425  play 3 destination column, AI slot 49 = unit 99 (COMCEN): $13 = column 19 (unchanged: the cell it starts on) - the AI comcen; plans 2-4 discard this order at $ED4E-$ED56 and send group 0 after the spearhead instead

; $0426-$0457 - play 3 destination rows.  The grunt-and-boomer spearhead (slots 0-11 and 24-27) is
; pushed one to two rows forward of where template 3 stands it, to rows $0C-$0F; the three rider
; groups keep their start rows $0F-$11 (2x2 blocks with the spy one row in front); and the comcen is
; ordered from row $09 to $0B.  17 of the 50 rows differ from the template, all of them forward.
trainerPlay3DestRow:
        .byte   $0F                     ; 0426  play 3 destination row, AI slot 0 = unit 50 (GRUNT): $0F = row 15 (starts on $0D)
        .byte   $0F,$0E,$0E,$0D,$0D,$0C,$0C,$0D; 0427  ........
        .byte   $0D                     ; 042F  .
play3Row10:
        .byte   $0C                     ; 0430  play 3 destination row, AI slot 10 = unit 60 (GRUNT): $0C = row 12 (starts on $0B)
        .byte   $0C                     ; 0431  .
play3Row12:
        .byte   $10                     ; 0432  play 3 destination row, AI slot 12 = unit 62 (RIDER): $10 = row 16 (unchanged: the cell it starts on)
        .byte   $10,$0F,$0F,$10,$10,$0F,$0F,$10; 0433  ........
        .byte   $10,$0F,$0F,$0D,$0D,$0C,$0C,$0D; 043B  ........
        .byte   $0C,$0C,$0C,$0C,$0D,$0C,$0D,$0C; 0443  ........
        .byte   $0C,$0C,$06,$0C,$0C     ; 044B  .....
play3Row42:
        .byte   $0C                     ; 0450  play 3 dest row, AI slot 42 (unit 92 is not in play here): template 3's own start row $0C, a don't-care
        .byte   $0C,$0D,$0D,$11,$11,$11 ; 0451  ......
        .byte   $0B                     ; 0457  play 3 destination row, AI slot 49 = unit 99 (COMCEN): $0B = row 11 (starts on $09) - the AI comcen; plans 2-4 discard this order at $ED4E-$ED56 and send group 0 after the spearhead instead

; trainerPlay4 - play 4, used by FULL WAR (game type 5) and DEFENDER (game type 6), and the fallback
; for any biased game type of 4 or more ($EC6F-$EC91).  Roster: unit start template 0 ($F000) - the
; full army of 28 GRUNTs, 12 RIDERs, 6 BOOMERs, 3 SPYs and a comcen, so all 50 AI slots are live and
; no $FF appears anywhere in this record.  Companions: spearhead group 4, 5 group slots, drone
; detonation threshold $0C.  For DEFENDER $EC73-$EC85 additionally queues command $A5,00,$14 (20 x 10
; = 200 extra purchase points for the computer), and for both types $EC88-$EC8E resets the AI comcen's
; flags so it is free to move.
; $0458-$0489 - play 4 group ids.  Group 4, the spearhead, swallows all 28 GRUNTs (slots 0-27) and all
; 6 BOOMERs (slots 40-45) - 34 units in one mass; group 3 = riders 28, 29, 33, 34 with spy 46; group 2
; = riders 30, 31, 32, 39 with spy 47; group 1 = riders 35-38 with spy 48; group 0 = the comcen.
; $EC9C picks one of groups 1-3 at random to stay behind as the home guard, stationed on the comcen at
; $ED59-$ED69.
trainerPlay4:
        .byte   $04                     ; 0458  play 4 group id, AI slot 0 = unit 50 (GRUNT): group 4 - the spearhead group named by mainGroupByPlanTable ($EC00)
        .byte   $04,$04,$04,$04,$04,$04,$04,$04; 0459  ........
        .byte   $04,$04,$04             ; 0461  ...
play4Grp12:
        .byte   $04                     ; 0464  play 4 group id, AI slot 12 = unit 62 (GRUNT): group 4 - the spearhead group named by mainGroupByPlanTable ($EC00)
        .byte   $04,$04,$04,$04,$04,$04,$04,$04; 0465  ........
        .byte   $04,$04,$04,$04,$04,$04,$04; 046D  .......
        .byte   $03                     ; 0474  play 4 group id, AI slot 28 = unit 78 (RIDER): group 3 - one of the three flank groups, any of which $EC9C may pick as the home guard
        .byte   $03,$02,$02             ; 0475  ...
play4Grp32:
        .byte   $02                     ; 0478  play 4 group id, AI slot 32 = unit 82 (RIDER): group 2 - one of the three flank groups, any of which $EC9C may pick as the home guard
        .byte   $03                     ; 0479  .
play4Grp34:
        .byte   $03                     ; 047A  play 4 group id, AI slot 34 = unit 84 (RIDER): group 3 - one of the three flank groups, any of which $EC9C may pick as the home guard
        .byte   $01                     ; 047B  .
play4Grp36:
        .byte   $01                     ; 047C  play 4 group id, AI slot 36 = unit 86 (RIDER): group 1 - one of the three flank groups, any of which $EC9C may pick as the home guard
        .byte   $01,$01,$02             ; 047D  ...
        .byte   $04                     ; 0480  play 4 group id, AI slot 40 = unit 90 (BOOMER): group 4 - the spearhead group named by mainGroupByPlanTable ($EC00)
play4Grp41:
        .byte   $04                     ; 0481  play 4 group id, AI slot 41 = unit 91 (BOOMER): group 4 - the spearhead group named by mainGroupByPlanTable ($EC00)
        .byte   $04,$04                 ; 0482  ..
play4Grp44:
        .byte   $04                     ; 0484  play 4 group id, AI slot 44 = unit 94 (BOOMER): group 4 - the spearhead group named by mainGroupByPlanTable ($EC00)
        .byte   $04                     ; 0485  .
        .byte   $03                     ; 0486  play 4 group id, AI slot 46 = unit 96 (SPY): group 3 - one of the three flank groups, any of which $EC9C may pick as the home guard
        .byte   $02,$01                 ; 0487  ..
        .byte   $00                     ; 0489  play 4 group id, AI slot 49 = unit 99, the AI comcen: group 0, which is the comcen on its own in every play

; $048A-$04BB - play 4 destination columns.  The 34-unit spearhead is compressed into columns $0F-$19
; in the middle of the field, and the three rider groups sit out on $05/$06, $13/$14 and $21/$22.  22
; of the 50 columns differ from template 0's start columns.  Only $04AE-$04BB of this array is visible
; as data in the sibling file game/scratchAndMessages0400; $048A-$04AD is the tail of that file's boot
; checksum routine, which is why the listing here is cut into fragments.
trainerPlay4DestCol:
        .byte   $10                     ; 048A  play 4 destination column, AI slot 0 = unit 50 (GRUNT): $10 = column 16 (starts on $06)
play4Col01:
        .byte   $11                     ; 048B  play 4 destination column, AI slot 1 = unit 51 (GRUNT): $11 = column 17 (starts on $07)
play4Col02:
        .byte   $18                     ; 048C  play 4 destination column, AI slot 2 = unit 52 (GRUNT): $18 = column 24 (starts on $23)
        .byte   $11,$10,$11,$19,$18,$11,$12,$15; 048D  ........
        .byte   $16,$13,$14,$18,$13,$11,$17,$14; 0495  ........
        .byte   $17,$17,$17             ; 049D  ...
play4Col22:
        .byte   $17                     ; 04A0  play 4 destination column, AI slot 22 = unit 72 (GRUNT): $17 = column 23 (starts on $20)
        .byte   $15,$10,$14,$0F,$14,$22,$21,$14; 04A1  ....."!.
        .byte   $13,$14,$22,$21,$05     ; 04A9  .."!.
        .byte   $05,$06,$06,$13,$13,$16,$16,$15,$12,$12,$22,$14,$05; 04AE  .........."..
        .byte   $13                     ; 04BB  play 4 destination column, AI slot 49 = unit 99 (COMCEN): $13 = column 19 (unchanged: the cell it starts on) - the AI comcen; plans 2-4 discard this order at $ED4E-$ED56 and send group 0 after the spearhead instead

; $04BC-$04ED - play 4 destination rows, the last 50 bytes of the playbook.  The spearhead occupies
; rows $0A-$10, the rider groups rows $07-$0A (each 2x2 block with its spy one row in front), and the
; comcen is ordered from its back-row start (template 0: column $13, row $06) forward to row $0B - the
; longest comcen move of any play.  36 of the 50 rows differ from the template.  As with plays 2 and
; 3, the scatter at $ED12 translates each group to a random point, so it is these relative offsets
; that matter, not the absolute cells.
trainerPlay4DestRow:
        .byte   $0D,$0E,$0B,$0C,$0B,$0A,$0C,$0C,$0D,$0E,$0E,$0E; 04BC  ............  play 4 destination row, AI slot 0 = unit 50 (GRUNT): $0D = row 13 (unchanged: the cell it starts on)
play4Row12:
        .byte   $0F                     ; 04C8  play 4 destination row, AI slot 12 = unit 62 (GRUNT): $0F = row 15 (starts on $0D)
play4Row13:
        .byte   $0E                     ; 04C9  play 4 destination row, AI slot 13 = unit 63 (GRUNT): $0E = row 14 (starts on $0C)
        .byte   $0D,$0E,$0B,$0A,$0B,$0B ; 04CA  ......
play4Row20:
        .byte   $0C                     ; 04D0  play 4 destination row, AI slot 20 = unit 70 (GRUNT): $0C = row 12 (unchanged: the cell it starts on)
play4Row21:
        .byte   $0D                     ; 04D1  play 4 destination row, AI slot 21 = unit 71 (GRUNT): $0D = row 13 (starts on $0C)
        .byte   $0E,$0F,$0C,$10,$0C,$0F,$09,$09; 04D2  ........
        .byte   $07,$08,$08,$08,$08     ; 04DA  .....
play4Row35:
        .byte   $09                     ; 04DF  play 4 destination row, AI slot 35 = unit 85 (RIDER): $09 = row 9 (unchanged: the cell it starts on)
        .byte   $08,$09,$08,$07,$0D,$0B,$0D; 04E0  .......
play4Row43:
        .byte   $0D                     ; 04E7  play 4 destination row, AI slot 43 = unit 93 (BOOMER): $0D = row 13 (starts on $0B)
        .byte   $0B,$0D,$0A,$09,$0A     ; 04E8  .....
        .byte   $0B                     ; 04ED  play 4 destination row, AI slot 49 = unit 99 (COMCEN): $0B = row 11 (starts on $06) - the AI comcen; plans 2-4 discard this order at $ED4E-$ED56 and send group 0 after the spearhead instead

; playbookTail - 18 bytes of padding after the fifth record (5 x 150 = 750 bytes, ending at $04ED),
; and the only bytes in the file that are not part of a play.  Nothing reads them: the copy loop only
; ever touches the 150 bytes of the record it selected.  The content is $20,$20 then
; $06,$01,$13,$14,$0C,$0F,$01,$04 then eight more $20, which in C64 screen codes (screen codes, not
; PETSCII: 'A' = $01) reads '  FASTLOAD        ' - probably a scrap of the mastering machine's screen
; memory that happened to be in the sector buffer when the file was written.  The sequence occurs
; nowhere else on the disk.
playbookTail:
        .byte   $20,$20,$06,$01,$13,$14,$0C,$0F,$01,$04,$20,$20,$20,$20,$20,$20,$20,$20; 04EE    ........          18 unused bytes: '  FASTLOAD' plus spaces in screen codes, not playbook data
