Peaceful chess queen armies: Difference between revisions

Line 2,586:
There are two Fortran programs and a driver script. One program generates a Fortran module for basic operations; the other program (which must be linked with the generated module) does the actual work. The driver script is for Unix shell.
 
For speed, armies are represented by 64-bit or 128-bit integers, depending on the value of n. A 1-bit represets a queen. Rotations and reflections of the board are elemental integer operations on an army. Checking for any attacks is an elemental integer-to-boolean operation on the two armies (though the program detects rook-like attacks by a different mechanism). Equivalence under interchange of the colors can be tested by reversing which army gets which integer value.
Here is the first program, '''peaceful_queens_elements_generator.f90''', which generates code to deal with the representations of the armies as integers:
 
Here is the first program, '''peaceful_queens_elements_generator.f90''', which generates code (specialized for given m and n) to deal with the representations of the armies as integers:
<lang fortran>program peaceful_queens_elements_generator
use, intrinsic :: iso_fortran_env, only: int64
1,448

edits