Golf from Moscow.pm for everyone



    All with Friday! Following the results of the recent Moscow.pm meeting, I want to invite everyone to compete in solving the problem.

    Golf is a sports game in which individual participants or teams compete by driving a small ball into special holes with club strikes, trying to cover the allotted distance in the minimum number of strokes.
    Wikipedia

    The game I want to invite you to play is also called Golf. Its essence is to solve the problem for the minimum number of characters.

    Domino Challenge: on Github

    Domino is a game in the process of which a chain of knuckles (“bones”, “stones”) is built, touching in half with the same number of points. Thus, each knuckle is characterized by a pair of numbers, no matter in what order.
    Wikipedia

    Challenge. Find the longest possible ring, which can be made from the list of knuckles offered to you or print 0 if they cannot be looped.

    Input: A string of pairs of numbers from 0 to 6, separated by a space. Each pair is one knuckle.
    Example: 01 11 12 22 31 32
    Data is sent to STDIN: cat data | golf.pl
    Example of response: 11 12 22 23 31

    You can check the solution’s functionality with the attached test suite, so far only for perl (send your pool requests):
    prove test.pl

    The solution size can be calculated using the golfcount script. pl: Send
    perl golfcount.pl golf.pl

    solutions to dzirtik@gmail.comwith the theme "Golf 1410." The deadline for making decisions is October 31, 2014, 23.59. The solution can be in any programming language. For the best solutions, we have prepared prizes.

    Also popular now: