public Bid auction(Bid bid) { int n; bool end = false; if (bid.getAmount() != 0) { Network.SendPrivate(this, "The actual bill is " + bid.getAmount() + " " + bid.getSuit() + " from " + bid.getTeam() + " team.\n"); } else { Network.SendPrivate(this, "You are the first one to bid!"); } Network.SendPrivate(this, "Player " + id + " turn to bid:"); while (!end) { string str = "What do you want to do? "; switch (bid.getStatus()) { case Status.AMOUNT: str += "1->bid "; goto case Status.CAPOT; case Status.CAPOT: str += "2->coinche "; goto case Status.COINCH; case Status.COINCH: if (bid.getStatus() == Status.COINCH) { str += "3->surcoinche "; } break; case Status.SURCOINCH: Network.SendPrivate(this, "You can't bid anymore."); passed = true; return(bid); } if (bid.getStatus() == Status.AMOUNT) { str += "4->capot "; } Network.SendPrivate(this, str + "5->pass"); n = WaitForMessage(); end = true; switch (n) { case 1: Network.SendPrivate(this, "What is the amount of your bid ? (>= " + (bid.getAmount() == 0 ? 80 : bid.getAmount() + 10) + ")"); if (!bid.setAmount(WaitForMessage()) || bid.getStatus() != Status.AMOUNT) { Network.SendPrivate(this, "Incorrect input"); end = false; break; } Network.SendPrivate(this, "What is the suit ? (0->CLUB | 1->DIAMOND | 2->HEART | 3->SPADE)"); n = WaitForMessage(); if (n < 0 || n > 3) { Network.SendPrivate(this, "Incorrect input"); end = false; break; } bid.setSuit(n); bid.setTeam(this.team); passed = false; break; case 2: if (bid.getStatus() != Status.AMOUNT && bid.getStatus() != Status.CAPOT) { Network.SendPrivate(this, "Incorrect input"); end = false; break; } bid.setStatus(Status.COINCH); passed = false; break; case 3: if (bid.getStatus() != Status.COINCH) { Network.SendPrivate(this, "Incorrect input"); end = false; break; } bid.setStatus(Status.SURCOINCH); passed = false; break; case 4: if (bid.getStatus() == Status.COINCH || bid.getStatus() == Status.SURCOINCH || bid.getStatus() == Status.CAPOT) { Network.SendPrivate(this, "Incorrect input"); end = false; break; } bid.setStatus(Status.CAPOT); bid.setTeam(team); passed = false; break; case 5: passed = true; break; default: Network.SendPrivate(this, "Incorrect input"); end = false; break; } } Network.SendPrivate(this, "Great!"); return(bid); }