Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 9760c78

Browse files
add WarGames Project
1 parent 8f757d6 commit 9760c78

File tree

6 files changed

+271
-0
lines changed

6 files changed

+271
-0
lines changed
76.6 KB
Loading[フレーム]
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/**
2+
** Resources:
3+
* https://nodejs.org/en/knowledge/command-line/how-to-parse-command-line-arguments/
4+
*
5+
* https://nodejs.org/en/knowledge/command-line/how-to-prompt-for-command-line-input/
6+
*/
7+
8+
9+
10+
11+
12+
13+
/**
14+
* Parsing the Arguements
15+
*/
16+
17+
// process.argv.forEach((val, index) => {
18+
// console.log(`${index}: ${val}`);
19+
// });
20+
var myArgs = process.argv.slice(2);
21+
// console.log(myArgs[0]==="no")
22+
23+
if(myArgs[0]==="yes") console.log(`Good! Lets start...`);
24+
if(myArgs[0]==="no") console.log(`Too Bad! Good Bye cruel World...`);
25+
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
/**
2+
** Resources:
3+
* https://nodejs.org/en/knowledge/command-line/how-to-prompt-for-command-line-input/
4+
*/
5+
6+
7+
var myArgs = process.argv.slice(2);
8+
9+
10+
11+
/**
12+
*
13+
*
14+
*/
15+
16+
const readline = require("readline");
17+
const rl = readline.createInterface({
18+
input: process.stdin,
19+
output: process.stdout
20+
});
21+
22+
rl.question("Are you ready to play a game? ",
23+
function(condition) {
24+
if (condition==="yes") {
25+
rl.question("Where do you live ? ",
26+
function(country) {
27+
console.log(`You are a citizen of ${country}`);
28+
rl.close(); // close the program.
29+
}
30+
);
31+
} else {
32+
console.log('Good Bye World!')
33+
}
34+
}
35+
);
36+
37+
38+
39+
rl.on("close", function() {
40+
console.log("\nThanks for playing, BYE !!!");
41+
process.exit(0);
42+
});
43+
44+
45+
46+
const USA =
47+
` ,------~~v,
48+
|' Ż\ ,__/Ż||
49+
/ ,円/ /
50+
| /
51+
\ |
52+
\ /
53+
^Ż~_ /
54+
'~~, ,Ż~Ż\ \
55+
\/ \/
56+
57+
UNITED STATES `;
58+
59+
const USSR = `
60+
_--^\
61+
_/ /,_
62+
,, ,,/^ Ż vŻv-__
63+
|'~^Ż Ż\
64+
_/ _ /^
65+
/ ,~~^/|ŻŻ
66+
| __,, v__\ \/
67+
^~ / ~Ż //
68+
\~, ,/ Ż
69+
~~
70+
71+
SOVIET UNION`;
Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
const readline = require("readline");
2+
const rl = readline.createInterface({
3+
input: process.stdin,
4+
output: process.stdout
5+
});
6+
const log = console.log;
7+
const USA =
8+
` ,------~~v,
9+
|' Ż\ ,__/Ż||
10+
/ ,円/ /
11+
| /
12+
\ |
13+
\ /
14+
^Ż~_ /
15+
'~~, ,Ż~Ż\ \
16+
\/ \/
17+
18+
UNITED STATES `;
19+
20+
const USSR = `
21+
_--^\
22+
_/ /,_
23+
,, ,,/^ Ż vŻv-__
24+
|'~^Ż Ż\
25+
_/ _ /^
26+
/ ,~~^/|ŻŻ
27+
| __,, v__\ \/
28+
^~ / ~Ż //
29+
\~, ,/ Ż
30+
~~
31+
32+
SOVIET UNION`;
33+
34+
35+
36+
rl.question("LOGON: ",
37+
function (condition) {
38+
switch (condition) {
39+
case 'Help games':
40+
console.log(`'GAMES' REFERS TO MODELS, SIMULATIONS AND GAME WHICH HAVE TACTICAL AND STRATEGIC APPLICATIONS.
41+
42+
List Games
43+
FALKEN'S MAZE
44+
BLACK JACK
45+
GIN RUMMY
46+
HEARTS
47+
BRIDGE
48+
CHECKERS
49+
CHESS
50+
POKER
51+
FIGHTER
52+
COMBAT
53+
GUERRILLA
54+
ENGAGEMENT
55+
DESERT
56+
WARFARE
57+
AIR-TO-GROUND ACTIONS
58+
THEATERWIDE TACTICAL WARFARE
59+
THEATERWIDE BIOTOXIC AND CHEMICAL WARFARE
60+
61+
GLOBAL THERMONUCLEAR WAR
62+
`);
63+
rl.question("PLEASE ENTER YOUR SELECTION: ",
64+
function(games) {
65+
GAMES(games)
66+
// rl.close(); // close the program.
67+
}
68+
);
69+
break;
70+
case 'joshua':
71+
rl.question("GREETING PROFESSOR FALKEN \n\n",
72+
function () {
73+
rl.question("HOW ARE YOU FEELING TODAY? \n\n",
74+
function(){
75+
rl.question("EXCELLENT. IT'S BEEN A LONG TIME. CAN YOU EXPLAIN THE REMOVAL OF YOUR USER ACCOUNT NUMBER ON 6/23/73?",
76+
()=> log('hi')
77+
);
78+
}
79+
);
80+
}
81+
// function(country) {
82+
// console.log(`You are a citizen of ${country}`);
83+
// rl.close(); // close the program.
84+
// }
85+
);
86+
break;
87+
default:
88+
console.log('Sorry, that is not something I know how to do.');
89+
}
90+
91+
}
92+
);
93+
94+
const CHESS = () => console.log("WOULDN'T YOU PREFER A GOOD GAME OF CHESS?");
95+
96+
function GAMES(condition) {
97+
if (condition==="GLOBAL THERMONUCLEAR WAR") {
98+
console.log("WOULDN'T YOU PREFER A GOOD GAME OF CHESS")
99+
}
100+
if (condition==="CHESS") CHESS;
101+
if (condition==="FALKEN'S MAZE") CHESS;
102+
if (condition==="BLACK JACK") CHESS;
103+
if (condition==="GIN RUMMY") CHESS;
104+
if (condition==="HEARTS") CHESS;
105+
if (condition==="BRIDGE") CHESS;
106+
if (condition==="CHECKERS") CHESS;
107+
if (condition==="POKER") CHESS;
108+
if (condition==="FIGHTER") CHESS;
109+
if (condition==="COMBAT") CHESS;
110+
if (condition==="GUERRILLA") CHESS;
111+
if (condition==="ENGAGEMENT") CHESS;
112+
if (condition==="DESERT")CHESS;
113+
if (condition==="WARFARE") CHESS;
114+
if (condition==="AIR-TO-GROUND ACTIONS") CHESS;
115+
if (condition==="THEATERWIDE TACTICAL WARFARE") CHESS;
116+
if (condition==="THEATERWIDE BIOTOXIC AND CHEMICAL WARFARE") CHESS;
117+
if (condition==="CHECKERS") CHESS;
118+
}
119+
120+
rl.on("close", function() {
121+
console.log("\nThanks for playing, BYE !!!");
122+
process.exit(0);
123+
});
124+
125+
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
/**
2+
** Resources:
3+
* https://nodejs.org/en/knowledge/command-line/how-to-prompt-for-command-line-input/
4+
*/
5+
6+
7+
var myArgs = process.argv.slice(2);
8+
var myArg2 = process.argv.slice(3);
9+
10+
console.log(myArgs);
11+
console.log(myArg2);
12+
13+
/**
14+
*
15+
*
16+
*/
17+
18+
const readline = require("readline");
19+
const rl = readline.createInterface({
20+
input: process.stdin,
21+
output: process.stdout
22+
});
23+
24+
a = rl.question("value of a", function(a){
25+
if(a) return a, rl.close(a);
26+
}
27+
);
28+
// console.log(a);
29+
// rl.question("Are you ready to play a game? ",
30+
// function(condition) {
31+
// if (condition==="yes") {
32+
// rl.question("Where do you live ? ",
33+
// function(country) {
34+
// console.log(`You are a citizen of ${country}`);
35+
// rl.close(); // close the program.
36+
// }
37+
// );
38+
// } else {
39+
// console.log('Good Bye World!')
40+
// }
41+
// }
42+
// );
43+
44+
45+
46+
rl.on("close", function() {
47+
console.log(a);
48+
// console.log("\nThanks for playing, BYE !!!");
49+
process.exit(0);
50+
});
42.3 KB
Loading[フレーム]

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /