Skip to content

Instantly share code, notes, and snippets.

@5t111111
Created November 23, 2014 15:37
Show Gist options
  • Save 5t111111/a3a8f17b5c7f2a3f1424 to your computer and use it in GitHub Desktop.
Save 5t111111/a3a8f17b5c7f2a3f1424 to your computer and use it in GitHub Desktop.
Nimmt Card Example
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