Training courses

Kernel and Embedded Linux

Bootlin training courses

Embedded Linux, kernel,
Yocto Project, Buildroot, real-time,
graphics, boot time, debugging...

Bootlin logo

Elixir Cross Referencer

   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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
.\"	$NetBSD: sail.6,v 1.18 2009/03/02 10:16:54 dholland Exp $
.\"
.\" Copyright (c) 1988, 1993
.\"	The Regents of the University of California.  All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\"    notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\"    notice, this list of conditions and the following disclaimer in the
.\"    documentation and/or other materials provided with the distribution.
.\" 3. Neither the name of the University nor the names of its contributors
.\"    may be used to endorse or promote products derived from this software
.\"    without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\"	@(#)sail.6	8.3 (Berkeley) 6/1/94
.\"
.Dd March 2, 2009
.Dt SAIL 6
.Os
.Sh NAME
.Nm sail
.Nd multi-user wooden ships and iron men
.Sh SYNOPSIS
.Nm
.Op Fl bx
.Op Fl s Op Fl l
.Op Ar num
.Sh DESCRIPTION
.Nm
is a computer version of Avalon Hill's game of fighting sail
originally developed by S. Craig Taylor.
.Pp
Players of
.Nm
take command of an old-fashioned Man of War and fight other
players or the computer.
They may re-enact one of the many
historical sea battles recorded in the game, or they can choose
a fictional battle.
.Pp
As a sea captain in the
.Nm Sail
Navy, the player has complete control over the workings of his ship.
He must order every maneuver, change the set of his sails, and judge the
right moment to let loose the terrible destruction of his broadsides.
In addition to fighting the enemy, he must harness the powers of the wind
and sea to make them work for him.
The outcome of many battles during the
age of sail was decided by the ability of one captain to hold the
.Sq weather gage .
.Pp
The flags are:
.Bl -tag -width flag -compact
.It Fl b
No bells.
.It Fl l
Show the login name.
Only effective with
.Fl s .
.It Fl s
Print the names and ships of the top ten sailors.
.It Fl x
Play the first available ship instead of prompting for a choice.
.El
.Sh IMPLEMENTATION
.Nm
is a multiplayer game.
Each player runs
.Nm
to either connect to an existing game or start a new one.
The game server (or
.Dq driver )
is an extra fork of the
.Nm
program created when a game is started.
The driver coordinates the game and runs the computer ships.
.\" .Pp
.\" Because the
.\" driver
.\" must calculate moves for each ship it controls, the
.\" more ships the computer is playing, the slower the game will appear.
.Pp
If a player joins a game in progress, a synchronization process occurs
.Pq a rather slow process for everyone ,
and then the game continues.
.Pp
Note that while each scenario can be running independently with
different players, each scenario can also only be running once at any
given time.
.Ss COMMUNICATION
To implement a multi-user game in Version 7 UNIX, which was the operating
system
.Nm
was first written under, the communicating processes must use a common
temporary file as a place to read and write messages.
For e.g. scenario 21, this file is
.Pa /var/games/sail/#sailsink.21 .
Corresponding file names are used for the other scenarios.
.Pp
In addition, a locking mechanism must be provided to ensure exclusive
access to the shared file.
.Nm
uses a technique stolen from an old game called
.Dq pubcaves
by Jeff Cohen.
Processes do a busy wait in the loop
.Bd -literal -offset indent
for (n = 0; link(sync_file, sync_lock) \*[Lt] 0 \*[Am]\*[Am] n \*[Lt] 30; n++)
        sleep(2);

.Ed
until they are able to create a hard link named e.g.
.Pa /var/games/sail/#saillock.21 .
where 21 is again the scenario number.
Since creating a hard link is atomic, a process where this succeeds
will have exclusive access to the temporary file.
.Ss CONSEQUENCES OF SEPARATE PLAYER AND DRIVER PROCESSES
When players do something of global interest, such as moving or firing,
the driver must coordinate the action with the other ships in the game.
For example, if a player wants to move in a certain direction, he writes a
message into the temporary file requesting the driver to move his ship.
Each
.Dq turn ,
the driver reads all the messages sent from the players and
decides what happened.
It then writes back into the temporary file new values of variables, etc.
.Pp
The most noticeable effect this communication has on the game is the
delay in moving.
Suppose a player types a move for his ship and hits return.
What happens then?
The player process saves up messages to
be written to the temporary file in a buffer.
Every 7 seconds or so, the player process gets exclusive access to
the temporary file and writes out its buffer to the file.
The driver, running asynchronously, must
read in the movement command, process it, and write out the results.
This takes two exclusive accesses to the temporary file.
Finally, when the player process gets around to doing another 7-second
update, the results of the move are displayed on the screen.
Hence, every movement requires four
exclusive accesses to the temporary file (anywhere from 7 to 21 seconds
depending upon asynchrony) before the player sees the results of his moves.
.Pp
In practice, the delays are not as annoying as they would appear.
There is room for
.Dq pipelining
in the movement.
After the player writes out
a first movement message, a second movement command can then be issued.
The first message will be in the temporary file waiting for the driver, and
the second will be in the file buffer waiting to be written to the file.
Thus, by always typing moves a turn ahead of the time, the player can
sail around quite quickly.
.Pp
If the player types several movement commands between two 7-second updates,
only the last movement command typed will be seen by the driver.
Movement commands within the same update
.Dq overwrite
each other, in a sense.
.Ss DEFECTS OF THIS SYSTEM IN THE MODERN WORLD
Quite a few.
.Pp
It should be thrown out and replaced with something socket-based.
.Sh HISTORICAL INFO
Old square-riggers were very maneuverable ships capable of intricate
sailing.
Their only disadvantage was an inability to sail very close to the wind.
The design of a wooden ship allowed for the guns to bear only to the
left and right sides.
A few guns of small
aspect (usually 6 or 9 pounders) could point forward, but their
effect was small compared to a 68 gun broadside of 24- or 32-pounders.
The guns bear approximately like so:
.Bd -literal -offset indent

       \\
        b----------------
    ---0
        \\
         \\
          \\     up to a range of ten (for round shot)
           \\
            \\
             \\

