Giter VIP home page Giter VIP logo

state_capitals's Introduction

Let's Learn our State Capitals

We're going to create a game to help us memorize the names of the capitals of all 50 states.

To play the game:

  • Your program should prompt the user to identify the capital associated with a given state.
  • There should be running tallies on the number of correct and incorrect answers for each state
  • After getting through all 50 states one time, users should be asked whether or not they want to play again.

Game Requirements

  • Make sure the states don't appear in alphabetical order in the prompts. This will make the game a bit more challenging for the user.

  • Provide a welcome message to introduce the player to the game.

  • Initialize new keys in the hashes that store the number of times a user gets a capital correct and the number of times the answer is wrong.

  • Through all 50 states, prompt the user to name the capital of the state.

  • If the answer is correct, display a message saying so, and increment the correct key.

  • If the answer is wrong, display a message saying so, and increment the wrong key.

  • After each prompt, display a message telling the reader how many times the state was answered correctly out of the total number of times answered.

  • Once the user has gone through all 50 states, ask them if they'd like to play again.

Getting Started

You're given an array of hashes that contain each state name and capital.

Hint: For the purposes of developing this program, start with a test array of three hashes so you don't have to play through all 50 states each time.

Potentially Useful Methods

  • puts
  • gets
  • .each
  • .sort_by
  • .shuffle

Bonus!

  • Calculate a overall total score, display a running tally for each prompt
  • If the user plays again, set the order of how the prompts appear to start with the ones they got wrong the most often.
  • Add a hint functionality that prints the first 3 letters of a capital
  • Group states that have two or more incorrect guesses.

state_capitals's People

Contributors

nayana487 avatar nolds9 avatar

Watchers

James Cloos avatar Rafael Fernandez avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.