TF Vital Statistics
Alix Marchandise-Franquet
Where to turn in your homework
Office Hours
Section Web Page:
You can always send questions to libe50a@fas.harvard.edu (which is read by all the TFs) or to other TFs.
What are these .something files?
How to find out if someone is online?
The settings:
The basic robot type (class): the ur_Robot
It can also sense several things:
Robots are created at the beginning of a task. You have to specify:
Loops
Making new robots, an example
class Fencebuilder : ur_Robot // remember the single column
// definition of the arrangeOneRow instruction
// definition of the arrangeFourRows instruction
task
Syntax / Indentation
This week, try to read at least the first three chapters of the Karel++ book.
Part C: Debugging
Part D: Pencil and Paper (you are strongly encouraged to type your answers...)
Part E: Programming Exercises
Do only problem 5 this week (you will need next weekıs lecture for the others).
Email: afranq@fas.harvard.edu
Please put [E50a] in the subject of your messages
If you figure out the answer to a question before I reply, please
email me back with the subject:
[E50a]Never mind
Outside of Science Center 102, the first box to your right
* Always, by e-mail
* After section on Wednesday nights in Emerson 106
* Some weeks on Thursday nights at the Church street lab (time TBD)
* Feel free to ask questions after lecture too (I usually sit in the back).
http://www.fas.harvard.edu/~afranq/e50a
UNIX Info
Remember that after you activated your account, we asked you to do the following:
% cp ~libe50a/.login .
% cp ~libe50a/.cshrc .
I am sure that many of you are wondering what all this was about. Basically, these are files that are loaded when you log into your account, and that set up your
environment. Thanks to the .login file you can see the MOTD (Message Of The Day)
which provides various info for the course. Without the proper .cshrc file, you couldnıt
use the ³sections² command.
If you want to know if your new best friend from E50a is also working on his/her
assignment or if your TF is still working on a project at 5am, you can use the
³finger² command as follows:
%finger login@hostname
For example: %finger afranq@fas.harvard.edu
If you just type ³finger joe², it will automatically finger the person whose login is joe
on the machine you are currently logged on.The Wonderful World of Karel++
All the above is defined in a .wld file that we provide or you create.
A robot of class ur_robot can obey to 5 basic instructions:
Here is an example of a declaration of a Robot:
ur_Robot Karel (3, 4, South, 2); // donıt forget the semicolumn!
This will create a robot of class ur_Robot named Karel.
Karel will start to execute its instructions at the corner of 3rd street and 4th avenue,
facing South, with 2 beepers in its beeper bag.
Loops are just a way to repeat an instruction or a set of instruction a given number
of times.
loop (number of times you want this repeated)
{
instruction1();
instruction2();
}
Problem 16, page 66
{
// declaration of new instructions
void arrangeOneRow(); // donıt forget the semicolumns
void arrangeFourRows();
}; // donıt forget this semicolumn either!
void Fencebuilder :: arrangeOneRow() // here, double column
{
putBeeper(); // no robot name in the definition of new instructions
move();
putBeeper();
move();
putBeeper();
move();
} // no semicolumn here
void Fencebuilder :: arrangeFourRows()
{
arrangeOneRow();
turnLeft();
arrangeOneRow();
turnLeft();
arrangeOneRow();
turnLeft();
arrangeOneRow();
turnLeft();
} // no semicolumn here
{
Fencebuilder Karel (3, 3, East, 12);
// these instructions are for Karel, so we put its name
Karel.arrangeFourRows();
Karel.turnOff();
} // no semicolumn here
Writing a Program
A Word on Problem Set 1 (due Monday, October 5 before lecture)
First fix the problems with spelling and syntax.
Then see if the program terminates abnormally (with an error shutoff) and fix that.
Finally, is it doing what it should?
After every change you make, test again!
Stick to problem 1 for this week. You may define extra instructions in order to define
the 3 new instructions. But remember: do not use loops or if statements.