This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"lastUpload":"2020-10-28T08:53:14.795Z","extensionVersion":"v3.4.3"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#if DEBUG | |
func playDebug(combination: Combination) { | |
playCombination(combination: combination) | |
} | |
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func testGamePhaseOneDirectEndGame() { | |
let game = Game(players: [Player(name: "Player1"), Player(name: "Player2")]) | |
game.playDebug(combination: Combination(one: 4, two: 2, three: 1)) // 421 -> 10 tokens | |
game.playDebug(combination: Combination(one: 1, two: 1, three: 1)) // 111 -> 6 tokens | |
XCTAssertEqual(0, game.tokenPlayers[0]) | |
XCTAssertEqual(15, game.tokenPlayers[1]) | |
XCTAssertEqual(0, game.tokenToDistribute) | |
XCTAssertTrue(game.isOver) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func playDebug(combination: Combination) { | |
playCombination(combination: combination) | |
} | |
func play() { | |
playCombination(combination: generateCombination()) | |
} | |
private func playCombination(combination: Combination) { | |
let combination = combination |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func play(combination: Combination) { | |
let combination = combination | |
... | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func play() { | |
let combination = generateCombination() | |
... | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private func generateCombination() -> Combination { | |
var dice = Dice() | |
dice.roll() | |
let valueOne = dice.value | |
dice.roll() | |
let valueTwo = dice.value | |
dice.roll() | |
let valueThree = dice.value | |
return Combination(one: valueOne, two: valueTwo, three: valueThree) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func testGamePhaseOneprint() { | |
let game = Game(players: [Player(name: "Player1"), Player(name: "Player2")]) | |
game.play() | |
game.play() | |
XCTAssertEqual(1, game.tokenPlayers[0]) | |
XCTAssertEqual(0, game.tokenPlayers[1]) | |
XCTAssertEqual(14, game.tokenToDistribute) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func play() { | |
// We Check we are in Phase One | |
if phase == Phase.phase1 { | |
// We need to clean the result from previous turn | |
emptyTurnCombinationIfNecessary() | |
//We get a new random combination | |
var dice = Dice() | |
dice.roll() | |
let valueOne = dice.value |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
import GooglePlaces | |
final class GooglePlaceService { | |
private var placesClient: GMSPlacesClient! | |
private var filter = GMSAutocompleteFilter() | |
// Map the Google Category to your own category | |
private let typesToDrink = ["bar", "cafe"] |
NewerOlder