Skip to content
This repository has been archived by the owner on Jan 1, 2021. It is now read-only.

Commit

Permalink
Do not allow using same word number cell
Browse files Browse the repository at this point in the history
  • Loading branch information
laurynas committed Jan 26, 2011
1 parent b5da070 commit 9cea2d2
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 17 deletions.
2 changes: 1 addition & 1 deletion demo.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
<? endforeach; ?>
</select>

Colors:
Debug:
<input type="checkbox" name="colors" value="1" <? if (!empty($_REQUEST['colors'])) echo 'checked'; ?> />

Big blocks?:
Expand Down
12 changes: 1 addition & 11 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,20 +53,10 @@
<li>Colored debugging</li>
</ul>

<h3>TODO</h3>

<ul>
<li>API Documentation</li>
<li>Installation instructions</li>
<li>Client Java Applet</li>
<li>More databases support...</li>
</ul>


<hr size="1" />

&copy; Laurynas Butkus (laurynas.butkus at gmail.com), 2005


</body>
</html>
</html>
2 changes: 1 addition & 1 deletion lib/php_crossword.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -811,4 +811,4 @@ function generateFromWords($words_list)
}

}
?>
?>
16 changes: 12 additions & 4 deletions lib/php_crossword_grid.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,13 @@ function placeWord($word, $x, $y, $axis)
{
$s = $x;
$c =& $cx;
$t =& $cy;
}
else
{
$s = $y;
$c =& $cy;
$t =& $cx;
}

// dump( "PLACING WORD: $cx x $cy - {$w->word}" );
Expand All @@ -139,15 +141,21 @@ function placeWord($word, $x, $y, $axis)
// disable cell before first cell
$c = $s - 1;
if ($c >= 0 )
$this->cells[$cx][$cy]->setCanCross(PC_AXIS_BOTH, FALSE);
$this->cells[$cx][$cy]->setCanCross(PC_AXIS_BOTH, FALSE);

$this->cells[$cx][$cy]->number = $w->inum; // sandy addition

// disable cell after first cell
// disable cell after last cell
$c = $s + strlen($word);
if (is_object($this->cells[$cx][$cy]))
$this->cells[$cx][$cy]->setCanCross(PC_AXIS_BOTH, FALSE);
$this->cells[$cx][$cy]->setCanCross(PC_AXIS_BOTH, FALSE);

// avoid starting "corner word" - which would use the same
// number cell as this word
$c = $s - 1;
$t = $t + 1;
if ($c >= 0 && is_object($this->cells[$cx][$cy]))
$this->cells[$cx][$cy]->setCanCross(PC_AXIS_BOTH, FALSE);
}

/**
Expand Down Expand Up @@ -387,4 +395,4 @@ function getHTML($params = array())
return $html;
}
}
?>
?>

0 comments on commit 9cea2d2

Please sign in to comment.