30 lines
565 B
C
30 lines
565 B
C
#include <stdio.h>
|
|
#include <stdbool.h>
|
|
|
|
int main()
|
|
{
|
|
int CurrentFloor = 8;
|
|
int TargetFloor = 2;
|
|
|
|
bool GoingUp = true;
|
|
bool isDone = false;
|
|
|
|
for(int Timestep = 0; Timestep < 15 && !isDone; Timestep++)
|
|
{
|
|
printf("I'm currently at floor %d\n", CurrentFloor);
|
|
// TODO: replace this with a more apropiate logic
|
|
// for choosing the direction
|
|
if(GoingUp)
|
|
{
|
|
CurrentFloor++;
|
|
}
|
|
else
|
|
{
|
|
CurrentFloor--;
|
|
}
|
|
|
|
// TODO: check if we reached the target floor and set the isDone variable to true
|
|
}
|
|
printf("I ended up in floor %d.", CurrentFloor);
|
|
}
|