title: Store Scores in an array , shared preference or database?
body: <p>I'm currently assigning numbers to an object for each round of a game. for instance a,b,c,d,e.  I save this object in an array and then later use this array to build a recycler view for each new round, so you can scroll through all the rounds and see how you did.  What I'm having trouble doing are 2 things.  each round you're going to get either 10 * what is in a or -10 * what is in a.  </p>
  
  <ol>
  <li><p>Should I do the math on that and store it in the object, or is it better to get a from the object and do the math on it then?</p></li>
  <li><p>How should i total the score?  should i run the array through a loop each time a round is submitted and total a, or is there a better/easier way to update your total score when each round is submitted?</p></li>
  </ol>
  
  <p>Here's my object class</p>
  
  <pre><code> class Rounds (
       var rn: Int,
       var t1score: Int,
       var t2score: Int,
   )
  </code></pre>
  
  <p>and my function </p>
  
  <pre><code>  private fun funScoreRound(rounds: ArrayList&lt;Rounds&gt;, rn: Int) {
  
      //rn = round, t1score = team one score for the round, t2score = team two score for the round
      var rn++
      var t1score = t1bid * 10
      var t2score = t2bid * 10
  
  
  
      rounds.add(Rounds(rn, 1score, t2score))
  </code></pre>
  
  <p>I tried using</p>
  
  <pre><code> var onetotal = rounds.sumby { t1score }
   var twototal = rounds.sumby { t2score }
  </code></pre>
  
  <p>but that does not total how i expected.  Just really looking for what the best practice is, if it's to save it to a shared preference and then every time a round is submitted resave it and reupdate the text field, or ...</p>