aaloo 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/DEMO.md CHANGED
@@ -1,10 +1,4 @@
1
- # How to get a demo of this game?
2
-
3
- - Go to <a href='https://github.dev/bhatrichit10-ux/aaloo'>Github Dev </a>
4
- - Go to Menu Bar > Terminal > New terminal
5
- ![Image](assets/6.png)
6
- - Click on Continue Working in Github Codepspaces
7
- - CLick on The 2GB Ram option on the top searchbar
8
- - Wait for a few seconds
9
- - Go to its terminal and write ` bash ./install.sh`
10
- - Run using `node .`
1
+ # How to get a demo of this game?
2
+
3
+ - Install using `npm i -g aaloo`
4
+ - Run using `aaloo`
package/README.md CHANGED
@@ -8,27 +8,29 @@
8
8
  ### 🏠 [Homepage](https://github.com/bhatrichit10-ux/aaloo#readme)
9
9
 
10
10
  ## Install
11
+
11
12
  ```
12
- git clone https://github.com/bhatrichit10-ux/aaloo
13
- cd aaloo
14
- npm install
15
- node .
13
+ npm i -g aaloo
14
+ aaloo
16
15
  ```
16
+
17
17
  ## Images
18
- ![Some random images of usage](assets/1.png) <br>
19
- ---
20
- ![Some random images of usage](assets/2.png) <br>
21
- ---
22
- ![Some random images of usage](assets/3.png) <br>
23
- ---
24
- ![Some random images of usage](assets/4.png) <br>
25
- ---
26
- ![Some random images of usage](assets/5.png)
18
+
19
+ ## ![Some random images of usage](assets/1.png) <br>
20
+
21
+ ## ![Some random images of usage](assets/2.png) <br>
22
+
23
+ ## ![Some random images of usage](assets/3.png) <br>
24
+
25
+ ## ![Some random images of usage](assets/4.png) <br>
26
+
27
+ ![Some random images of usage](assets/5.png)
28
+
27
29
  ## Author
28
30
 
29
31
  👤 **Richit Bhat**
30
32
 
