Skip to content

Commit 0b2ced8

Browse files
committed
Add solutions to shared game
1 parent 0e622e6 commit 0b2ced8

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

app/controllers/MathSwipeController.coffee

-2
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,6 @@ class MathSwipeController
5151
inputs = []
5252
inputLengths = RandomizedFitLength.generate length * length
5353
@generateInputs inputLengths, inputs, goals
54-
console.log expression for expression in inputs
55-
console.log '\n'
5654
boardValues = @generateBoard inputs, length, solutionPlacements
5755

5856
@goalContainer = new GoalContainer goals, Colors

app/services/ShareGameService.coffee

+6
Original file line numberDiff line numberDiff line change
@@ -67,20 +67,26 @@ class ShareGameService
6767
@initializeTempBoard board
6868
@solutionService = new SolutionService @tempBoard, board.goals
6969

70+
inputs = []
7071
for expression in solutionPlacements
7172
clickedCells = []
7273
for index in [0...expression.length]
7374
cell = expression[index]
7475
clickedCells.push {row: cell[0], col: cell[1]}
7576
@solutionService.initialize clickedCells
7677

78+
solution = []
7779
for cell in clickedCells
80+
solution.push @tempBoard.boardValues[cell.row][cell.col]
7881
@tempBoard.boardValues[cell.row][cell.col] = ' '
7982
@pushDownTempBoard()
8083

8184
unless @solutionService.isSolution()
8285
return false
86+
inputs.push solution
8387

88+
console.log expression for expression in inputs
89+
console.log '\n'
8490
true
8591

8692
@initializeTempBoard: (board) ->

0 commit comments

Comments
 (0)