Write a program that, given a word, computes the scrabble score for that word.
eg. the word cabbage should have a score of 14
eg. the word cat should have a score of 5
Your program should be in a file named scrabble.rb or scrabble.js.
| <!doctype html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <title>demo2</title> | |
| <link rel="stylesheet" href="stylesheets/main.css"> | |
| <style> | |
| html, body { height: 100%; margin: 0;} | |
| #container { display: flex; height: 100%; flex-flow: row;} | |
| #index { flex: 1; background: white; } |
| class Node | |
| attr_accessor :value, :next_node | |
| def initialize(value=nil) | |
| @value = value | |
| @next_node = nil | |
| end | |
| def to_s | |
| @value || nil |
| /** @jsx React.DOM */ | |
| var MyComponent = React.createClass({ | |
| getInitialState: function() { | |
| // set up the initial state. used for "logical" initialization code | |
| return {perMinute: '-', perDay: '-'}; | |
| }, | |
| componentDidMount: function() { | |
| // fired only once, when the component is added to the DOM | |
| // used for initialization code that has "side effects" i.e. i/o, jquery plugins, etc | |
| var socket = io.connect(this.props.url); |
| /** @jsx React.DOM */ | |
| var MyRootComponent = React.createClass({ | |
| getInitialState: function() { | |
| return {perMinute: '-', perDay: '-'}; | |
| }, | |
| componentDidMount: function() { | |
| var socket = io.connect(this.props.url); | |
| socket.on('business.clickout', this.setState.bind(this)); | |
| }, | |
| render: function() { |
| <html> | |
| <head> | |
| <title>Test</title> | |
| <script src="http://code.jquery.com/jquery-1.9.1.js"></script> | |
| <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script> | |
| <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" /> | |
| <script src="http://fb.me/react-0.5.1.js"></script> | |
| <script src="http://fb.me/JSXTransformer-0.5.1.js"></script> | |
| </head> |
Bob is a lackadaisical teenager. In conversation, his responses are very limited.
He answers 'Sure.' if you ask him a question. He answers 'Whatever.' if you tell him something. He answers 'Woah, chill out!' if you yell at him (ALL CAPS). He says 'Fine. Be that way!' if you address him without actually saying anything.
Write Bob so that you can have an interactive conversation with him.