identification division.
program-id. schach.
* aus Univalg - Beispiel zu Relationen
* die eine Äquivalenz modulo ... definieren
* Februar 2011
author. JD.
date-written. 6.2.2011.
date-compiled.
data division.
working-storage section.
77 white value 1.
77 black value 2.
77 sumrc pic 9(4).
linkage section.
01 chessfield.
05 r pic 9(4).
05 c pic 9(4).
77 color pic 9(4).
77 neighbours pic 9(4).
77 rplusc pic 9(4).
77 keyofrc pic 9(4)V9(4).
procedure division using chessfield
color
rplusc
keyofrc.
perform fieldcolor.
perform numberneighbours.
compute rplusc=r+c.
compute keyofrc=r-1/c.
stop run.
*
fieldcolor.
add r c giving sumrc.
if function mod(sumrc,2)=0 then
move white to color
else
move black to color
numberneighbours.
if (r=1 or r=8) and (c=1 or c=8) then
move 3 to neighbours
else if r=1 or r=8 or c=1 or c=8 then
move 5 to neighbours
else
move 8 to neighbours
end-program schach.
¤ Dauer der Verarbeitung: 0.24 Sekunden
(vorverarbeitet)
¤
|
Haftungshinweis
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.
|