Permalink
Cannot retrieve contributors at this time
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?
370CT/Rover/rover.cpp
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
53 lines (43 sloc)
1.03 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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; | |
} |