Skip to content
Permalink
ee735956f4
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
53 lines (43 sloc) 1.03 KB
#include <iostream>
#include <cmath>
#include <thread>
#include <chrono>
void report_to_earth(std::string fault){
std::cout << "reported to fault to earth" << std::endl;
}
void resolve_dropped_wheel(){
}
void resolve_stuck_wheel(){
}
bool determine_success(){
}
int determine_scenario(short num){
if (num > 95) return 3; //wheel power failure
if (num > 90) return 2; //wheels drops/dips (hole or cliff edge)
if (num > 80) return 1; //if large rock in the way
else return 0; //clear path
}
int main(){
short randNum;
int scenario;
do{
randNum = rand() % 100 + 1;
std::cout << "Rand num = " << randNum << std::endl;
scenario = determine_scenario(randNum);
if (scenario == 3){
//if wheel failure
report_to_earth("Wheel Failure");
}
if (scenario == 2){
std::cout << "Wheel dropped" << std::endl;
}
if (scenario == 1){
std::cout << "wheel stuck" << std::endl;
}
else{
std::cout << "No problem" << std::endl;
}
std::this_thread::sleep_for(std::chrono::seconds(1));
}while(true);
return 0;
}