You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

4.7 KiB

Landscaper

studio ghibli landscape

You'll be creating a simple, terminal-based PHP game.

Learning Objectives

  • Putting everything you've learned so far together (arrays, loops, conditionals, functions)

Prerequisites

  • PHP (arrays, loops, conditionals, functions)

Getting Started

  1. Create a landscaper.php inside this folder.

Landscaper

  1. You are starting a landscaping business, but all you have are your teeth.

  2. Using just your teeth, you can spend the day cutting lawns and make $1. You can do this as much as you want.


    🔴 Commit your work!
    Your commit message should read something like:
    "landscaper: user can use teeth to cut grass"
  3. At any point, if you are currently using your teeth, you can buy a pair of rusty scissors for $5. You can do this once, assuming you have enough money.


    🔴 Commit your work!
    Your commit message should read something like:
    "landscaper: user can buy scissors"
  4. Using the rusty scissors, you can spend the day cutting lawns and make $5. You can do this as much as you want.


    🔴 Commit:
    "Landscaper App: user can use scissors to cut grass"
  5. At any point, if you are currently using rusty scissors, you can buy an old-timey push lawnmower for $25. You can do this once, assuming you have enough money.


    🔴 Commit your work!
    Your commit message should read something like:
    "landscaper: user can buy push lawnmower"
  6. Using the old-timey push lawnmower, you can spend the day cutting lawns and make $50. You can do this as much as you want.


    🔴 Commit your work!
    Your commit message should read something like:
    "landscaper: user can use push lawnmower to cut grass"
  7. At any point, if you are currently using the old-timey push lawnmower, you can buy a fancy battery-powered lawnmower for $250. You can do this once, assuming you have enough money.


    🔴 Commit your work!
    Your commit message should read something like:
    "landscaper: user can buy battery-powered lawnmower"
  8. Using the the fancy battery-powered lawnmower, you can spend the day cutting lawns and make $100. You can do this as much as you want.


    🔴 Commit your work!
    Your commit message should read something like:
    "landscaper: user can use battery-powered lawnmower to cut grass"
  9. At any point, if you are currently using the fancy battery-powered lawnmower, you can hire a team of starving students for $500. You can do this once, assuming you have enough money.


    🔴 Commit your work!
    Your commit message should read something like:
    "landscaper: user can hire a team"
  10. Using the the team of starving students, you can spend the day cutting lawns and make $250. You can do this as much as you want.


    🔴 Commit your work!
    Your commit message should read something like:
    "landscaper: user can use a team to cut grass"
  11. You win the game when you have a team of starving students and $1000. In this situation, send a message to the user telling them, they've won.


    🔴 Commit your work!
    Your commit message should read something like:
    "landscaper: win scenario"

Deliverables

For this section of the homework, inside the landscaper folder you should have an and app.php that simulates the landscaper game outlined above. Your app must have:

  • The ability to take user input
  • The ability for the user to earn money
  • The ability to buy tools and use the new tool
  • The ability to win the game and end it
    • Hint: Try setting the win amount to $10 frst, then $50, and etc. until you get to the end to allow for easier testing!

Technical Requirements

  1. Your landscaper game must run on first load with no syntax errors
  2. If there are errors you can't solve, comment them out and leave a comment above it explaining what is wrong

Submission Guidelines

  • Submit your homework via github issues and please don't forget to fill out the form!

Hungry for More?

  1. Add the ability to reset the game at any point so that you can play again
  2. Make it so that a user can have multiple tools, and money earned each day is increased appropriately (e.g. 2 scissors, and an old-timey push lawnmower means you earn $60/day )
  3. Once you've implemented multiple tools, make it so you can sell tools for half price