Git Product home page Git Product logo

c3projects--scrabble's Introduction

Scrabble

Use TDD to create classes that would be used to build a scrabble game. Don't actually build an interactive game (yet)!

Project Expectations

From the project root, you should be able to execute all of your specs by just running rspec. All of your classes should be in their own files in lib/, and the entire project should be namespaced in a module called Scrabble.

Your spec descriptions should be meaningful and organized into context blocks that reflect your intent on how to use the code.

Do not move onto a new tier of requirements until the minimum requirements of the previous tier are complete and your specs are green across the board. Use TDD to drive your development and document your edge cases.

Breakfast

Create a Scrabble class with a minimum of 8 specs. The class should have the following class methods:

  • self.score(word): returns the total score value for the given word. The word is input as a string (case insensitive). The chart below shows the point value for a given letter.
  • self.highest_score_from(array_of_words): returns the word in the array with the highest score.
    • Note that it’s better to use fewer tiles, so if the top score is tied between multiple words, pick the one with the fewest letters.
    • Note that there is a greater bonus for using all seven letters. If the top score is tied between multiple words and one used all seven letters, choose the one with seven letters over the one with fewer tiles.
    • If the there are multiple words that are the same score and same length, pick the first one in supplied list

Score chart

Letter Value
A, E, I, O, U, L, N, R, S, T 1
D, G 2
B, C, M, P 3
F, H, V, W, Y 4
K 5
J, X 8
Q, Z 10

Lunch

Create a Player class with a minimum of 11 specs. The class should have the following class and instance methods:

  • self.new(name): creates a new instance with the instance variable name assigned
  • #name: returns the @name instance variable
  • #plays: returns an Array of the words played by the player
  • #play(word): Adds the input word to the plays Array
    • Returns false if player has already won
  • #total_score: Sums up and returns the score of the players words
  • #won?: If the player has over 100 points, returns true, otherwise returns 'false'
  • #highest_scoring_word: Returns the highest scoring word the user has played.
  • #highest_word_score: Returns the highest_scoring_word score.

Dinner

Create a TileBag class with a minimum of 5 specs. It should have the following class and instance methods:

  • self.new creates an instance with a collection of default tiles
  • #draw_tiles(n) returns n number of random tiles, removes the tiles from the default set.
  • #tiles_remaining returns the number of tiles remaining in the bag

Create specs for (minimum 2) and add to the Player class the following instance methods:

  • #tiles a collection of letters that the player can play (max 7)
  • #draw_tiles(tile_bag) fills tiles array until it has 7 letters from the given tile bag

Beginning Tile Quantities:

  • A: 9
  • B: 2
  • C: 2
  • D: 4
  • E: 12
  • F: 2
  • G: 3
  • H: 2
  • I: 9
  • J: 1
  • K: 1
  • L: 4
  • M: 2
  • N: 6
  • O: 8
  • P: 2
  • Q: 1
  • R: 6
  • S: 4
  • T: 6
  • U: 4
  • V: 2
  • W: 2
  • X: 1
  • Y: 2
  • Z: 1

Dessert

  • Create a Dictionary class that includes a method for searching a list of words to determine if a given word is a valid word.
  • Create a Board class that has a matrix (array of arrays) of tile places. Check if a word can be played on a given tile place in a certain direction.
  • Include a minimum of 20 specs between the Dictionary and Board classes.

c3projects--scrabble's People

Contributors

jnf avatar

Stargazers

Edilene avatar

Watchers

Dave Foley avatar Bookis Worthy avatar Denise Mauldin avatar Elise Worthy avatar James Cloos avatar Chris M avatar Michael Hotan avatar George Murray avatar HHH avatar susanev avatar Saloni Jain avatar Katherine Patke avatar Lila Garcia avatar  avatar Brenna avatar Victoria Shabunia avatar Carly Hiller avatar Sally Moore avatar Kyna Nguyen avatar Brandi avatar Kari avatar  avatar  avatar  avatar  avatar  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.