From e428912eacf4f782c2442afea1ca656e47713443 Mon Sep 17 00:00:00 2001 From: Jonathan Chu Date: Thu, 3 Sep 2015 16:45:17 -0700 Subject: [PATCH 1/9] Add favicon --- index.html | 2 ++ public/assets/images/favicon.ico | Bin 0 -> 1086 bytes 2 files changed, 2 insertions(+) create mode 100644 public/assets/images/favicon.ico diff --git a/index.html b/index.html index 25493a7..ed97b14 100644 --- a/index.html +++ b/index.html @@ -1,6 +1,8 @@ + +
diff --git a/public/assets/stylesheets/GameBackground.css b/public/assets/stylesheets/GameBackground.css index dd61e87..640ef04 100644 --- a/public/assets/stylesheets/GameBackground.css +++ b/public/assets/stylesheets/GameBackground.css @@ -31,7 +31,7 @@ body { text-align: center; font-size: 30px; } .center-column .game-desc-hr { - margin: 40px 0px 20px 0px; } + margin: 10px 0px 20px 0px; } .center-column #how-to-play { margin: 10px auto 10px auto; width: 95%; @@ -63,15 +63,16 @@ body { text-align: center; margin: 10px 0px 20px 0px; } .game-button-wrapper .game-btn { - height: auto; + height: 40px; + word-wrap: break-word; display: inline-block; width: 40%; - margin: 0px 10px; + margin: 0 0 10px; background-color: Transparent; border-style: solid; border-color: #a7acb0; border-radius: 10px; } - .game-button-wrapper .game-btn p { + .game-button-wrapper .game-btn .button-text { font-size: 30px; color: #D1857F; margin: 0px 0px 5px 0px; } diff --git a/public/assets/stylesheets/GameBackground.sass b/public/assets/stylesheets/GameBackground.sass index b2fee4e..1431462 100644 --- a/public/assets/stylesheets/GameBackground.sass +++ b/public/assets/stylesheets/GameBackground.sass @@ -36,7 +36,7 @@ body font-size: 30px .game-desc-hr - margin: 40px 0px 20px 0px + margin: 10px 0px 20px 0px #how-to-play margin: 10px auto 10px auto @@ -73,16 +73,17 @@ body margin: 10px 0px 20px 0px .game-btn - height: auto + height: 40px + word-wrap: break-word display: inline-block width: 40% - margin: 0px 10px + margin: 0 0 10px background-color: Transparent border-style: solid border-color: #a7acb0 border-radius: 10px - p + .button-text font-size: 30px color: #D1857F margin: 0px 0px 5px 0px From e4330b8cd40136237fbf22a2c4497558139e5758 Mon Sep 17 00:00:00 2001 From: Brandon Woo Date: Sun, 1 Nov 2015 23:24:49 -0800 Subject: [PATCH 3/9] Create twitter service --- app/services/ShareGameService.coffee | 8 ++------ app/services/TwitterGameService.coffee | 12 ++++++++++++ 2 files changed, 14 insertions(+), 6 deletions(-) create mode 100644 app/services/TwitterGameService.coffee diff --git a/app/services/ShareGameService.coffee b/app/services/ShareGameService.coffee index c0bf71b..75ca1ff 100644 --- a/app/services/ShareGameService.coffee +++ b/app/services/ShareGameService.coffee @@ -1,12 +1,8 @@ -$ = require 'jquery' +TwitterGameService = require './TwitterGameService' class ShareGameService @setMessage: -> - possible = ['Play MathSwipe with me! Try to beat my score at', - 'Play MathSwipe with me! Try to solve my board at', - 'Play MathSwipe with me! Solve my puzzle at'] - text = possible[Math.floor(Math.random() * 3)] - $( '#tweet' ).attr( 'data-text' , text ) + TwitterGameService.setTweet() module.exports = ShareGameService diff --git a/app/services/TwitterGameService.coffee b/app/services/TwitterGameService.coffee new file mode 100644 index 0000000..aeb8702 --- /dev/null +++ b/app/services/TwitterGameService.coffee @@ -0,0 +1,12 @@ +$ = require 'jquery' + +class TwitterGameService + + @setTweet: -> + possible = ['Play MathSwipe with me! Try to beat my score at', + 'Play MathSwipe with me! Try to solve my board at', + 'Play MathSwipe with me! Solve my puzzle at'] + text = possible[Math.floor(Math.random() * 3)] + $( '#tweet' ).attr( 'data-text' , text ) + +module.exports = TwitterGameService From 4f732d1e3a6b3a6158fadf8f4e6d268318e8fb81 Mon Sep 17 00:00:00 2001 From: Brandon Woo Date: Sun, 1 Nov 2015 23:30:05 -0800 Subject: [PATCH 4/9] Build twtter share bundle --- bundle.js | 67 ++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 46 insertions(+), 21 deletions(-) diff --git a/bundle.js b/bundle.js index 786b6f4..c9b87d6 100644 --- a/bundle.js +++ b/bundle.js @@ -65,7 +65,7 @@ Tuple = __webpack_require__(/*! ./app/models/Tuple */ 5); - Two = __webpack_require__(/*! two.js */ 25); + Two = __webpack_require__(/*! two.js */ 26); game = new MathSwipeController; @@ -9322,21 +9322,21 @@ ShareGameService = __webpack_require__(/*! ../services/ShareGameService */ 17); - SolutionService = __webpack_require__(/*! ../services/SolutionService */ 18); + SolutionService = __webpack_require__(/*! ../services/SolutionService */ 19); - Title = __webpack_require__(/*! ../services/Title */ 19); + Title = __webpack_require__(/*! ../services/Title */ 20); TrackingService = __webpack_require__(/*! ../services/TrackingService */ 8); - Board = __webpack_require__(/*! ../views/Board */ 20); + Board = __webpack_require__(/*! ../views/Board */ 21); - Cell = __webpack_require__(/*! ../views/Cell */ 21); + Cell = __webpack_require__(/*! ../views/Cell */ 22); - Colors = __webpack_require__(/*! ../views/Colors */ 22); + Colors = __webpack_require__(/*! ../views/Colors */ 23); - GoalContainer = __webpack_require__(/*! ../views/GoalContainer */ 23); + GoalContainer = __webpack_require__(/*! ../views/GoalContainer */ 24); - GeneralTests = __webpack_require__(/*! ../../tests/controllers/GeneralTests */ 24); + GeneralTests = __webpack_require__(/*! ../../tests/controllers/GeneralTests */ 25); MathSwipeController = (function() { function MathSwipeController() { @@ -10359,29 +10359,54 @@ \**********************************************/ /***/ function(module, exports, __webpack_require__) { - var $, ShareGameService; + var ShareGameService, TwitterGameService; - $ = __webpack_require__(/*! jquery */ 2); + TwitterGameService = __webpack_require__(/*! ./TwitterGameService */ 18); ShareGameService = (function() { function ShareGameService() {} ShareGameService.setMessage = function() { + return TwitterGameService.setTweet(); + }; + + return ShareGameService; + + })(); + + module.exports = ShareGameService; + + +/***/ }, +/* 18 */ +/*!************************************************!*\ + !*** ./app/services/TwitterGameService.coffee ***! + \************************************************/ +/***/ function(module, exports, __webpack_require__) { + + var $, TwitterGameService; + + $ = __webpack_require__(/*! jquery */ 2); + + TwitterGameService = (function() { + function TwitterGameService() {} + + TwitterGameService.setTweet = function() { var possible, text; possible = ['Play MathSwipe with me! Try to beat my score at', 'Play MathSwipe with me! Try to solve my board at', 'Play MathSwipe with me! Solve my puzzle at']; text = possible[Math.floor(Math.random() * 3)]; return $('#tweet').attr('data-text', text); }; - return ShareGameService; + return TwitterGameService; })(); - module.exports = ShareGameService; + module.exports = TwitterGameService; /***/ }, -/* 18 */ +/* 19 */ /*!*********************************************!*\ !*** ./app/services/SolutionService.coffee ***! \*********************************************/ @@ -10452,7 +10477,7 @@ /***/ }, -/* 19 */ +/* 20 */ /*!***********************************!*\ !*** ./app/services/Title.coffee ***! \***********************************/ @@ -10479,7 +10504,7 @@ /***/ }, -/* 20 */ +/* 21 */ /*!********************************!*\ !*** ./app/views/Board.coffee ***! \********************************/ @@ -10698,7 +10723,7 @@ /***/ }, -/* 21 */ +/* 22 */ /*!*******************************!*\ !*** ./app/views/Cell.coffee ***! \*******************************/ @@ -10708,7 +10733,7 @@ $ = __webpack_require__(/*! jquery */ 2); - Colors = __webpack_require__(/*! ./Colors */ 22); + Colors = __webpack_require__(/*! ./Colors */ 23); Cell = (function() { function Cell(col1, row1, size, scene, board, clickHandler, symbolBlueprint) { @@ -10906,7 +10931,7 @@ /***/ }, -/* 22 */ +/* 23 */ /*!*********************************!*\ !*** ./app/views/Colors.coffee ***! \*********************************/ @@ -10929,7 +10954,7 @@ /***/ }, -/* 23 */ +/* 24 */ /*!****************************************!*\ !*** ./app/views/GoalContainer.coffee ***! \****************************************/ @@ -10984,7 +11009,7 @@ /***/ }, -/* 24 */ +/* 25 */ /*!***********************************************!*\ !*** ./tests/controllers/GeneralTests.coffee ***! \***********************************************/ @@ -11083,7 +11108,7 @@ /***/ }, -/* 25 */ +/* 26 */ /*!*******************************!*\ !*** ./~/two.js/build/two.js ***! \*******************************/ From 5065aaabe02252f76b91045843dec5a427ae359a Mon Sep 17 00:00:00 2001 From: Brandon Woo Date: Tue, 17 Nov 2015 01:44:12 -0800 Subject: [PATCH 5/9] Refactor to align with leveler branch --- app/controllers/MathSwipeController.coffee | 9 +++++--- app/services/HashingService.coffee | 13 ++++++------ app/services/SolutionService.coffee | 2 +- bundle.js | 24 +++++++++++++--------- 4 files changed, 28 insertions(+), 20 deletions(-) diff --git a/app/controllers/MathSwipeController.coffee b/app/controllers/MathSwipeController.coffee index 60211f2..0bdece6 100644 --- a/app/controllers/MathSwipeController.coffee +++ b/app/controllers/MathSwipeController.coffee @@ -23,6 +23,7 @@ GeneralTests = require '../../tests/controllers/GeneralTests' class MathSwipeController constructor: -> + length = 3 @gameScene = @createGameScene() @symbols = @getSymbols() @bindNewGameButton() @@ -34,12 +35,13 @@ class MathSwipeController TrackingService.desktopView() @cursorToPointer() ShareGameService.setMessage() - @initialize window.location.hash, 3 + @initialize() # # Uncomment the following line to perform general tests # GeneralTests.tests @board - initialize: (hash, length = 3) -> + initialize: () -> + length = 3 solutionPlacements = [] inputLengths = [] boardValues = [] @@ -91,7 +93,8 @@ class MathSwipeController @gameScene.clear() @goalContainer.clearGoals() ResetButton.unbindClick() - @initialize (window.location.hash = '') + HashingService.emptyHash() + @initialize() createGameScene: -> gameDom = document.getElementById('game') diff --git a/app/services/HashingService.coffee b/app/services/HashingService.coffee index f62abaa..da12533 100644 --- a/app/services/HashingService.coffee +++ b/app/services/HashingService.coffee @@ -1,5 +1,10 @@ class HashingService + alphabet = ['"', '{', '}', '[', ']', ',', ':', + 'b', 'g', 'p', '1', '2', '3', '4', + '5', '6', '7', '8', '9', '0', + '+', '-', '*'] + @reloadPageWithHash: (board, solutionPlacements, SolutionService) -> unless @checkSolutionPlacements board, solutionPlacements, SolutionService @emptyHash() @@ -23,7 +28,7 @@ class HashingService btoa(JSON.stringify {b: boardValues, g: goals, p: solutionPlacements}) - @decodeMap: () -> + @decodeMap: -> try decoded_s = atob window.location.hash.substr(1, window.location.hash.length) decoded = JSON.parse decoded_s @@ -47,10 +52,6 @@ class HashingService @regexPass decoded @regexPass: (decoded) -> - alphabet = ['"', '{', '}', '[', ']', ',', ':', - 'b', 'g', 'p', '1', '2', '3', '4', - '5', '6', '7', '8', '9', '0', - '+', '-', '*'] for char in decoded return false if char not in alphabet true @@ -122,4 +123,4 @@ class HashingService @tempBoard.boardValues[r1][c1] = @tempBoard.boardValues[r2][c2] @tempBoard.boardValues[r2][c2] = temp -module.exports = HashingService \ No newline at end of file +module.exports = HashingService diff --git a/app/services/SolutionService.coffee b/app/services/SolutionService.coffee index b82286c..77e2028 100644 --- a/app/services/SolutionService.coffee +++ b/app/services/SolutionService.coffee @@ -20,7 +20,7 @@ class SolutionService @RunningSum.display @RunningSum.solutionOperatorString false - finished: -> @solution[@solution.length - 1] not in "+-*" + finished: -> @solution[@solution.length - 1] not in '+-*' isCompleteExpression: -> @solution.search(/-?\d+[-+\*]\d+/g) is 0 diff --git a/bundle.js b/bundle.js index 1591352..23a19d5 100644 --- a/bundle.js +++ b/bundle.js @@ -9342,6 +9342,8 @@ MathSwipeController = (function() { function MathSwipeController() { + var length; + length = 3; this.gameScene = this.createGameScene(); this.symbols = this.getSymbols(); this.bindNewGameButton(); @@ -9354,14 +9356,12 @@ this.cursorToPointer(); } ShareGameService.setMessage(); - this.initialize(window.location.hash, 3); + this.initialize(); } - MathSwipeController.prototype.initialize = function(hash, length) { - var boardValues, decoded, goals, inputLengths, inputs, ref, ref1, solutionPlacements; - if (length == null) { - length = 3; - } + MathSwipeController.prototype.initialize = function() { + var boardValues, decoded, goals, inputLengths, inputs, length, ref, ref1, solutionPlacements; + length = 3; solutionPlacements = []; inputLengths = []; boardValues = []; @@ -9419,7 +9419,8 @@ this.gameScene.clear(); this.goalContainer.clearGoals(); ResetButton.unbindClick(); - return this.initialize((window.location.hash = '')); + HashingService.emptyHash(); + return this.initialize(); }; MathSwipeController.prototype.createGameScene = function() { @@ -10140,8 +10141,12 @@ indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }; HashingService = (function() { + var alphabet; + function HashingService() {} + alphabet = ['"', '{', '}', '[', ']', ',', ':', 'b', 'g', 'p', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '+', '-', '*']; + HashingService.reloadPageWithHash = function(board, solutionPlacements, SolutionService) { if (!this.checkSolutionPlacements(board, solutionPlacements, SolutionService)) { this.emptyHash(); @@ -10203,8 +10208,7 @@ }; HashingService.regexPass = function(decoded) { - var alphabet, char, k, len; - alphabet = ['"', '{', '}', '[', ']', ',', ':', 'b', 'g', 'p', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '+', '-', '*']; + var char, k, len; for (k = 0, len = decoded.length; k < len; k++) { char = decoded[k]; if (indexOf.call(alphabet, char) < 0) { @@ -10682,7 +10686,7 @@ SolutionService.prototype.finished = function() { var ref; - return ref = this.solution[this.solution.length - 1], indexOf.call("+-*", ref) < 0; + return ref = this.solution[this.solution.length - 1], indexOf.call('+-*', ref) < 0; }; SolutionService.prototype.isCompleteExpression = function() { From 3cd6d4faccd7c10c48e42738ec0d9bc0ca6d1ebf Mon Sep 17 00:00:00 2001 From: Brandon Woo Date: Tue, 17 Nov 2015 01:48:33 -0800 Subject: [PATCH 6/9] Revert facebook sharing --- README.md | 4 +-- app/services/ShareGameService.coffee | 2 -- index.html | 33 +------------------ public/assets/stylesheets/GameBackground.css | 2 -- public/assets/stylesheets/GameBackground.sass | 3 -- 5 files changed, 2 insertions(+), 42 deletions(-) diff --git a/README.md b/README.md index 550af80..d6c9726 100644 --- a/README.md +++ b/README.md @@ -2,15 +2,13 @@ [MathSwipe](http://sf-interns.github.io/mathswipe/) is a `CoffeeScript` game developed in the context of the [Originate](http://www.originate.com/) 'Intern Hack 2015' Event, presented August 2015. It is a web-game in which the user is given a grid of numbers (0-9) and operators (+, -, ×). The user's goal is to swipe a path through the cells to create an expression that evaluates to one of the goal-values listed below the board. A level is completed when the user finds expressions evaluating to each goal-value and has cleared the board of all cells. -Math Swipe is a simple brain game that is rooted in math. From children to their parents, Math Swipe is simple yet challenging enough to stump even the strongest math wizzes. - ## Development Information Note that the other services, when run locally, expect the frontend to be served on port 8080. The codebase is primarily written in CoffeeScript using the Node package manager to install most of the dependencies. The entire project (including its dependencies) is bundled by `Webpack` into a single bundle.js file which can be served locally or staticlly with GitHub pages. -Animation and functionality of the game is implemented using `jQuery`, `Two.js` and Scalable Vector Graphics (SVGs). +Animation and functionality of the game is implemented using `jQuery`, `Two.js` and Scalable Vector Graphics (SVGs). The styling is written in `SASS` and compiled down to CSS before use. If you plan to clone this repository and try building the game locally, we recommend using the Sublime plugin `SASS Build` to compile down to CSS. diff --git a/app/services/ShareGameService.coffee b/app/services/ShareGameService.coffee index 6c61d59..c0bf71b 100644 --- a/app/services/ShareGameService.coffee +++ b/app/services/ShareGameService.coffee @@ -8,7 +8,5 @@ class ShareGameService 'Play MathSwipe with me! Solve my puzzle at'] text = possible[Math.floor(Math.random() * 3)] $( '#tweet' ).attr( 'data-text' , text ) - console.log $('#fb-share') - $( '#fb-share' ).attr( 'data-href' , window.location.hash ) module.exports = ShareGameService diff --git a/index.html b/index.html index 76c6514..1cc1d56 100644 --- a/index.html +++ b/index.html @@ -12,38 +12,8 @@ - - - - - - -
-
- -

