# Review Algorithmic Thinking by Building a Dice Game - Step 7

**URL:** <https://forum.freecodecamp.org/t/review-algorithmic-thinking-by-building-a-dice-game-step-7/704081>\
**Category:** General\
**Tags:** español\
**Created:** [August 2, 2024, 12:48am UTC](https://forum.freecodecamp.org/t/review-algorithmic-thinking-by-building-a-dice-game-step-7/704081 "2024-08-02T00:48:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jordanny17](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/jordanny17/32/346594_2.png) [@jordanny17](https://forum.freecodecamp.org/u/jordanny17)\
**Post date:** [August 2, 2024, 12:48am UTC](https://forum.freecodecamp.org/t/review-algorithmic-thinking-by-building-a-dice-game-step-7/704081/1 "2024-08-02T00:48:43Z")

</div>

### Tell us what’s happening:

hi, can you help me see what I’m doing wrong please?

### Your code so far

```html
<!-- file: index.html -->

```

```css
/* file: styles.css */

```

```javascript
/* file: script.js */
// User Editable Region

const getHighestDuplicates = (numbers) => {

  const countObject = {};

   numbers.forEach((number) => {
    if (countObject[number]) {
      countObject[number]++;
    } else {
      countObject[number] = 1;
    }
  });

  const sum = numbers.reduce((a, b) => a + b, 0);

  if (highestCount >= 4) {
    updateRadioOption('fourOfAKind', sum);
  } else if (highestCount >= 3) {
    updateRadioOption('threeOfAKind', sum);
  } else {
    updateRadioOption('finalOption', 0);
  }
}

 

rollDiceBtn.addEventListener("click", () => {
  if (rolls === 3) {
    alert("You have made three rolls this round. Please select a score.");
  } else {
    rolls++;
    rollDice();
    updateStats();
    getHighestDuplicates();
  }
});

// User Editable Region

```

### Your browser information:

El agente de usuario es: `Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36`

### Challenge Information:

Review Algorithmic Thinking by Building a Dice Game - Step 7

> **[freeCodeCamp.org](https://www.freecodecamp.org/espanol/learn/javascript-algorithms-and-data-structures-v8/review-algorithmic-thinking-by-building-a-dice-game/step-7)**
>
> Aprende a programar, ¡GRATIS!

---

<div class="post-metadata">

**Author:** ![a2937](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/a2937/32/253267_2.png) [@a2937](https://forum.freecodecamp.org/u/a2937)\
**Post date:** [August 2, 2024, 1:25am UTC](https://forum.freecodecamp.org/t/review-algorithmic-thinking-by-building-a-dice-game-step-7/704081/2 "2024-08-02T01:25:43Z")

</div>

In English:

Hi there. There’s four issues with your code.

`highestCount` is never defined. Your code right now has no idea what the largest count is. You are tracking the numbers though as values in your `countObject` though. You need to determine which is the biggest.

The indexes given to the your `updateRadioButton` are not valid. The function needs a number. If you look to the side, you can see what order they are in. Note: All array indexes start at 0.

Thirdly a four of kind still technically counts as a three of a kind. So the available choices need to include “Three of a Kind”, “Four of a Kind” , and “None” which four of the same dice sides are showing. It’s not exclusive.

Lastly, your function call `getHighestDuplicates` needs the values of the dice passed. Otherwise it has no idea what it is comparing.

> **En español de Google Translate**
>
> Hola, ahí. Hay cuatro problemas con tu código.
> 
> Nunca se define el Count más alto. Su código ahora mismo no tiene idea de cuál es el mayor conteo. Usted está rastreando los números, aunque como valores en su “countObject”. Tienes que determinar cuál es el más grande.
> 
> Los índices dados a su “actualRadioButton”, no son válidos. La función necesita un número. Si miras a un lado, puedes ver en qué orden están. Nota: Todos los índices de matriz comienzan en 0.
> 
> En tercer lugar, un cuatro de tipo todavía técnicamente cuenta como un tipo de tres. Así que las opciones disponibles tienen que incluir “Tres de un tipo”, “Cuatro de un tipo” , y “Ninguno” que cuatro de los mismos lados de dados están mostrando. No es exclusivo.
> 
> Por último, su llamada de función “getHighestDuplicates”, necesita los valores de los dados pasados. De lo contrario no tiene ni idea de lo que está comparando.

---

<div class="post-metadata">

**Author:** ![ILM](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/ilm/32/363239_2.png) [@ILM](https://forum.freecodecamp.org/u/ILM)\
**Post date:** [January 8, 2025, 3:48pm UTC](https://forum.freecodecamp.org/t/review-algorithmic-thinking-by-building-a-dice-game-step-7/704081/3 "2025-01-08T15:48:46Z")

</div>

Closed on January 8, 2025, 3:48pm UTC


