TEAM LICENSES: Save money and learn new skills through a Hacking with Swift+ team license >>

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      

Hacking with Swift is sponsored by RevenueCat.

SPONSORED Take the pain out of configuring and testing your paywalls. RevenueCat's Paywalls allow you to remotely configure your entire paywall view without any code changes or app updates.

Learn more here

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.