Slight bias in the game?

Forum rules
Please DO NOT POST BUGS on this forum. Please report (and vote) bugs on : https://boardgamearena.com/bugs
User avatar
PaleHorse
Posts: 5
Joined: 04 December 2013, 20:48

Re: Slight bias in the game?

Post by PaleHorse »

As far as unusual stuff going on, after more than 120 games here I've noticed 2 glaring issues: 1) there are a lot of Jacks cut and mainly 2) there are WAY WAY too many hands in which all 4 of something (four 7s or four 2s, etc) gets played. Please understand what I'm saying--four of the same thing per HAND (my hand and my opponent's hand together. I just played a game where four of the same thing happened in 2 consecutive hands!

From my experience playing literally thousands of Cribbage games in my life the times that this has happened puts the odds off the chart. I'm convinced there is a problem the coding.
User avatar
RicardoRix
Posts: 2115
Joined: 29 April 2012, 23:43

Re: Slight bias in the game?

Post by RicardoRix »

PaleHorse wrote: 11 February 2021, 22:10 From my experience playing literally thousands of Cribbage games in my life the times that this has happened puts the odds off the chart. I'm convinced there is a problem the coding.
You'll be happy to know you can check the code yourself:
https://studio.boardgamearena.com/projects

Let us know your findings.
User avatar
PaleHorse
Posts: 5
Joined: 04 December 2013, 20:48

Re: Slight bias in the game?

Post by PaleHorse »

So, I have played another 20-25 games since my post and and the number of times there is four something per hand (see my original post) has only INCREASED. This happens often enough that I have had to alter my play strategy to anticipate it happening!! In real life, this should only happen, on average, once every 20-25 games (at least in my experience). Here, it happens AT LEAST every other game, I've even had it happen twice in the same game!
I can't be the only one this happens to. I'm no programmer but this is broken in some way. No doubt at all about it.
User avatar
MikeIsHere
Posts: 137
Joined: 30 April 2020, 22:52

Re: Slight bias in the game?

Post by MikeIsHere »

According to the stat's page after 127k games about 26 four card hands per game 9 hands and 4 cribs x 2

The average stats are
https://boardgamearena.com/playerstat?i ... &game=1214
The average is
75.25 pts in 9.67 ~ 7.78 pts per hand (the average cribbage hand is considered to be 8 points)

The winners
81.95pts in 9.86 ~ 8.3 pts per hand (the average cribbage hand is considered to be 8 points)

Cribs are
22.11pts per 4.62 ~ 4.78
winners
23.84 per 4.72 ~ 5.05 (I believe the average expected crib is suppose to be 4 pts) so this does seem a little high

Again you can check the code, I actually do two deck shuffles one for the new hand and one right before the card is cut (this is a programming thing not a game mechanic)
But there is no more bias in cribbage as there is for doubles in Backgammon :o

I look at a couple of your games and did not see where you had quads(four of something) in your hand/cut card, a lot of 3 of a kinds (which out of 6 cards happens 3.6% of the time or 1 out of 27 hands)

https://boardgamearena.com/gamereview?table=146834129
3- 3 of a kind
Player PaleHorse has scored 6 points with their Hand:
Hand / Cut Card:
7♥
7♣
7♠
10♣
/
6♠

Player flynav has scored 6 points with their Crib:
Crib / Cut Card:
K♠
10♠
K♣
K♥
/
6♠

Player flynav has scored 14 points with their Hand:
Hand / Cut Card:
3♠
4♦
4♣
4♥
/
7♠
-----------------------------------------------------------------
https://boardgamearena.com/gamereview?table=146055243
2-3 of a kind
Player PaleHorse has scored 6 points with their Hand:
Hand / Cut Card:
10♠
10♥
10♣
8♠
/
A♣

Player PaleHorse has scored 21 points with their Hand:
Hand / Cut Card:
5♠
4♥
6♠
6♦
/
6♥
--------------------------------------------------------------
https://boardgamearena.com/gamereview?table=145698690

Player Little Foot has scored 8 points with their Hand:
Hand / Cut Card:
4♦
4♣
4♠
5♠
/
10♠

Player Little Foot has scored 6 points with their Hand:
Hand / Cut Card:
4♦
4♣
4♥
J♠
/
K♦

--------------------------------------------------
https://boardgamearena.com/gamereview?table=144560577

None
User avatar
PaleHorse
Posts: 5
Joined: 04 December 2013, 20:48

Re: Slight bias in the game?

Post by PaleHorse »

I'm sorry sir but you didn't read my post carefully enough. I never claimed that I had 4 of a kind in a hand/crib. Again, I am speaking of a TOTAL ROUND in which the opponent has 6 cards, I have 6 cards, and then a cut card for a total of 13 cards per round. Out of those 13, my assertion is that 4 of the same card (four 7s or 4 queens, etc) appears WAY more than statistical average.

I have no data to back me up but I do have thousands of games in my life under my belt and also common sense that tells me something is amiss. I appreciate your time spent with your statistical presentation but if you are able to obtain the stats for the conditions I have described above I would be very interested in those results.

As I have said, this happens so often (at least to me) that I have had to alter my strategy with the play of my cards. Sorry for any confusion and I'm not trying to rile anybody up. Just reporting what I observe. Thanks, Palehorse
User avatar
MikeIsHere
Posts: 137
Joined: 30 April 2020, 22:52

Re: Slight bias in the game?

Post by MikeIsHere »

Thank you for the clarification
The odds of 4 of kind appearing in 13 cards, which is 1/4 of the deck, is actually ~3.5%

https://math.stackexchange.com/question ... poker-game

So on average if a game last 9 hands you would expect it to happen 1 every 3 games about-- the fact that it happen in 2 consecutive hands (and I am still looking for the logs) is a probability of 0.12% or 1 in 833 very high but not astronomical

Please feel free to look through the code and make any suggestions you feel would improve the game and game distribution
User avatar
twenty9oh7
Posts: 104
Joined: 10 August 2020, 16:26

Re: Slight bias in the game?

Post by twenty9oh7 »

Honest question, when choosing a card presented on the screen for cuts or otherwise, does it actually matter which of the face down cards on the screen that we press? Curious if there are actually multiple cards actually facedown, or just a button on each that picks random from available cards leftover.
User avatar
MikeIsHere
Posts: 137
Joined: 30 April 2020, 22:52

Re: Slight bias in the game?

Post by MikeIsHere »

So if the random option is chosen, then the program picks a random number from 1 to 40

But in the manual option the card you click on is the number of cards the program deals out and then grabs the last card dealt

So if in the line of cards you click on the 22nd card then the program deals 22 cards and takes the last one as the cut card

The cards have been shuffled and the only info delivered to the client and server is the card position from the left most card
User avatar
MikeIsHere
Posts: 137
Joined: 30 April 2020, 22:52

Re: Slight bias in the game?

Post by MikeIsHere »

The code the does the cut card if done manual


Javascript

Code: Select all

 onEnteringState: function (stateName, args) {             
                                
                switch (stateName) {
                 ...
                    case 'cutCard':  
                    case 'cutDeal':  
                            this.hideElement('#cutCard')
                            this.showElement('#deckContainer');
                            this.spreadDeck('fullDeck', (stateName == 'cutDeal' ? 52: 40));
                        break;
                }
            },
            
            spreadDeck: function(parentDiv, num_cards) {
                $(parentDiv).innerHTML = '';
                if (typeof(num_cards) == 'undefined') num_cards = 40;  
                this.deck.removeAll();                           
                for(var i=1; i<= num_cards; i++) {                    
                    this.deck.addToStockWithId(i, i);
                }
                this.deck.resetItemsPosition();
            },
            
            onDeckSelect: function (control_name, item_id) {
                var action = this.gamedatas.gamestate.name;
                if (item_id > 0) {
                    if (this.checkAction(action)) { 
                        this.ajaxcall("/" + this.game_name + "/" + this.game_name + "/" + action + ".html",
                        {
                            card: item_id,
                            lock: true
                        }, this, function (result) { }, function (is_error) {}
                        );       
                    } 
                    this.deck.unselectAll();                    
                }
            },
PHP (when in cutCard phase)

Code: Select all

    function cutCard($card_id) {
        self::checkAction("cutCard");
        $card_id = intval($card_id);

        if($card_id == null || $card_id>40) {
            throw new BgaUserException(self::_('Card Id invalid'));
        }
        
        $this->performCut($card_id);
    }
    
    function performCut($card_id) {
        $cards = $this->cards->pickCardsForLocation( $card_id, 'deck', 'deck');        
        
        $actualCard = array_values($cards)[$card_id - 1];

        $this->cards->moveCard($actualCard['id'], 'cutCard');

        $dealer_id = self::getDealerId();

        self::notifyAllPlayers('cutCard', clienttranslate('The ${cardValue} has been cut'), array(
            'cardValue' => self::cardValue($actualCard),
            'card' => $actualCard
        ));
User avatar
twenty9oh7
Posts: 104
Joined: 10 August 2020, 16:26

Re: Slight bias in the game?

Post by twenty9oh7 »

MikeIsHere wrote: 10 April 2021, 02:20 So if the random option is chosen, then the program picks a random number from 1 to 40

But in the manual option the card you click on is the number of cards the program deals out and then grabs the last card dealt

So if in the line of cards you click on the 22nd card then the program deals 22 cards and takes the last one as the cut card

The cards have been shuffled and the only info delivered to the client and server is the card position from the left most card
Very neat! Thank you!
Post Reply

Return to “Cribbage”