$str = $_GET['genre'].'|'.$_GET['w'].'|'.$_GET['h']; include "cross.php"; $MIN_SIZE = 1; $MAX_SIZE = 25; $DEF_WIDTH = 12; $DEF_HEIGHT = 12; $START_YEAR = 2006; function safe_number($num) { if ($num == NULL) return false; global $MIN_SIZE; if ( (int)$num < $MIN_SIZE) return false; global $MAX_SIZE; if ( (int)$num > $MAX_SIZE) return false; return true; } $genres = file('genre.txt'); $genre = (int)$_GET['genre']; if ($genre == NULL || $genre < 0 || $genre >= count($genres)) { $genre = 0; } $wordfile = 'data/'.rtrim($genres[$genre]).'.words.txt'; $cluefile = 'data/'.rtrim($genres[$genre]).'.clues.txt'; $width = $DEF_WIDTH; $height = $DEF_HEIGHT; if (safe_number($_GET['w'])) { $width = (int)$_GET['w']; } if (safe_number($_GET['h'])) { $height = (int)$_GET['h']; } $length = $width * $height; $solution_grid; $word_data; $clues_across; $clues_down; header("Content-type: text/html; charset=utf-8"); ?>
ob_flush(); flush(); ?>
$words_used = make_crossword($wordfile, $solution_grid, $word_data, $clues_across, $clues_down, $width, $height);
$words = file($wordfile);
$clues = file($cluefile);
// fill grid with ID numbers
$grid = array_fill(0, $width * $height, '');
foreach ($word_data as $w) {
$la = explode('|', $w);
$grid[$width * $la[2] + $la[1]] = $la[4];
}
?>
|
|
||||
Clues across // Render clues across foreach ($clues_across as $c) echo $c." "; ?> |
Clues down // Render clues down foreach ($clues_down as $c) echo $c." "; ?> |
Copyright © 2006 - 2024 XZIST.org | Information