This commit is contained in:
@@ -13,7 +13,7 @@ case class Match(totalplayers: List[Player], private[rounds] var number_of_cards
|
||||
private[rounds] var dogLife = false
|
||||
|
||||
def create_round(): Round = {
|
||||
val remainingPlayer = (roundlist.isEmpty ? totalplayers |: roundlist.last.remainingPlayers()).toOption.get
|
||||
val remainingPlayer = roundlist.isEmpty ? totalplayers |: roundlist.last.remainingPlayers()
|
||||
provideCards(remainingPlayer)
|
||||
if (roundlist.isEmpty) {
|
||||
val random_trumpsuit = CardManager.nextCard().suit
|
||||
|
||||
@@ -3,18 +3,18 @@ package de.knockoutwhist.utils
|
||||
import scala.annotation.targetName
|
||||
|
||||
object Implicits {
|
||||
|
||||
|
||||
implicit class Ternable(condition: Boolean) {
|
||||
def ?[T](ifTrue: => T): Option[T] = {
|
||||
if (condition) Some(ifTrue) else None
|
||||
}
|
||||
}
|
||||
|
||||
implicit class Colonable[T, F](ifFalse: => F) {
|
||||
def |:(intermediate: Option[T]): Either[T, F] =
|
||||
implicit class Colonable[T](ifFalse: => T) {
|
||||
def |:(intermediate: Option[T]): T =
|
||||
intermediate match {
|
||||
case Some(ifTrue) => Left(ifTrue)
|
||||
case None => Right(ifFalse)
|
||||
case Some(ifTrue) => ifTrue
|
||||
case None => ifFalse
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user