#include "waiter.h" #include static void runCustomer(std::ifstream &fin, std::ofstream &fout) { int N, k; fin >> N >> k; std::vector S(k); for(auto &x : S) { fin >> x; } initCustomer(N, k, S); char ch; while(fin >> ch) { if(ch == 'x') { break; } if(ch == '!') { fout << makeOrder() << std::endl; } if(ch == '.') { int x; fin >> x; waitTurn(x); } } } static void runChef(std::ifstream &fin, std::ofstream &fout) { int N; fin >> N; initChef(N); int x; while(fin >> x) { std::vector rez = getOrder(x); if(rez.empty()) fout << "ORDER SOME MORE, YO!" << std::endl; else { fout << "YEAH, SCIENCE!\n" << rez.size() << '\n'; for(auto dish : rez) { fout << dish << ' '; } fout.flush(); exit(0); } } } int main(int argc, char *argv[]) { std::string playerType; std::ofstream fout(argv[2]); std::ifstream fin(argv[1]); fin >> playerType; if(playerType == "chef") { runChef(fin, fout); } else if(playerType == "customer") { runCustomer(fin, fout); } }