Recognize group allies in bribes and deals
Verify and publish checkpoint container / container (push) Canceled after 0s
Verify and publish checkpoint container / container (push) Canceled after 0s
This commit is contained in:
1 parent
2fe97ddd1f
commit
6e26ceb216
12 files changed
+318
-29
No files matched your search
@@ -30,7 +30,7 @@ export type PublicDeal = {
|
||||
paymentStatus?: PublicDealPaymentStatus;
|
||||
};
|
||||
|
||||
export type PublicDealSeat = { id: string; bot?: unknown; ally?: string | null };
|
||||
export type PublicDealSeat = { id: string; bot?: unknown; ally?: string | null; allies?: readonly string[] };
|
||||
|
||||
export class PublicDealError extends Error {
|
||||
constructor(message: string) {
|
||||
@@ -62,7 +62,8 @@ function participants(players: readonly PublicDealSeat[], ids: readonly string[]
|
||||
}
|
||||
function notAllied(seats: readonly PublicDealSeat[]): void {
|
||||
requireDeal(seats.every((seat, index) => seats.slice(index + 1).every(other =>
|
||||
seat.ally !== other.id && other.ally !== seat.id)),
|
||||
seat.ally !== other.id && other.ally !== seat.id &&
|
||||
!seat.allies?.includes(other.id) && !other.allies?.includes(seat.id))),
|
||||
'A deal is available only between seats that are not allied with each other.');
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user