The entire card deck is exposed to the player via `gameui.gamedatas.deck`

Forum rules
Please DO NOT POST BUGS on this forum. Please report (and vote) bugs on : https://boardgamearena.com/#!bugs
Post Reply
Spicy
Posts: 10
Joined: 01 October 2022, 01:41

The entire card deck is exposed to the player via `gameui.gamedatas.deck`

Post by Spicy »

Before posting this I looked through the forum and the bug list but couldn't find anything related. I'm sorry if this is a known issue.

Bug report: https://boardgamearena.com/bug?id=78674

The development team has done a great job of hiding the player's starting cards. However, for some reason the game client knows the entire content of the card deck from the very beginning of the match. This data is passed to `gameui.completesetup(...)` as an argument (location: the page source) and is accessible through `gameui.gamedatas.deck`.

Here's a script that uses this information, which we definitely shouldn't have, and prints the player's hand and the top card of the deck.

Code: Select all

(function() {
    function printPlayerHand() {
        const cardsDiv = document.getElementById(`playertablecard_${gameui.player_id}`);
        const cards = [...cardsDiv.getElementsByClassName("card")].reverse();
        const message = cards.map(card => {
            const cardId = card.id.split("_").at(-1);
            const info = gameui.gamedatas.deck[cardId];
            return info ? `${info.type_arg} ${gameui.colorNames[info.type]}` : "?";
        }).join(", ");

        console.log(`Your hand: ${message}`);
    }

    function printNextCard() {
        const cardsLeft = Number(document.getElementById("deck_pile_item_1").textContent);
        const info = gameui.gamedatas.deck[String(cardsLeft * 2)];

        console.log(`The next card in the deck: ${info.type_arg} ${gameui.colorNames[info.type]}`)
    }

    printPlayerHand();
    printNextCard();
})();
Image

Now I know my cards are (4 blue, 2 white, 5 green, ?) without needing any clues. "?" means this card is one of my starting cards, so it's not in the `deck` object.

Interestingly enough, I couldn't find any usage of this object in the code. If that's true, I'm guessing it's a pretty easy fix.
Spicy
Posts: 10
Joined: 01 October 2022, 01:41

Re: The entire card deck is exposed to the player via `gameui.gamedatas.deck`

Post by Spicy »

Looks like the issue has been patched. The `deck` object is no longer present in `gameui.gamedatas`.

Honestly, I was expecting at least some kind of reaction to this... Not just a silent game update. But well, thanks for the fix, whoever added it.
User avatar
Blacktango
Posts: 35
Joined: 18 April 2015, 12:15

Re: The entire card deck is exposed to the player via `gameui.gamedatas.deck`

Post by Blacktango »

I don’t think there are updates on Hanabi anymore, especially so fast.

By the way, all the game data are visible in the dev console, including players hand. You don’t even have to call a function. :|
User avatar
Silene
Posts: 661
Joined: 23 October 2013, 17:50

Re: The entire card deck is exposed to the player via `gameui.gamedatas.deck`

Post by Silene »

I think it doesn't really matter. It's a cooperative game so there's no competition. Usually other players want to play the game and not look up their cards. If you meet players that want to mess with you, they have already lots of options available. This just adds one more.
Hosting Allround-League: https://boardgamearena.com/group?id=7870115 --> a league where you have matches of random games vs. other players in your group - season 4 started Sept.'22
User avatar
Jellby
Posts: 558
Joined: 31 December 2013, 12:22

Re: The entire card deck is exposed to the player via `gameui.gamedatas.deck`

Post by Jellby »

Blacktango wrote: 07 January 2023, 15:01 I don’t think there are updates on Hanabi anymore, especially so fast.
Release 230106-1055

So yes, there has been an update.
Spicy
Posts: 10
Joined: 01 October 2022, 01:41

Re: The entire card deck is exposed to the player via `gameui.gamedatas.deck`

Post by Spicy »

Blacktango wrote: 07 January 2023, 15:01 By the way, all the game data are visible in the dev console, including players hand. You don’t even have to call a function. :|
Not quite sure what game data you mean. Everything exposed to the player through the UI does not need to be hidden for someone trying to get that through the game data. That's not an issue. The issue was that the information that wasn't supposed to be available to the player by the rules was available through the game data.

Also, while we're on the subject... No, the data that must be hidden isn't actually available. Maybe you meant the logging of a player picking a card. I'm not sure why do they log that (or at least were, because I can't see those entries now), but if you look closely, the cards picked by you always have the same data { ...color: 5, value: 6... }. So they are actually hidden, which is great.
Spicy
Posts: 10
Joined: 01 October 2022, 01:41

Re: The entire card deck is exposed to the player via `gameui.gamedatas.deck`

Post by Spicy »

Silene wrote: 07 January 2023, 15:35 I think it doesn't really matter. It's a cooperative game so there's no competition. Usually other players want to play the game and not look up their cards. If you meet players that want to mess with you, they have already lots of options available. This just adds one more.
Can't disagree, you're absolutely right.

The main reason I reported this is because I've had a few instances where a player played their card, it worked perfectly, but there was no reason for them to play it. And those cards were mainly unmarked.

I'm definitely not an expert in Hanabi, but I think I have enough experience to be able to read most of the smart and complex plays. Now I can be sure that's actually a great player who can read the game much better than me and not just someone who know their cards just by using basically cheats.
User avatar
zellaaa
Posts: 19
Joined: 13 February 2022, 11:13

Re: The entire card deck is exposed to the player via `gameui.gamedatas.deck`

Post by zellaaa »

Jellby wrote: 07 January 2023, 15:40
Blacktango wrote: 07 January 2023, 15:01 I don’t think there are updates on Hanabi anymore, especially so fast.
Release 230106-1055

So yes, there has been an update.
Doesn't that mean it has been released on January 23, 2006?
zellaaa
User avatar
Jellby
Posts: 558
Joined: 31 December 2013, 12:22

Re: The entire card deck is exposed to the player via `gameui.gamedatas.deck`

Post by Jellby »

Unlikely, since Hanabi was first (physically) published in 2010.
User avatar
robinzig
Posts: 318
Joined: 11 February 2021, 18:23

Re: The entire card deck is exposed to the player via `gameui.gamedatas.deck`

Post by robinzig »

zellaaa wrote: 23 January 2023, 11:56
Jellby wrote: 07 January 2023, 15:40
Blacktango wrote: 07 January 2023, 15:01 I don’t think there are updates on Hanabi anymore, especially so fast.
Release 230106-1055

So yes, there has been an update.
Doesn't that mean it has been released on January 23, 2006?
No, the date format used here is YYMMDD. (I know by looking at the current version number for a game I developed.)
Post Reply

Return to “Hanabi”