Created
November 23, 2014 15:37
-
-
Save 5t111111/a3a8f17b5c7f2a3f1424 to your computer and use it in GitHub Desktop.
Nimmt Card Example
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
class Card: Comparable { | |
private let number: Int; | |
private let cow: Int; | |
var owner: Player?; | |
init(number: Int, cow: Int = 1) { | |
self.number = number; | |
self.cow = cow; | |
self.owner = nil; | |
} | |
class func all() -> Array<Card> { | |
return (1...104).map { (number: Int) -> Card in | |
return Card(number: number); | |
} | |
} | |
} | |
func <(lhs: Card, rhs: Card) -> Bool { | |
return lhs.number < rhs.number | |
} | |
func ==(lhs: Card, rhs: Card) -> Bool { | |
return lhs.number == rhs.number | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment