fork download
  1. program eightqueen1;
  2. var i : integer;
  3. q : boolean;
  4. a : array[ 1 .. 8] of boolean;
  5. b : array[ 2 .. 16] of boolean;
  6. c : array[ -7 .. 7] of boolean;
  7. d : array[ 1 .. 8] of integer;
  8.  
  9.  
  10. procedure try( i : integer; var q : boolean); var j : integer; begin j := 0;
  11. repeat j := j + 1; q := false;
  12. if a[ j] and b[ i + j] and c[ i - j] then
  13. begin x[ i] := j;
  14. a[ j] := false; b[ i + j] := false; c[ i - j] := false;
  15. if i < 8 then
  16. begin try( i + 1, q);
  17. if not q then
  18. begin a[ j] := true; b[ i + j] := true; c[ i - j] := true;
  19. end
  20. end else q := true
  21. end
  22. until q or (j = 8);
  23.  
  24. end; begin for i := 1 to 8 do a[ i] := true; for i := 1 to 8 do b[ i] := true; for i := -7 to 7 do c[ i] := true; try( 1, q); if q then
  25. for i := 1 to 8 do write( x[ i]:4);
  26. writeln end.
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.pas: In procedure `try':
prog.pas:13: error: undeclared identifier `x' (first use in this routine)
prog.pas:13: error:  (Each undeclared identifier is reported only once
prog.pas:13: error:  for each routine it appears in.)
prog.pas: In main program:
prog.pas:25: error: undeclared identifier `x' (first use in this routine)
stdout
Standard output is empty