Ejemplos de las notas
Karel
BEGINNING_OF_PROGRAM
BEGINNING_OF_EXECUTION
move;
move;
pickbepper;
move;
turnleft;
move;
move;
putbeeper;
move;
turnoff;
END_OF_EXECUTION
END_OF_PROGRAM
DEFINE_NEW_INSTRUCTION cosecha1fila AS
{
pickbeeper;
move;
pickbeeper;
move;
pickbeeper;
move;
pickbeeper;
move;
pickbeeper;
move;
pickbeeper;
}
DEFINE_NEW_INSTRUCTION voltea_al_norte AS
{
IF facing_east THEN
turnleft;
IF facing_south THEN
{
turnleft;
turnleft;
};
IF facing_west THEN
{
turnleft;
turnleft;
turnleft;
};
}
DEFINE_NEW_INSTRUCTION voltea_al_norte AS
{
IF not_facing_north THEN
turnleft;
IF not_facing_north THEN
turnleft;
IF not_facing_north THEN
turnleft;
}
DEFINE_NEW_INSTRUCTION replanta_uno AS
{
IF not_next_to_a_beeper THEN
putbeeper;
ELSE
{
pickbeeper;
IF not_next_to_a_beeper THEN
putbeeper;
};
}
DEFINE_NEW_INSTRUCTION misteriosa AS
{
IF facing_west THEN
{
move;
turnright;
IF facing_north THEN
move;
turnleft;
turnleft;
};
ELSE
{
move;
turnleft;
move;
turnleft;
turnleft;
};
}
DEFINE_NEW_INSTRUCTION encuentra_biper AS
{
WHILE not_next_to_a_beeper DO
{
IF front_is_clear THEN
move;
ELSE turnleft;
};
}
DEFINE_NEW_INSTRUCTION voltea_al_norte AS
{
IF not_facing_north THEN
BEGIN
turnleft;
voltea_al_norte;
};
}
DEFINE_NEW_INSTRUCTION busca_mina AS
{
IF not_next_to_a_beeper THEN
{
move;
busca_mina;
move;
};
ELSE turnleft;
}
Modificado el: Mon Jul 12 11:43:06 1999, por: Ramon Reyes Carrion