#include <iostream>
#include <cstdlib>
#include <ctime>

using namespace std;

void moveForward() {
    cout << "Moving forward" << endl;
}

void turnRight() {
    cout << "Turning right" << endl;
}

void stopMovement() {
    cout << "Stopping movement" << endl;
}

int measureDistance() {
    return rand() % 50 + 1; // Simulate distance measurement (1-50 cm)
}

void dropPackage() {
    cout << "Dropping package" << endl;
}

int main() {
    srand(time(0)); // Seed for random values

    cout << "Starting simulation..." << endl;

    for (int i = 0; i < 10; i++) { // Simulating 10 sensor readings
        int distance = measureDistance();
        cout << "Measured Distance: " << distance << " cm" << endl;

        if (distance < 10) {
            stopMovement();
            dropPackage();
            break;
        } else if (distance < 20) {
            stopMovement();
            turnRight();
        } else {
            moveForward();
        }
    }

    cout << "Simulation complete!" << endl;
    return 0;
}
