-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcal.js
77 lines (63 loc) · 2.5 KB
/
cal.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
// getCnt() {
// const result = [];
// let ballCnt = 0;
// let strikeCnt = 0;
// [...this.userInput].forEach((num, idx) => {
// if (+num !== this.answer[idx] && this.answer.includes(+num)) ballCnt += 1;
// else if (+num === this.answer[idx]) strikeCnt += 1;
// });
// if (ballCnt > 0) result.push(`${ballCnt}볼`);
// if (strikeCnt > 0) result.push(`${strikeCnt}스트라이크`);
// return result;
// }
// createResult() {
// const getCntResult = this.getCnt();
// let result = "낫싱";
// if (getCntResult.length === 1) result = getCntResult.join("");
// else if (getCntResult.length === 2)
// result = getCntResult.map((str) => str).join(" ");
// Console.print(result);
// if (result === MESSAGE.CLEAR) {
// Console.print(MESSAGE.FINISH);
// this.restartQuestion();
// } else this.getUserInput();
// }
const a = 1;
// createResult() {
// const [ball, strike] = this.getCnt();
// let result = "";
// if (ball === 0 && strike === 0) result = "낫싱";
// if (ball > 0) result += `${ball}볼`;
// if (ball > 0 && strike > 0) result += " ";
// if (strike > 0) result += `${strike}스트라이크`;
// getCnt() {
// const result = [];
// let ballCnt = 0;
// let strikeCnt = 0;
// [...this.userInput].forEach((num, idx) => {
// if (+num !== this.answer[idx] && this.answer.includes(+num)) ballCnt += 1;
// else if (+num === this.answer[idx]) strikeCnt += 1;
// });
// if (ballCnt > 0) result.push(`${ballCnt}볼`);
// if (strikeCnt > 0) result.push(`${strikeCnt}스트라이크`);
// return result;
// }
// createResult() {
// const getCntResult = this.getCnt();
// let result = "낫싱";
// if (getCntResult.length === 1) result = getCntResult.join("");
// else if (getCntResult.length === 2)
// result = getCntResult.map((str) => str).join(" ");
// Console.print(result);
// if (result === MESSAGE.CLEAR) {
// Console.print(MESSAGE.FINISH);
// this.restartQuestion();
// } else this.getUserInput();
// }
// createResult() {
// const [ball, strike] = this.getCnt();
// let result = "";
// if (ball === 0 && strike === 0) result = "낫싱";
// if (ball > 0) result += `${ball}볼`;
// if (ball > 0 && strike > 0) result += " ";
// if (strike > 0) result += `${strike}스트라이크`;