Adjusted RPS related actions

This commit is contained in:
Aaron
2021-01-23 16:47:31 -05:00
parent e461dae024
commit 219de54856
3 changed files with 6 additions and 4 deletions
+1 -1
View File
@@ -696,7 +696,7 @@
<rect key="frame" x="0.0" y="0.0" width="374" height="170"/> <rect key="frame" x="0.0" y="0.0" width="374" height="170"/>
<subviews> <subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="person.crop.circle.badge.checkmark" catalog="system" translatesAutoresizingMaskIntoConstraints="NO" id="yVW-fL-SIQ"> <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="person.crop.circle.badge.checkmark" catalog="system" translatesAutoresizingMaskIntoConstraints="NO" id="yVW-fL-SIQ">
<rect key="frame" x="130.5" y="0.0" width="111.5" height="109.5"/> <rect key="frame" x="132" y="0.0" width="110" height="109.5"/>
<constraints> <constraints>
<constraint firstAttribute="width" constant="110" id="So8-k5-nLS"/> <constraint firstAttribute="width" constant="110" id="So8-k5-nLS"/>
<constraint firstAttribute="height" constant="110" id="inA-vb-CrL"/> <constraint firstAttribute="height" constant="110" id="inA-vb-CrL"/>
+1 -1
View File
@@ -175,7 +175,7 @@ class RPS {
else if you == .paper && computer == .rock { return true} else if you == .paper && computer == .rock { return true}
else if you == .scissors && computer == .paper { return true } else if you == .scissors && computer == .paper { return true }
else { else {
return playRPS(you: you, computer: RPS.randomComputerChoice()) return false
} }
} }
+4 -2
View File
@@ -15,10 +15,12 @@ func walkAction() {
} }
func jumpAction() { func jumpAction() {
let rps = RPS()
} }
func rpsAction() { func rpsAction(choice: RPS.Choice) -> Bool? {
let rps = RPS()
return rps.playRPS(you: choice, computer: RPS.randomComputerChoice())
} }