Code Golf

Discussion in 'Forum Games' started by TheDiamondPicks, Nov 4, 2016.

?

Is the last response on this thread the shortest possible version

  1. Yes

    0 vote(s)
    0.0%
  2. Not yet voted [If you don't believe it is]

    100.0%
  1. TheDiamondPicks

    TheDiamondPicks Rank.MODERATOR.toString() Staff Member Moderator

    Messages:
    2,140
    Likes Received:
    3,368
    Minecraft:
    TheDiamondPicks
    Hello,

    So some of you may have heard of code golf before, it is basically working to get a piece of code as short as possible. So some of you are experienced programmers, and will find this easy, and others are people with little or no experience, which is great!

    So a few ground rules before we start:
    • If you believe a piece of code is a short as possible, then vote in the poll. Once the poll reaches 7 votes a new piece of code may be created.
    • Once you have noticed a post has reached 7 votes, feel free to post some more code, however these is some criteria:
      • There is no limit to how difficult it can be, but remember challenging is fun, almost impossible isn't.
      • The piece of code you post, must not be impossible to shorten.
      • You may use any language, just do [code]// Language Name code here[/code], just make sure it isn't *too* obscure.
    • Make sure that you use [code] code tags (not essential).
    • You also don't need things like class names etc.
    • Use http://www.lettercount.com/ or something like that to get the amount of characters.
    Code:
    // Java
    System.out.println(27);
    System.out.println(24);
    System.out.println(21);
    System.out.println(18);
    System.out.println(15);
    System.out.println(12);
    System.out.println(9);
    System.out.println(6);
    189 Characters (not including the comment)
    Nice 'n simple

    thanks Zackkyy for reminding me about code golf
     
    TheMint, Zackery and Sakujo like this.
  2. TheDiamondPicks

    TheDiamondPicks Rank.MODERATOR.toString() Staff Member Moderator

    Messages:
    2,140
    Likes Received:
    3,368
    Minecraft:
    TheDiamondPicks
    erm
    I may have not explained this well. You need to shorten the already posted code, until it cannot be done further. My original code is still the target.
     
    Sakujo likes this.
  3. TheMint

    TheMint Former Mod+ Donator

    Messages:
    6,175
    Likes Received:
    15,888
    Minecraft:
    TheMint
    Haven't done Python in a really long time but why not?
    Code:
    // Python
    i = 27
    while i >= 6:
        print i
        i -=3
    
     
    Last edited: Nov 4, 2016
    TheDiamondPicks likes this.