The Museum of HP Calculators

Artillery for the HP-67

This program is Copyright © 1976 by Hewlett-Packard and is used here by permission. This program was originally published in the HP-67 Games Pac 1.

This program is supplied without representation or warranty of any kind. Hewlett-Packard Company and The Museum of HP Calculators therefore assume no responsibility and shall have no liability, consequential or otherwise, of any kind arising from the use of this program material or any part thereof.

 Artillery Shift Init (Speed) (Spotr) (Kill) Brg^El-> Label Start Hit (->Target) Brg->El-> Key A B C D E

Overview

This program simulates the firing of an artillery round at a moving target whose initial position has been randomly selected. Feedback to the gunner is via a spotter plane weaving in and out of clouds over the battle area.

Initial display for each new battle is one of the 8 main compass directions: 0 (North), 45, 90 (East), 135, 180 (South), 225, 270 (West); or 315. The target lies in that general direction from the hidden gun and is 5 to 10 kilometers away.

The gunner fires by bearing and elevation parameters. A spotter (poor to perfect) relays information by displaying hh.DDDD:

hh (0 to 12)
is the shell hit as an hour position on a relative clock face with the target at center and 6 o'clock in line with the gun.
DDDD
is the estimated range from target to shell hit.

Thus 8.0950 means the shell was a bit short, left, and 950m away and 12.1230 means the shell passed over target and hit 1230m beyond.

If shell lands within KILL range of target, the gunner wins. If not destroyed, and target has closed within 500 meters, target blasts gun to pieces--player loses!

Win is indicated by PRINT/PAUSE display of stack:

• T = spotter rating
• Z = maximum axial movement of target (SPEED)
• Y = KILL range
• X = proximity of shell hit to target

Loss is indicated by flashing 500.0.

Between one-minute shots, target randomly moves (up to maximum SPEED both N-S and E-W) but usually closes toward gun. Accurate information on where target was when last shell was fired can be obtained via C in format bbb.DDDD (true bearing and distance from gun).

