Box the compass: Difference between revisions
Content added Content deleted
Recombinant (talk | contribs) m (→{{header|Zig}}: Updated to use 0.11.0 enum casts) |
(Added various BASIC dialects (Chipmunk Basic, GW-BASIC, MSX Basic and Quite BASIC))) |
||
Line 1,259: | Line 1,259: | ||
354.37 32 North by west |
354.37 32 North by west |
||
354.38 1 North</pre> |
354.38 1 North</pre> |
||
==={{header|Chipmunk Basic}}=== |
|||
{{works with|Chipmunk Basic|3.6.4}} |
|||
<syntaxhighlight lang="qbasic">100 dim names$(31) |
|||
110 restore 300 |
|||
120 for c = 0 to ubound(names$) |
|||
130 read a$ |
|||
140 names$(c) = a$ |
|||
150 next c |
|||
160 dim degrees(32) |
|||
170 restore 380 |
|||
180 for c = 0 to ubound(degrees) |
|||
190 read b |
|||
200 degrees(c) = b |
|||
210 next c |
|||
220 for i = 0 to ubound(degrees) |
|||
230 j = int((degrees(i)+5.625)/11.25) |
|||
240 if j > 31 then j = j-32 |
|||
250 print using "####.##";degrees(i); |
|||
260 print using " ## ";j; |
|||
270 print names$(j) |
|||
280 next i |
|||
290 end |
|||
300 data "North","North by east","North-northeast","Northeast by north" |
|||
310 data "Northeast","Northeast by east","East-northeast","East by north" |
|||
320 data "East","East by south","East-southeast","Southeast by east" |
|||
330 data "Southeast","Southeast by south","South-southeast","South by east" |
|||
340 data "South","South by west","South-southwest","Southwest by south" |
|||
350 data "Southwest","Southwest by west","West-southwest","West by south" |
|||
360 data "West","West by north","West-northwest","Northwest by west","Northwest" |
|||
370 data "Northwest by north","North-northwest","North by west","North" |
|||
380 data 0,16.87,16.88,33.75,50.62,50.63,67.5,84.37,84.38,101.25 |
|||
390 data 118.12,118.13,135,151.87,151.88,168.75,185.62,185.63,202.5,219.37 |
|||
400 data 219.38,236.25,253.12,253.13,270,286.87,286.88,303.75,320.62,320.63 |
|||
410 data 337.5,354.37,354.388</syntaxhighlight> |
|||
{{out}} |
|||
<pre>Same as FreeBASIC entry.</pre> |
|||
==={{header|GW-BASIC}}=== |
|||
{{works with|PC-BASIC|any}} |
|||
{{works with|BASICA}} |
|||
{{works with|Chipmunk Basic}} |
|||
{{works with|QBasic}} |
|||
{{works with|MSX BASIC}} |
|||
<syntaxhighlight lang="qbasic">100 dim n$(31) |
|||
110 restore 300 |
|||
120 for c = 0 to 31 |
|||
130 read a$ |
|||
140 n$(c) = a$ |
|||
150 next c |
|||
160 dim d(32) |
|||
170 restore 380 |
|||
180 for c = 0 to 32 |
|||
190 read b |
|||
200 d(c) = b |
|||
210 next c |
|||
220 for i = 0 to 32 |
|||
230 j = int((d(i)+5.625)/11.25) |
|||
240 if j > 31 then j = j-32 |
|||
250 print using "####.##";d(i); |
|||
260 print using " ## ";j; |
|||
270 print n$(j) |
|||
280 next i |
|||
290 end |
|||
300 data "North","North by east","North-northeast","Northeast by north" |
|||
310 data "Northeast","Northeast by east","East-northeast","East by north" |
|||
320 data "East","East by south","East-southeast","Southeast by east" |
|||
330 data "Southeast","Southeast by south","South-southeast","South by east" |
|||
340 data "South","South by west","South-southwest","Southwest by south" |
|||
350 data "Southwest","Southwest by west","West-southwest","West by south" |
|||
360 data "West","West by north","West-northwest","Northwest by west","Northwest" |
|||
370 data "Northwest by north","North-northwest","North by west","North" |
|||
380 data 0,16.87,16.88,33.75,50.62,50.63,67.5,84.37,84.38,101.25 |
|||
390 data 118.12,118.13,135,151.87,151.88,168.75,185.62,185.63,202.5,219.37 |
|||
400 data 219.38,236.25,253.12,253.13,270,286.87,286.88,303.75,320.62,320.63 |
|||
410 data 337.5,354.37,354.38</syntaxhighlight> |
|||
{{out}} |
|||
<pre>Same as FreeBASIC entry.</pre> |
|||
==={{header|MSX Basic}}=== |
|||
{{works with|MSX BASIC|any}} |
|||
The [[#GW-BASIC|GW-BASIC]] solution works without any changes. |
|||
==={{header|Quite BASIC}}=== |
|||
{{works with|BASICA}} |
|||
{{works with|Chipmunk Basic}} |
|||
<syntaxhighlight lang="qbasic">100 array n$ |
|||
110 for c = 0 to 31 |
|||
120 read a$ |
|||
130 let n$(c) = a$ |
|||
140 next c |
|||
150 array d |
|||
160 for c = 0 to 33 |
|||
170 read b |
|||
180 let d(c) = b |
|||
190 next c |
|||
200 for i = 1 to 33 |
|||
210 let j = int((d(i)+5.625)/11.25) |
|||
220 if j > 31 then let j = j-32 |
|||
230 print d(i);" ";j;" ";n$(j) |
|||
240 next i |
|||
250 end |
|||
260 data "North","North by east","North-northeast","Northeast by north" |
|||
270 data "Northeast","Northeast by east","East-northeast","East by north" |
|||
280 data "East","East by south","East-southeast","Southeast by east" |
|||
290 data "Southeast","Southeast by south","South-southeast","South by east" |
|||
300 data "South","South by west","South-southwest","Southwest by south" |
|||
310 data "Southwest","Southwest by west","West-southwest","West by south" |
|||
320 data "West","West by north","West-northwest","Northwest by west","Northwest" |
|||
330 data "Northwest by north","North-northwest","North by west","North" |
|||
340 data 0,16.87,16.88,33.75,50.62,50.63,67.5,84.37,84.38,101.25 |
|||
350 data 118.12,118.13,135,151.87,151.88,168.75,185.62,185.63,202.5,219.37 |
|||
360 data 219.38,236.25,253.12,253.13,270,286.87,286.88,303.75,320.62,320.63 |
|||
370 data 337.5,354.37,354.38</syntaxhighlight> |
|||
{{out}} |
|||
<pre>Same as FreeBASIC entry.</pre> |
|||
=={{header|Befunge}}== |
=={{header|Befunge}}== |
||
<syntaxhighlight lang="befunge">>>::"}"9**\4+3%79*9*5-*79*9*5--+:5>>>06p:55+%68*+v |
<syntaxhighlight lang="befunge">>>::"}"9**\4+3%79*9*5-*79*9*5--+:5>>>06p:55+%68*+v |