Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re^2: The Perl 6 Coding Contest 2012

by moritz (Cardinal)
on Dec 24, 2012 at 21:21 UTC ( #1010234=note: print w/ replies, xml ) Need Help??


in reply to Re: The Perl 6 Coding Contest 2012
in thread The Perl 6 Coding Contest 2012

I'm pretty sure it means that you can't cross the wires (0, 1) and (1, 2) at once, just (0, 1) and (2, 3):

# allowed: 0 _ _ 1 \/ 1 _/\_ 0 2 _ _ 3 \/ 3 _/\_ 2 # disallowed, ambiguous: 0 _ _ 1 \/ 1 _/\_ 0 \/ 2 _/\ _ 3


Comment on Re^2: The Perl 6 Coding Contest 2012
Download Code
Re^3: The Perl 6 Coding Contest 2012
by BrowserUk (Pope) on Dec 24, 2012 at 23:11 UTC

    Hm. To me, that was clearly not an option.

    My doubt centers around this:

    0 _ _ 3 \ / 1 _ \ / _ 4 \ \/ / 2 __\/\/__ 2 /\/\ 3 _/ /\ \_ 0 / \ 4 _/ \_ 1

    The crossovers between: the 0 & 3 wires; and the 1 & 4 wires are "vertically adjacent". Ie. As close together vertically as two crossovers can be. It also means that the striaght through 2 wire has a large break which cannot be filled, leaving its continuity unclear.

    Both of these things can be addressed like this:

    0 ___ ___ 3 \ / 1 _ \/ _ 4 \ /\ / 2 __\/__\/__ 2 /\ /\ 3 _/ \/ \_ 0 /\ 4 ___/ \___ 1

    This makes for a much clearer diagram, but that means that all the crossovers are 'on the wire lines' rather than between them. It also may be seen to contravene the "It is considered elegant not to make the grid wider than it has to be." rule.

    So maybe it would need to be something like:

    0 _____ _____ 3 \/ 1 _ /\ _ 4 \ / \ / 2 __\/____\/__ 2 /\ /\ 3 _/ \ / \_ 0 \/ 4 _____/\_____ 1

    But that still leaves some crossovers occurring on wire lines rather than between them. So maybe:

    0 _____ _____ 3 \/ 1 ___ /\ ___ 4 \/ \/ 2 __ /\__/\___ 2 / \/ \ 3 _/ /\ \_ 0 / \ 4 ___/ \___ 1

    The 2 line sucks and it destroys the natural symmetry, but it more clearly complies with the rules -- except perhaps the no wider than necessary. Unless it is necessary to be that wide in order to comply with the other rules :)

    It is an interesting programming problem, but it would suck to implement a brilliant solution, only to be failed because the problem description was ambiguous.


    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.

    RIP Neil Armstrong

    Science is about questioning the status quo. Questioning authority
      0 _ _ 3 \ / 1 _ \ / _ 4 \ \/ / 2 __\/\/__ 2 /\/\ 3 _/ /\ \_ 0 / \ 4 _/ \_ 1

      That's not an option. Crossing have to be pairwise, I.e if 0 crosses over to 1, 1 must also cross over to 0. So you have to wire it as

      0 _____ _____ 3 \/ 1 ___ /\ ___ 4 \/ \/ 2 _ /\ /\ _ 2 \/ \/ \/ 3 _/\ /\ /\_ 0 \/ \/ 4 ___/\__/\___ 1

      Think of it as physical wires, and all you can do is to exchange two adjacent wires.

      I'll point masak to this thread so he can object if I wrote something wrong.

        Crossing have to be pairwise,

        Sorry, but that contradicts masak's second and third examples (I think!).


        With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        "Science is about questioning the status quo. Questioning authority".
        In the absence of evidence, opinion is indistinguishable from prejudice.
Re^3: The Perl 6 Coding Contest 2012
by masak (Scribe) on Dec 25, 2012 at 22:56 UTC

    Yep, moritz has it right.

    Think of it like this. The fundamental operation is "exchange wires N and N+1". This is depicted graphically with a single crossing between two adjacent wires. You're allowed to put several of these fundamental operations in the same column, provided no two operations in the same column act on the same wire.

      Ignoring questions of optimality, is this legal? (If not, which rule(s) does it violate?)

      0 _____ _____ 3 \/ 1 ___ /\ _ 4 \/ \/\/ 2 _ /\ /\/\_ 2 \/ \/ /\ 3 _/\__/\/ \_ 0 /\ 4 _____/ \___ 1

      With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.
        Each cell of the grid is either empty … or a crossing

        The visualisation of the examples use a character grid but their crossings are not atomic (i.e. characters) but 2x2 sprites. In your last graph you shifted 2 of those (those nearest to the lower right corner) half a grid cell, so that is no longer a rectangular grid.

        Using just 1 character for each atomic cell, an _ for a pass through and an X for a crossing and transliterating O. K. examples we saw in this thread in this way (the "wire" goes on the base line of the number):

        0 1 1X0 2 3 3X2
        0 ________1 1X _______2 2_X ______3 3__X _____4 4___X ____5 5____X ___6 6_____X __7 7______X _8 8_______X 9 9________X0
        0__ __3 1_ X _4 2 X X 2 3X X X0 4_X_X_1

        Due to the half cell shifts in your graphs, none of those can be displayed in this way.


        Update: On reviewing, also in this type of graph a crossing is an X in one cell, but also an empty cell above (mandatory, because otherwise would be an incorrect wiring). So the original constraint formulation ("each cell is one of 2 types") seems indeed not totally fitting.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (8)
As of 2014-08-20 17:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (121 votes), past polls