Giter Club home page Giter Club logo

scrabble's Introduction

Scrabble

Work on the sample exercise defined below for 30 minutes.

As you work, you may:

  • Ask questions of your facilitator
  • Reference external public resources (ie: Google, Ruby API, etc)
  • Use the tooling most comfortable to you (Editor/IDE, testing framework, support tools like Guard, etc)

As you work, you should not:

  • Copy code snippets other than those present in this description
  • Seek live support from individuals other than your facilitator

Setup

$ git clone https://github.com/turingschool/scrabble
$ cd scrabble
$ bundle

Running Specs/Tests

Starter files for both MiniTest and RSpec are provided.

To run the RSpec specs:

bundle exec rake spec

To run the MiniTest tests:

bundle exec rake test

Sample Exercise: Word Scoring

Let’s use test-driven development to build pieces of a Scrabble-like game.

Create functionality to score words based on the following letter values:

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
{
  "A"=>1, "B"=>3, "C"=>3, "D"=>2,
    "E"=>1, "F"=>4, "G"=>2, "H"=>4,
    "I"=>1, "J"=>8, "K"=>5, "L"=>1,
    "M"=>3, "N"=>1, "O"=>1, "P"=>3,
    "Q"=>10, "R"=>1, "S"=>1, "T"=>1,
    "U"=>1, "V"=>4, "W"=>4, "X"=>8,
    "Y"=>4, "Z"=>10

}

Create your solution:

  • using Test-Driven Development with MiniTest or RSpec
  • insensitive to case
  • such that an empty word or nil scores 0
  • using this interaction model:
> game = Scrabble.new
=> ...
> game.score("hello")
=> 8
> game.score("")
=> 0
> game.score(nil)
=> 0

scrabble's People

Contributors

jcasimir avatar joshcheek avatar kytrinyx avatar s-espinosa avatar mikedao avatar sidewinder2020 avatar dalexj avatar icorson3 avatar rnavarrete avatar

Watchers

James Cloos 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.