UPGRADE YOUR SKILLS: Learn advanced Swift and SwiftUI on Hacking with Swift+! >>

Day 25 : how to handle ties in Rock Paper Scissors app?

Forums > 100 Days of SwiftUI

This might of been answered before, but I can't find a way to search on the forums, but with the Rock Paper Scissor app, how should you handle a tie? I.E the app picked rock and the player picked rock?

2      

There are few ways you can do it (me personal I would use a enum result to define case win, lose, draw and then switch result)

If you read @MarcusKay https://www.hackingwithswift.com/forums/100-days-of-swiftui/day-25-challenge/5291 is a good point.

PS there is no "search" in forums just yet (maybe in future). however if you click on the 100 Days of SwiftUI you will taking to the post of that only then look for Day 25 or Rock.... in the title. there (at present only 2 pages).

2      

In the current incarnation of the app, ties are not an option, at least as outlined. The player either Wins or Loses, so there is only 1 correct answer. If they app picks Rock and the player picks Rock, they will lose 1 point, regardless of whether they were supposed to Win or Lose.

At least that's how I've set up the app/game.

2      

TAKE YOUR SKILLS TO THE NEXT LEVEL If you like Hacking with Swift, you'll love Hacking with Swift+ – it's my premium service where you can learn advanced Swift and SwiftUI, functional programming, algorithms, and more. Plus it comes with stacks of benefits, including monthly live streams, downloadable projects, a 20% discount on all books, and free gifts!

Find out more

Sponsor Hacking with Swift and reach the world's largest Swift community!

Archived topic

This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.