Add React frontend and clean up legacy HTTP backend
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
import type { CardColor, Hand } from '../types';
|
||||
|
||||
export function computePlayable(hand: Hand, ledColor: CardColor | null): Set<string> {
|
||||
const keys = Object.keys(hand);
|
||||
if (!ledColor) return new Set(keys);
|
||||
|
||||
const ledKeys = keys.filter((k) => hand[k].color === ledColor);
|
||||
if (ledKeys.length > 0) return new Set(ledKeys);
|
||||
|
||||
const heartKeys = keys.filter((k) => hand[k].color === 'HEARTS');
|
||||
if (heartKeys.length > 0) return new Set(heartKeys);
|
||||
|
||||
return new Set(keys);
|
||||
}
|
||||
Reference in New Issue
Block a user