Updated 30 Jan 2023
Treasure Hunt Game: Learn to Code
Created with R2022b. Compatible with R2022b and later releases.
This curriculum module contains interactive live scripts that teach fundamental concepts and basic terminology related to programming computers. This includes discussion of variables, matrices, conditional statements, strings, arrays, indexing and functions.
These lessons can be used as part of a lecture, as activities in an instructional setting, or as interactive assignments to be completed outside class.
Please contact the MathWorks online teaching team with any feedback or questions.
Get started with the Treasure Hunt Game: Learn to Code interactive examples
Option 1: Download to Desktop Download and unzip the repository. Then, double-click the TreasureHunt.prj file inside MATLAB®.
Option 2: Log in to your MathWorks account to access your license. If you are associated with a university, use your university email to access a license.
- The instructions inside the live scripts will guide you through the exercises and activities.
- Get started with each live script by running it one section at a time.
- To stop running the script or a section midway (for example, if a loop is running longer than intended), click the Stop button in the RUN section of the Live Editor tab in the MATLAB Toolstrip.
Prerequisite Domain Knowledge
This module assumes an ability to identify and plot X,Y points on a grid. It is also intended for those who have an understanding of basic computer science concepts, such as syntax, variables, and arrays. If you would like more practice with these concepts, we recommend trying the set of exercises in Fundamentals of Programming.
This script walks the learner through the necessary steps to build the treasure hunting game, while teaching the relevant computer science concepts along the way.
This script contains the solutions for the treasureHuntLearn.mlx script.
This script contains a barebones version of the playable treasure hunt game, with guidance for the learner to paste their code from treasureHuntLearn.mlx in order to make the game playable.
This script contains the solutions for the treasureHuntPlay.mlx script.
- Recognize and assign values to variables
- Recognize and use built-in MATLAB functions and live controls
- Interpret messages about syntax errors
- Write comments in code and explain their importance
- Use documentation to learn new functionality in a programming language
- Assign values to the elements of a matrix and manipulate matrices
- Identify and use conditional statements
- Create and use custom functions
The license for this module is available in the License.txt file in this GitHub repository.
If you would like to provide feedback or have a question, contact the MathWorks online teaching team.
Copyright 2023 The MathWorks, Inc.
Ryan Weinstein (2023). Treasure-Hunt (https://github.com/MathWorks-Teaching-Resources/Treasure-Hunt/releases/tag/v1.0.1), GitHub. Retrieved .
MATLAB Release Compatibility
Platform CompatibilityWindows macOS Linux
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!
Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
See release notes for this release on GitHub: https://github.com/MathWorks-Teaching-Resources/Treasure-Hunt/releases/tag/v1.0.1