v8rexx

v8.rexx

Rexx dilinde

/* 8 Queens */

m.=1

n=0

i=1

loop: do d=1 to i-1

j=i-d

if m.i=m.j then signal incm

if abs(m.i-m.j)=d then signal incm

end

inci: i=i+1

if i<9 then signal loop

n=n+1

say n': a'm.1' b'm.2' c'm.3' d'm.4' e'm.5' f'm.6' g'm.7' h'm.8

signal deci

incm: m.i=m.i+1

if m.i<9 then signal loop

m.i=1

deci: i=i-1

if i>0 then signal incm