diff --git a/README.md b/README.md
index 317a3e58..572d8975 100644
--- a/README.md
+++ b/README.md
@@ -1,96 +1,51 @@
-# Project Name (Start editing here)
-
+### Project Name (Cash Crops)
+link : https://empludo.github.io/project-1/
+## Overview
+You are a cash crop farmer. Your objective is to farm a crop, hope for a good harvest and make a nice profit. The higher the profit the better.
-#  Project #1: The Game
+Throughout the game, you will pick the
-### Overview
+* type of crop to farm
+* level of farming equipment to buy
+* level of fertilizer to buy
+* level of pest control to buy
-Let's start out with something fun - **a game!**
+Usually, the higher the cost you pay, the greater the corresponding returns (you get better harvest yields).
-Everyone will get a chance to **be creative**, and work through some really **tough programming challenges** – since you've already gotten your feet wet with Tic Tac Toe, it's up to you to come up with a fun and interesting game to build.
-**You will be working individually for this project**, but we'll be guiding you along the process and helping as you go. Show us what you've got!
+After making the above 4 decisions, the game will generate a type of harvest based on probability. The types of harvests are:
+* Famine(10% chance)
+* Poor(20% chance)
+* Normal(40% chance)
+* Good(20% chance)
+* Bountiful(10% chance)
+The higher the level of harvests, the better your harvest yields. Harvest yield is measured in bushels.
----
+Your Total Harvest Yield is determined by the type of harvest you get and the level of farming equipment/fertilizer/pest-control you choose to buy.
+Total harvest yield is measured in bushels.
-### Technical Requirements
+The price per bushel of crop you plant will be determined by the crop you choose to farm and the type of harvest you get.
+Usually the more expensive the crop seeds cost to buy, the greater the price per bushel you can sell them for.
+Also, the worse the type of harvest, the higher the price you can sell per bushel.(Shortages drive up prices);
-Your app must:
+Your total revenue will be the price per bushel of your chosen crop multiplied by the total harvest yield. Your profit will be the revenue less the cost you spend buying stuff.
-* **Render a game in the browser**
-* **Any number of players** will be okay, switch turns will be great
-* **Design logic for winning** & **visually display which player won**
-* **Include separate HTML / CSS / JavaScript files**
-* Stick with **KISS (Keep It Simple Stupid)** and **DRY (Don't Repeat Yourself)** principles
-* Use **Javascript** for **DOM manipulation**, jQuery is not compulsory
-* **Deploy your game online**, where the rest of the world can access it
-* Use **semantic markup** for HTML and CSS (adhere to best practices)
-* **No canvas** project will be accepted, only HTML5 + CSS3 + JS please
+Your objective is to maximize profit, AND END THE GAME WITH MORE CASH THEN YOU STARTED OUT WITH.
----
-### Necessary Deliverables
+## Game Logic
+#typeOfHarvest()
+Determines the type of harvest (Famine,Poor, Normal ,Good, Bountiful)
-* A **working game, built by you**, hosted somewhere on the internet
-* A **link to your hosted working game** in the URL section of your GitHub repo
-* A **git repository hosted on GitHub**, with a link to your hosted game, and frequent commits dating back to the very beginning of the project
-* **A ``readme.md`` file** with explanations of the technologies used, the approach taken, installation instructions, unsolved problems, etc.
+#equipmentType()
+Calculates the effect that the chosen equipment has on harvest yield
----
+#fertilizerType()
+Calculates the effect that the chosen fertilizer has on harvest yield
-### Suggested Ways to Get Started
+#pestControlType()
+Calculates the effect that the chosen pest control has on harvest yield
-* **Break the project down into different components** (data, presentation, views, style, DOM manipulation) and brainstorm each component individually. Use whiteboards!
-* **Use your Development Tools** (console.log, inspector, alert statements, etc) to debug and solve problems
-* Work through the lessons in class & ask questions when you need to! Think about adding relevant code to your game each night, instead of, you know... _procrastinating_.
-* **Commit early, commit often.** Don’t be afraid to break something because you can always go back in time to a previous version.
-* **Consult documentation resources** (MDN, jQuery, etc.) at home to better understand what you’ll be getting into.
-* **Don’t be afraid to write code that you know you will have to remove later.** Create temporary elements (buttons, links, etc) that trigger events if real data is not available. For example, if you’re trying to figure out how to change some text when the game is over but you haven’t solved the win/lose game logic, you can create a button to simulate that until then.
-
----
-
-### Potential Project Ideas
-
-##### Blackjack
-Make a one player game where people down on their luck can lose all their money by guessing which card the computer will deal next!
-
-##### Self-scoring Trivia
-Test your wits & knowledge with whatever-the-heck you know about (so you can actually win). Guess answers, have the computer tell you how right you are!
-
----
-
-### Useful Resources
-
-* **[MDN Javascript Docs](https://developer.mozilla.org/en-US/docs/Web/JavaScript)** _(a great reference for all things Vanilla Javascript)_
-* **[jQuery Docs](http://api.jquery.com)** _(if you're using jQuery)_
-* **[GitHub Pages](https://pages.github.com)** _(for hosting your game)_
-* **[How to write readme - Markdown CheatSheet](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet)** _(for editing this readme)_
-* **[How to write a good readme for github repo!](https://gist.github.com/PurpleBooth/109311bb0361f32d87a2)** _(to make it better)_
-
----
-
-### Project Feedback + Evaluation
-
-* __Project Workflow__: Did you complete the user stories, wireframes, task tracking, and/or ERDs, as specified above? Did you use source control as expected for the phase of the program you’re in (detailed above)?
-
-* __Technical Requirements__: Did you deliver a project that met all the technical requirements? Given what the class has covered so far, did you build something that was reasonably complex?
-
-* __Creativity__: Did you add a personal spin or creative element into your project submission? Did you deliver something of value to the end user (not just a login button and an index page)?
-
-* __Code Quality__: Did you follow code style guidance and best practices covered in class, such as spacing, modularity, and semantic naming? Did you comment your code as your instructors have in class?
-
-* __Deployment__: Did you deploy your application to a public url using GitHub Pages?
-
-* __Total__: Your instructors will give you a total score on your project between:
-
- Score | Expectations
- ----- | ------------
- **0** | _Incomplete._
- **1** | _Does not meet expectations._
- **2** | _Meets expectations, good job!_
- **3** | _Exceeds expectations, you wonderful creature, you!_
-
- This will serve as a helpful overall gauge of whether you met the project goals, but __the more important scores are the individual ones__ above, which can help you identify where to focus your efforts for the next project!
+## Future upgrades
+Play for additional seasons, so you can use your newly accquired wealth to grow it further
diff --git a/assets/css/stylesheet.css b/assets/css/stylesheet.css
deleted file mode 100644
index e69de29b..00000000
diff --git a/assets/js/script.js b/assets/js/script.js
deleted file mode 100644
index e69de29b..00000000
diff --git a/images/5018795998_3e2fa11c1c_o-4-e1467288941131.jpg b/images/5018795998_3e2fa11c1c_o-4-e1467288941131.jpg
new file mode 100644
index 00000000..f5d3351c
Binary files /dev/null and b/images/5018795998_3e2fa11c1c_o-4-e1467288941131.jpg differ
diff --git a/images/DB-f10v-d4l.jpg b/images/DB-f10v-d4l.jpg
new file mode 100644
index 00000000..501e28e9
Binary files /dev/null and b/images/DB-f10v-d4l.jpg differ
diff --git a/images/Harvest-Time-Lambourne-Berks.jpg b/images/Harvest-Time-Lambourne-Berks.jpg
new file mode 100644
index 00000000..9a93498f
Binary files /dev/null and b/images/Harvest-Time-Lambourne-Berks.jpg differ
diff --git a/images/Locusts.jpg b/images/Locusts.jpg
new file mode 100644
index 00000000..cdfaeb99
Binary files /dev/null and b/images/Locusts.jpg differ
diff --git a/images/Reeve_and_Serfs.jpg b/images/Reeve_and_Serfs.jpg
new file mode 100644
index 00000000..20170a0a
Binary files /dev/null and b/images/Reeve_and_Serfs.jpg differ
diff --git a/images/afb51be644760c0b6d3d5124b83f0384--pirate-sims-.jpg b/images/afb51be644760c0b6d3d5124b83f0384--pirate-sims-.jpg
new file mode 100644
index 00000000..7070572d
Binary files /dev/null and b/images/afb51be644760c0b6d3d5124b83f0384--pirate-sims-.jpg differ
diff --git a/images/cash-crop.jpg b/images/cash-crop.jpg
new file mode 100644
index 00000000..e780335a
Binary files /dev/null and b/images/cash-crop.jpg differ
diff --git a/images/crop-specialization.jpg b/images/crop-specialization.jpg
new file mode 100644
index 00000000..95f752de
Binary files /dev/null and b/images/crop-specialization.jpg differ
diff --git a/images/equipmentimg.jpg b/images/equipmentimg.jpg
new file mode 100644
index 00000000..077da7d3
Binary files /dev/null and b/images/equipmentimg.jpg differ
diff --git a/images/lessing_art_103107516471.gif b/images/lessing_art_103107516471.gif
new file mode 100644
index 00000000..cb583fd9
Binary files /dev/null and b/images/lessing_art_103107516471.gif differ
diff --git a/images/medieval-harvest-flyer2.jpg b/images/medieval-harvest-flyer2.jpg
new file mode 100644
index 00000000..0d7bc0a8
Binary files /dev/null and b/images/medieval-harvest-flyer2.jpg differ
diff --git a/images/oldpaper.jpg b/images/oldpaper.jpg
new file mode 100644
index 00000000..ae93bc22
Binary files /dev/null and b/images/oldpaper.jpg differ
diff --git a/images/paper.jpg b/images/paper.jpg
new file mode 100644
index 00000000..916b79ca
Binary files /dev/null and b/images/paper.jpg differ
diff --git a/images/pigeonandcricket.jpg b/images/pigeonandcricket.jpg
new file mode 100644
index 00000000..aa08371b
Binary files /dev/null and b/images/pigeonandcricket.jpg differ
diff --git a/images/seagullsandcrickets.jpg b/images/seagullsandcrickets.jpg
new file mode 100644
index 00000000..33165129
Binary files /dev/null and b/images/seagullsandcrickets.jpg differ
diff --git a/index.html b/index.html
index 5b002212..cff06d86 100644
--- a/index.html
+++ b/index.html
@@ -1,11 +1,30 @@
-
-
-
-
-
-
-
-
+
+
+ Cash Crops
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/script.js b/script.js
new file mode 100644
index 00000000..bef427e9
--- /dev/null
+++ b/script.js
@@ -0,0 +1,437 @@
+$(document).ready(function () {
+
+ var initialSum = 2000
+ var sumLeft
+
+ //crop type
+ var c1 = {
+ name: "Sugarcane",
+ num: 1,
+ cost: 300,
+ seedCostModifier: 0.3,
+ premium: 0.6,
+ des: "You can never go wrong with sugarcanes -$300"
+ }
+ var c2 = {
+ name: "Coffee",
+ num: 2,
+ cost: 500,
+ seedCostModifier: 0.5,
+ premium: 0.8,
+ des: "There is no shortage of demand for coffee -$500"
+ }
+ var c3 = {
+ name: "Cotton",
+ num: 3,
+ cost: 600,
+ seedCostModifier: 0.6,
+ premium: 1.0,
+ des: "Cotton is always needed to make clothes. -$600"
+ }
+ var c4 = {
+ name: "Tobacco",
+ num: 4,
+ cost: 800,
+ seedCostModifier: 0.8,
+ premium: 1.2,
+ des: "Tobacco is an excellent investment -$800"
+ }
+ var c5 = {
+ name: "Cannabis",
+ num: 5,
+ cost: 1100,
+ seedCostModifier: 1.1,
+ premium: 1.8,
+ des: "Cannabis is a high-risk, high-reward venture -$1100"
+ }
+
+ var crops = [c1, c2, c3, c4, c5];
+
+ function findObjectByKey(array, key, value) {
+ for (var i = 0; i < array.length; i++) {
+ if (array[i][key] === value) {
+ return array[i];
+ }
+ }
+ return null;
+ }
+ //start screen
+ // $(".backdrop").append("")
+
+ $("#text").append("
You are a new farmer who has just inherited a small plot of farmland and a substantial sum of $" + initialSum + ". Realizing the potentially greater profits that cash crops can bring over traditional crops, you decided to go all in and dedicate your entire fortune and farmland towards farming cash crops.
The first thing to do after deciding to be a cash crop farmer is to decide on the type of crop to farm. Usually, the higher the cost of the seeds, the higher the price the harvested crop would sell for.
Select the type of crop you want to plant:
")
+
+ for (var i = 0; i < crops.length; i++) {
+ $("#decisions").append("")
+ }
+ });
+
+ $(".container").on("click", ".cropoption", function () {
+ $(".cropcontent").remove();
+ $(".cropoption").remove();
+ $(".backgroundpic").remove();
+
+ $(".backdrop").append("")
+ $("#text").append("
After choosing the type of crop you want to plant, you need to take necessary measures to maximize your harvest. To do that, you head to the store in the town to buy the necessary farming and pest control equipment as well as fertilizers.
")
+ $("#decisions").append("")
+ var userClicked = $(this).attr("id");
+ chosenCrop = findObjectByKey(crops, "name", userClicked);
+ console.log(chosenCrop);
+ });
+
+ //equipment types
+ var basicEquipment = {
+ name: "basic",
+ cost: 100,
+ des: "Only the bare necessities, like a few rakes and sickles. -$100",
+ res: "as you only bought the basics, your yields did not see any improvement as a result of using better farming tools."
+ }
+ var upgradedEquipment = {
+ name: "upgraded",
+ cost: 200,
+ des: "More equipment like scythes and ploughs to make life easier -$200",
+ res: "as you invested more money in equipment you got better yields"
+ }
+ var bestEquipment = {
+ name: "best",
+ cost: 300,
+ des: "The best and latest equipment plus a few strong oxen -$300",
+ res: "you paid top dollar to procure the best equipment and as a result of this, crop output has increased significantly."
+ }
+ var equipments = [basicEquipment, upgradedEquipment, bestEquipment]
+
+ $(".container").on("click", ".storeoption", function () {
+ sumLeft = initialSum - chosenCrop.cost;
+ $(".storetext").remove();
+ $(".storeoption").remove();
+ $(".backgroundpic").remove();
+ $(".backdrop").append("")
+ $("#text").append("
You now have $" + sumLeft + ". Select the type of equipment you want to buy:
")
+
+ for (var i = 0; i < equipments.length; i++) {
+ $("#decisions").append("")
+
+ }
+
+ });
+
+ var chosenEquipment;
+ // //fertilizer types
+ var basicFertilizer = {
+ name: "basic",
+ cost: 100,
+ des: "Fertilizer gotten mainly off excrement from questionable sources along the streets.Though their quality is questionable, it is probably better than no fertilizer at all. -$100",
+ res: "the basic level of fertilizer applied marginally improved the output of your crops "
+ }
+ var upgradedFertilizer = {
+ name: "upgraded",
+ cost: 200,
+ des: "High-grade fertilizer gotten from organic sources that will be extremely nutritous for your crops-$200",
+ res: "the investment in high-grade fertilizer paid off quite handsomely and has greatly improved your harvest"
+ }
+ var bestFertilizer = {
+ name: "best",
+ cost: 300,
+ des: "Even more organic high-grade fertilizer. Of the same quality as the above option but with twice the quantity and with a big discount thrown in. There is never too much of a good thing. -$300",
+ res: "the excessive amount of fertilizer applied to your crops resulted in over-fertilization and has severely diminished the output of your crops. Guess too much of a good thing may result in bad outcomes"
+ }
+ var fertilizers = [basicFertilizer, upgradedFertilizer, bestFertilizer]
+
+ $(".container").on("click", ".equipmentoption", function () {
+ $(".equipmenttext").remove();
+ $(".equipmentoption").remove();
+ $(".backgroundpic").remove();
+ $(".backdrop").append("")
+
+ var userClicked = $(this).attr("id");
+ chosenEquipment = findObjectByKey(equipments, "des", userClicked);
+
+ console.log(chosenEquipment);
+ sumLeft = sumLeft - chosenEquipment.cost
+
+ $("#text").append("
You have $" + sumLeft + " left. Select the type of fertilizer you want to buy:
")
+
+ for (var i = 0; i < fertilizers.length; i++) {
+ $("#decisions").append("")
+
+ }
+ });
+
+ var chosenFertilizer;
+
+
+ // //pest-control measures
+ var basicPestControl = {
+ name: "basic",
+ cost: 100,
+ des: "A simple fence to keep out unwanted animals -$100",
+ res: "the fences did their job in keeping out larger animals. However, they were not very effective against birds and bugs, resulting in some crops being lost."
+ }
+ var upgradedPestControl = {
+ name: "upgraded",
+ cost: 200,
+ des: "More fences, plus a few scarecrows -$200",
+ res: "the scarecrows did job well. However, they were not very effective in keeping out the bugs and weeds and still some crops were lost."
+ }
+ var bestPestControl = {
+ name: "best",
+ cost: 300,
+ des: "A comprehensive pest control programme involving pesticides, fences, scarecrows and herbicides to counteract pests of all types -$300",
+ res: "the comprehensive pest-control measures have paid off and losses of crop due to pests and weeds have been kept to a bare minimum."
+ }
+ var pesticides = [basicPestControl, upgradedPestControl, bestPestControl]
+
+ $(".container").on("click", ".fertilizeroption", function () {
+ $(".fertilizertext").remove();
+ $(".fertilizeroption").remove();
+ $(".backgroundpic").remove();
+ $(".backdrop").append("")
+
+ var userClicked = $(this).attr("id");
+ chosenFertilizer = findObjectByKey(fertilizers, "des", userClicked);
+
+ console.log(chosenFertilizer);
+ sumLeft = sumLeft - chosenFertilizer.cost
+ $("#text").append("
You have $" + sumLeft + " left. Select the level of pest-control you want to buy:
")
+
+ for (var i = 0; i < pesticides.length; i++) {
+ $("#decisions").append("")
+ }
+ });
+
+
+
+ var chosenPestControl
+
+
+ $(".container").on("click", ".pestcontroloption", function () {
+ $(".pestcontroltext").remove();
+ $(".pestcontroloption").remove();
+ $(".backgroundpic").remove();
+ $(".backdrop").append("")
+
+ var userClicked = $(this).attr("id");
+ chosenPestControl = findObjectByKey(pesticides, "des", userClicked);
+
+ console.log(chosenPestControl);
+ $("#text").append("
You leave the shop with a cart full of your purchases. As you arrive back at your farm after an exhausting day of travelling and shopping, you unearth a dusty record that keeps track of your personal finances.
")
+ $("#decisions").append("")
+
+ });
+
+ // Total Costs and sum left
+ var totalCost;
+
+ $(".container").on("click", ".itemsboughtoption", function () {
+ $(".itemsboughttext").remove();
+ $(".itemsboughtoption").remove();
+ $(".backgroundpic").remove();
+ $(".backdrop").append("")
+ totalCost = chosenCrop.cost + chosenEquipment.cost + chosenFertilizer.cost + chosenPestControl.cost;
+ sumLeft = initialSum - totalCost;
+ console.log(totalCost);
+ $("#text").append("
You spent $" + totalCost + " in total. You have $" + sumLeft + " left in your account. Hopefully the upcoming harvest will be a good one.
")
+ $("#decisions").append("")
+ });
+
+ //Harvest types:
+ var awfulHarvest = {
+ premium: 2,
+ type: "a famine",
+ modifier: 0.01,
+ des: "This season's harvest has been the worst in living memory. On the bright side, a shortage may also mean higher prices and a better deal in the marketplace."
+ }
+ var poorHarvest = {
+ premium: 1.5,
+ type: "a poor harvest",
+ modifier: 0.05,
+ des: "The amount of crop output is far lower than expected, but hey, it could have been worse."
+ }
+ var normalHarvest = {
+ premium: 1,
+ type: "a normal harvest",
+ modifier: 1.0,
+ des: "Crop yields are average compared to previous years. It has been a mundane year with a mediocre harvest."
+ }
+ var goodHarvest = {
+ premium: 0.9,
+ type: "a good harvest",
+ modifier: 1.5,
+ des: "It has been one of the better harvests in the past few years. Farmers are expecting a tidy profit from their plentiful harvests!"
+ }
+ var bountifulHarvest = {
+ premium: 0.8,
+ type: "a bountiful harvest",
+ modifier: 2.0,
+ des: "It is the best harvest in years. However, an abundance of crops in the market may also mean lower prices. "
+ }
+ var defaultYield = 1000
+ var sellingPrice
+
+ //Decision Modifiers (Chosen equipment,crops etc and their effects on yield)
+ function equipmentType() {
+ if (chosenEquipment.name == "basic") {
+ return 1;
+ } else if (chosenEquipment.name == "upgraded") {
+ return 1.05;
+ } else {
+ return 1.15;
+ }
+ }
+
+ function fertilizerType() {
+ if (chosenFertilizer.name == "basic") {
+ return 1.05;
+ } else if (chosenFertilizer.name == "upgraded") {
+ return 1.3;
+ } else {
+ return 0.8;
+ }
+ }
+
+ function pestControlType() {
+ if (chosenPestControl.name == "basic") {
+ return 0.85;
+ } else if (chosenPestControl.name == "upgraded") {
+ return 0.95;
+ } else {
+ return 1;
+ }
+ }
+
+ //Yields
+ function yieldType() {
+ return Math.random();
+
+ }
+
+ function typeOfHarvest() {
+ if (yieldType() < 0.1) {
+ return awfulHarvest;
+ } else if (yieldType() < 0.3) {
+ return poorHarvest;
+ } else if (yieldType() < 0.7) {
+ return normalHarvest;
+ } else if (yieldType() < 0.9) {
+ return goodHarvest;
+ } else {
+ return bountifulHarvest;
+ }
+ }
+
+ var harvestType
+
+ $(".container").on("click", ".totalcostsoption", function () {
+ $(".totalcoststext").remove();
+ $(".totalcostsoption").remove();
+ $(".backgroundpic").remove();
+ $(".backdrop").append("")
+ harvestType = typeOfHarvest();
+
+ $("#text").append("
For the past year, there has been " + harvestType.type + " in the country. " + harvestType.des + "
With a " + harvestType.type + ", prices of " + chosenCrop.name + " are selling for $" + Math.round(harvestType.premium * chosenCrop.premium * 100) / 100 + " per bushel. Hence, as you have " + totalCropsHarvested + " bushels, you have made a total revenue of $" + harvestRevenue + ". Together with the $" + sumLeft + " in your account, you now have $" + finalSum + " in total.
")
+ $("#decisions").append("")
+
+ });
+
+ var failure = {
+ type: "lose",
+ des: "Due to either extreme bad luck or poor purchasing decisions, you lost more money than you spent. Perhaps next year will be a better year for you. Better luck next time!"
+ }
+ var meh = {
+ type: "earn",
+ des: "You have made more money than you spent, but just barely. At least you did not lose any money, and you can always try again. Perhaps next year will be a better year for you."
+ }
+ var success = {
+ type: "earn",
+ des: "You have managed to turn a substantial profit from your investments. Over time, if you keep up with this performance, you just might become a wealthy farmer!"
+ }
+ var champ = {
+ type: "earn",
+ des: "Amazing! You not only turned a spectacular profit, you more than doubled your initial sum. Word of your success has spread all over the country and your name is known far and wide. Well done, there can't be a better outcome than this!"
+ }
+
+ function appraisal() {
+
+ if (finalScore < 0) {
+ return failure;
+ } else if (finalScore < 200) {
+ return meh;
+ } else if (finalScore < 2000) {
+ return success;
+ } else {
+ return champ;
+
+ }
+ };
+
+ $(".container").on("click", ".finalsaleoption", function () {
+ $(".finalsaletext").remove();
+ $(".finalsaleoption").remove();
+ $(".backgroundpic").remove();
+ $(".backdrop").append("")
+ finalScore = finalSum - initialSum;
+
+ var finalGrade = appraisal()
+
+ $("#text").append("
Over the course of the year, with revenues of $" + harvestRevenue + " and expenses of $" + totalCost + ", you have managed to " + finalGrade.type + " $ " + Math.abs(finalScore) + ". " + finalGrade.des + "