Skip to main content

Lesson 4: Dynamic Castle Crasher Challenge

In the Dynamic Castle Crasher Challenge, the VR Robot must now knock ALL pieces off of each iteration of the Dynamic Castle Crasher Playground, in the quickest way possible!

A top down view of an empty Dynamic Castle Crasher Playground, with the VR Robot at the bottom right corner and all castle pieces completely cleared leaving a blank surface.

Learning Outcome

  • Apply logic of repeated decisions with multiple sensors to solve the Dynamic Castle Crasher Challenge.

Putting It All Together

Algorithms enable a user to create more diverse and efficient projects. Algorithms are precise sequences of instructions that can use selection and iteration to instruct the VR Robot to use information from its environment to execute behaviors.

A close up top down view of the VR Robot directly in front of a castle on the Playground. Red and green curved lines illustrate the detection of the castle by the sensor on the front of the robot.

Algorithms use loops to continually check sensor values, and repeat behaviors. Nesting conditional statements inside loops such as [Forever] or [Repeat until] blocks will instruct the VR Robot to continually check those conditions.

A sample project from the Unit to illustrate nesting an if then else block inside of a Forever block to continually check a condition and make a decision.

Selection is employed by using conditional statements such as [If then else] or [Repeat until] blocks to instruct the VR Robot to execute certain behaviors, depending on reported conditions, such as sensor values.

A diagram of the project flow of an if then else block within a Forever block showing how the condition of the If then else block is continually checked, and only one branch is executed each time. All of this continues over and over because of the Forever loop.

Using sensors with loops and selection enables the VR Robot to interact with a changing environment, such as the Dynamic Castle Crasher Playground.

Perspective view of the VR Robot facing the castles on the Dynamic Castle Crasher Playground at the start of the project.

Dynamic Castle Crasher Challenge

In this challenge, create a project where the VR Robot uses an algorithm to knock all of the building pieces off of the Dynamic Castle Crasher Playground, in the shortest amount of time possible.

Solving the Dynamic Castle Crasher Challenge requires the use of a timer. You can use a stopwatch, a phone, or you can even use the timer on the VR Robot.

For Your Information

You can use the monitor feature in VEXcode VR, and select the (Timer value) block to be monitored. Every time the project is run, the monitor resets.

The VEXcode VR interface shows the Toolbox on the far left, with the timer in seconds block checked off, then VR Playground Window in the center, and the Monitor console open, with the Timer in Seconds shown in the monitor.

For more information on using the Monitor Console, view this article.

Follow these steps to complete the challenge:

  • Create a new project or load a project from previous Lessons in this Unit. If creating a new project, selsct the Dynamic Castle Crasher Playground.
  • Rename the project Unit9Challenge.
  • Launch the Playground window.
  • Load the Dynamic Castle Crasher Playground.
  • Add the blocks necessary to drive the VR Robot to push all of the building pieces off of the Dynamic Castle Crasher Playground in the shortest amount of time. Remember that if you have a VR Premium account, you can use VEXcode Blocks, Switch blocks, or a combination of both block types to complete the challenge. The VR Robot should not fall off of the Playground.
  • Start the project to test if it works. The algorithm should work regardless of the layout of the Playground.
  • Document the time it took to complete the challenge on a piece of paper, on your device, or by monitoring the timer in VEXcode VR.
  • Continue to revise and run the project until the VR Robot successfully completes the Dynamic Castle Crasher Challenge in the shortest time.
  • Save the project once the VR Robot successfully knocks all of the building pieces off of the Dynamic Castle Crasher Playground in record time.

Congratulations! You have successfully completed the Dynamic Castle Crasher Challenge!

Questions

Please select a link below to access the lesson quiz.

Google Doc / .docx / .pdf