# DataWeave programming challenge #2: Rock Paper Scissors game score system

> Score a series of Rock Paper Scissors rounds in DataWeave — 0 for a loss, 3 for a draw, 6 for a win — and total it out of 30. Clues and full solutions are in the companion article.

- **Watch:** https://www.youtube.com/watch?v=cZVwl55yTWo
- **Page:** https://prostdev.com/video/dataweave-challenge-2-rock-paper-scissors-score
- **Series:** DataWeave Challenges

## About this video

Score a series of Rock Paper Scissors rounds in DataWeave — 0 for a loss, 3 for a draw, 6 for a win — and total it out of 30. Clues and full solutions are in the companion article.

## Resources

- [Read the article](https://www.prostdev.com/post/dataweave-programming-challenge-2)
- [Solve on the Playground](https://dataweave.mulesoft.com/learn/playground?projectMethod=GHRepo&repo=alexandramartinez%2Fdataweave-challenges&path=challenges%2F2)

## Transcript

### Intro

Hello hello, I'm Alex Martinez, I am the founder of ProstDev, and today I bring to you challenge number two of DataWeave programming.

### The challenge

In this case we have this input payload, which is just a series of characters, but each character represents a different move from the Rock Paper Scissors game: R is for rock, P is for paper, and S is for scissors. The rules of the game are simple — rock defeats scissors, paper defeats rock, and scissors defeats paper.

Now, the first column of this series of characters is what your opponent chose, and the second column is what you chose. So for example, in the first round you both chose rock, so this is a draw.

Now the way that we are keeping the score is: you will keep a 0 if you lost a round, you will earn a 3 if it was a draw, and you will earn 6 if you won the round. So in this case, since it was a draw, you will get just 3 points. The second round was rock and paper, so paper defeats rock, which means you won — you won 6 points. And on the third round, rock and scissors, and rock defeats scissors, so you lose this round, which means you get 0.

So after you count the points from each one of the rounds, you will get a result out of 30. And that's all.

### Clues and solutions

So that's the explanation for challenge number two of DataWeave in ProstDev. If you want to see the clues or the solutions that I provided for you, you'll have to go to ProstDev.com, or go into the comment section and click on the link in the description. Remember to subscribe so you get notifications as soon as new challenges are released. Good luck, thank you!