.Ed
Firing a broadside into a ship lengthwise, from bow to stern or stern
to bow, is called
.Em raking .
This did a great deal more damage, because the shot tended to bounce
along the deck.
Because the bows of a ship are very strong and present a smaller
target than the stern, a stern rake (firing from the stern to the bow) causes
more damage than a bow rake.
.Bd -literal -offset indent

                        b
                       00   ----  Stern rake!
                         a

.Ed
Most ships were equipped with
.Em carronades ,
which were very large, close range cannons.
American ships from the revolution until the War of 1812
were almost entirely armed with carronades.
.Pp
The period of history covered in
.Nm
is approximately from the 1770's until the end of Napoleonic France in 1815.
There are many excellent books about the age of sail.
.Pq See Sx REFERENCES .
.Pp
Fighting ships came in several sizes classed by armament.
The mainstays of
any fleet were its
.Em ships of the line ,
or
.Em line of battle ships .
These were so named because in fleet actions they would sail in lines
so as to present all broadsides to the enemy at once.
.\" ... to sail close enough for mutual support.
The modern terms
.Dq ocean liner ,
and
.Dq battleship
are derived from
.Dq ship of the line .
.Pp
The pride of the fleet were the
.Dq first-rates .
These were huge three decked ships of the line mounting 80 to 136 guns.
The guns in the three tiers
were usually 18, 24, and 32 pounders in that order from top to bottom.
.Pp
Lesser ships were known as
.Dq second-rates ,
.Dq third-rates ,
and even
.Dq fourth-rates .
The most common size was the 74 gun two-decked ship of the line.
The two gun decks usually mounted 18 and 24 pounder guns.
.Pp
.Em Razees
were ships of the line with one deck sawed off.
These mounted 40-64 guns and were
a poor cross between a frigate and a line of battle ship.
They neither had the speed of the former nor the firepower of the latter.
.Pp
The next class was the
.Em frigate .
Often called the
.Dq eyes of the fleet ,
frigates came in many sizes mounting anywhere from 32 to 44 guns.
These were very handy vessels.
They could outsail anything bigger and outshoot anything smaller.
Frigates did not generally fight in lines of battle as the much bigger
74s did.
Instead, they were sent on individual missions or in small groups to
harass the enemy's rear or capture crippled ships.
.\" cutting out expeditions or boat actions.
They were much more useful this way, in missions away from the fleet.
They could hit hard and get away fast.
.Pp
Lastly, there were the corvettes, sloops, and brigs.
These were smaller ships mounting typically fewer than 20 guns.
A corvette was only slightly
smaller than a frigate, so one might have up to 30 guns.
Sloops were used for carrying despatches or passengers.
Brigs were small vessels typically built for land-locked lakes.
.Sh SAIL PARTICULARS
Ships in
.Nm
are represented on the screen by two characters.
One character represents the bow of
the ship, and the other represents the stern.
Ships have nationalities and numbers.
The first ship of a nationality is number 0, the second
number 1, etc.
Therefore, the first British ship in a game would be printed as
.Dq b0 .
The second Brit would be
.Dq b1 ,
and the fifth Don would be
.Dq s4 .
.Pp
Ships can set normal sails, called
.Em Battle Sails ,
or bend on extra canvas called
.Em Full Sails .
A ship under full sail is a beautiful sight indeed,
and it can move much faster than a ship under battle sails.
The only trouble is, with full sails set, there is so much tension on sail and
rigging that a well aimed round shot can burst a sail into ribbons where
it would only cause a little hole in a loose sail.
For this reason, rigging damage is doubled on a ship with full sails set.
This does not mean that full sails should never be used; the author
recommends keeping them up right into the heat of battle.
When a ship has full sails set, the letter for its nationality is
capitalized.
E.g., a Frog,
.Dq f0 ,
with full sails set would be printed as
.Dq F0 .
.Pp
When a ship is battered into a listing hulk, the last man aboard
.Em strikes the colors .
This ceremony is the ship's formal surrender.
The nationality character of a surrendered ship is printed as
.So
!
.Sc .
E.g., the Frog of our last example would soon be
.Dq !0 .
.Pp
A ship that reaches this point has a chance of catching fire or sinking.
A sinking ship has a
.Sq ~
printed for its nationality,
and a ship on fire and about to explode has a
.Sq #
printed.
.Pp
Ships that have struck can be captured;
captured ships become the nationality of the prize crew.
Therefore, if
an American ship captures a British ship, the British ship will
thenceforth have an
.Sq a
printed for its nationality.
In addition, the ship number is changed
to one of the characters
.So
\*[Am]'()*+
.Sc
corresponding to its original number
.So
012345
.Sc .
E.g., the
.Dq b0
captured by an American becomes the
.Dq a\*[Am] .
The
.Dq s4
captured by a Frog becomes the
.Dq f* .
.Pp
The ultimate example is, of course, an exploding Brit captured by an
American:
.Dq #\*[Am] .
.Sh MOVEMENT
Movement is the most confusing part of
.Nm
to many.
Ships can head in 8 directions:
.Bd -literal -offset indent
                         0      0      0
b       b       b0      b       b       b       0b      b
0        0                                             0

.Ed
The stern of a ship moves when it turns.
The bow remains stationary.
Ships can always turn, regardless of the wind (unless they are becalmed).
All ships drift when they lose headway.
If a ship doesn't move forward at all for two turns, it will begin to drift.
If a ship has begun to
drift, then it must move forward before it turns, if it plans to do
more than make a right or left turn, which is always possible.
.Pp
Movement commands to
.Nm
are a string of forward moves and turns.
An example is
.Dq l3 .
It will turn a ship left and then move it ahead 3 spaces.
In the drawing above, the
.Dq b0
made 7 successive left turns.
When
.Nm
prompts you for a move, it prints three characters of import.
E.g.,
.Dl move (7, 4):
The first number is the maximum number of moves you can make, including turns.
The second number is the maximum number of turns you can make.
Between the numbers is sometimes printed a quote
.Pq ' .
If the quote is present, it means that your ship has been drifting, and
you must move ahead to regain headway before you turn (see note above).
Some of the possible moves for the example above are as follows:
.Bd -literal -offset indent
move (7, 4): 7
move (7, 4): 1
move (7, 4): d          /* drift, or do nothing */
move (7, 4): 6r
move (7, 4): 5r1
move (7, 4): 4r1r
move (7, 4): l1r1r2
move (7, 4): 1r1r1r1
.Ed
.Pp
Because square riggers performed so poorly sailing into the wind, if at
any point in a movement command you turn into the wind, the movement stops
there.
E.g.,
.Bd -literal -offset indent
move (7, 4): l1l4
Movement Error;
Helm: l1l

.Ed
Moreover, upon making a turn, the movement allowance drops to the
lesser of what remains this turn and what would be available when
going in the new direction.
Thus, any turn closer to the wind will generally preclude sailing the
full distance printed in the
.Dq move
prompt.
.Pp
Old sailing captains had to keep an eye constantly on the wind.
Captains in
.Nm
are no different.
A ship's ability to move depends on its attitude to the wind.
The best angle possible is to have the wind off your quarter, that is,
just off the stern.
The direction rose on the side of the screen gives the
possible movements for your ship at all positions to the wind.
Battle
sail speeds are given first, and full sail speeds are given in parenthesis.
.Bd -literal

				 0 1(2)
				\\|/
				-^-3(6)
				/|\\
				 | 4(7)
				3(6)

.Ed
Pretend the bow of your ship
.Pq the Dq ^
is pointing upward and the wind is
blowing from the bottom to the top of the page.
The numbers at the bottom
.Dq 3(6)
will be your speed under battle or full
sails in such a situation.
If the wind is off your quarter, then you can move
.Dq 4(7) .
If the wind is off your beam,
.Dq 3(6) .
If the wind is off your bow, then you can only move
.Dq 1(2) .
Facing into the wind, you cannot move at all.
Ships facing into the wind are said to be
.Em in irons .
.Sh WINDSPEED AND DIRECTION
The windspeed and direction is displayed as a weather vane on the
side of the screen.
The number in the middle of the vane indicates the wind
speed, and the + to - indicates the wind direction.
The wind blows from the + sign (high pressure) to the - sign (low pressure).
E.g.,
.Bd -literal
                                |
                                3
                                +
