|
|
DataMuseum.dkPresents historical artifacts from the history of: Rational R1000/400 |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about Rational R1000/400 Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - download
Length: 3072 (0xc00)
Types: Ada Source
Notes: 03_class, FILE, R1k_Segment, e3_tag, package body Board_Management, seg_05814b
└─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000
└─⟦cfc2e13cd⟧ »Space Info Vol 2«
└─⟦this⟧
with Text_Io;
use Text_Io;
package body Board_Management is
procedure Set_Queen (Row, Col : in Integer) is
begin
Safe_Row (Row) := False;
Safe_Up_Diag (Row + Col) := False;
Safe_Down_Diag (Row - Col) := False;
Configuration (Col) := Row;
end Set_Queen;
procedure Remove_Queen (Row, Col : in Integer) is
Vacant : constant Integer := 0;
begin
Safe_Row (Row) := True;
Safe_Up_Diag (Row + Col) := True;
Safe_Down_Diag (Row - Col) := True;
Configuration (Col) := Vacant;
end Remove_Queen;
function Is_Safe (Row, Col : in Integer) return Boolean is
begin
return Safe_Row (Row) and then Safe_Up_Diag (Row + Col) and then
Safe_Down_Diag (Row - Col);
end Is_Safe;
procedure Display_Board is
subtype Disp_Range is Integer range 1 .. 4 * Board_Size + 1;
use Text_Io;
Line : String (Disp_Range);
Pos : Disp_Range;
begin
for Row in Row_Range loop
Put_Line ((Disp_Range => '-'));
Pos := 1;
for Col in Col_Range loop
if Configuration (Col) = Row then
Line (Pos .. Pos + 3) := "| Q ";
else
Line (Pos .. Pos + 3) := "| ";
end if;
Pos := Pos + 4;
end loop;
Line (Pos) := '|';
Put_Line (Line);
end loop;
Put_Line ((Disp_Range => '-'));
end Display_Board;
begin
-- Clear the board
Safe_Row := (Row_Range => True);
Safe_Up_Diag := (Up_Diag_Range => True);
Safe_Down_Diag := (Down_Diag_Range => True);
end Board_Management;
nblk1=2
nid=0
hdr6=4
[0x00] rec0=21 rec1=00 rec2=01 rec3=004
[0x01] rec0=1a rec1=00 rec2=02 rec3=001
tail 0x2176572f087e05333b9d7 0x42a00088462060003