Forum Home
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Popular

    The First Drunken Code Contest (Java) - Win 10 FTC \[FINISHED\]

    Off-Topic
    10
    26
    6904
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • ChekaZ
      ChekaZ last edited by

      Its an awesome code which prints out awesome stuff if you dont forgett to put in the numbers, cause you are a number nazi and you dont like if the user doesnt put in numbers :D - btw do her! ;)

      BTC: 1Ges1taJ69W7eEMbQLcmNGnUZenBkCnn45
      FTC: 6sxjM96KMZ7t4AmDTUKDZdq82Nj931VQvY

      1 Reply Last reply Reply Quote 0
      • A
        adamstgbit last edited by

        1.
        reads in user input 1 line at a time, until user enters nothing.

        prints it out the list of number separated by commas

        sorts the numbers ( i think …??? )

        prints it out the sorted list

        2. magicly

        3. using a sort function

        1 Reply Last reply Reply Quote 0
        • F
          futureproof Regular Member last edited by

          “public class ImASexGod”

          Ha. ;D

          Have you forgotten to declare “swapWith” as a variable?

          1 Reply Last reply Reply Quote 0
          • K
            Kevlar Spammer last edited by

            [quote name=“adamstgbit” post=“48244” timestamp=“1388332754”]
            1.
            reads in user input 1 line at a time, until user enters nothing.

            prints it out the list of number separated by commas

            sorts the numbers ( i think …??? )

            prints it out the sorted list

            2. magicly

            3. using a sort function
            [/quote]

            0 points awarded for an incomplete answer! The answer is not magically, and substitute code isn’t provided. Keep trying!

            1 Reply Last reply Reply Quote 0
            • K
              Kevlar Spammer last edited by

              [quote name=“futureproof” post=“48247” timestamp=“1388334971”]
              “public class ImASexGod”

              Ha. ;D

              Have you forgotten to declare “swapWith” as a variable?
              [/quote]

              It was a typo, and had you fixed it you would have gotten the 5 FTC! But alas, I fixed it.

              1 Reply Last reply Reply Quote 0
              • T
                Tuck Fheman last edited by

                [code]public class ImASexGod {
                private static final Random RANDOM = new Random();[/code]

                This searches match.com for random chicks.

                [code] do{//her
                try {//it once
                input = br.readLine();[/code]

                Obviously code from GT5 where you do her in the breadline.

                [code] System.out.print(“Enter numbers until you’re awesome.”);[/code]

                Time waster routine for when there’s no hot chicks.

                [code] if (!input.equals(“”)) System.out.println(“Only numbers are allowed. I’m a number nazi.”);[/code]

                Tricky age verification to ensure 18+.

                [code] while (isBetterBest(doubleList) < doubleList.getItemCount()){
                List newlist = createSomething(doubleList);[/code]

                Create list of hot qualifying women found in search.

                [code] if (isBetterBest(doubleList)

                1 Reply Last reply Reply Quote 0
                • F
                  futureproof Regular Member last edited by

                  Haha. Brilliant!

                  1 Reply Last reply Reply Quote 0
                  • B
                    BikerGSX Regular Member last edited by

                    Damn-Blast! I should have got that one :'(

                    1 Reply Last reply Reply Quote 0
                    • T
                      Tuck Fheman last edited by

                      Did I win? :P

                      1 Reply Last reply Reply Quote 0
                      • K
                        Kevlar Spammer last edited by

                        [quote name=“Tuck Fheman” post=“48271” timestamp=“1388345646”]
                        Did I win? :P
                        [/quote]

                        No. But I liked your answer enough to give you a rep.

                        1 Reply Last reply Reply Quote 0
                        • D
                          DARKANGEL6415 Regular Member last edited by

                          nice

                          1 Reply Last reply Reply Quote 0
                          • T
                            Tuck Fheman last edited by

                            [quote name=“Kevlar” post=“48316” timestamp=“1388363730”]
                            [quote author=Tuck Fheman link=topic=6453.msg48271#msg48271 date=1388345646]
                            Did I win? :P
                            [/quote]

                            No. But I liked your answer enough to give you a rep.
                            [/quote]

                            How long until Rep’s are on Cryptsy?

                            1 Reply Last reply Reply Quote 0
                            • A
                              adamstgbit last edited by

                              [quote name=“Tuck Fheman” post=“48324” timestamp=“1388370010”]
                              [quote author=Kevlar link=topic=6453.msg48316#msg48316 date=1388363730]
                              [quote author=Tuck Fheman link=topic=6453.msg48271#msg48271 date=1388345646]
                              Did I win? :P
                              [/quote]

                              No. But I liked your answer enough to give you a rep.
                              [/quote]

                              How long until Rep’s are on Cryptsy?
                              [/quote]

                              less long then someone winning this thing

                              I got 0 points
                              0!
                              * hang head in shame *

                              is the answer for #2 bubble sort?

                              is it sorting the numbers? i can’t tell the code is purposely confusing

                              *tries to read the “createSomething()” method*

                              :o

                              OH F THIS.

                              ;D

                              1 Reply Last reply Reply Quote 0
                              • K
                                Kevlar Spammer last edited by

                                [quote name=“adamstgbit” post=“48329” timestamp=“1388372067”]
                                is the answer for #2 bubble sort?
                                [/quote]

                                Nope.

                                [quote]
                                is it sorting the numbers? i can’t tell the code is purposely confusing
                                [/quote]

                                Well I was drunk when I wrote it! Why don’t you run the code and find out?

                                1 Reply Last reply Reply Quote 0
                                • D
                                  delimitri last edited by

                                  [quote name=“Kevlar” post=“48193” timestamp=“1388323454”]
                                  Welcome! I’m drunk, and writing code. I’ll give 10 FTC to the first person who can tell me the following:

                                  1. What does this code do?
                                  2. How does it do it?
                                  3. How would I do this if I was sotally tober?

                                  [code]
                                  package totally.awesome;

                                  import java.awt.List;
                                  import java.io.BufferedReader;
                                  import java.io.IOException;
                                  import java.io.InputStreamReader;
                                  import java.util.Random;

                                  import org.joda.time.DateTime;
                                  import org.joda.time.Interval;

                                  public class ImASexGod {
                                  private static final Random RANDOM = new Random();

                                  public static void main(String[] args) {

                                  List doubleList = new java.awt.List();

                                  System.out.print(“Enter numbers until you’re awesome.”);

                                  // open up standard input
                                  BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

                                  String input = null;

                                  do{//her
                                  try {//it once
                                  input = br.readLine();
                                  } catch (IOException ioe) {
                                  System.out.println(“Dude, that’s not awesome!”);
                                  System.exit(1);
                                  }

                                  try {//it you’ll like it
                                  double d = Double.parseDouble(input);
                                  doubleList.add(input);
                                  } catch (NumberFormatException e) {
                                  if (!input.equals(“”)) System.out.println(“Only numbers are allowed. I’m a number nazi.”);
                                  }

                                  } while (!input.equals(“”));

                                  printCurrentListAndStuff(doubleList);

                                  while (isBetterBest(doubleList) < doubleList.getItemCount()){
                                  List newlist = createSomething(doubleList);

                                  //oh man this is awesome
                                  //this must be where the awesome happens
                                  if (isBetterBest(doubleList)

                                  1 Reply Last reply Reply Quote 0
                                  • zerodrama
                                    zerodrama Regular Member last edited by

                                    Too tired right now, but obviously it’s a number snorter and it has lines of code.

                                    Back soon.

                                    1 Reply Last reply Reply Quote 0
                                    • K
                                      Kevlar Spammer last edited by

                                      And ZD WINS!!! Congrats. Very well done.

                                      One might call this a Monte-Carlo sort. It uses evolution to arrive at a perfectly sorted list by following this algorithm:

                                      1. Get a list of numbers.
                                      2. Randomly reorder the numbers in the list.
                                      3. See if this list is “more” sorted than the last one.
                                      4. If it’s perfectly sorted, we’re done.
                                      5. If it’s better, use it as the new list, and go to step 2.
                                      6. If it’s worse, throw it out and go back to step 2.

                                      This is, obviously, highly inefficient and a huge waste of time and code to accomplish something that could be done using a lot less work.

                                      The correct code to do this, as ZD correctly pointed out is with the one line of code: Collections.sort(list)

                                      FTC will be sent tonight. Stay tuned for the next Drunken Coding Challenge!

                                      1 Reply Last reply Reply Quote 0
                                      • D
                                        delimitri last edited by

                                        [quote name=“Kevlar” post=“48454” timestamp=“1388430164”]
                                        And ZD WINS!!! Congrats. Very well done.

                                        One might call this a Monte-Carlo sort. It uses evolution to arrive at a perfectly sorted list by following this algorithm:

                                        1. Get a list of numbers.
                                        2. Randomly reorder the numbers in the list.
                                        3. See if this list is “more” sorted than the last one.
                                        4. If it’s perfectly sorted, we’re done.
                                        5. If it’s better, use it as the new list, and go to step 2.
                                        6. If it’s worse, throw it out and go back to step 2.

                                        This is, obviously, highly inefficient and a huge waste of time and code to accomplish something that could be done using a lot less work.

                                        The correct code to do this, as ZD correctly pointed out is with the one line of code: Collections.sort(list)

                                        FTC will be sent tonight. Stay tuned for the next Drunken Coding Challenge!
                                        [/quote]

                                        I might be blind, but it looks like ZD went to sleep.
                                        Wasn’t that my answer that mentioned Collections.sort(listName)? :o

                                        1 Reply Last reply Reply Quote 0
                                        • K
                                          Kevlar Spammer last edited by

                                          [quote name=“delimitri” post=“48548” timestamp=“1388449163”]
                                          [quote author=Kevlar link=topic=6453.msg48454#msg48454 date=1388430164]
                                          And ZD WINS!!! Congrats. Very well done.

                                          One might call this a Monte-Carlo sort. It uses evolution to arrive at a perfectly sorted list by following this algorithm:

                                          1. Get a list of numbers.
                                          2. Randomly reorder the numbers in the list.
                                          3. See if this list is “more” sorted than the last one.
                                          4. If it’s perfectly sorted, we’re done.
                                          5. If it’s better, use it as the new list, and go to step 2.
                                          6. If it’s worse, throw it out and go back to step 2.

                                          This is, obviously, highly inefficient and a huge waste of time and code to accomplish something that could be done using a lot less work.

                                          The correct code to do this, as ZD correctly pointed out is with the one line of code: Collections.sort(list)

                                          FTC will be sent tonight. Stay tuned for the next Drunken Coding Challenge!
                                          [/quote]

                                          I might be blind, but it looks like ZD went to sleep.
                                          Wasn’t that my answer that mentioned Collections.sort(listName)? :o
                                          [/quote]

                                          Holy crap, I credited the wrong person entirely!!!

                                          I take it all back.

                                          delimitri wins!!! MY BAD!!! LOL. Sorry, please forgive me. I guess that’s what you get for running a drunken contest?

                                          Sorry about that! Funds will still be sent tonight! :)

                                          1 Reply Last reply Reply Quote 0
                                          • D
                                            delimitri last edited by

                                            [quote name=“Kevlar” post=“48454” timestamp=“1388430164”]

                                            Holy crap, I credited the wrong person entirely!!!

                                            I take it all back.

                                            delimitri wins!!! MY BAD!!! LOL. Sorry, please forgive me. I guess that’s what you get for running a drunken contest?

                                            Sorry about that! Funds will still be sent tonight! :)
                                            [/quote]

                                            Hahaha no problem. :D

                                            I was just curious and looking for the answer in previous posts. I thought I might have missed it when reading through the responses the first time, and then when I couldn’t see anything I thought wait a minute… that was me… yay!!!

                                            Thanks. Really appreciate it. I have only recently started mining, so only have 6 or 7 FTC at the moment. So this is a big bonus for me ;D

                                            1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post