31
- * Github: [@bhatrichit10-ux](https://github.com/bhatrichit10-ux)
33
+ - Github: [@bhatrichit10-ux](https://github.com/bhatrichit10-ux)
32
34
 
33
35
  ## Show your support
34
36
 
@@ -39,4 +41,4 @@ Give a ⭐️ if this project helped you!
39
41
  Copyright © 2025 [Richit Bhat](https://github.com/bhatrichit10-ux).<br />
40
42
  This project is [ISC](https://github.com/bhatrichit10-ux/aaloo/blob/master/LICENSE) licensed.
41
43
 
42
- ***
44
+ ---
package/cli/ask.js CHANGED
@@ -1,17 +1,17 @@
1
- const inquirer = require('inquirer')
2
-
3
- async function ask(q, utype, ch) {
4
- const ans = await inquirer.default.prompt([
5
- {
6
- type: utype,
7
- name: "value",
8
- message: `${q} > `,
9
- mask: "*",
10
- choices: ch
11
- }
12
- ])
13
-
14
- return ans.value
15
- }
16
-
17
- module.exports = { ask }
1
+ const inquirer = require("inquirer");
2
+
3
+ async function ask(q, utype, ch) {
4
+ const ans = await inquirer.default.prompt([
5
+ {
6
+ type: utype,
7
+ name: "value",
8
+ message: `${q} > `,
9
+ mask: "*",
10
+ choices: ch,
11
+ },
12
+ ]);
13
+
14
+ return ans.value;
15
+ }
16
+
17
+ module.exports = { ask };
package/index.js CHANGED
@@ -4,35 +4,43 @@ const { hungerTick } = require("./src/hungerTick");
4
4
  const { applyTimeReward } = require("./src/timeReward");
5
5
  const { actions } = require("./src/actions");
6
6
  const { food, list } = require("./src/food");
7
- const { ask } = require("./cli/ask");
8
- let ac = ['play', 'run', 'sleep', 'feed', 'wake', 'exit'];
7
+ const { ask } = require("./cli/ask");
8
+ let ac = ["play", "run", "sleep", "feed", "wake", "exit"];
9
9
  async function main() {
10
10
  console.log("Welcome to the Aaloo Simulator!");
11
- while (true) {
12
- const stats = get();
13
- console.log(`\nMood: ${stats.mood} | Hunger: ${stats.hunger} | Energy: ${stats.energy} | Activity: ${stats.activity}`);
14
- const action = await ask("What do you want to do?", "list", ac);
15
- if (action === "exit") {
16
- console.log("Exiting the simulator. Goodbye!");
17
- break;
18
- } else if (action === "feed") {
19
- const foodList = list();
20
- const foodChoices = foodList.map(f => f.name);
21
- const chosenFoodName = await ask("What do you want to feed?", "list", foodChoices);
22
- const chosenFood = foodList.find(f => f.name === chosenFoodName);
23
- if (chosenFood) {
24
- const newHunger = chosenFood.effect();
25
- console.log(`You fed your potato ${chosenFood.name}. Hunger changed by ${chosenFood.hungerRestore}. New hunger: ${newHunger}`);
26
- } else if(action === 'wake'){
27
- actions()['wake']();
28
- console.log("Your potato is now awake!");
29
- }
30
- } else {
31
- const result = actions()[action]();
32
- console.log(result);
33
- }
34
- hungerTick();
35
- applyTimeReward();
36
- }
11
+ while (true) {
12
+ const stats = get();
13
+ console.log(
14
+ `\nMood: ${stats.mood} | Hunger: ${stats.hunger} | Energy: ${stats.energy} | Activity: ${stats.activity}`,
15
+ );
16
+ const action = await ask("What do you want to do?", "list", ac);
17
+ if (action === "exit") {
18
+ console.log("Exiting the simulator. Goodbye!");
19
+ break;
20
+ } else if (action === "feed") {
21
+ const foodList = list();
22
+ const foodChoices = foodList.map((f) => f.name);
23
+ const chosenFoodName = await ask(
24
+ "What do you want to feed?",
25
+ "list",
26
+ foodChoices,
27
+ );
28
+ const chosenFood = foodList.find((f) => f.name === chosenFoodName);
29
+ if (chosenFood) {
30
+ const newHunger = chosenFood.effect();
31
+ console.log(
32
+ `You fed your potato ${chosenFood.name}. Hunger changed by ${chosenFood.hungerRestore}. New hunger: ${newHunger}`,
33
+ );
34
+ } else if (action === "wake") {
35
+ actions()["wake"]();
36
+ console.log("Your potato is now awake!");
37
+ }
38
+ } else {
39
+ const result = actions()[action]();
40
+ console.log(result);
41
+ }
42
+ hungerTick();
43
+ applyTimeReward();
44
+ }
37
45
  }
38
- main();
46
+ main();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aaloo",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "a virtual pet potato that performs random culinary tasks when fed!",
5
5
  "main": "index.js",
6
6
  "bin": {
package/src/actions.js CHANGED
@@ -5,7 +5,8 @@ function actions() {
5
5
  return {
6
6
  run() {
7
7
  const stats = get();
8
- if (stats.activity === "sleeping") return "Potato is sleeping. Wake it up first."; // These strings were changed to be more descriptive
8
+ if (stats.activity === "sleeping")
9
+ return "Potato is sleeping. Wake it up first."; // These strings were changed to be more descriptive
9
10
  if (stats.hunger >= 80) return "Potato is too hungry to run."; // I used chatgpt for that. I hope it's okay.
10
11
  if (stats.energy < 20) return "Potato is too tired to run.";
11
12
  set("activity", "running");
@@ -17,7 +18,8 @@ function actions() {
17
18
  play() {
18
19
  const stats = get();
19
20
 
20
- if (stats.activity === "sleeping") return "Potato is sleeping. Wake it up first.";
21
+ if (stats.activity === "sleeping")
22
+ return "Potato is sleeping. Wake it up first.";
21
23
  if (stats.hunger >= 80) return "Potato is too hungry to play.";
22
24
  if (stats.energy < 10) return "Potato is too tired to play.";
23
25
 
@@ -34,7 +36,7 @@ function actions() {
34
36
  wake() {
35
37
  set("activity", "idle");
36
38
  return "The potato woke up. He is a bit sleepy but now he is ready for action!";
37
- }
39
+ },
38
40
  };
39
41
  }
40
42
 
package/src/food.js CHANGED
@@ -27,7 +27,11 @@ function list() {
27
27
  { name: "Apple", hungerRestore: 15, effect: food().apple },
28
28
  { name: "Rice", hungerRestore: 2, effect: food().rice },
29
29
  { name: "Sus Stew", hungerRestore: 50, effect: food().susStew },
30
- { name: "Poisonous Potato", hungerRestore: -15, effect: food().poisonousPotato },
30
+ {
31
+ name: "Poisonous Potato",
32
+ hungerRestore: -15,
33
+ effect: food().poisonousPotato,
34
+ },
31
35
  ];
32
- }
33
- module.exports = { food, list };
36
+ }
37
+ module.exports = { food, list };
package/src/stats.js CHANGED
@@ -11,7 +11,7 @@ const DEFAULT_STATS = {
11
11
  energy: 100,
12
12
  mood: 100,
13
13
  activity: "idle",
14
- lastRewardCheck: 0
14
+ lastRewardCheck: 0,
15
15
  };
16
16
 
17
17
  function ensureData() {
@@ -20,10 +20,7 @@ function ensureData() {
20
20
  }
21
21
 
22
22
  if (!fs.existsSync(statsD)) {
23
- fs.writeFileSync(
24
- statsD,
25
- JSON.stringify(DEFAULT_STATS, null, 2)
26
- );
23
+ fs.writeFileSync(statsD, JSON.stringify(DEFAULT_STATS, null, 2));
27
24
  }
28
25
  }
29
26
 
@@ -44,15 +41,12 @@ function set(key, value) {
44
41
  const stats = get();
45
42
  stats[key] = value;
46
43
 
47
- fs.writeFileSync(
48
- statsD,
49
- JSON.stringify(stats, null, 2)
50
- );
44
+ fs.writeFileSync(statsD, JSON.stringify(stats, null, 2));
51
45
 
52
46
  return stats;
53
47
  }
54
48
 
55
49
  module.exports = {
56
50
  get,
57
- set
51
+ set,
58
52
  };
package/install.sh DELETED
@@ -1,2 +0,0 @@
1
- npm i
2
- echo "Installed! Run using the command >> node . <<"