Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^4: Sudoku puzzles solved using Regular Expressions

by ikegami (Pope)
on Jun 30, 2005 at 05:42 UTC ( #471226=note: print w/ replies, xml ) Need Help??


in reply to Re^3: Sudoku puzzles solved using Regular Expressions
in thread Sudoku puzzles solved using Regular Expressions

Yeah, there are diminishing returns to adding more shortcuts.

Technically, $grid_v is not needed at all.

return if index(substr($grid_v, $x*$size, $size), $n) >= 0;

can be written as

foreach my $y_ (0 .. $size-1) { return if substr($grid_h, $y_*$size+$x, 1) eq $n; }

I just thought the former would be faster, even though we must constantly make copies of $grid_v in addition to $grid_h.


Comment on Re^4: Sudoku puzzles solved using Regular Expressions
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://471226]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (6)
As of 2015-07-05 03:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (60 votes), past polls