#! /usr/bin/env perl # Write a chess board in IFM format. @pieces = ("Rook", "Knight", "Bishop", "Queen", "King", "Bishop", "Knight", "Rook"); # Print header. print <= 7) { $piece = "Black "; $piece .= ($row == 8 ? $pieces[$col - 1] : "Pawn"); } else { undef $piece; } print " item \"$piece\";\n" if $piece; # Link room with others below it. $rooms[$row][$col] = $tag; for ($i = -1; $i <= 1; $i++) { $other = $rooms[$row - 1][$col + $i]; print " link last to $other;\n" if $other; } } }