fix: clarify scoring system in track placement and guessing logic
This commit is contained in:
@@ -224,6 +224,15 @@ export class GameService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Check title and artist guess
|
* Check title and artist guess
|
||||||
|
*
|
||||||
|
* SCORING SYSTEM:
|
||||||
|
* - Tokens: Awarded ONLY for correctly guessing BOTH title AND artist
|
||||||
|
* - 1 token per round (can only get once per track)
|
||||||
|
* - Used as currency/bonus points
|
||||||
|
*
|
||||||
|
* - Score: Number of correctly placed tracks in timeline (timeline.length)
|
||||||
|
* - Increases only when placement is correct
|
||||||
|
* - This is the main win condition
|
||||||
*/
|
*/
|
||||||
async checkTitleArtistGuess(
|
async checkTitleArtistGuess(
|
||||||
room: RoomModel,
|
room: RoomModel,
|
||||||
@@ -274,6 +283,11 @@ export class GameService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Place track in timeline
|
* Place track in timeline
|
||||||
|
*
|
||||||
|
* SCORING SYSTEM:
|
||||||
|
* - Correct placement: Adds track to timeline, increasing score (timeline.length)
|
||||||
|
* - Incorrect placement: Track is discarded, no score increase
|
||||||
|
* - NO tokens awarded here - tokens are only from title+artist guesses
|
||||||
*/
|
*/
|
||||||
async placeInTimeline(
|
async placeInTimeline(
|
||||||
room: RoomModel,
|
room: RoomModel,
|
||||||
@@ -318,7 +332,7 @@ export class GameService {
|
|||||||
logger.warn(`Track has no year: ${track.title}`);
|
logger.warn(`Track has no year: ${track.title}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update timeline if correct
|
// Update timeline if correct (score is the timeline length)
|
||||||
if (correct) {
|
if (correct) {
|
||||||
const newTimeline = [...timeline];
|
const newTimeline = [...timeline];
|
||||||
newTimeline.splice(slot, 0, {
|
newTimeline.splice(slot, 0, {
|
||||||
@@ -328,19 +342,18 @@ export class GameService {
|
|||||||
artist: track.artist,
|
artist: track.artist,
|
||||||
});
|
});
|
||||||
room.state.timeline[playerId] = newTimeline;
|
room.state.timeline[playerId] = newTimeline;
|
||||||
|
|
||||||
// Award 1 token for correct placement (independent of title+artist token)
|
|
||||||
room.state.tokens[playerId] = (room.state.tokens[playerId] || 0) + 1;
|
|
||||||
|
|
||||||
|
// Score increases automatically (it's the timeline length)
|
||||||
|
// NO token awarded here - tokens are only from title+artist guesses
|
||||||
logger.info(
|
logger.info(
|
||||||
`Player ${playerId} correctly placed track in timeline. Awarded 1 token for placement.`
|
`Player ${playerId} correctly placed track in timeline. Score is now ${newTimeline.length}.`
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
// Discard the track
|
// Discard the track
|
||||||
room.discard.push(track);
|
room.discard.push(track);
|
||||||
|
|
||||||
logger.info(
|
logger.info(
|
||||||
`Player ${playerId} incorrectly placed track. No token awarded.`
|
`Player ${playerId} incorrectly placed track. No score increase.`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user