-
Notifications
You must be signed in to change notification settings - Fork 5
/
CWSTRAT.BAS
5009 lines (4571 loc) · 150 KB
/
CWSTRAT.BAS
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
DEFINT A-Z
DECLARE SUB animate (index%, flag%)
DECLARE SUB armies ()
DECLARE SUB armystat (index%)
DECLARE SUB armyxy (x%, y%, z%)
DECLARE SUB barnacle (who%)
DECLARE SUB battle (attack%, defend%, win%, lose%)
DECLARE SUB bub2 (limit%)
DECLARE SUB bubble (size%)
DECLARE SUB cancel (side%)
DECLARE SUB cannon ()
DECLARE SUB capitol ()
DECLARE SUB capture (active%, c%, s%, flag%)
DECLARE SUB center (y%, a$)
DECLARE SUB chessie ()
DECLARE SUB choices (b1%, wide%)
DECLARE SUB clrbot ()
DECLARE SUB combine (who%)
DECLARE SUB clrrite ()
DECLARE SUB commander (who%, empty%)
DECLARE SUB cutoff (who%, target%, a%)
DECLARE SUB endit ()
DECLARE SUB engine ()
DECLARE SUB evaluate (index%, x%)
DECLARE SUB events ()
DECLARE SUB filer (switch%)
DECLARE SUB flags (who%, w%, a%)
DECLARE SUB flashcity (which%)
DECLARE SUB fortify (target%)
DECLARE SUB icon (from%, dest%, kind%)
DECLARE SUB image2 (a$, s%)
DECLARE SUB integrity ()
DECLARE SUB iterate ()
DECLARE SUB ironclad ()
DECLARE SUB maptext ()
DECLARE SUB maxx ()
DECLARE SUB menu (switch%)
DECLARE SUB movefrom (index%, target%)
DECLARE SUB mxw (wide%)
DECLARE SUB navy (who%, x%)
DECLARE SUB newarmy (who%, empty%, target%)
DECLARE SUB newcity (index%)
DECLARE SUB normal (xbar%, vary%, result%)
DECLARE SUB occupy (x%)
DECLARE SUB placearmy (which%)
DECLARE SUB railroad (who%)
DECLARE SUB recruit (who%)
DECLARE SUB relieve (who%)
DECLARE SUB report (who%)
DECLARE SUB resupply (index%)
DECLARE SUB retreat (active%, x%)
DECLARE SUB roman (target%, a$)
DECLARE SUB rwin ()
DECLARE SUB schooner ()
DECLARE SUB scribe (a$, flag%)
DECLARE SUB shen ()
DECLARE SUB ships ()
DECLARE SUB shipicon (who%, flag%)
DECLARE SUB shiptype (who%, i%)
DECLARE SUB showcity ()
DECLARE SUB smarts ()
DECLARE SUB snapshot (x%, y%, flag%)
DECLARE SUB starfin (star%, fin%, who%)
DECLARE SUB stax (who%)
DECLARE SUB strong (index%)
DECLARE SUB surrender (who%)
DECLARE SUB TICK (sec!)
DECLARE SUB touchup ()
DECLARE SUB tupdate ()
DECLARE SUB tinytrain (who%, flag%)
DECLARE SUB traincapacity (who%, limit%)
DECLARE SUB topbar ()
DECLARE SUB usa ()
DECLARE SUB usamap ()
DECLARE SUB victor ()
DECLARE SUB void (a%, y%)
'==========================================================================
COMMON SHARED choose%, tlx%, tly%, size%, mtx$(), wtype%, colour%, hilite%
COMMON SHARED cityx(), cityy(), cityv(), cityp(), city$(), lname$(), filel
COMMON SHARED cash(), control(), matrix(), income(), anima(), rating(), rflag
COMMON SHARED nflag, bold, turbo!, rr(), starx(), stary(), mtn(), rrfrom()
COMMON SHARED image(), force$(), armyloc(), armyname$(), player, aggress!
COMMON SHARED armysize(), armylead(), armyexper(), supply(), month$()
COMMON SHARED rcity(), price(), vicflag(), tracks(), batwon(), cityo()
COMMON SHARED armymove(), month, year, array(), mflag, side, ATKFAC, DEFAC, TCR
COMMON SHARED navyloc(), navysize(), navymove(), occupied(), vptotal, fort()
COMMON SHARED victory(), graf, noise, capcity(), difficult, usadv, bw
COMMON SHARED train(), font$(), brray(), jancam, randbal, realism, casualty&()
COMMON SHARED pcode, history, thrill, fleet$(), commerce, raider, grudge
COMMON SHARED cwsdatapath$
'==========================================================================
DIM SHARED cityx(40), cityy(40), cityv(40), cityp(40), city$(40), lname$(40), rcity(5)
DIM SHARED cash(2), control(2), matrix(40, 7), income(2), anima(300), rating(40)
DIM SHARED mtx$(21), image(300), force$(2), armyloc(40), armyname$(40), vicflag(6)
DIM SHARED armysize(40), armylead(40), armyexper(40), supply(40), month$(12)
DIM SHARED armymove(40), array(40), starx(8), stary(8), mtn(1 TO 1564), rrfrom(2)
DIM SHARED navyloc(2), navysize(2), navymove(2), occupied(40), fort(40), rr(2)
DIM SHARED victory(2), capcity(2), emancipate, price(3), tracks(2), fleet$(2)
DIM SHARED train(2), font$(26), brray(40), casualty&(2), batwon(2), cityo(40)
DIM shared mtz$(21)
DIM SHARED graphic(1 TO 1564), Ncap(60)
DIM SHARED graft(1 TO 1564)
$EXEICON: 'cws.ico'
_ICON
_TITLE "VGA Civil War Strategy Game"
' Necessary Preparations for File Management
' That Supports Microsoft UWP restrictions
' Create CWS Folder in Local App Data Folder.
localappdatapath$ = ENVIRON$("LOCALAPPDATA")
cwsdatapath$ = localappdatapath$ + "\cws"
IF NOT _DIREXISTS(cwsdatapath$) THEN
MKDIR cwsdatapath$
END IF
' Copy files from current application directory to CWS in Local App Data.
CALL CopyFile("ALTLEAD.DAT", cwsdatapath$ + "\ALTLEAD.DAT")
CALL CopyFile("ALTMAP.BAT", cwsdatapath$ + "\ALTMAP.BAT")
CALL CopyFile("ALTMAP.INI", cwsdatapath$ + "\ALTMAP.INI")
CALL CopyFile("CITIES.GRD", cwsdatapath$ + "\CITIES.GRD")
CALL CopyFile("CWS.CFG", cwsdatapath$ + "\CWS.CFG")
CALL CopyFile("CWS.INI", cwsdatapath$ + "\CWS.INI")
CALL CopyFile("CWSLEAD.DAT", cwsdatapath$ + "\CWSLEAD.DAT")
CALL CopyFile("HISCORE.CWS", cwsdatapath$ + "\HISCORE.CWS")
replay = 0
newgame:
pcode = 0: rflag = 0
FOR k = 1 TO 40: armysize(k) = 0: armyloc(k) = 0: armymove(k) = 0: armylead(k) = 0: armyname$(k) = "": NEXT k
usadv = 0: emancipate = 0
FOR k = 1 TO 2
navysize(k) = 0: navyloc(k) = 0: navymove(k) = 0
rr(k) = 0: victory(k) = 0: tracks(k) = 0
NEXT k
filel = 1: vicflag(1) = 1
CALL filer(1)
IF _FILEEXISTS("mtn.vga") THEN
DEF SEG = VARSEG(mtn(1))
BLOAD "mtn.vga", VARPTR(mtn(1))
DEF SEG
ELSE
COLOR 15: BEEP: PRINT "ERROR: Missing File 'MTN.VGA'": TICK 9
END IF
RESTORE
FOR k = 1 TO 26: READ font$(k): NEXT k
IF realism > 0 AND year < 1862 THEN
FOR i = 1 TO 2
a$ = STRING$(LEN(fleet$(i)), "W")
fleet$(i) = a$
NEXT i
END IF
IF player < 1 OR player > 2 THEN player = 1
IF player = 2 OR side = 0 THEN side = 1
IF side = 1 THEN randbal = 7
IF side = 2 THEN randbal = 3
IF turbo! < 1 THEN turbo! = 2
IF side = 1 AND difficult < 3 THEN cash(2) = cash(2) + 600 - 100 * difficult
IF side = 2 AND difficult > 3 THEN cash(1) = cash(1) + 100 * difficult
FOR i = 1 TO 2: income(i) = cash(i): cash(i) = cash(i) + 50 * RND: NEXT i
choose = 0
_FULLSCREEN _SQUAREPIXELS, _SMOOTH
SCREEN 12
DEF SEG = VARSEG(graphic(1))
BLOAD "cwsicon.vga", VARPTR(graphic(1))
DEF SEG
PUT (100, 100), graphic(), PSET
GET (101, 101)-(113, 113), Ncap
CLS
COLOR 11: LOCATE 14, 27: PRINT "VGA CIVIL WAR STRATEGY GAME"
COLOR 4: LOCATE 15, 32: PRINT "Registered Edition"
COLOR 14: LOCATE 28, 1: PRINT TAB(8); "(c) 1998, 2017, 2018 by W. R. Hutsell, Dave Mackey"
LOCATE 28, 60: PRINT "v2.11"
LINE (190, 170)-(440, 260), 1, B
LINE (180, 180)-(450, 250), 7, B
CALL flags(1, -440, 0): CALL flags(2, -100, 0)
IF replay = 0 AND noise = 2 AND choose = 0 THEN
IF side = 1 THEN
IF INKEY$ <> "" GOTO notitle
PLAY "MST170o1e8o0b8o1e8"
IF INKEY$ <> "" GOTO notitle
PLAY "e8e4f#8g4f#8"
IF INKEY$ <> "" GOTO notitle
PLAY "g4e8d2o0b8o1d2 "
IF INKEY$ <> "" GOTO notitle
PLAY "o1e8o0b8o1e8e8e4f#8g4f#8g4a8b2g8b2MLg16a16"
IF INKEY$ <> "" GOTO notitle
PLAY "MSb4b8b8a8g8a4a8a4f#8g4g8MLg8f#8"
IF INKEY$ <> "" GOTO notitle
PLAY "MSe8f#4f#8f#8g8a8b4.a4.g4.f#4.o0b8o1e8e8e4d8e2."
ELSE
CALL shen
END IF
END IF
notitle:
GOSUB unionplus
city$(0) = "NONE"
OPEN "I", 1, cwsdatapath$ + "\cities.grd"
vptotal = usadv + 200
FOR i = 1 TO 40: INPUT #1, a, cityx(i), cityy(i), city$(i), cityp(i), cityv(i)
cityo(i) = cityp(i)
CALL occupy(i)
FOR j = 1 TO 7: INPUT #1, matrix(i, j): NEXT j: INPUT #1, fort(i)
IF cityp(i) > 0 THEN x = cityp(i): control(x) = control(x) + 1: victory(x) = victory(x) + cityv(i)
IF cityp(i) > 0 THEN cash(cityp(i)) = cash(cityp(i)) + cityv(i)
vptotal = vptotal + cityv(i)
NEXT i
CLOSE #1: CALL clrbot
RANDOMIZE TIMER
TICK .3
wtype = 2
hilite = 15
replay = 1
IF player = 2 THEN GOSUB blanken
mtx$(0) = "VGA CIVIL WAR STRATEGY"
mtx$(1) = "Resume Saved Game"
mtx$(2) = "Start NEW Game"
mtx$(3) = "Quit"
tlx = 33: tly = 20: colour = 5: size = 3
choose = 23
CALL menu(0)
IF choose = 1 THEN
CLS
GOTO loader
GOTO menu0
END IF
IF choose = 3 THEN CLS : END
IF history = 1 THEN
CLS
makeoldhistory$ = "copy " + cwsdatapath$ + "\cws.his " + cwsdatapath$ + "\oldhist.ory"
IF _FILEEXISTS(cwsdatapath$ + "\cws.his") THEN SHELL makeoldhistory$ ' "copy cws.his oldhist.ory"
OPEN "O", 2, cwsdatapath$ + "\cws.his"
PRINT #2, TAB(20); "[ HISTORY OF GAME BEGUN "; DATE$; " ]"
CLOSE #2
ELSE
SCREEN 12: CLS
END IF
CALL usa
GOTO menu0
' New Month
newmonth:
IF side > 2 THEN side = 1
a$ = "--------> EVENTS FOR " + month$(month) + " " + STR$(year) + " --------"
CALL scribe(a$, 0)
CALL tupdate
control(1) = 0: control(2) = 0
FOR i = 1 TO 2
income(i) = 0
IF cash(i) > 19999 THEN cash(i) = 19999
IF cash(i) < 0 THEN cash(i) = 0
NEXT i
IF player = 1 AND side = 2 THEN income(1) = income(1) + usadv
FOR i = 1 TO 40
IF cityp(i) > 0 THEN x = cityp(i): control(x) = control(x) + 1: income(x) = income(x) + cityv(i)
armymove(i) = 0
NEXT i
FOR i = 1 TO 2: navymove(i) = 0: IF capcity(i) > 0 THEN income(i) = income(i) + 100
cash(i) = cash(i) + income(i)
IF commerce > 0 AND i <> commerce THEN cash(i) = cash(i) - raider
NEXT i
vptotal = income(1) + income(2)
chosit = 22
IF player = 2 THEN GOSUB blanken: CALL usa
CALL victor
ON ERROR GOTO 0
IF pcode > 0 THEN
FOR k = 1 TO 40: armyloc(k) = 0: NEXT k
GOTO newgame
END IF
' Main Menu
menu0:
CALL topbar
IF player = 2 AND side = 0 THEN side = 1
IF cash(side) < 100 AND navyloc(side) = 0 THEN nflag = 1
hilite = 11
colour = 4
tlx = 67: tly = 13
mtx$(0) = "Main"
mtx$(1) = "Troops": IF rflag < 0 OR cash(side) < 100 THEN mtx$(1) = "-": chosit = 23
mtx$(2) = "Moves": IF mflag > 0 THEN mtx$(2) = "-": IF chosit = 23 THEN chosit = 24
mtx$(3) = "Ships": IF nflag > 0 THEN mtx$(3) = "-": IF chosit = 24 THEN chosit = 25
mtx$(4) = "Railroad": IF rr(side) > 0 THEN mtx$(4) = "-": IF chosit = 25 THEN chosit = 26
mtx$(5) = "END TURN"
mtx$(6) = "Inform"
mtx$(7) = "COMMANDS"
mtx$(8) = "UTILITY"
mtx$(9) = "Files"
size = 9
choose = chosit
CALL menu(0): CALL clrrite
'==========================================================================
' Main Menu
'==========================================================================
SELECT CASE choose
CASE 1 ' Recruit
IF cash(side) < 100 OR rflag < 0 THEN rflag = -1: GOTO menu0
CALL recruit((side))
chosit = 23
GOTO menu0
CASE 2 ' Armies
CALL armies
chosit = 23
GOTO menu0
CASE 3 ' Navies
IF nflag = 0 THEN CALL navy((side), 0)
chosit = 25
CASE 4 ' Railroad
IF rr(side) = 0 THEN
COLOR 15: LOCATE 4, 68: PRINT "RAILROAD MOVE"
PSET (550, 20), 0
DRAW "C15S6R9D4R6U3R3D3R7U5H3U2R9D3G2D6F1D3F5L10D1G1L4H2L7G2L3H2L3U9L2U5R1BF4"
z = 9
IF side = 2 THEN z = 7
x = POINT(0): y = POINT(1)
PAINT (x, y), z, 15
COLOR 15
IF side = 1 THEN COLOR 11
CALL traincapacity(side, limit)
CALL clrbot: PRINT "Railroad capacity ="; RTRIM$(STR$(limit)); "00";
CALL railroad(side)
ELSE
CALL clrbot: COLOR 11: PRINT "Railroad is already carrying "; armyname$(rr(side)); " to "; city$(armymove(rr(side))); : GOTO menu0
END IF
CASE 5 ' End Turn
tlx = 67: tly = 15
hilite = 15: colour = 3: choose = 23
mtx$(0) = "End Turn"
mtx$(1) = "Yes"
mtx$(2) = "NOT YET"
size = 2
CALL menu(0)
CALL clrrite
IF choose <> 1 THEN chosit = 24: GOTO menu0
endrnd:
rflag = 0: mflag = 0: nflag = 0
IF player = 2 THEN side = side + 1: IF side = 2 THEN GOSUB blanken: CALL usa: GOTO menu0
GOTO newmonth
CASE 6
CALL report((side)): chosit = 27
CALL starfin(star, fin, side)
FOR i = star TO fin
IF armymove(i) > 0 THEN CALL icon(armyloc(i), armymove(i), 1)
NEXT i
CASE 7 ' Commands
optmen:
tlx = 67: tly = 13
COLOR 11: LOCATE tly - 2, tlx: PRINT "esc=Main Menu"
hilite = 15: colour = 3: chosit = 24
mtx$(0) = "Commands"
mtx$(1) = "Cancel"
mtx$(2) = "Fortify": IF cash(side) < 200 THEN mtx$(2) = "-"
mtx$(3) = "Join"
mtx$(4) = "Supply"
mtx$(5) = "Capital": IF capcity(side) = 0 OR cash(side) < 500 THEN mtx$(5) = "-"
mtx$(6) = "Detach": IF side = 1 THEN mtx$(6) = "-"
mtx$(7) = "Army Drill"
mtx$(8) = "Relieve"
mtx$(9) = "MAIN MENU"
size = 9
CALL menu(0): CALL clrrite
chosit = 28
SELECT CASE choose
CASE 1 ' Cancel
CALL cancel(side): mflag = 0
choose = 22
CASE 2 ' Fortify
IF cash(side) < 200 THEN COLOR 11: CALL clrbot: PRINT "Not enough money for fort"; : GOTO menu0
CALL fortify(target)
IF cash(side) < 200 GOTO menu0
choose = 23
GOTO optmen
CASE 3 ' Combine
x = side
CALL combine(x)
IF x < 0 THEN
CALL clrbot
COLOR 11
PRINT "No eligible armies in same city to combine";
CALL stax(side)
GOTO menu0
END IF
choose = 24
GOTO optmen
CASE 4 ' Supply
CALL starfin(star, fin, (side))
mtx$(0) = "Supply"
tlx = 67: tly = 5: colour = 5
size = 0
FOR i = star TO fin
IF armyloc(i) = 0 OR supply(i) > 1 GOTO alone
IF realism > 0 THEN
CALL cutoff(side, armyloc(i), a)
IF a < 1 THEN CALL clrbot: COLOR 15: PRINT force$(side); " army in "; city$(armyloc(i)); " is CUT OFF !"; : TICK turbo!: GOTO alone
END IF
size = size + 1
max = 11: IF LEN(armyname$(i)) < 11 THEN max = LEN(armyname$(i))
mtx$(size) = LEFT$(armyname$(i), max)
array(size) = i
alone:
NEXT i
IF size = 0 THEN COLOR 11: CALL clrbot: PRINT "All eligible "; force$(side); " armies have supplies"; : GOTO menu0
CALL menu(6): CALL clrrite
IF choose < 0 GOTO menu0
index = array(choose)
IF supply(index) < 2 THEN
CALL resupply(index)
CALL placearmy(index)
END IF
choose = 25
GOTO optmen
CASE 5' Move Capital
IF capcity(side) = 0 OR cash(side) < 500 THEN CALL clrbot: COLOR 11: PRINT "Cannot move capital"; : GOTO menu0
cash(side) = cash(side) - 500
victory(3 - side) = victory(3 - side) + 50
CALL clrrite
mtx$(0) = "Capital"
a$ = city$(capcity(side))
index = capcity(side)
CALL newcity(index)
IF index = 0 GOTO menu0
capcity(side) = index
CALL clrbot: PRINT force$(side); " capital moved from "; a$; " to "; city$(capcity(side));
CALL clrrite
CALL showcity
CALL TICK(9): CALL clrbot
CASE 6 ' Detach
IF side = 1 THEN CALL clrbot: COLOR 11: PRINT "Option not available to Union"; : GOTO menu0
COLOR 14: LOCATE 4, 68: PRINT "DETACH UNIT"
CALL movefrom(index, target): IF target < 1 OR index < 1 GOTO menu0
IF armysize(index) < 65 THEN CALL clrbot: PRINT "Too small to detach"; : CALL TICK(turbo!): GOTO menu0
CALL commander(2, empty): IF empty = 0 GOTO menu0
supply(empty) = .3 * supply(index): supply(index) = supply(index) - supply(empty): IF supply(index) < 0 THEN supply(index) = 0
armysize(empty) = .3 * armysize(index): armysize(index) = armysize(index) - armysize(empty)
armyloc(empty) = target: armyexper(empty) = armyexper(index): armymove(empty) = 0
armylead(empty) = rating(empty)
armyname$(empty) = lname$(empty): lname$(empty) = ""
armyexper(empty) = armyexper(index)
COLOR 11: CALL clrbot: PRINT "Unit #"; empty; " with "; : CALL strong(empty): PRINT " men detached under "; armyname$(empty); : CALL TICK(turbo!): IF noise > 0 THEN SOUND 2222, 1
CALL stax(side)
choose = 27
GOTO optmen
CASE 7 ' Drill
COLOR 14: LOCATE 4, 68: PRINT "DRILL ARMY"
CALL movefrom(index, target)
IF target < 1 OR index < 1 THEN COLOR 11: CALL clrbot: PRINT "No armies remain eligible for drills in "; month$(month); : GOTO menu0
IF armyexper(index) > 5 OR armyexper(index) >= armylead(index) THEN COLOR 12: CALL clrbot: PRINT armyname$(index); ": Army has reached maximum improvement through drilling"; : GOTO optmen
armyexper(index) = armyexper(index) + 1
CALL clrbot: PRINT armyname$(index); " has drilled to reach experience level "; armyexper(index); : IF noise > 0 THEN SOUND 2222, 1
CALL TICK(turbo!): clrbot
armymove(index) = -1
choose = 28
GOTO optmen
CASE 8 ' Relieve
CALL relieve(side)
choose = 29
GOTO optmen
CASE ELSE
chosit = 28
GOTO menu0
END SELECT
choose = 21 + choose: GOTO optmen
CASE 8 ' Utility Menu
utile:
chosit = 29
mtx$(0) = "Utility"
mtx$(1) = "Side": IF player = 2 THEN mtx$(2) = ""
mtx$(2) = "1 Player": IF player = 2 THEN mtx$(2) = "2 Player"
mtx$(3) = "Graphics" + STR$(graf)
mtx$(4) = "Noise": IF noise > 0 THEN mtx$(4) = mtx$(4) + STRING$(noise, "*")
mtx$(5) = "Display" + STR$(turbo!)
a$ = STR$(difficult): IF side = 1 THEN a$ = STR$(6 - difficult)
mtx$(6) = "Balance" + a$
mtx$(7) = "End Cond"
a$ = "+": IF randbal = 0 THEN a$ = ""
mtx$(8) = "Rndom Evt " + a$
mtx$(9) = "Vary Start"
a$ = "": IF jancam = 1 THEN a$ = "+"
mtx$(10) = "Jan Campgn" + a$
a$ = "": IF realism = 1 THEN a$ = "+"
mtx$(11) = "Realism " + a$
mtx$(12) = "Chk Links"
a$ = "": IF history = 1 THEN a$ = "+"
mtx$(13) = "History" + a$
size = 13: tlx = 67: tly = 11
COLOR 11: LOCATE tly - 2, tlx: PRINT "esc=Main Menu"
IF player = 1 THEN size = 14: mtx$(14) = "Aggress" + STR$(bold)
CALL menu(-1): CALL clrrite
SELECT CASE choose
CASE 1 ' Swap Sides
IF player = 2 GOTO menu0
side = 3 - side: COLOR 9: IF side = 2 THEN COLOR 7
CALL clrbot: PRINT "Now playing "; force$(side); " side"; : IF noise > 0 THEN SOUND 999, 1
IF side = 1 THEN randbal = 7
IF side = 2 THEN randbal = 3
CALL topbar
GOTO menu0
CASE 2 ' Solo or Two Player
player = 3 - player: CALL clrbot: COLOR 12
IF noise > 0 THEN SOUND 999, 1
a$ = "Solo": IF player = 2 THEN a$ = "2 Player"
PRINT a$; " Game";
choose = 23: GOTO utile
CASE 3 ' Graphics
graf = graf + 1
IF graf > 3 THEN graf = 0
a$ = "ROADS"
IF graf = 0 THEN a$ = "DISABLED"
IF graf = 2 THEN a$ = "CITY NAMES"
IF graf = 3 THEN a$ = "FULL"
CLS
CALL usa
CALL clrbot: COLOR 11: PRINT "Graphics : "; a$; : IF noise > 0 THEN SOUND 2700, 1
choose = 24: GOTO utile
CASE 4 ' Sounds
CALL clrrite: choose = noise + 22
mtx$(0) = "SOUNDS"
mtx$(1) = "Quiet"
mtx$(2) = "Sound"
mtx$(3) = "Full"
size = 3: tlx = 67: tly = 12
CALL menu(0): CALL clrrite
IF choose < 1 GOTO menu0
COLOR 11: CALL clrbot: PRINT "Sound Option : "; mtx$(choose);
noise = choose - 1
IF noise > 0 THEN SOUND 999, 1
choose = 25: GOTO utile
CASE 5 ' Display Speed
choose = turbo! + 21
mtx$(0) = "Display"
mtx$(1) = "Fast"
mtx$(2) = "Normal"
mtx$(3) = "Slow"
mtx$(4) = "Very Slow"
mtx$(5) = "Reg Color": IF bw > 0 THEN mtx$(5) = "Alt Color"
tlx = 67: tly = 15: size = 5
CALL menu(0): CALL clrrite
SELECT CASE choose
CASE IS < 1
CASE IS < 5
turbo! = choose
IF turbo! = 4 THEN turbo! = 8
CALL clrbot: COLOR 11
PRINT "Display Speed : "; mtx$(choose);
CASE 5
bw = 1 - bw
CLS
CALL usa
CALL topbar
END SELECT
choose = 26: GOTO utile
CASE 6 ' Play Balance
choose = difficult + 21
mtx$(0) = "Balance"
mtx$(1) = "Rebel ++"
mtx$(2) = "Rebel +"
mtx$(3) = "Balanced"
mtx$(4) = "Union +"
mtx$(5) = "Union ++"
tlx = 67: tly = 15: size = 5
CALL menu(8): CALL clrrite
IF choose < 1 GOTO menu0
CALL clrbot
COLOR 11: CALL clrbot: PRINT "Play Balance : "; mtx$(choose);
difficult = choose
GOSUB unionplus
choose = 27: GOTO utile
CASE 7 ' Ending Conditions
CALL endit
choose = 28: GOTO utile
CASE 8 ' Random Event Options
mtx$(0) = "Random Events"
size = 4: tlx = 30: tly = 8
mtx$(1) = "OFF"
mtx$(2) = "Favor Union ": IF randbal = 3 THEN mtx$(2) = mtx$(2) + " +"
mtx$(3) = "Neutral ": IF randbal = 5 THEN mtx$(3) = mtx$(3) + " +"
mtx$(4) = "Favor Rebels": IF randbal = 7 THEN mtx$(4) = mtx$(4) + " +"
colour = 5
CALL menu(0)
colour = 4
SELECT CASE choose
CASE 1
randbal = 0: t$ = ""
CASE 2
randbal = 3
CASE 3
randbal = 5
CASE 4
randbal = 7
CASE ELSE
END SELECT
IF choose > 1 AND choose < 5 THEN t$ = mtx$(choose)
CALL clrbot
a$ = ""
IF randbal = 0 THEN a$ = "OFF"
COLOR 11: PRINT "Random Events : "; a$; " "; t$;
COLOR 14: PRINT " press a key";
DO WHILE INKEY$ = "": LOOP
CLS
CALL usa
choose = 29
GOTO utile
CASE 9 ' Vary Start Conditions
CALL filer(1)
cash(1) = cash(1) - 100 + 200 * RND
cash(2) = cash(2) + 100 + 200 * RND
bold = 5 * RND
FOR k = 1 TO 6
IF RND > .6 THEN
armyloc(k) = 0: armysize(k) = 0: armylead(k) = 0
armyexper(k) = 0: armymove(k) = 0: supply(k) = 0
END IF
NEXT k
FOR k = 21 TO 6
IF RND > .6 THEN
armyloc(k) = 0: armysize(k) = 0: armylead(k) = 0
armyexper(k) = 0: armymove(k) = 0: supply(k) = 0
END IF
NEXT k
FOR k = 1 TO 40
CALL occupy(k)
NEXT k
navysize(1) = 10 * RND: IF navysize(1) = 0 THEN navyloc(1) = 0
navysize(2) = 10 * RND: IF navysize(2) > 0 THEN navyloc(2) = 27
FOR i = 1 TO 2
fleet$(i) = ""
FOR j = 1 TO navysize(i)
a$ = "W": IF RND > .45 * side THEN a$ = "I"
fleet$(i) = fleet$(i) + a$
NEXT j
NEXT i
IF RND > .7 THEN capcity(2) = 25
FOR k = 1 TO 40
IF RND > .8 THEN rating(k) = rating(k) - 3 + 6 * RND: IF rating(k) > 9 THEN rating(k) = 9
IF rating(k) < 1 THEN rating(k) = 1
NEXT k
CLS
CALL usa
choose = 30: GOTO utile
CASE 10 ' January Campaigns
jancam = 1 - jancam
a$ = "PROHIBITED"
IF jancam = 1 THEN a$ = "ALLOWED"
COLOR 11
CALL clrbot
PRINT "January Campaigns : "; a$;
choose = 31: GOTO utile
CASE 11 ' Realism Switch
realism = 1 - realism
CALL clrbot: COLOR 11
IF realism = 0 THEN
PRINT "Recruiting FIXED : 7000 for NEW Armies 4500 for Additions";
ELSE
PRINT "REALISM ON: Recruiting based on CITY SIZE";
IF side = 2 AND randbal = 1 AND randbal < 5 THEN randbal = randbal + 2
GOSUB unionplus
END IF
choose = 32: GOTO utile
CASE 12 ' Check Map Linkages
CALL integrity
CALL TICK(99)
CALL usa
CASE 13 ' History
history = 1 - history
a$ = "OFF"
IF history = 1 THEN a$ = "ON"
CALL clrbot: PRINT "History is now "; a$;
choose = 34: GOTO utile
CASE 14 ' Aggression
bold = bold + 1
IF bold > 5 THEN bold = 0
SELECT CASE bold
CASE 0: a$ = "PASSIVE"
CASE 1: a$ = "TIMID"
CASE 2: a$ = "CAUTIOUS"
CASE 3: a$ = "NORMAL"
CASE 4: a$ = "BOLD"
CASE 5: a$ = "RECKLESS"
END SELECT
CALL clrbot
COLOR 11
PRINT "Enemy Aggression : "; a$; " ("; bold; ")";
choose = 35: GOTO utile
CASE ELSE
END SELECT
CASE 9 ' Files
IF _FILEEXISTS(cwsdatapath$ + "\*.sav") THEN filel = 0
filex:
choose = 23: chosit = 30: IF year = 1861 THEN choose = 22
mtx$(0) = "Options"
mtx$(1) = "Load": IF filel = 0 THEN mtx$(1) = "-": choose = 23
mtx$(2) = "Save"
mtx$(3) = "New Game"
mtx$(4) = "Quit"
size = 4: tlx = 67: tly = 15
CALL menu(0): CALL clrrite
SELECT CASE choose
CASE IS < 1: GOTO menu0
CASE 1, 2
loader:
IF choose = 1 AND filel = 0 GOTO filex
CALL filer(choose + 1)
IF choose = 1 THEN rflag = 0: mflag = 0: nflag = 0
GOTO menu0
CASE 3
OPEN "O", 1, cwsdatapath$ + "\cws.cfg"
WRITE #1, side, graf, noise, difficult, player, turbo!, randbal, train(1), train(2), jancam, realism, batwon(1), batwon(2), casualty&(1), casualty&(2), history, bold
CLOSE #1
CLS
GOTO newgame
CASE 4
choose = 23
mtx$(0) = "Quit"
mtx$(1) = "Yes"
mtx$(2) = "No"
size = 2: colour = 5
tlx = 67: tly = 15
CALL menu(0): CALL clrrite: IF choose = 1 THEN END ELSE GOTO menu0
END SELECT
CASE 99
GOTO endrnd
CASE ELSE
chosit = 22
GOTO menu0
END SELECT
GOTO menu0
'............................................................................
' Subs
'............................................................................
'............................................................................
unionplus:
usadv = 120 * difficult: IF player = 2 THEN usadv = 50 * difficult
IF realism > 0 THEN usadv = usadv * .7
RETURN
'............................................................................
blanken:
c = 1: IF side = 2 THEN c = 7
CLS : LINE (100, 200)-(500, 300), c, BF
LINE (100, 200)-(500, 300), 8 - c, B
COLOR 7: LOCATE 14, 31: PRINT " "; month$(month); year
COLOR 11: LOCATE 17, 30: PRINT force$(side); " PLAYER TURN"
DO WHILE INKEY$ = "": LOOP
RETURN
'............................................................................
DATA "U2E2F2D2BU1L3","U4R3F1G1L2BR2BF1G1L2","H1U2E1R2F1BD2G1L1"
DATA "U4R3F1D1D1G1L2","U4R3BD2BL1L2D2R3","U4R3BD2BL1L2","H1U2E1R3BD2L2BD2R2U1"
DATA "U4BD2BR1R3U2BD3D1","R1U4L1R2BL1BD4R1","R1E1U3BG3F1","U4BR3G2F2"
DATA "U4BD4BR1R1","U4F2E2D4","U4F4U4","H1U2E1R2F1D2G1L1","U4R3F1G1L2"
DATA "H1U2E1R2F1D2G1L1BE1F1R1","U4R3F1G1L2BR1F2","R3E1H1L2H1E1R3"
DATA "U4L2BR3R1","H1U3BR4D3G1L1","H2U2BR4D2G2","H2U2BF3BU1D1F1E2U2"
DATA "E4BD4H4","U2H2BR4G2","E4L4BD4R4"
SUB animate (index, flag)
from = armyloc(index): to2 = armymove(index): armyloc(index) = 0
x = cityx(from) - 12
y = cityy(from) - 11
x1 = .5 * (cityx(to2) + cityx(from))
y1 = .5 * (cityy(to2) + cityy(from))
CALL occupy(from): IF occupied(from) > 0 THEN CALL placearmy(occupied(from))
IF flag > 0 GOTO already
GET (x - 9, y - 7)-(x + 9, y + 6), anima
IF occupied(from) = 0 THEN LINE (x - 9, y - 8)-(x + 10, y + 8), 2, BF
already:
FOR i = 2 TO 8
x1 = .1 * (i * cityx(to2) + (10 - i) * cityx(from))
y1 = .1 * (i * cityy(to2) + (10 - i) * cityy(from))
GET (x1 - 10, y1 - 10)-(x1 + 9, y1 + 9), image
PUT (x1 - 10, y1 - 10), anima, PSET
IF turbo! > 1 THEN CALL TICK(.1) ELSE CALL TICK(.02)
IF noise > 0 THEN SOUND 200, .1: SOUND 50, .1
PUT (x1 - 10, y1 - 10), image, PSET
NEXT i
armyloc(index) = from
END SUB
SUB armies
CALL movefrom(index, target): IF target > 0 AND index > 0 GOTO tent
IF index = -1 THEN mflag = 1
GOTO dudd
tent:
tlx = 67: tly = 12
CALL armystat(index)
COLOR 11: LOCATE 11, 68: PRINT city$(target)
size = 0
mtx$(0) = "To"
FOR i = 1 TO 6: IF matrix(target, i) > 0 THEN size = size + 1: mtx$(size) = city$(matrix(target, i)): array(size) = matrix(target, i)
NEXT i
CALL bubble(size)
hilite = 10: colour = 3: CALL menu(2): CALL clrrite
IF choose < 0 GOTO dudd
IF month < 3 AND jancam = 0 AND cityp(array(choose)) <> side THEN COLOR 11: CALL clrbot: PRINT "No campaigns in January"; : CALL TICK(9): CALL clrbot: GOTO dudd
CALL clrbot: PRINT "Army "; index; " "; armyname$(index); " is moving from "; city$(target); " to "; city$(array(choose));
IF noise > 0 THEN SOUND 2200, .5: SOUND 2900, .7
CALL icon(target, array(choose), 1)
armymove(index) = array(choose): CALL TICK(turbo!): CALL clrbot
CALL clrrite
dudd:
END SUB
SUB armystat (index)
LINE (530, 60)-(639, 150), 0, BF
COLOR 15
LOCATE 5, 68: PRINT armyname$(index)
COLOR 9: IF index > 20 THEN COLOR 7
LOCATE 6, 68: PRINT "Size:"; : CALL strong(index)
LOCATE 7, 68: PRINT "Leader:"; TAB(75); armylead(index)
LOCATE 8, 68: PRINT "Exper:"; TAB(75); armyexper(index)
IF supply(index) < 2 THEN COLOR 12
LOCATE 9, 68: PRINT "Supply:"; TAB(75); supply(index)
END SUB
SUB barnacle (who)
navysize(who) = navysize(who) - 1
IF navysize(who) > 0 THEN
fleet$(who) = LEFT$(fleet$(who), navysize(who))
ELSE
fleet$(who) = "": navyloc(who) = 0: navysize(who) = 0
END IF
END SUB
SUB battle (attack, defend, win, lose)
IF armysize(defend) < 1 THEN armysize(defend) = 1
IF armysize(attack) < 1 THEN armysize(attack) = 1
CALL icon(armyloc(defend), 0, 9)
LOCATE 1, 1: PRINT SPACE$(80)
CALL clrrite: y = 68: COLOR 11: LOCATE 1, y: PRINT "Attacker"
c = 9: IF attack > 20 THEN c = 7
COLOR c: LOCATE 2, y: PRINT armyname$(attack)
LOCATE 3, y: CALL strong(attack)
x = .01 * armysize(attack): IF x > TCR THEN x = TCR
LOCATE 4, y: PRINT "Base "; x
IF armysize(attack) / armysize(defend) > .2 THEN x = x + .3 * armylead(attack) + .3 * armyexper(attack): IF x > TCR THEN x = TCR
IF armyexper(attack) > 8 THEN x = x + 1: IF x > TCR THEN x = TCR
LOCATE 5, y: PRINT "Ldr/Exp "; x
IF armysize(attack) < 15 THEN x = .5 * x: IF x > TCR THEN x = TCR
LOCATE 6, y: PRINT "Small "; x
IF armysize(attack) / armysize(defend) <= .5 THEN x = x - 2: IF x < 1 THEN x = 1
IF armysize(attack) / armysize(defend) > 3 THEN x = x + 2: IF x > TCR THEN x = TCR
IF armysize(attack) / armysize(defend) > 10 THEN x = TCR
IF armysize(attack) / armysize(defend) <= .2 THEN x = 1
LOCATE 7, y: PRINT "Outman "; x
IF supply(attack) < 1 THEN x = .5 * x: COLOR 13
LOCATE 8, y: PRINT "Supply "; x: COLOR c
IF x < 1 THEN x = 1
' Adjust attack advantage
IF attack < 21 AND side = 2 AND difficult > 3 THEN x = x + 2 * difficult - 6
IF attack > 20 AND side = 1 AND difficult < 3 THEN x = x + 6 - 2 * difficult
LOCATE 9, y: PRINT "Difclt "; x
IF x > TCR THEN x = TCR
COLOR 11: LOCATE 11, y: PRINT "Attack "; x
LINE (530, 155)-(635, 175), 11, B
x1 = .013 * armysize(defend) + 1: IF realism = 1 THEN x1 = .02 * armysize(defend) + 2: IF x1 > 20 THEN x1 = 20
LOCATE 13, y: PRINT "Defender"
COLOR 16 - c: LOCATE 14, y: PRINT armyname$(defend)
LOCATE 15, y: CALL strong(defend)
LOCATE 16, y: PRINT "Base "; INT(.01 * armysize(defend))
LOCATE 17, y: PRINT "Defense "; x1
IF armysize(defend) / armysize(attack) > .2 THEN x1 = x1 + .3 * armylead(defend) + .3 * armyexper(defend): IF x1 > TCR THEN x1 = TCR
IF armyexper(defend) > 8 THEN x1 = x1 + 1: IF x1 > TCR THEN x1 = TCR
LOCATE 18, y: PRINT "Ldr/Exp "; x1
IF armysize(defend) < 15 THEN x1 = .5 * x1
LOCATE 19, y: PRINT "Small "; x1
R! = armysize(defend) / armysize(attack)
SELECT CASE R!
CASE IS > 10
x1 = TCR
CASE IS > 1.5
x1 = x1 + 2
CASE IS < .5
x1 = .8 * x1
CASE IS < .2
x1 = .5 * x1
END SELECT
IF x1 < 1 THEN x1 = 1
IF x1 > TCR THEN x1 = TCR
LOCATE 20, y: PRINT "Outman "; x1
IF supply(defend) < 1 THEN x1 = .5 * x1: COLOR 13
LOCATE 21, y: PRINT "Supply "; x1: COLOR 16 - c
IF x1 < 1 THEN x1 = 1
' Adjust defend advantage
IF defend < 21 AND side = 2 AND difficult > 3 THEN x1 = x1 + 2 * difficult - 6
IF defend > 20 AND side = 1 AND difficult < 3 THEN x1 = x1 + 6 - 2 * difficult
LOCATE 22, y: PRINT "Difclt "; x1
a$ = "Fort": IF armymove(defend) = 0 THEN x1 = x1 * (1 + fort(armyloc(defend)))
IF x1 > TCR THEN x1 = TCR
IF fort(armyloc(defend)) > 0 AND armymove(defend) = 0 THEN
COLOR 13: a$ = "Fort+"
IF fort(armyloc(defend)) = 2 THEN a$ = "Fort++"
END IF
LOCATE 23, y: PRINT a$; TAB(76); x1
IF x1 > TCR THEN x1 = TCR
COLOR 11: LOCATE 25, y: PRINT "Defend "; x1
LINE (530, 380)-(635, 400), 11, B
spin = 0
scale = x: IF x1 > scale THEN scale = x1
scale = scale + 1
odds! = x / (x + x1): a = INT(100 * odds!): IF a < 1 THEN a = 1
a$ = LTRIM$(RTRIM$(STR$(a))) + "%"
COLOR 14: LOCATE 27, y: PRINT "Odds: "; a$;
LINE (530, 412)-(635, 435), 14, B
LINE (528, 410)-(637, 437), 14, B
DO WHILE INKEY$ = "": LOOP
IF graf > 2 THEN
CALL cannon
k = fort(armyloc(defend))
t$ = "fort" + LTRIM$(STR$(k)) + ".vga"
IF _FILEEXISTS(t$) THEN
DEF SEG = VARSEG(graphic(1))
BLOAD t$, VARPTR(graphic(1))
DEF SEG
PUT (550, 270), graphic, PSET
END IF
ELSE
CALL clrrite
END IF
FOR i = 1 TO 2: IF supply(i) > 0 THEN supply(i) = supply(i) - 1
NEXT i
grapple:
hit = 0: hit1 = 0
star = scale * RND: fin = scale * RND
IF noise > 0 THEN SOUND 77, .5: SOUND 59, .5: CALL TICK(.1)
IF star <= x THEN hit = 1
IF fin <= x1 THEN hit1 = 1
IF hit = 0 AND hit1 = 0 GOTO grapple
IF hit = 1 AND hit1 = 1 GOTO grapple
win = defend: lose = attack: IF hit = 1 THEN win = attack: lose = defend
a$ = "UNION": IF win > 20 THEN a$ = "REBEL"
COLOR 14: LOCATE 3, 68: PRINT a$; " VICTORY"
LOCATE 4, 71: PRINT "in"
LOCATE 5, 69: PRINT city$(armyloc(defend))
a = 1: IF win > 20 THEN a = 2
CALL flags(a, 0, 0)
CALL clrbot: COLOR 11: PRINT armyname$(win); " defeats "; armyname$(lose); " in "; city$(armyloc(defend)); : CALL TICK(9)
pct! = .01 * DEFAC - .03 * fort(armyloc(defend)): IF win = attack THEN pct! = 1.3 * pct!
SELECT CASE armysize(defend)
CASE IS > 300
pct! = .9 * pct!
CASE IS > 800
pct! = .8 * pct!
END SELECT
xbar = armysize(attack) * pct!
vary = xbar * (1 - pct!)
CALL normal(xbar, vary, killd)
pct! = .01 * ATKFAC + .02 * fort(armyloc(defend)): IF win = defend THEN pct! = 1.5 * pct!
SELECT CASE armysize(attack)
CASE IS > 300
pct! = .9 * pct!
CASE IS > 800
pct! = .8 * pct!
END SELECT
xbar = armysize(defend) * pct!
vary = xbar * (1 - pct!)
CALL normal(xbar, vary, killa)
killa = .8 * killa + .2 * killd: IF killa < 1 THEN killa = 1
killd = .8 * killd + .2 * killa: IF killd < 1 THEN killd = 1
IF killa > 9 * killd THEN killa = 9 * killd
IF killd > 5 * killa THEN killd = 5 * killa
IF killa >= armysize(attack) THEN killa = armysize(attack) - 1
IF killd >= armysize(defend) THEN killd = armysize(defend) - 1
x = INT(100 * odds!): IF x < 1 THEN x = 1
a$ = LTRIM$(RTRIM$(STR$(x))) + "%"