$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"); ?> Puzzle Machina - Crossword Puzzle Generator

Welcome to Puzzle Machina

a crossword puzzle generator

Crossword may take a few seconds to generate...

'; for ($y = 0; $y < $height; $y ++) { echo ''; for ($x = 0; $x < $width; $x ++) { if ($solution_grid[$width * $y + $x] == ' ') { // black square echo ""; } else { // letter square $square = $grid[$width * $y + $x]; echo ""; } } echo "\r\n"; } //echo ''; function numbers($str) { $tokens = explode(" ", $str); $retval = ""; foreach($tokens as $token) { $retval .= strlen($token).', '; } return rtrim($retval, ', '); } $events = 'onmouseover="this.style.backgroundColor=\'#99FF00\'; this.style.cursor=\'pointer\';" onmouseout="this.style.backgroundColor=\'transparent\'; this.style.cursor=\'auto\';"'; // find clues across for ($i = 0; $i < count($clues_across); $i ++) { $la = explode('|', $clues_across[$i]); $clue_text = rtrim($clues[$la[0]]); $clues_across[$i] = ''.$la[4].') '.''.$clue_text.' ('.numbers(rtrim($words[$la[0]])).')'.""; } // find clues down for ($i = 0; $i < count($clues_down); $i ++) { $la = explode('|', $clues_down[$i]); $clue_text = rtrim($clues[$la[0]]); $clues_down[$i] = ''.$la[4].') '.''.$clue_text.' ('.numbers(rtrim($words[$la[0]])).')'.""; } ?>
"; if ($square != '') { // square with a number (ID) echo ''.$square.""; } else { // hack to keep cells the same width echo ""; } echo ''; echo "
Puzzle Machine

(genre)

(width and height)

Clues across
"; ?>
Clues down
"; ?>

Copyright © 2006 - 2024 XZIST.org | Information