Announcement

Collapse
No announcement yet.

Coding Puzzle!

Collapse
X
  •  
  • Filter
  • Time
  • Show
Clear All
new posts

  • Coding Puzzle!

    Hi all,
    Found this coding puzzle online, I enjoyed it very much and thought to share it with you guys.
    If anyone would like to test their Coding Skills or Logical thinking have a go.
    Everyone is welcome to try it out regardless of your coding knowledge.
    NOTE: There is a mini survey at the beginning, does not ask for confidential information.

    LINK --> http://puzzle.prenda.co/

    After you have completed the Puzzle, please post your results.
    [SIZE=4][SIZE=5]Happy Flying :)[/SIZE][/SIZE]

    [SIZE=1][B]YouTube:[/B][url]https://www.youtube.com/user/TrixterGaming36[/url][/SIZE]
    [SIZE=2]-Trixter36[/SIZE]

  • #2
    Great little game.
    I've been doing many games similar to this through my career to see if I'm thick or not ��

    So feel I might have cheated.

    Code:
    Congratulations!
    You successfully solved the puzzle. And not only did you solve it, but you solved it with the fewest possible code blocks. That earns you an extra 100 points, so you will have 100 extra chances to win the grand prize. In total, you earned 200 points, and you will be entered into the prize drawing 200 times. Thank you for playing!
    In order to be eligible for the prize drawing, please provide your email address:
    If you don't use BOINC or World Community Grid then you should!

    Comment


    • #3
      Got my 200 points... Let's see a more advanced version!

      Edit: I re-did it to make the car go around the circle clockwise once... but I didn't get any extra bonus points.
      Now I want to infinite-loop the sucker... can I get the car to traverse the puzzle to the space just before END and back to the START, and forth, and back, indefinitely?

      Edit: I've gotten it to get to and then pace back and forth between the first green square and prior blue square. Therapeutic to watch, but not yet the ultimate goal of my efforts.
      Take the time, a second to soar; for soon after, beckons a second more.

      Comment


      • #4
        thanks, that was fun

        Comment


        • #5
          Originally posted by ATC_ROO View Post
          Code:
          Congratulations!
          You successfully solved the puzzle. And not only did you solve it, but you solved it with the fewest possible code blocks.
          Quiz questions for budding programmers:
          1. The above comment suggests that code written with fewer possible blocks is better. Why?
          2. When is that not true? What is it that's often more important than trying to use the least number of code blocks, especially when writing code professionally?

          Comment


          • #6
            Originally posted by Storm View Post
            Quiz questions for budding programmers:
            1. The above comment suggests that code written with fewer possible blocks is better. Why?
            2. When is that not true? What is it that's often more important than trying to use the least number of code blocks, especially when writing code professionally?
            Well I'm not a programmer and tend to class myself as a It'sNotDoingWhatIWantSoMakeItDoIter.

            But I'd say less blocks means fewer calculations so produces a faster performing program.

            Not true when you need a more stable performing program so introduce more blocks of code to take over if the first blocks fail.

            Ie turn left on all green squares.
            If the car didn't turn left send a standard turn left command.
            If you don't use BOINC or World Community Grid then you should!

            Comment


            • #7
              It's also a lot more fun with more unnecessary blocks... give this one a whirl! (SPOILER!)

              To Storm's points: you're not programming professionally if you assume the working environment of your code will be perfect. People interface with whatever you've coded, and therein lies the need for thousands of pounds (tons) of error catching, conflict handling, and all-around foolprofing.

              if this code was to direct a human steering the vehicle, for example, you bet there'd be a bunch of safety checks such as:
              - If human failed to comply with instruction, then pass voltage potential to electrode.
              - If human turned wrong way, then pass voltage potential to electrode.
              - If human took hands off wheel, then pass voltage potential to electrode.

              Hey, I might have just stumbled upon the fix for Florida's average driver!
              Take the time, a second to soar; for soon after, beckons a second more.

              Comment


              • #8
                P.S.- I got the back/forth through the maze thing going. It uses an absolute reference, which I'm not too proud of, but there appears to be no function for the relative references I would want to use (like if End or if Start). [Solution]
                Take the time, a second to soar; for soon after, beckons a second more.

                Comment


                • #9
                  Originally posted by Storm View Post
                  Quiz questions for budding programmers:
                  1. The above comment suggests that code written with fewer possible blocks is better. Why?
                  2. When is that not true? What is it that's often more important than trying to use the least number of code blocks, especially when writing code professionally?
                  I'm not a programmer either but I would say 1) a 6 step guide is better then a 36 step guide if they both give the same result. Having a concise program that does something in 6 lines versus a clunky program that gives the same result in 36 lines is beautiful. Makes for easier troubleshooting/editing should the need arise. 2) I'm not sure... (try to make it as complicated as possible so its harder to steal your intellectual property?)

                  Comment


                  • #10
                    I think you guys have the answer. The answer to the first question is simply that a small program may run faster. And in general, taking up less space is good. For the second question, there are three things you can choose to optimize when coding:
                    • speed/performance (e.g. how many frames per second your game displays and how clear or fuzzy it is);
                    • space/resources needed (e.g. whether your program takes up 3 Megabytes or 5 Gigabytes or needs a 10 core CPU);
                    • maintainability (how quickly it takes another coder - even you after, say, 6 months of doing something else - to understand the program and/or make changes to it).

                    Sometimes you can optimize two or more of those, sometimes only one. But if you have the choice and you can fulfill minimum speed and space requirements, always choose to optimize maintainability.

                    For example, does the code satisfy "Storm's Half-Second Rule"? Storm's Half-Second Rule states: if a code fragment takes more than half-a-second for an experienced programmer to understand, it's badly written and should be rewritten.

                    Naturally there are people who deliberately write unmaintainable code because they naively believe it makes them indispensable and hence have greater job security. But on the contrary, it just makes them more fireable, and many companies have procedures in place to catch this sort of thing!

                    On the other hand, there are people who have fun deliberately trying to write the most indecipherable, inscrutable and unmaintainable code possible. If you have such a perverse tendency, you'll enjoy the long running International Obfuscated C Code Contest, now in its 24th year. But be warned: it may break your brain and cause your eyes to water.

                    Comment


                    • #11
                      However, I was about to double the resolution speed of this program by explicitly directing the car, rather than iterating through IFs and LOOPs.
                      Take the time, a second to soar; for soon after, beckons a second more.

                      Comment


                      • #12
                        It took me 8 tries before I figured out all the different ways the pieces could go together. I got 155. That was fun. I couldn't stop until I got it right.

                        Comment


                        • #13
                          Does anyone remember doing this puzzle, a really while ago. Well, it turns out it was an experiment. Full Explanation here. It's pretty interesting.
                          [SIZE=4][SIZE=5]Happy Flying :)[/SIZE][/SIZE]

                          [SIZE=1][B]YouTube:[/B][url]https://www.youtube.com/user/TrixterGaming36[/url][/SIZE]
                          [SIZE=2]-Trixter36[/SIZE]

                          Comment


                          • #14
                            185 thank you very much. It would have been higher but I spent the 15 points figuring out how the blocks worked in the first place...

                            A question, does a repeat whatever count as 1 block or do you have to count each step in the repeat forever as a block?

                            Comment


                            • #15
                              Interesting study... While the results seem obvious, the solution does not. There are about 56 million students in elementary and secondary schools (NCES.ed.gov); how does one ensure that 56 million students receive 56 million unique lesson plans focused on the individual growth of each student? The first batch of ideas I have each require the acceptance of some requisite assumption, but I find each such assumption unacceptable. They include: all students have access to/want to/know how to use a computer; all students have at least one parent/guardian involved in their education; and the number of teachers is always greater than the number of students (definitions of student and teacher can be variable).

                              To be continued...
                              Take the time, a second to soar; for soon after, beckons a second more.

                              Comment

                              Sorry, you are not authorized to view this page
                              Who has read this thread:
                              Working...
                              X