Skip to main content

Scoring System Overview

After each guess, you receive feedback in two numbers:
  • Fijas: Digits that are correct AND in the correct position
  • Picas: Digits that are correct BUT in the wrong position
These two values help you deduce your opponent’s secret number through logical elimination.

What is a Fija?

A Fija (“fixed” or “exact”) occurs when a digit in your guess matches the digit in the secret number at the same position.
Think of Fijas as “perfect matches” - right digit, right spot.
Example:
  • Secret number: 5892
  • Your guess: 5234
  • Position 0: 5 = 5This is a Fija
  • Position 1: 28
  • Position 2: 39
  • Position 3: 42
Result: 1 Fija, 1 Pica (the digit 2 is in the secret number but in a different position)

What is a Pica?

A Pica (“hint” or “clue”) occurs when a digit in your guess exists in the secret number but at a different position.
Think of Picas as “partial matches” - right digit, wrong spot.
Example:
  • Secret number: 5892
  • Your guess: 2345
  • Position 0: 25, but 2 exists at position 3 in the secret ✓ This is a Pica
  • Position 1: 38, and 3 doesn’t exist anywhere ✗
  • Position 2: 49, and 4 doesn’t exist anywhere ✗
  • Position 3: 52, but 5 exists at position 0 in the secret ✓ This is a Pica
Result: 0 Fijas, 2 Picas

The Calculation Algorithm

Here’s the exact algorithm the server uses to calculate Picas and Fijas:
// From server.js:170-177
function getPicasFijas(secret, guess) {
    let fijas = 0, picas = 0;
    for (let i = 0; i < 4; i++) {
        if (guess[i] === secret[i]) fijas++;
        else if (secret.includes(guess[i])) picas++;
    }
    return { fijas, picas };
}
How it works:
  1. Loop through each position (0-3)
  2. If the digit at position i in the guess matches the digit at position i in the secret → increment Fijas
  3. Otherwise, if the digit exists anywhere in the secret number → increment Picas
  4. Return both counts

Comprehensive Examples

Let’s work through several examples with the same secret number: 7304

Example 1: All Wrong

SecretGuessPosition 0Position 1Position 2Position 3FijasPicas
730412561≠7 (no match)2≠3 (no match)5≠0 (no match)6≠4 (no match)00

Example 2: One Fija

SecretGuessPosition 0Position 1Position 2Position 3FijasPicas
730472567=7 ✓2≠3 (no match)5≠0 (no match)6≠4 (no match)10

Example 3: Two Picas

SecretGuessPosition 0Position 1Position 2Position 3FijasPicas
730407650≠7 (0 exists at pos 2)7≠3 (7 exists at pos 0)6≠0 (no match)5≠4 (no match)02

Example 4: One Fija, Two Picas

SecretGuessPosition 0Position 1Position 2Position 3FijasPicas
730470437=7 ✓0≠3 (0 exists at pos 2)4≠0 (4 exists at pos 3)3≠4 (3 exists at pos 1)13

Example 5: All Correct Digits, Wrong Order

SecretGuessPosition 0Position 1Position 2Position 3FijasPicas
730443074≠7 (4 exists at pos 3)3≠3… wait, 3=3 ✓0=0 ✓7≠4 (7 exists at pos 0)22

Example 6: Perfect Match (Win!)

SecretGuessPosition 0Position 1Position 2Position 3FijasPicas
730473047=7 ✓3=3 ✓0=0 ✓4=4 ✓40
When you achieve 4 Fijas, the game immediately ends and you win! No more guesses are accepted.

Understanding the Feedback

The result is sent to both players after each guess:
// From server.js:116-128
const result = getPicasFijas(opponentSecret, guess);
const turnNumber = room.turnCounts[socket.playerId]++;

const data = {
    jugadorId: socket.playerId,
    jugador: socket.playerId === 0 ? 'yo' : 'oponente',
    turno: turnNumber,
    intento: guess,
    fijas: result.fijas,
    picas: result.picas
};

room.players.forEach(p => p.emit('result', data));

Strategy Tips

When you receive Picas without Fijas, you know those digits are in the secret number but need to be rearranged. Try permutations of those digits in subsequent guesses.Example:
  • Guess 1234 → 2 Picas, 0 Fijas
  • Next try: 2143 or 3412 to test different positions
Your first few guesses should aim to identify which digits are in the secret number. Try using completely different digits:
  • Guess 1: 1234
  • Guess 2: 5678
  • Guess 3: 9012
This way, you can quickly narrow down the 4 digits that compose the secret number.
If you get 3-4 Picas, you’re very close! The secret number contains those exact digits, just in a different arrangement.Example:
  • Secret: 5892
  • Guess: 2985 → 0 Fijas, 4 Picas
  • You now know the secret is some permutation of 2, 9, 8, 5
  • Try: 5928, 8592, 9258, etc.

Edge Cases

Maximum possible sum: Since there are only 4 positions, the maximum value of (Fijas + Picas) is 4. You cannot have 3 Fijas and 2 Picas, for example.

Zero Feedback

If you receive 0 Fijas and 0 Picas, none of your guessed digits are in the secret number. This is actually very valuable information! Example:
  • Guess 1234 → 0 Fijas, 0 Picas
  • You can now eliminate 1, 2, 3, and 4 from all future guesses
  • Try 5678, 9056, etc.

All Picas, No Fijas

This means you have the right digits but all in the wrong positions. Example:
  • Secret: 5892
  • Guess: 2985 → 0 Fijas, 4 Picas
  • Simply rearrange these exact 4 digits to find the solution

Common Mistakes

Mistake: Thinking Picas and Fijas can overlapReality: Each position is evaluated only once. A digit cannot be both a Pica AND a Fija in the same guess.
Mistake: Assuming duplicate digits in your guess will count multiple timesReality: The server rejects guesses with duplicate digits! All 4 digits must be unique.

Build docs developers (and LLMs) love