Ad
  • Custom User Avatar
  • Custom User Avatar

    Because it would require the black ball twice potted in a single shot, it cannot be in 1 shot. I'll explain these rules in the challenge. I will not add restrictions. Theoretical breaks, for instance where all balls are potted in a single shot, will be included.

  • Custom User Avatar

    I like this setup. But I don't understand why the lowest break is 1 in your example. In theory, all 7 balls could be potted in one shot. Or do you want to restrict the maximum number of potted balls?

  • Custom User Avatar

    What do you guys think of this setup? A list of strings is given, representing the break. The user needs to find out which of all possible shot sequences results in the highest scoring break. Not only you need to think about how each next shot gets nominated, but also possible free balls and fouls. Potential penalty points awarded to your opponent are to be discarted from calculation.

    input = [ "black", "red", "black", "yellow", "green", "white", "brown" ]
    
    # highest scoring break: 14 points
    return [ ["black", "red"], ["black"], ["yellow"], ["green"], ["white", "brown"] ]
    
    # EXPLANATION:
    # shot #1: open with a free ball (black), pot the black and the last red ball on the table (+2), black gets respotted afterwards
    # shot #2: black (+7), gets respotted afterwards
    # shot #3: yellow (+2)
    # shot #4: green (+3)
    # shot #5: potted the brown, but the cue ball got potted too (+0)
    
    # COROLLARY
    
    # the lowest scoring break would be: 1 point
    return [ ["black"], ["red", "black", "yellow", "green", "white", "brown"] ]
    
    # EXPLANATION:
    # shot #1: open with a free ball (black) (+1), and it gets respotted afterwards
    # shot #2: you aimed at a color, but completely missed your shot
    #          6 balls, including the cue ball and respotted black ball got potted (+0)
    
  • Custom User Avatar

    I will ask for removal of this kata when you create a new one.

  • Custom User Avatar

    Ok, I'll create one.

  • Custom User Avatar

    I would prefer to get a new more comprehensive kata. This kata (C# only, 68% satisfaction) can be retired.

  • Custom User Avatar

    This challenge shows potential but has significant limitations. A more comprehensive and nuanced challenge about snooker breaks would greatly benefit the platform. Developing a replacement that captures the full complexity of snooker rules would be a valuable contribution. Should I have a go at creating a new challenge, aimed at replacing this one, or can this existing one be effectively resurrected and improved?

  • Custom User Avatar

    unless you like solution as this

  • Custom User Avatar

    Player class should be preloaded.

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    Not an issue

  • Custom User Avatar
  • Custom User Avatar

    The Pink test is already problem. The test waits for exception here. :(

  • Custom User Avatar
  • Loading more items...