.Ed
.Pp
The wind speeds are:
.Bl -tag -width 012 -compact -offset indent
.It 0
becalmed
.It 1
light breeze
.It 2
moderate breeze
.It 3
fresh breeze
.It 4
strong breeze
.It 5
gale
.It 6
full gale
.It 7
hurricane
.El
If a hurricane shows up, all ships are destroyed.
.Sh GRAPPLING AND FOULING
If two ships collide, they run the risk of becoming tangled together.
This is called
.Em fouling .
Fouled ships are stuck together, and neither can move.
They can unfoul each other if they want to.
Boarding parties can only be
sent across to ships when the antagonists are either fouled or grappled.
.Pp
Ships can grapple each other by throwing grapnels into the rigging of
the other.
.Pp
The number of fouls and grapples you have are displayed on the upper
right of the screen.
.Sh BOARDING
Boarding was a very costly venture in terms of human life.
Boarding parties may be formed in
.Nm
to either board an enemy ship or to defend your own ship against attack.
Men organized as Defensive Boarding Parties fight twice as hard to save
their ship as men left unorganized.
.Pp
The boarding strength of a crew depends upon its quality and upon the
number of men sent.
.Sh CREW QUALITY
The British seaman was world renowned for his sailing abilities.
American sailors, however, were actually the best seamen in the world.
Because the
American Navy offered twice the wages of the Royal Navy, British seamen
who liked the sea defected to America by the thousands.
.Pp
In
.Nm ,
crew quality is quantized into 5 energy levels.
.Em Elite
crews can outshoot and outfight all other sailors.
.Em Crack
crews are next.
.Em Mundane
crews are average, and
.Em Green
and
.Em Mutinous
crews are below average.
A good rule of thumb is that
.Em Crack
or
.Em Elite
crews get one extra hit
per broadside compared to
.Em Mundane
crews.
Don't expect too much from
.Em Green
crews.
.Sh BROADSIDES
Your two broadsides may be loaded with four kinds of shot: grape, chain,
round, and double.
You have guns and carronades in both the port and starboard batteries.
Carronades only have a range of two, so you have to get in
close to be able to fire them.
You have the choice of firing at the hull or rigging of another ship.
If the range of the ship is greater than 6,
then you may only shoot at the rigging.
.Pp
The types of shot and their advantages are:
.Bl -tag -width DOUBLEx
.It ROUND
Range of 10.
Good for hull or rigging hits.
.It DOUBLE
Range of 1.
Extra good for hull or rigging hits.
Double takes two turns to load.
.It CHAIN
Range of 3.
Excellent for tearing down rigging.
Cannot damage hull or guns, though.
.It GRAPE
Range of 1.
Sometimes devastating against enemy crews.
.El
.Pp
On the side of the screen is displayed some vital information about your
ship:
.Bd -literal -offset indent
Load  D! R!
Hull  9
Crew  4  4  2
Guns  4  4
Carr  2  2
Rigg  5 5 5 5

