Quellcode-Bibliothek
© Kompilation durch diese Firma
[Weder Korrektheit noch Funktionsfähigkeit der Software werden zugesichert.]
Datei:
pebbles.cob
Sprache: Unknown
identification division.
program-id. pebbles.
author. "Reisig/ PN Newsletter 10-05 p. 3".
* ursprünglich von E. W. Diijkstra
date-written. 22.11.2005.
date-compiled.
data division.
working-storage section.
77 b pic 9(4).
77 w pic 9(4).
linkage section.
77 BB pic 9(4).
77 WW pic 9(4).
procedure division using BB WW.
* computes solutions for the pebble game
move BB to b
move WW to w
perform until false
if w>=1 and b>=1
subtract 1 from b
else if b>=2 then
subtract 1 from b
else if w>=2 then
subtract 2 from w
add 1 to b
end-if end-if end-if
end-perform.
display "b="b" w="w.
end-program pebbles.
[ Verzeichnis aufwärts0.25unsichere Verbindung
Übersetzung europäischer Sprachen durch Browser
]
|
|