best of
list
buy
there
myself


blog
text
image
code
puzzles
flame

 

C

CODE


Wolves versus Sheep -- the eternal struggle continues. This code attempts to generate a square in which a given number of wolves are unable to attack a given number of sheep. For example:
    S S . . .     |  wvs -b 5 -s 3 -w 5
    . . . W W     |
    . . . . W     |
    S . . . .     |
    . . W W .     |
    --------------+--------------------
    S . S S . .   |  wvs -b 6 -s 5 -w 6
    . . . . . W   |
    S . S . . .   |
    . . . . W .   |
    . W . . . W   |
    . W . . W .   |
    --------------+--------------------
    S . .         |  wvs -b 3 -s 1 -w 2
    . . W         |
    . W .         |
    --------------+--------------------
    Can't do it.  |  wvs -b 3 -s 2 -w 2
    
Here's a bit of geeky code which attempts to generate a 6x6 Euler square. Damn it, if I can't take the time to find a proof that no such square exists, I'll exhaustively prove it to myself through brute force.

 
 copyright 1994-2008 John Toomey