8 Card Programming Challenges

Challenges list below…

  1. Question: Do you have a Nine?
    Goal: Run the program. Check the “Left Hand Value”. If it is 9 then the answer is yes. If “Left Hand Value” is not a 9 then the answer is no.
  2. Question: Do you have a 2 or a 10?
    Goal: Run the program. Check the “Left Hand Value”. If it is 2 or 10 then the answer is yes. If “Left Hand Value” is not a 2 or 1 0 then the answer is no.
  3. Question: Do you have a 2 and a 10?
    Goal: Run the program. Check the “Left Hand Value” and see if it is a 2. Check the “Right hand Value” and see if it is a 10. If the hands are not on a 2 & 10 as described above then the answer to the question is no.
  4. Question: How many 2s do you have?
    Goal: Run the program. Check the “Left Hand Position”. The “Left Hand Position” will be the number of 2s that you have.
  5. Question: What is the smallest card?
    Goal: Run the program. Check the “Left Hand Value”. The “Left Hand Value” will be the smallest card.
  6. Action: Move the smallest card to Position 0. (Read about the swap command at the bottom of this page)
  7. Action: Move the smallest card to Position 0 and the largest card to position 7.
  8. Action: Shift all card one position to the right (the card in position seven should
    move to position zero).
  9. Action: Sort the cards from smallest to largest.
  • For  challenges 6+ you will need to move cards. To move cards you will need the SWAP command (S). The swap command moves cards not hands. It will move the left hand card to the right hand position and move the right hand card to the left hand position. To enable this command you will need to edit your IDE URL as shown below…
    https://mxepstein.com/HML/?swap=true&cards=48530296&code=X

Robot Maze Challenge

Available commands are…

  • MOVE_FORWARD();
  • ROTATE_RIGHT();
  • MOVE_FORWARD();
  • CAN_MOVE(“direction”);

Choices for “direction” are…

  • “forward”
  • “backward”
  • “right”
  • “left”

Example Code…

if(CAN_MOVE(“right”)){
    ROTATE_RIGHT();
    MOVE_FORWARD();
}

Write one code that can guide the robot from the top left square to the bottom right square no matter which of the 6 situations the robot finds itself in.

You can test your code here. *

Programming Challenges 2024-2025

When completing your code challenges keep in mind the four characteristics of quality code…

  1. Functional – Accomplishes it’s task every time.
  2. Readable – Easy for a human to read and edit
  3. Efficient – Executes quickly without unnecessary steps.
  4. Short – Uses the fewest lines of code.

Or put another way…

  1. Does it work? Your code should meet all of the requirements and work in every situation.
  2.  Is it understandable? Your code should be easy for a human to read and understand.
  3. Is it fast? You code should execute and finish as quickly as possible.
  4. Is it short? Your code should be as few line of code as possible.

Submit Your Programming Challenges here. Please make sure your challenge meets all of the requirements before submitting. Also please make sure your app is titled “Programming Challenge #__” to make it extra clear which challenge you have completed.

  1. Four Function Calculator App – Create a basic four function calculator. Remix this template to start. Watch a video example to see how it should work here.
  2. Four Function Calculator App (Final Draft) – Fine tune your calculator to handle these weird errors and other small things…
    • What if the user puts a non-number into one of the boxes?
      • Print “Error: Please only enter numbers”
    • Do not allow users to edit the big output text area
    • What if they divide by zero?
      • Print “Error: Cannot divide by zero”
    • What if the output is scientific notation
      • If the output is scientific notation, then print “Error: Answer is too long”
  3. Robot Maze Challenge
  4. getSquarePerimeter(area) – Given the area of a square return the perimeter of the square.
  5. Write a function getSmallestNumber(n1,n2,n3,n4) that returns a numeric value that represents the smallest number given four numbers. Please do not use the built in Math.min function
  6. Fix the code to make a “Match Object to Color” app. Remix template here.
  7. 4 Function Calculator (Model View Controller)
  8. Safe to Eat (See template)
  9. Tri-Tac-Toe
  10. Create a 2-Button AppSee details here.
  11. Create List App #1Watch the video. Start by remixing the template.
  12. Create List App #2Watch the video. Start by remixing the template.
  13. Create List App #3Watch the video. Start by remixing the template .
  14. Create List App #4Watch the video. Start by remixing the template.
  15. Create Random IconsWatch the video. Start by remixing the template.