paulkoegel / irmingard-backbone

Solitaire-like card game built with Backbone Marionette. (Currently porting this to Om here: https://github.com/paulwittmann/omingard)
http://irmingard.herokuapp.com
28 stars 14 forks source link

Duplicate Card #1

Open bcambel opened 11 years ago

bcambel commented 11 years ago

screen shot 2013-07-29 at 2 32 32 pm

Take a look at the Diamond 4 which is 2 times on the deck

paulkoegel commented 11 years ago

woo, how did you manage to do that? local setup or on irmingard.heroku.com?

bcambel commented 11 years ago

on irmingard.heroku.com

paulkoegel commented 11 years ago

thanks for reporting the bug. let me know if it ever happens again. cannot really explain it, though. have played the game myself a couple hundred times on Heroku and never had this problem.

cards get generated in app/assets/javascripts/setup/game.js.coffee (8 ff.):

IG.stack =  new IG.Models.Stack(_id: 1)
decks = ['a', 'b']
suits = ['diamonds', 'spades', 'hearts', 'clubs']
cardsPerSuit = 13

_.each decks, (deck) ->
  _.each suits, (suit) ->
    _.times cardsPerSuit, (index) ->
        card = new IG.Models.Card
          deck: deck
          suit: suit
          value: index+1
          column: null
          pile: null
          stack: true
          position: IG.stack.get('cards').length
        card.setSlug()
        card.setImageAssetPath(gon.image_paths)
        IG.stack.get('cards').add card

do you have any idea how a card might get generated twice? just for the record, what browser were you on?

bcambel commented 11 years ago

chrome. I guess this will be a tough one to figure out..

paulkoegel commented 11 years ago

hm, any further info on what you were doing just before the diamond 4 appeared twice? think it's rather an error in the JS code than the card shuffling / generation. probably a card somehow got duplicated / not properly moved from one column to another?!?

paulkoegel commented 11 years ago

and as a general note, as you can tell by the occasionally faulty card highlighting, the app's not really optimized for Chrome.