Alexa Persistent Flashcards-Game: save different scores


#1

Hello, everyone,
I just finished the flashcard game from persistence exercise. I wonder whether it is possible to play the game with different scores.
After the start it will be checked if there are already scores available. If so, you can decide whether you want to continue playing the previous game or start a new one. When you start a new one, however, the old score will not be deleted/overridden but a new one will be created.
Since DynamoDb creates only one line in the database for an Amazon account, I was thinking that when you create a new score, you create a new variable. But I can’t find a solution right now.
My previous consideration was that you assign an ID to the current session attribute object, which you count up whenever you want to start a new score. Something like this:

scoreID = 0;

#when a user wants to start a new game
 'newScoreIntent': function() {
    scoreID=++
}

this.attributes.flashcards = {
    scoreID = {
          'currentLanguage': '',
          'languages': {
            'ruby': {
              'numberCorrect': 0,
              'currentFlashcardIndex': 0
            },
            'python': {
              'numberCorrect': 0,
              'currentFlashcardIndex': 0
            },
            'javascript': {
              'numberCorrect': 0,
              'currentFlashcardIndex': 0
            }
          }
        }
    }

/**Saved Attributes in DynamoDB**/
  scoreID= 1, {
      'currentLanguage': '',
       ....
      }
  scoreID= 2, {
      'currentLanguage': '',
       ....
      }

Maybe someone understands me and can help me. :slight_smile: