├── modules ├── styles.css ├── welcome.html ├── round.html └── app.js ├── package.json ├── index.html ├── README.md └── LICENSE /modules/styles.css: -------------------------------------------------------------------------------- 1 | a { 2 | cursor: pointer; 3 | } 4 | 5 | li { 6 | font-size: 140%; 7 | } 8 | 9 | .flex { 10 | display: flex; 11 | flex-direction: column; 12 | } 13 | .flex-fill { 14 | flex: 1; 15 | } 16 | 17 | .form-control { 18 | font-size: 140%; 19 | } 20 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "word-scramble", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "modules/app.js", 6 | "scripts": { 7 | "test": "gulp test" 8 | }, 9 | "author": "Dean Sofer | Proloser", 10 | "license": "MIT", 11 | "dependencies": { 12 | "angular": "^1.4.8", 13 | "angular-ui-router": "^0.2.15", 14 | "bootstrap": "^3.3.6" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Word Scramble 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # word-scramble 2 | Pick a word, and try to see how many recombinations of that word you can think of. 3 | 4 | [https://proloser.github.io/word-scramble/#/](https://proloser.github.io/word-scramble/#/) 5 | 6 | # Instructions 7 | 8 | 1. Go to [https://proloser.github.io/word-scramble/#/](https://proloser.github.io/word-scramble/#/) 9 | 2. Enter a word to scramble and hit 'Start Game' 10 | 3. Start entering variations of the word 11 | 4. Hit the trash to remove bad variations 12 | 5. You can sort the variations alphabetically or in the order they were entered 13 | 6. Adding a variation filters the list to show similar matches 14 | 7. Letters that don't occur in the main word will prevent submitting a variation 15 | 8. Hit the pencil to start a new round 16 | 17 | # Setup 18 | 19 | 1. git clone 20 | 2. npm install # currently all files are committed 21 | 3. Start a webserver from the primary directory 22 | 4. Visit the webserver in the browser. 23 | 24 | # Thanks 25 | 26 | Built for my Grandmother 27 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015 Dean Sofer 2 | 3 | 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | 13 | 14 | The above copyright notice and this permission notice shall be included in 15 | all copies or substantial portions of the Software. 16 | 17 | 18 | 19 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | THE SOFTWARE. 26 | -------------------------------------------------------------------------------- /modules/welcome.html: -------------------------------------------------------------------------------- 1 |

Word Scramble

2 | 3 |

Enter a word to start the round:

4 |
5 |
6 | 7 |
8 |
9 | 12 |
13 |
14 | 15 | 16 |

How to Play:

17 |
    18 |
  1. 19 | Come up with a (preferably large) word to start the round 20 |
  2. 21 |
  3. 22 | Try to come up with as many words you can think of that are made up of letters from the source word 23 |
  4. 24 |
  5. 25 | Duplicates and words that do not use letters from the source word are not allowed 26 |
  6. 27 |
  7. 28 | The variation list filters down to a list of matches as you enter the new word. 29 |
  8. 30 |
  9. 31 | You can remove bad variations by clicking the (trash) icon. 32 |
  10. 33 |
  11. 34 | Press the (pencil) icon to come back here and start a new round. 35 |
  12. 36 |
37 | 38 |

Tip:

39 | 50 | 51 |

Source Code

52 |

53 | Github repo can be found here. 54 |

55 | -------------------------------------------------------------------------------- /modules/round.html: -------------------------------------------------------------------------------- 1 |
2 |
3 | 4 |

5 | Word: {{::word}} 6 | 7 |

8 |

9 | The variation list is filtered as you type in the next word to show nearest matches. The form will turn RED if the word is invalid. 10 |

11 |
12 |
13 | 14 |
15 |
16 | 18 |
19 |
20 | 21 |

22 | {{variations.length}} Variations: 23 | 24 | 25 | 26 | 27 | 28 | (Ordered {{alpha?'alphabetically':'from newest to oldest'}}) 29 | 30 |

31 | 32 |
33 | 34 |
35 | 48 | 49 | 50 |
51 | 52 |
53 | -------------------------------------------------------------------------------- /modules/app.js: -------------------------------------------------------------------------------- 1 | angular.module('app', [ 2 | 'ui.router', 3 | ]) 4 | 5 | .config(function($stateProvider, $urlRouterProvider) { 6 | $urlRouterProvider.otherwise('/'); 7 | 8 | $stateProvider.state('welcome', { 9 | url: '/', 10 | controller: 'Welcome', 11 | templateUrl: 'modules/welcome.html', 12 | }); 13 | 14 | $stateProvider.state('game', { 15 | abstract: true, 16 | template: '', 17 | }) 18 | 19 | $stateProvider.state('round', { 20 | parent: 'game', 21 | url: '/round/:word', 22 | resolve: { 23 | 24 | }, 25 | controller: 'Round', 26 | templateUrl: 'modules/round.html' 27 | }) 28 | }) 29 | 30 | .controller('Welcome', function($scope, $state){ 31 | $scope.go = $state.go; 32 | }) 33 | 34 | .controller('Round', function($scope, $stateParams) { 35 | $scope.word = $stateParams.word; 36 | $scope.variations = []; 37 | 38 | /** 39 | * Adds the newWord input to the list if it passes the check 40 | */ 41 | $scope.add = function() { 42 | var word = $scope.newWord.trim(); 43 | if ($scope.isVariation($scope.word, word) 44 | && !~$scope.variations.indexOf(word) 45 | && word !== $scope.word) { 46 | $scope.variations.unshift(word.toLowerCase()); 47 | } 48 | $scope.newWord = ''; 49 | }; 50 | 51 | /** 52 | * Determines if the input is a variation of the round word 53 | * @param {string} variation Input to check 54 | * @return {boolean} Is the input a variation of letters 55 | */ 56 | $scope.isVariation = function(variation) { 57 | variation = variation || ''; 58 | variation = variation.toLowerCase(); 59 | var word = $scope.word.split(''); 60 | var valid = variation.split('').every(function(varLetter){ 61 | var index = word.indexOf(varLetter); 62 | if (~index) { 63 | word.splice(index, 1); 64 | return true; 65 | } else { 66 | return false; 67 | } 68 | }); 69 | return valid; 70 | }; 71 | }) 72 | --------------------------------------------------------------------------------