• Maximum gun range = 10,000 meters. (Thus, the formula for any shell's range = 10,000 x Sin (2 x elevation).)
• Target KILL range = 100 meters.
• Target SPEED = 500 meters/minute (along each axis).
• Spotter rating = 3.0 (1 = poor, 4 = perfect).
• Random number seed = 0.5284163

Remarks

Remember, information from a less than perfect spotter may be incorrect by as much as 3 hours in either circular direction and as much as +/-60% of the "miss" distance. A perfect (4.0) spotter will report to the nearest hour and within 10 meters. Target movement along axes (SPEED), spotter rating (SPOTR), and lethal radius of a shell blast (KILL) may all be altered by the player even during a battle. Distinguished indeed will be the first player to win a battle under the following conditions: SPEED = 1000, SPOTR = 1.0, and KILL = 0!

Instructions

 Step Instructions Input Data/Units Keys Output Data/Units 1 Load side 1 and side 2. 2 Initialize parameters f  A 10000.00 3 Optional-- Set target SPEED. Speed f B Speed Set spotter rating (1 = poor, 4= perfect). Spot f C Spot Set KILL range (1000= easy, 10 = tough). Kill f D Kill 4 Reset target for new battle. A BBB.* 5 Fire! Bearing ENTER Elevation E or or f E hh.DDDD* 6 Repeat step 5 until decision: WIN-Stack is output. LOSS-Flashing 500.0 7 Display bearing and distance to last target (Optional). C bbb.DDDD* 8 Recall rounds fired. RCL I Rounds 9 Go to step 3. *Outputs: BBB: Bearing in degrees. hh.DDDD: hh = Estimate of hour position of hit relative to target. 6 is nearest gun. DDDD = Estimate of distance from hit to target. bbb.DDDD = Correct bearing and distance to last target position.

Example

```Keystrokes                     Outputs
f A                            10000.00
(This initialization need be done only on a freshly loaded program.
SPEED 500, SPOTR = 3.0, and KILL = 100 meters.)

A (Starts the battle)              180.     (Approximate target bearing)
201 ENTER 33 E              201.0000000 ***
33.0 ***
11.0130 ***

(Spotter has reported that round landed left, long and missed by 130m.)
201.5 ENTER 32 E            201.5000000 ***
32.0 ***
2.0670 ***

199 ENTER 30 f E            199.0000000 ***
30.0 ***
1.0570 ***

196 ENTER 27 E              196.0000000 ***
27.0 ***

Target destroyed!
3.0 *** T Spotter rating
500.0 *** Z Target max. movement
100.0 *** Y Kill range
79.1 *** X "Miss" distance
```

Select SPEED = 100, SPOTR = 4.0 (perfect), and KILL = 20.

```Keystrokes                     Outputs
100 f B                           100.0
40 f C                              4.0
20 f D                             20.0

A                                  315.     (Approximate target bearing)

315 ENTER 30 E              315.0000000 ***
30.0 ***
3.3230 ***

295 ENTER 25 E              295.0000000 ***
25.0 ***
1.0530 ***

293 ENTER 22.5 f E          293.0000000 ***
22.5 ***
4.0050 ***

292.5 ENTER 22.2 E          292.5000000 ***
22.2 ***

Gotcha!
4.0 *** T Spotter rating
100.0 *** Z Target max. movement
20.0 *** Y Kill range
10.4 *** X "Miss" distance

```

***Shown by PRINT on HP-97 and by PAUSE on HP-67.

The Program

```LINE  KEYS
001  *LBL a     Initialize
002   FIX
003   DSP 2
004   .
005   5
006   2
007   8
008   4
009   1
010   6
011   3
012   STO 0     R0 <- seed = .5284163
013   3
014   STO C     RC <- spot rating = 3
015   5
016   0
017   0
018   STO B     RB <- speed = 500
019   EEX
020   2
021   STO D     RD <- kill range = 100
022   X2
023   STO 9     Max. gun range = 10000
024   RTN
025  *LBL A     Start a new battle
026   PRT SPC
027   0
028   STO I     Rounds = 0
029   RCL 9
030   2
031   ÷
032   ENTER
033   GSB 0
034   +         Generate target range.
035   3
036   6
037   0
038   GSB 0
039   STO 8     Generate target bearing.
040   roll up
041   ->R
042   STO 1     Save target N-S.
043   X<>Y
044   STO 2     Save target E-W.
045   4
046   5
047   STO ÷ 8
048   RCL 8
049   DSP 0     Display 45° sector.
050   RND
051   x
052   RTN
053  *LBL C     Routine to generate and display target's last position.
054   RCL 2
055   RCL 1
056   ->P
057   EEX
058   4
059   ÷
060   X<>Y
061   X>0?
062   GTO 2
063   3
064   6
065   0
066   +
067  *LBL 2
068   DSP 0
069   RND
070   +
071   DSP 4     Display brg. range.
072   RTN
073  *LBL b
074   STO B     Set new speed.
075   RTN
076  *LBL c
077   STO C     Set new spotter rating.
078   RTN
079  *LBL d
080   STO D     Set new KILL range.
081   RTN
082  *LBL 1     Routine to calculate movement of target
083   CF 0      in N-S and E-W directions.
084   X<0?
085   SF 0
086   RCL B
087   GSB 0
088   F0?
089   CHS
090   -
091   RTN
092  *LBL e     FIRE! routine
093  *LBL E
094   ISZ I
095   X<>Y
096   DSP 7
097   PRTX     Output bearing.
098   X<>Y
099   DSP 1
100   PRTX     Output elevation.
101   ENTER
102   +
103   SIN
104   RCL 9
105   x
106   ->R
107   STO 3     Save round's N-S.
108   X<>Y
109   STO 4     Save round's E-W.
110   RCL 1
111   GSB 1
112   STO 1     Move target N-S.
113   RCL 2
114   GSB 1
115   STO 2     Move target E-W.
116   CHS
117   RCL 4
118   +
119   RCL 3     Generate "miss" data.
120   RCL 1
121   -
122   ->P
123   STO 7     R7 <- miss.
124   RCL D
125   X<>Y      Test if round hit within KILL
126   X>Y?      range.
127   GTO 7
128   RCL C
129   RCL B
130   roll dn
131   roll dn
132   PRT STK
133   R/S
134  *LBL 7
135   roll dn
136   roll dn
137   RCL 2     Otherwise, test if target has
138   RCL 1     closed to within 500 meters.
139   ->P
140   5
141   0
142   0
143  *LBL 8     LOSE! So flash "500.0" repeatedly.
144   PAUSE
145   X>Y?
146   GTO 8
147   roll dn
148   roll dn   If no decision, generate spotter's estimate
149   -         of hour angle to shell hit.
150   3
151   0
152   ÷
153   4
154   RCL C
155   -
156   GSB 9
157  *LBL 5
158   X<0?
159   GTO 6
160   DSP 0
161   RND
162   STO 8     R8<- hour angle.
163   RCL 7
164   .
165   2         Generate up to 20% range error for each
166   ENTER     level of spotter incompetence.
167   4
168   RCL C
169   -
170   x
171   x
172   X=0?
173   GTO 3
174   GSB 9
175   RCL D
176  *LBL 3
177   X<=Y?
178   X<>Y
179   RCL 9
180   ÷
181   DSP 3
182   RND
183   RCL 8
184   +
185   DSP 4     Display and print hh.DDD feedback to gunner.
186   PRTX
187   RTN
188  *LBL 6
189   1         Patch to bring hour angle within clock numbers.
190   2
191   +
192   GTO 5
193  *LBL 9     Routine to generate soptter's estimate of "miss" data.
194   -
195   LST X
196   ENTER
197   +
198   GSB 0
199   +
200   RTN
201  *LBL 0     Random number generator.
202   RCL 0
203   9
204   9
205   7
206   x
207   FRAC
208   STO 0
209   x
210   RTN
```

Register Use

```R0  Seed
R1  Target N-S
R2  Target E-W
R3  Shell N-S
R4  Shell E-W
R7  Used
R8  Used
R9  Gun Range
B   SPEED
C   Spot Rating
D   KILL Range
I   Rounds Fired
```