.Ed
.Dq Load
shows what your port
.Pq left
and starboard
.Pq right
broadsides are
loaded with.
A
.So
!
.Sc
after the type of shot indicates that it is an initial broadside.
Initial broadside were loaded with care before battle and before
the decks ran red with blood.
As a consequence, initial broadsides are a
little more effective than broadsides loaded later.
A
.Sq *
after the type of shot indicates that the gun
crews are still loading it, and you cannot fire yet.
.Dq Hull
shows how much hull you have left.
.Dq Crew
shows your three sections of crew.
As your crew dies off, your ability to fire decreases.
.Dq Guns
and
.Dq Carr
show your port and starboard guns.
As you lose guns, your ability to fire decreases.
.Dq Rigg
shows how much rigging you have on your 3 or 4 masts.
As rigging is shot away, you lose mobility.
.Sh EFFECTIVENESS OF FIRE
It is very dramatic when a ship fires its thunderous broadsides, but the
mere opportunity to fire them does not guarantee any hits.
Many factors influence the destructive force of a broadside.
First of all, and the chief factor, is distance.
It is harder to hit a ship at range ten than it is
to hit one sloshing alongside.
Next is raking.
Raking fire, as mentioned before, can sometimes dismast a ship at range ten.
Next, crew size and quality affects the damage done by a broadside.
The number of guns firing also bears on the point, so to speak.
Lastly, weather affects the accuracy of a broadside.
If the seas are high (5 or 6), then the lower gunports
of ships of the line can't even be opened to run out the guns.
This gives frigates and other flush decked vessels an advantage in a storm.
The scenario
.Em Pellew vs. The Droits de L'Homme
takes advantage of this peculiar circumstance.
.Sh REPAIRS
Repairs may be made to your Hull, Guns, and Rigging at the slow rate of
two points per three turns.
The message "Repairs Completed" will be printed if no more repairs can be made.
.Sh PECULIARITIES OF COMPUTER SHIPS
Computer ships in
.Nm
follow all the rules above with a few exceptions.
Computer ships never repair damage.
If they did, the players could never beat them.
They play well enough as it is.
As a consolation, the computer ships can fire double shot every turn.
That fluke is a good reason to keep your distance.
The driver figures out the moves of the computer ships.
It computes them with a typical A.I. distance
function and a depth first search to find the maximum
.Dq score .
It seems to work fairly well, although I'll be the first to admit it isn't
perfect.
.Sh HOW TO PLAY
Commands are given to
.Nm
by typing a single character.
You will then be prompted for further input.
A brief summary of the commands follows.
.Ss COMMAND SUMMARY
.Bl -tag -width xD,xNxx -compact
.It Sq f
Fire broadsides if they bear
.It Sq l
Reload
.It Sq L
Unload broadsides (to change ammo)
.It Sq m
Move
.It Sq i
Print the closest ship
.It Sq I
Print all ships
.It Sq F
Find a particular ship or ships (e.g. "a?" for all Americans)
.It Sq s
Send a message around the fleet
.It Sq b
Attempt to board an enemy ship
.It Sq B
Recall boarding parties
.It Sq c
Change set of sail
.It Sq r
Repair
.It Sq u
Attempt to unfoul
.It Sq g
Grapple/ungrapple
.It Sq v
Print version number of game
.It Sq ^L
Redraw screen
.It Sq Q
Quit
.Pp
.It Sq C
Center your ship in the window
.It Sq U
Move window up
.It Sq D, N
Move window down
.It Sq H
Move window left
.It Sq J
Move window right
.It Sq S
Toggle window to follow your ship or stay where it is
.El
.Sh SCENARIOS
Here is a summary of the scenarios in
.Nm :
.Ss Ranger vs. Drake :
Wind from the N, blowing a fresh breeze.
.Bd -literal
(a) Ranger            19 gun Sloop (crack crew) (7 pts)
(b) Drake             17 gun Sloop (crack crew) (6 pts)
.Ed
.Ss The Battle of Flamborough Head :
Wind from the S, blowing a fresh breeze.
.Pp
This is John Paul Jones' first famous battle.
Aboard the
.Em Bonhomme Richard ,
he was able to overcome the
.Em Serapis's
greater firepower
by quickly boarding her.
.Bd -literal
(a) Bonhomme Rich     42 gun Corvette (crack crew) (11 pts)
(b) Serapis           44 gun Frigate (crack crew) (12 pts)
.Ed
.Ss Arbuthnot and Des Touches :
Wind from the N, blowing a gale.
.Bd -literal
(b) America           64 gun Ship of the Line (crack crew) (20 pts)
(b) Befford           74 gun Ship of the Line (crack crew) (26 pts)
(b) Adamant           50 gun Ship of the Line (crack crew) (17 pts)
(b) London            98 gun 3 Decker SOL (crack crew) (28 pts)
(b) Royal Oak         74 gun Ship of the Line (crack crew) (26 pts)
(f) Neptune           74 gun Ship of the Line (average crew) (24 pts)
(f) Duc de Bourgogne  80 gun 3 Decker SOL (average crew) (27 pts)
(f) Conquerant        74 gun Ship of the Line (average crew) (24 pts)
(f) Provence          64 gun Ship of the Line (average crew) (18 pts)
(f) Romulus           44 gun Ship of the Line (average crew) (10 pts)
.Ed
.Ss Suffren and Hughes :
Wind from the S, blowing a fresh breeze.
.Bd -literal
(b) Monmouth          74 gun Ship of the Line (average crew) (24 pts)
(b) Hero              74 gun Ship of the Line (crack crew) (26 pts)
(b) Isis              50 gun Ship of the Line (crack crew) (17 pts)
(b) Superb            74 gun Ship of the Line (crack crew) (27 pts)
(b) Burford           74 gun Ship of the Line (average crew) (24 pts)
(f) Flamband          50 gun Ship of the Line (average crew) (14 pts)
(f) Annibal           74 gun Ship of the Line (average crew) (24 pts)
(f) Severe            64 gun Ship of the Line (average crew) (18 pts)
(f) Brilliant         80 gun Ship of the Line (crack crew) (31 pts)
(f) Sphinx            80 gun Ship of the Line (average crew) (27 pts)
.Ed
.Ss Nymphe vs. Cleopatre :
Wind from the S, blowing a fresh breeze.
.Bd -literal
(b) Nymphe            36 gun Frigate (crack crew) (11 pts)
(f) Cleopatre         36 gun Frigate (average crew) (10 pts)
.Ed
.Ss Mars vs. Hercule :
Wind from the S, blowing a fresh breeze.
.Bd -literal
(b) Mars              74 gun Ship of the Line (crack crew) (26 pts)
(f) Hercule           74 gun Ship of the Line (average crew) (23 pts)
.Ed
.Ss Ambuscade vs. Baionnaise :
Wind from the N, blowing a fresh breeze.
.Bd -literal
(b) Ambuscade         32 gun Frigate (average crew) (9 pts)
(f) Baionnaise        24 gun Corvette (average crew) (9 pts)
.Ed
.Ss Constellation vs. Insurgent :
Wind from the S, blowing a gale.
.Bd -literal
(a) Constellation     38 gun Corvette (elite crew) (17 pts)
(f) Insurgent         36 gun Corvette (average crew) (11 pts)
.Ed
.Ss Constellation vs. Vengeance :
Wind from the S, blowing a fresh breeze.
.Bd -literal
(a) Constellation     38 gun Corvette (elite crew) (17 pts)
(f) Vengeance         40 gun Frigate (average crew) (15 pts)
.Ed
.Ss The Battle of Lissa :
Wind from the S, blowing a fresh breeze.
.Bd -literal
(b) Amphion           32 gun Frigate (elite crew) (13 pts)
(b) Active            38 gun Frigate (elite crew) (18 pts)
(b) Volage            22 gun Frigate (elite crew) (11 pts)
(b) Cerberus          32 gun Frigate (elite crew) (13 pts)
(f) Favorite          40 gun Frigate (average crew) (15 pts)
(f) Flore             40 gun Frigate (average crew) (15 pts)
(f) Danae             40 gun Frigate (crack crew) (17 pts)
(f) Bellona           32 gun Frigate (green crew) (9 pts)
(f) Corona            40 gun Frigate (green crew) (12 pts)
(f) Carolina          32 gun Frigate (green crew) (7 pts)
.Ed
.Ss Constitution vs. Guerriere :
Wind from the SW, blowing a gale.
.Bd -literal
(a) Constitution      44 gun Corvette (elite crew) (24 pts)
(b) Guerriere         38 gun Frigate (crack crew) (15 pts)
.Ed
.Ss United States vs. Macedonian :
Wind from the S, blowing a fresh breeze.
.Bd -literal
(a) United States     44 gun Frigate (elite crew) (24 pts)
(b) Macedonian        38 gun Frigate (crack crew) (16 pts)
.Ed
.Ss Constitution vs. Java :
Wind from the S, blowing a fresh breeze.
.Bd -literal
(a) Constitution      44 gun Corvette (elite crew) (24 pts)
(b) Java              38 gun Corvette (crack crew) (19 pts)
.Ed
.Ss Chesapeake vs. Shannon :
Wind from the S, blowing a fresh breeze.
.Bd -literal
(a) Chesapeake        38 gun Frigate (average crew) (14 pts)
(b) Shannon           38 gun Frigate (elite crew) (17 pts)
.Ed
.Ss The Battle of Lake Erie :
Wind from the S, blowing a light breeze.
.Bd -literal
(a) Lawrence          20 gun Sloop (crack crew) (9 pts)
(a) Niagara           20 gun Sloop (elite crew) (12 pts)
(b) Lady Prevost      13 gun Brig (crack crew) (5 pts)
(b) Detroit           19 gun Sloop (crack crew) (7 pts)
(b) Q. Charlotte      17 gun Sloop (crack crew) (6 pts)
.Ed
.Ss Wasp vs. Reindeer :
Wind from the S, blowing a light breeze.
.Bd -literal
(a) Wasp              20 gun Sloop (elite crew) (12 pts)
(b) Reindeer          18 gun Sloop (elite crew) (9 pts)
.Ed
.Ss Constitution vs. Cyane and Levant :
Wind from the S, blowing a moderate breeze.
.Bd -literal
(a) Constitution      44 gun Corvette (elite crew) (24 pts)
(b) Cyane             24 gun Sloop (crack crew) (11 pts)
(b) Levant            20 gun Sloop (crack crew) (10 pts)
.Ed
.Ss Pellew vs. Droits de L'Homme :
Wind from the N, blowing a gale.
.Bd -literal
(b) Indefatigable     44 gun Frigate (elite crew) (14 pts)
(b) Amazon            36 gun Frigate (crack crew) (14 pts)
(f) Droits L'Hom      74 gun Ship of the Line (average crew) (24 pts)
.Ed
.Ss Algeciras :
Wind from the SW, blowing a moderate breeze.
.Bd -literal
(b) Caesar            80 gun Ship of the Line (crack crew) (31 pts)
(b) Pompee            74 gun Ship of the Line (crack crew) (27 pts)
(b) Spencer           74 gun Ship of the Line (crack crew) (26 pts)
(b) Hannibal          98 gun 3 Decker SOL (crack crew) (28 pts)
(s) Real-Carlos       112 gun 3 Decker SOL (green crew) (27 pts)
(s) San Fernando      96 gun 3 Decker SOL (green crew) (24 pts)
(s) Argonauta         80 gun Ship of the Line (green crew) (23 pts)
(s) San Augustine     74 gun Ship of the Line (green crew) (20 pts)
(f) Indomptable       80 gun Ship of the Line (average crew) (27 pts)
(f) Desaix            74 gun Ship of the Line (average crew) (24 pts)
.Ed
.Ss Lake Champlain :
Wind from the N, blowing a fresh breeze.
.Bd -literal
(a) Saratoga          26 gun Sloop (crack crew) (12 pts)
(a) Eagle             20 gun Sloop (crack crew) (11 pts)
(a) Ticonderoga       17 gun Sloop (crack crew) (9 pts)
(a) Preble            7 gun Brig (crack crew) (4 pts)
(b) Confiance         37 gun Frigate (crack crew) (14 pts)
(b) Linnet            16 gun Sloop (elite crew) (10 pts)
(b) Chubb             11 gun Brig (crack crew) (5 pts)
.Ed
.Ss Last Voyage of the USS President :
Wind from the N, blowing a fresh breeze.
.Bd -literal
(a) President         44 gun Frigate (elite crew) (24 pts)
(b) Endymion          40 gun Frigate (crack crew) (17 pts)
(b) Pomone            44 gun Frigate (crack crew) (20 pts)
(b) Tenedos           38 gun Frigate (crack crew) (15 pts)
.Ed
.Ss Hornblower and the Natividad :
Wind from the E, blowing a gale.
.Pp
A scenario for you Horny fans.
Remember, he sank the Natividad against heavy odds and winds.
Hint: don't try to board the Natividad;
her crew is much bigger, albeit green.
.Bd -literal
(b) Lydia             36 gun Frigate (elite crew) (13 pts)
(s) Natividad         50 gun Ship of the Line (green crew) (14 pts)
.Ed
.Ss Curse of the Flying Dutchman :
Wind from the S, blowing a fresh breeze.
.Pp
Just for fun, take the Piece of cake.
.Bd -literal
(s) Piece of Cake     24 gun Corvette (average crew) (9 pts)
(f) Flying Dutchy     120 gun 3 Decker SOL (elite crew) (43 pts)
.Ed
.Ss The South Pacific :
Wind from the S, blowing a strong breeze.
.Bd -literal
(a) USS Scurvy        136 gun 3 Decker SOL (mutinous crew) (27 pts)
(b) HMS Tahiti        120 gun 3 Decker SOL (elite crew) (43 pts)
(s) Australian        32 gun Frigate (average crew) (9 pts)
(f) Bikini Atoll      7 gun Brig (crack crew) (4 pts)
.Ed
.Ss Hornblower and the battle of Rosas bay :
Wind from the E, blowing a fresh breeze.
.Pp
The only battle Hornblower ever lost.
He was able to dismast one ship and stern rake the others though.
See if you can do as well.
.Bd -literal
(b) Sutherland        74 gun Ship of the Line (crack crew) (26 pts)
(f) Turenne           80 gun 3 Decker SOL (average crew) (27 pts)
(f) Nightmare         74 gun Ship of the Line (average crew) (24 pts)
(f) Paris             112 gun 3 Decker SOL (green crew) (27 pts)
(f) Napoleon          74 gun Ship of the Line (green crew) (20 pts)
.Ed
.Ss Cape Horn :
Wind from the NE, blowing a strong breeze.
.Bd -literal
(a) Concord           80 gun Ship of the Line (average crew) (27 pts)
(a) Berkeley          98 gun 3 Decker SOL (crack crew) (28 pts)
(b) Thames            120 gun 3 Decker SOL (elite crew) (43 pts)
(s) Madrid            112 gun 3 Decker SOL (green crew) (27 pts)
(f) Musket            80 gun 3 Decker SOL (average crew) (27 pts)
.Ed
.Ss New Orleans :
Wind from the SE, blowing a fresh breeze.
.Pp
Watch that little Cypress go!
.Bd -literal
(a) Alligator         120 gun 3 Decker SOL (elite crew) (43 pts)
(b) Firefly           74 gun Ship of the Line (crack crew) (27 pts)
(b) Cypress           44 gun Frigate (elite crew) (14 pts)
.Ed
.Ss Botany Bay :
Wind from the N, blowing a fresh breeze.
.Bd -literal
(b) Shark             64 gun Ship of the Line (average crew) (18 pts)
(f) Coral Snake       44 gun Corvette (elite crew) (24 pts)
(f) Sea Lion          44 gun Frigate (elite crew) (24 pts)
.Ed
.Ss Voyage to the Bottom of the Sea :
Wind from the NW, blowing a fresh breeze.
.Pp
This one is dedicated to Richard Basehart and David Hedison.
.Bd -literal
(a) Seaview           120 gun 3 Decker SOL (elite crew) (43 pts)
(a) Flying Sub        40 gun Frigate (crack crew) (17 pts)
(b) Mermaid           136 gun 3 Decker SOL (mutinous crew) (27 pts)
(s) Giant Squid       112 gun 3 Decker SOL (green crew) (27 pts)
.Ed
.Ss Frigate Action :
Wind from the E, blowing a fresh breeze.
.Bd -literal
(a) Killdeer          40 gun Frigate (average crew) (15 pts)
(b) Sandpiper         40 gun Frigate (average crew) (15 pts)
(s) Curlew            38 gun Frigate (crack crew) (16 pts)
.Ed
.Ss The Battle of Midway :
Wind from the E, blowing a moderate breeze.
.Bd -literal
(a) Enterprise        80 gun Ship of the Line (crack crew) (31 pts)
(a) Yorktown          80 gun Ship of the Line (average crew) (27 pts)
(a) Hornet            74 gun Ship of the Line (average crew) (24 pts)
(j) Akagi             112 gun 3 Decker SOL (green crew) (27 pts)
(j) Kaga              96 gun 3 Decker SOL (green crew) (24 pts)
(j) Soryu             80 gun Ship of the Line (green crew) (23 pts)
.Ed
.Ss Star Trek :
Wind from the S, blowing a fresh breeze.
.Bd -literal
(a) Enterprise        450 gun Ship of the Line (elite crew) (75 pts)
(a) Yorktown          450 gun Ship of the Line (elite crew) (75 pts)
(a) Reliant           450 gun Ship of the Line (elite crew) (75 pts)
(a) Galileo           450 gun Ship of the Line (elite crew) (75 pts)
(k) Kobayashi Maru    450 gun Ship of the Line (elite crew) (75 pts)
(k) Klingon II        450 gun Ship of the Line (elite crew) (75 pts)
(o) Red Orion         450 gun Ship of the Line (elite crew) (75 pts)
(o) Blue Orion        450 gun Ship of the Line (elite crew) (75 pts)
.Ed
.Sh HISTORY
Dave Riggle wrote the first version of
.Nm
on a PDP\-11/70 in the fall of 1980.
Needless to say, the code was horrendous,
not portable in any sense of the word, and didn't work.
The program was not
very modular and had
.Xr fseek 3
and
.Xr fwrite 3
calls every few lines.
After a tremendous rewrite from the top down,
the first working version was up and running by 1981.
There were several annoying bugs concerning firing broadsides and
finding angles.
.\" No longer true...
.\" .Nm
.\" uses no floating point, by the way, so the direction routines are rather
.\" tricky.
.Pp
Ed Wang rewrote the
.Fn angle
routine in 1981 to be more correct.
He also added code to let a player select
which ship he wanted at the start of the game, instead of always
taking the first one available.
.Pp
Captain Happy (Craig Leres) is responsible for making
.Nm
portable for the first time.
This was no easy task.
Constants like 2 and 10 were very frequent in the code.
The
.Nm
code was also notorious for the use of
.Dq Riggle Memorial Structures .
Many structure references were so long that they ran off the line
printer page.
Here is an example, if you promise not to laugh:
.Bd -literal -offset indent
specs[scene[flog.fgamenum].ship[flog.fshipnum].shipnum].pts
.Ed
.Pp
.Nm
received its fourth and most thorough rewrite in the summer and fall
of 1983.
Ed Wang rewrote and modularized the code (a monumental feat)
almost from scratch.
Although he introduced many new bugs, the final result was very much
cleaner and (?) faster.
He added window movement commands and find ship commands.
.Pp
At some currently unknown time,
.Nm
was imported into
.Bx .
.Sh AUTHORS
.Nm
has been a group effort.
.Ss AUTHOR
Dave Riggle
.Ss CO-AUTHOR
Ed Wang
.Ss REFITTING
Craig Leres
.Ss CONSULTANTS
.Bl -item -compact
.It
Chris Guthrie
.It
Captain Happy
.It
Horatio Nelson
.El
and many valiant others...
.Sh REFERENCES
.Rs
.%B Wooden Ships \*[Am] Iron Men
.%A "Avalon Hill"
.Re
.Pp
.Rs
.%B Master and Commander
.%O and 20 more volumes
.%A Patrick O'Brian
.Re
.Pp
.Rs
.%B Captain Horatio Hornblower Novels
.%O "(13 of them)"
.%A "C.S. Forester"
.Re
.Pp
.Rs
.%B Captain Richard Bolitho Novels
.%O "(12 of them)"
.%A "Alexander Kent"
.Re
.Pp
.Rs
.%B The Complete Works of Captain Frederick Marryat
.%O "(about 20)"
.Re
.Pp
Of these, consider especially
.Bl -item -offset indent -compact
.It
.%B Mr. Midshipman Easy
.It
.%B Peter Simple
.It
.%B Jacob Faithful
.It
.%B Japhet in Search of a Father
.It
.%B Snarleyyow, or The Dog Fiend
.It
.%B Frank Mildmay, or The Naval Officer
.El
.\" .Sh BUGS
.\" Probably a few, and please report them to "riggle@ernie.berkeley.edu" and
.\" "edward@ucbarpa.berkeley.edu".