Commit ee46293f authored by Chingiz's avatar Chingiz 💻

Fix changed list order

parent bb1cae7b
...@@ -120,21 +120,28 @@ export class Control { ...@@ -120,21 +120,28 @@ export class Control {
} }
start() { start() {
let out: boolean = true; let out: boolean = true;
console.log("Hello, your robot name is D2R. Please, take controle of him. \n"); console.log(
"Hello, your robot name is D2R. Please, take controle of him. \n"
);
while (out) { while (out) {
const answerFromUser: string | null = readline.question( const answerFromUser: string | null = readline.question(
`Choose one of the commands: \n1) ${this.robot.tool ? "Use the "+ this.robot.tool.toolName : "No tools to use!"}\n2) ${this.robot.tool ? "Drop the " + this.robot.tool.toolName : "No tools to drop!"}\n3) ${this.robot.tool ? "Your tool is " + this.robot.tool.toolName : "Choose one of the tools"}\n4) Exit:\n ` `Choose one of the commands: \n1) ${
this.robot.tool
? "Your tool is " + this.robot.tool.toolName
: "Choose one of the tools"
} \n2) ${
this.robot.tool
? "Drop the " + this.robot.tool.toolName
: "No tools to drop!"
}\n3) ${
this.robot.tool
? "Use the " + this.robot.tool.toolName
: "No tools to use!"
}\n4) Exit:\n `
); );
switch (answerFromUser) { switch (answerFromUser) {
case "1": case "1":
this.robot.action();
break;
case "2":
this.robot.drop_tool();
break;
case "3":
const answer = readline.question( const answer = readline.question(
"Please, choose one of the tool: \n1) Saw\n2) Hammer\n3) screwdriver\n4) Axe\n5) Drill\n" "Please, choose one of the tool: \n1) Saw\n2) Hammer\n3) screwdriver\n4) Axe\n5) Drill\n"
); );
...@@ -161,8 +168,15 @@ export class Control { ...@@ -161,8 +168,15 @@ export class Control {
break; break;
} }
break; break;
case "2":
this.robot.drop_tool();
break;
case "3":
this.robot.action();
break;
case "4": case "4":
out = false; out = false;
break;
default: default:
console.log("============================================"); console.log("============================================");
console.log("Please, choose correct command"); console.log("Please, choose correct command");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment