BFOIT - Introduction to Computer Programming
Background
jLogo Programming
- Commanding a Turtle
- Pseudocode
- Adding New Commands
- Iteration & Animation
- Hierarchical Structure
- Procedure Inputs
- Primitive Operators
- Defining Operators
- Words & Sentences
- User Interface Events
- What If? (Predicates)
- Recursion
- Local Variables
- Global Variables
- Word/Sentence Iteration
- Mastermind Project
- Turtles As Actors
- Arrays
Java
- A Java Program
- What's a Class?
- Extending Existing Classes
- Types
- Turtle Graphics
- Control Flow
- User Interface Events
Appendices
Updates
Lastly
Appendix B (Directives)
TG Programming Environment Directives
Certain commands entered in the CommandCenter window help with the program development process. These commands are not part of the jLogo language = they can't be included in procedures you define. Examples of directives: there is a directive which prints the title lines of all of the procedures you've defined; there is a directive which prints a textual representation of a procedure you specify. In summary, directives help you write and debug programs.
| Program Management (Directives) | |||
| Name | Input(s) | Description | Example |
| BYE | Close the TG programming environment. | ||
| [Ctrl]-t | While in the CommandCenter, holding down the [Ctrl] key and pressing the "T" key will print the name of the current turtle and the state of all turtles. | ||
| [Ctrl]-q | While in the CommandCenter, holding down the [Ctrl] key and pressing the "Q" key will stop program execution - think of Ctrl-Q as a QUIT directive. | ||
| CLEARTEXT CT |
Erases all of the text in the CommandCenter. | CLEARTEXT | |
| END | Completes the definition of a procedure. | ||
| NEWTURTLE | name | Creates a new turtle with the specified name. | NEWTURTLE "t2 |
| PRINTPROCS PP |
Displays the names and inputs of all procedures that have been defined in the current session in the CommandCenter. | PRINTPROCS | |
| PRINTSTACK PS |
Prints the procedure invocation stack collected upon last runtime error. | ||
| PRINTTEXT PT |
name | Displays the source code representation of the procedure named name in the CommandCenter. | PRINTTEXT main |
| TALKTO | name | Directs future CommandCenter input to the specified turtle, i.e., makes name the current turtle. | TALKTO "t2 |
| TO | :input1 :input2 ... |
Initiates definition of a procedure. It will be named procname. Inputs, which are optional, are given the names input1, input2, etc. All names are case-insensitive. | TO box :size |
| TRACE | procName varName |
Directs TG to display information every time a specified user-defined procedure is invoked or a specified global variable's value is changed. | TRACE keyPressed TRACE curNum |
| UNTRACE | name | Cancels the TRACE request for the named procedure or global variable. | UNTRACE keyPressed UNTRACE curNum |
Go to the Table of Contents
On to jLogo Primitives