MathSwipe

@@ -57,11 +27,10 @@
-
+

New Game

-
diff --git a/public/assets/stylesheets/GameBackground.css b/public/assets/stylesheets/GameBackground.css index 845f3d1..b5aa147 100644 --- a/public/assets/stylesheets/GameBackground.css +++ b/public/assets/stylesheets/GameBackground.css @@ -62,8 +62,6 @@ body { .game-button-wrapper { text-align: center; margin: 10px 0px 20px 0px; } - .game-button-wrapper .reset-button { - margin: 6px 0 0 0; } .game-button-wrapper .game-btn { height: 40px; word-wrap: break-word; diff --git a/public/assets/stylesheets/GameBackground.sass b/public/assets/stylesheets/GameBackground.sass index 1d42672..7f0b5b4 100644 --- a/public/assets/stylesheets/GameBackground.sass +++ b/public/assets/stylesheets/GameBackground.sass @@ -72,9 +72,6 @@ body text-align: center margin: 10px 0px 20px 0px - .reset-button - margin: 6px 0 0 0 - .game-btn height: 40px word-wrap: break-word From 7c3a3bc9e5ed96f0d8c3f95788f5706bc6d534bd Mon Sep 17 00:00:00 2001 From: Brandon Woo Date: Tue, 17 Nov 2015 01:55:02 -0800 Subject: [PATCH 7/9] Revert reset button change --- index.html | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/index.html b/index.html index 1cc1d56..34a66a9 100644 --- a/index.html +++ b/index.html @@ -11,7 +11,6 @@ // ga('send', 'pageview'); -
@@ -27,7 +26,7 @@
-
+

Reset

New Game

From 57880c9063fc3a1ebdbfb2cb4615452bce741308 Mon Sep 17 00:00:00 2001 From: Brandon Woo Date: Tue, 17 Nov 2015 01:59:25 -0800 Subject: [PATCH 8/9] Rebase twitter code --- app/controllers/MathSwipeController.coffee | 6 +- app/services/HashingService.coffee | 2 +- app/services/ShareGameService.coffee | 12 ---- bundle.js | 79 ++++++---------------- index.html | 3 - 5 files changed, 25 insertions(+), 77 deletions(-) delete mode 100644 app/services/ShareGameService.coffee diff --git a/app/controllers/MathSwipeController.coffee b/app/controllers/MathSwipeController.coffee index 0bdece6..c90bcc6 100644 --- a/app/controllers/MathSwipeController.coffee +++ b/app/controllers/MathSwipeController.coffee @@ -10,7 +10,6 @@ InputSolver = require '../services/InputSolver' RandomizedFitLength = require '../services/RandomizedFitLength' ResetButton = require '../services/ResetButton' RunningSum = require '../services/RunningSum' -ShareGameService = require '../services/ShareGameService' SolutionService = require '../services/SolutionService' Title = require '../services/Title' TrackingService = require '../services/TrackingService' @@ -34,7 +33,6 @@ class MathSwipeController else TrackingService.desktopView() @cursorToPointer() - ShareGameService.setMessage() @initialize() # # Uncomment the following line to perform general tests @@ -128,7 +126,9 @@ class MathSwipeController generateBoard: (inputs, length, solutionPlacements) -> DFS.setEquationsOnGrid length, inputs, AdjacentCellsCalculator, solutionPlacements - generateInputs: (inputLengths, goals = [], inputs = []) -> + generateInputs: (inputLengths) -> + goals = [] + inputs = [] for inputSize in inputLengths value = -1 while value < 1 or value > 300 diff --git a/app/services/HashingService.coffee b/app/services/HashingService.coffee index da12533..07e40cb 100644 --- a/app/services/HashingService.coffee +++ b/app/services/HashingService.coffee @@ -30,7 +30,7 @@ class HashingService @decodeMap: -> try - decoded_s = atob window.location.hash.substr(1, window.location.hash.length) + decoded_s = atob window.location.hash.substr(1, window.location.hash.length) decoded = JSON.parse decoded_s catch e decoded = null diff --git a/app/services/ShareGameService.coffee b/app/services/ShareGameService.coffee deleted file mode 100644 index c0bf71b..0000000 --- a/app/services/ShareGameService.coffee +++ /dev/null @@ -1,12 +0,0 @@ -$ = require 'jquery' - -class ShareGameService - - @setMessage: -> - possible = ['Play MathSwipe with me! Try to beat my score at', - 'Play MathSwipe with me! Try to solve my board at', - 'Play MathSwipe with me! Solve my puzzle at'] - text = possible[Math.floor(Math.random() * 3)] - $( '#tweet' ).attr( 'data-text' , text ) - -module.exports = ShareGameService diff --git a/bundle.js b/bundle.js index 23a19d5..b61eafc 100644 --- a/bundle.js +++ b/bundle.js @@ -65,7 +65,7 @@ Tuple = __webpack_require__(/*! ./app/models/Tuple */ 5); - Two = __webpack_require__(/*! two.js */ 26); + Two = __webpack_require__(/*! two.js */ 25); game = new MathSwipeController; @@ -9296,7 +9296,7 @@ \****************************************************/ /***/ function(module, exports, __webpack_require__) { - var $, AdjacentCellsCalculator, Board, BoardSolvedService, Cell, ClickHandler, Colors, DFS, ExpressionGenerator, GeneralTests, GoalContainer, HashingService, HowToPlay, InputSolver, MathSwipeController, RandomizedFitLength, ResetButton, RunningSum, ShareGameService, SolutionService, Title, TrackingService; + var $, AdjacentCellsCalculator, Board, BoardSolvedService, Cell, ClickHandler, Colors, DFS, ExpressionGenerator, GeneralTests, GoalContainer, HashingService, HowToPlay, InputSolver, MathSwipeController, RandomizedFitLength, ResetButton, RunningSum, SolutionService, Title, TrackingService; $ = __webpack_require__(/*! jquery */ 2); @@ -9322,23 +9322,21 @@ RunningSum = __webpack_require__(/*! ../services/RunningSum */ 17); - ShareGameService = __webpack_require__(/*! ../services/ShareGameService */ 18); + SolutionService = __webpack_require__(/*! ../services/SolutionService */ 18); - SolutionService = __webpack_require__(/*! ../services/SolutionService */ 19); - - Title = __webpack_require__(/*! ../services/Title */ 20); + Title = __webpack_require__(/*! ../services/Title */ 19); TrackingService = __webpack_require__(/*! ../services/TrackingService */ 8); - Board = __webpack_require__(/*! ../views/Board */ 21); + Board = __webpack_require__(/*! ../views/Board */ 20); - Cell = __webpack_require__(/*! ../views/Cell */ 22); + Cell = __webpack_require__(/*! ../views/Cell */ 21); - Colors = __webpack_require__(/*! ../views/Colors */ 23); + Colors = __webpack_require__(/*! ../views/Colors */ 22); - GoalContainer = __webpack_require__(/*! ../views/GoalContainer */ 24); + GoalContainer = __webpack_require__(/*! ../views/GoalContainer */ 23); - GeneralTests = __webpack_require__(/*! ../../tests/controllers/GeneralTests */ 25); + GeneralTests = __webpack_require__(/*! ../../tests/controllers/GeneralTests */ 24); MathSwipeController = (function() { function MathSwipeController() { @@ -9355,7 +9353,6 @@ TrackingService.desktopView(); this.cursorToPointer(); } - ShareGameService.setMessage(); this.initialize(); } @@ -9463,14 +9460,10 @@ return DFS.setEquationsOnGrid(length, inputs, AdjacentCellsCalculator, solutionPlacements); }; - MathSwipeController.prototype.generateInputs = function(inputLengths, goals, inputs) { - var expression, i, inputSize, len, value; - if (goals == null) { - goals = []; - } - if (inputs == null) { - inputs = []; - } + MathSwipeController.prototype.generateInputs = function(inputLengths) { + var expression, goals, i, inputSize, inputs, len, value; + goals = []; + inputs = []; for (i = 0, len = inputLengths.length; i < len; i++) { inputSize = inputLengths[i]; value = -1; @@ -10617,36 +10610,6 @@ /***/ }, /* 18 */ -/*!**********************************************!*\ - !*** ./app/services/ShareGameService.coffee ***! - \**********************************************/ -/***/ function(module, exports, __webpack_require__) { - - var $, ShareGameService; - - $ = __webpack_require__(/*! jquery */ 2); - - ShareGameService = (function() { - function ShareGameService() {} - - ShareGameService.setMessage = function() { - var possible, text; - possible = ['Play MathSwipe with me! Try to beat my score at', 'Play MathSwipe with me! Try to solve my board at', 'Play MathSwipe with me! Solve my puzzle at']; - text = possible[Math.floor(Math.random() * 3)]; - $('#tweet').attr('data-text', text); - console.log($('#fb-share')); - return $('#fb-share').attr('data-href', window.location.hash); - }; - - return ShareGameService; - - })(); - - module.exports = ShareGameService; - - -/***/ }, -/* 19 */ /*!*********************************************!*\ !*** ./app/services/SolutionService.coffee ***! \*********************************************/ @@ -10712,7 +10675,7 @@ /***/ }, -/* 20 */ +/* 19 */ /*!***********************************!*\ !*** ./app/services/Title.coffee ***! \***********************************/ @@ -10739,7 +10702,7 @@ /***/ }, -/* 21 */ +/* 20 */ /*!********************************!*\ !*** ./app/views/Board.coffee ***! \********************************/ @@ -10958,7 +10921,7 @@ /***/ }, -/* 22 */ +/* 21 */ /*!*******************************!*\ !*** ./app/views/Cell.coffee ***! \*******************************/ @@ -10968,7 +10931,7 @@ $ = __webpack_require__(/*! jquery */ 2); - Colors = __webpack_require__(/*! ./Colors */ 23); + Colors = __webpack_require__(/*! ./Colors */ 22); Cell = (function() { function Cell(col1, row1, size, scene, board, clickHandler, symbolBlueprint) { @@ -11166,7 +11129,7 @@ /***/ }, -/* 23 */ +/* 22 */ /*!*********************************!*\ !*** ./app/views/Colors.coffee ***! \*********************************/ @@ -11189,7 +11152,7 @@ /***/ }, -/* 24 */ +/* 23 */ /*!****************************************!*\ !*** ./app/views/GoalContainer.coffee ***! \****************************************/ @@ -11244,7 +11207,7 @@ /***/ }, -/* 25 */ +/* 24 */ /*!***********************************************!*\ !*** ./tests/controllers/GeneralTests.coffee ***! \***********************************************/ @@ -11343,7 +11306,7 @@ /***/ }, -/* 26 */ +/* 25 */ /*!*******************************!*\ !*** ./~/two.js/build/two.js ***! \*******************************/ diff --git a/index.html b/index.html index 34a66a9..9613dde 100644 --- a/index.html +++ b/index.html @@ -28,10 +28,7 @@

Reset

New Game

- -
-

From 2e19b8259e7b57d3466820b6821451d9676adea0 Mon Sep 17 00:00:00 2001 From: Brandon Woo Date: Tue, 17 Nov 2015 14:16:39 -0800 Subject: [PATCH 9/9] Fix whitespace --- README.md | 4 +++- app/controllers/MathSwipeController.coffee | 1 - bundle.js | 2 -- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index d6c9726..550af80 100644 --- a/README.md +++ b/README.md @@ -2,13 +2,15 @@ [MathSwipe](http://sf-interns.github.io/mathswipe/) is a `CoffeeScript` game developed in the context of the [Originate](http://www.originate.com/) 'Intern Hack 2015' Event, presented August 2015. It is a web-game in which the user is given a grid of numbers (0-9) and operators (+, -, ×). The user's goal is to swipe a path through the cells to create an expression that evaluates to one of the goal-values listed below the board. A level is completed when the user finds expressions evaluating to each goal-value and has cleared the board of all cells. +Math Swipe is a simple brain game that is rooted in math. From children to their parents, Math Swipe is simple yet challenging enough to stump even the strongest math wizzes. + ## Development Information Note that the other services, when run locally, expect the frontend to be served on port 8080. The codebase is primarily written in CoffeeScript using the Node package manager to install most of the dependencies. The entire project (including its dependencies) is bundled by `Webpack` into a single bundle.js file which can be served locally or staticlly with GitHub pages. -Animation and functionality of the game is implemented using `jQuery`, `Two.js` and Scalable Vector Graphics (SVGs). +Animation and functionality of the game is implemented using `jQuery`, `Two.js` and Scalable Vector Graphics (SVGs). The styling is written in `SASS` and compiled down to CSS before use. If you plan to clone this repository and try building the game locally, we recommend using the Sublime plugin `SASS Build` to compile down to CSS. diff --git a/app/controllers/MathSwipeController.coffee b/app/controllers/MathSwipeController.coffee index c15c3d1..5121364 100644 --- a/app/controllers/MathSwipeController.coffee +++ b/app/controllers/MathSwipeController.coffee @@ -23,7 +23,6 @@ GeneralTests = require '../../tests/controllers/GeneralTests' class MathSwipeController constructor: -> - length = 3 @gameScene = @createGameScene() @symbols = @getSymbols() @bindNewGameButton() diff --git a/bundle.js b/bundle.js index 5c990f3..7a8cc0a 100644 --- a/bundle.js +++ b/bundle.js @@ -9342,8 +9342,6 @@ MathSwipeController = (function() { function MathSwipeController() { - var length; - length = 3; this.gameScene = this.createGameScene(); this.symbols = this.getSymbols(); this.bindNewGameButton();