title: How do I make the program keep track of the score of a "stone-paper-scissors" game?
body: <p>I am coding using Javascript.</p>
  
  <p><a href="http://www.programmingbasics.org/en/beginner/random.html" rel="nofollow">http://www.programmingbasics.org/en/beginner/random.html</a>
  (Please press 'next' until you arrive on the 'stone-paper-scissors' section.</p>
  
  <p>This is the code I've created so far:</p>
  
  <pre><code>while(true){you = choose("Make your choice", "rock", "paper", "scissors");
  
  com = random(3);
  if (com == 1){show("rock");}
  if (com == 2){show("paper");}
  if (com == 3){show("scissors");}
  
  w = "you win";
  l = "you lose";
  d = "draw";
  
  cs = 0;
  ys = 0;
  
  if (com == 1){
  if (you == 1){show(d);
  cs = cs + 0;
  ys = ys + 0;}
  if (you == 2){show(w);
  ys = ys + 1;}
  if (you == 3){show(l);
  cs = cs + 1;}
  }
  
  if (com == 2){
  if (you == 1){show(l);
  cs = cs + 1;}
  if (you == 2){show(d);
  cs = cs + 0;
  ys = ys + 0;}
  if (you == 3){show(w);
  ys = ys + 1;}
  }
  
  if (com == 3){
  if (you == 1){show(w);
  ys = ys + 1;}
  if (you == 2){show(l);
  cs = cs + 1;}
  if (you == 3){show(d);
  cs = cs + 0;
  ys = ys + 0;}
  }
  
  show("Computer score: "+cs);
  show("Your score: "+ys);
  
  if (cs == 3){break;}
  if (ys == 3){break;}
  }
  </code></pre>
  
  <p>Whereby 'cs' = computer score and 'ys' = your score.</p>
  
  <p>How do I keep track of the score while starting a new game?</p>
  
  <p>Thank you.</p>