From f96725b8221aa96ddc479d5773b2fcf8c684268e Mon Sep 17 00:00:00 2001 From: Guillaume Dott Date: Fri, 12 Dec 2014 12:23:25 +0100 Subject: [PATCH] Return cells with same prototype in Cell#adjacentCells() --- views/application.coffee | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/views/application.coffee b/views/application.coffee index d1c80cf..37508b2 100644 --- a/views/application.coffee +++ b/views/application.coffee @@ -115,11 +115,12 @@ class Nikoli.Cell getRow: -> @game[@x] adjacentCells: -> + constructor = Object.getPrototypeOf(this).constructor [ - new Cell(@x + 1, @y, @game), - new Cell(@x - 1, @y, @game), - new Cell(@x, @y + 1, @game), - new Cell(@x, @y - 1, @game) + new constructor(@x + 1, @y, @game), + new constructor(@x - 1, @y, @game), + new constructor(@x, @y + 1, @game), + new constructor(@x, @y - 1, @game) ] valid: (value) ->