Programming
To Teach
Programming
Origins
The Goals
- Build a game
- Controls must be a scripting language
- Teach basic programming principles
The Result
Overview
- Why we built Fable of Zelma.
- How it achieves the goals.
- Why it facilitates learning.
Why Build it?
Scripting Challenges
Flora vs Undead
- Tower Defense
- Limited Resources
- Competitive Play
Problems:
- No incentive for complex solutions
- Some commands didn't work
- Non-dynamic problems
Fable of Zelma
Variable Declaration
Link L1 = new Link();
Link L2 = new Link();
Link L3 = new Link();
Link L4 = new Link();
Link L5 = new Link();
Take Actions
L1.move(1);
L2.turn(RIGHT);
L2.move(1);
L3.turn(LEFT);
L3.move(1);
L4.turn(LEFT);
L4.turn(LEFT);
L4.move(1);
If Statements
L1.move(1);
if (L1.isBlocked()){
L1.turn(RIGHT);
}
L1.move(1);
Functions and Loops
public static void look(Link L){
if (L.isBlocked()){
L1.turn(RIGHT);
}
forward(L);
}
public static void forward(Link L) {
if (!L.isBlocked()){
L.move(1);
}
}
look(L1);
Advanced Actions
public void forward(Link L){
/* movement code */
activate(L);
/* forward_after */
}
public void activate(Link L){
if (L.isInteractive()){
L1.activate();
}
return;
}
Recall Problems
- No incentive for complex solutions
- Some commands didn't work
- Non-dynamic problems
Solutions
- Problems with varying difficulty
- Reliable goto, labels, and if's
- Always changing game state
The Result
- Flexible
- Extensible
- Simple syntax
- Advanced capabilities
Review
- Goals
- Previous Iterations
- Current Syntax
- The benefits
Code: github.com/ghmeier/fableofzelma
Video Games in Teaching
By Garret Meier
Video Games in Teaching
- 284