...

Forum rules
Please DO NOT POST BUGS on this forum. Please report (and vote) bugs on : https://boardgamearena.com/#!bugs
User avatar
Teapot
Posts: 17
Joined: 04 August 2015, 00:45

Re: "dubious" luck

Post by Teapot »

Ze Monstah wrote: 08 March 2020, 23:11 Backgammon BGA adaptation has been developed by a member of the BGA community: You can send him a message if you want::
https://boardgamearena.com/player?id=2892085

Here is the PHP code that he wrote to roll the dice:

Code: Select all

        // Roll dices
        $dice1_value = bga_rand(1, 6);
        $dice2_value = bga_rand(1, 6);
bga_rand() function is defined like this:

Code: Select all

function bga_rand( $min=null, $max=null )
{
    if( $min === null && $max ===  null )
        return random_int( 0, getrandmax() );   // For compatibility
    else
        return random_int( $min, $max );
}
What is the purpose of getrandmax and default null inputs. Seems to me if the function is ever called with improper values it's a serious bug and could well be a factor in the backgammon artifact we've all noted. I don't see any dice issues in say Can't Stop. It seems unique to the backgammon code.

anyway to loop https://boardgamearena.com/player?id=2892085 into this thread?
User avatar
Ze Monstah
Posts: 676
Joined: 10 October 2019, 08:08
Location: Brăila, Romania

...

Post by Ze Monstah »

:idea:
Last edited by Ze Monstah on 08 April 2022, 09:52, edited 1 time in total.
When life gives you a ZeMon, make ZeMonade...
https://youtu.be/fq_EAESWlOs
User avatar
Jest Phulin
Posts: 1856
Joined: 08 July 2013, 21:50

Re: "dubious" luck

Post by Jest Phulin »

Teapot wrote: 17 July 2020, 14:22
Ze Monstah wrote: 08 March 2020, 23:11 Backgammon BGA adaptation has been developed by a member of the BGA community: You can send him a message if you want::
https://boardgamearena.com/player?id=2892085

Here is the PHP code that he wrote to roll the dice:

Code: Select all

        // Roll dices
        $dice1_value = bga_rand(1, 6);
        $dice2_value = bga_rand(1, 6);
bga_rand() function is defined like this:

Code: Select all

function bga_rand( $min=null, $max=null )
{
    if( $min === null && $max ===  null )
        return random_int( 0, getrandmax() );   // For compatibility
    else
        return random_int( $min, $max );
}
What is the purpose of getrandmax and default null inputs. Seems to me if the function is ever called with improper values it's a serious bug
OK, the programming aspect of it.

BGA first developed a random number generator* function called bga_rand(a,b). Normal application is to return an integer value between the values of the parameters passed to it (a and b), inclusive. However, it could have been called without parameters (bga_rand()), returning a value between 0 and the maximum integer the system would handle.

While this method worked fine for casual games and computing capability of personal computers when the site was originally created, better options became available. Namely the PHP function random_int(a,b). So, bga_rand(a,b) was rewritten to simply call random_int(a,b). This would cause all programs to update to the better option without requiring looking through all the games and finding every instance of a call to bga_rand(a,b) and replacing it with random_int(a,b).

But, since bga_rand() could be called without parameters, the ability to recreate that had to be included. Which is why there's the comment "for compatibility" in the call if no (or null) parameters were passed to the function. Yes, it could be a valid call of bga_rand(null, null).

As far as calling it with improper values, that is still as much of an issue as it was**. Note that if bga_rand(a) is called (only one parameter), it will make a call to random_int(a, null), which will throw a TypeError exception. **But, it never really was much of an issue. The exception being thrown would cause the program to fail, and would never make it to the production server. Any code written to catch that error would be done by a programmer that wouldn't send improper arguments in the first place.

-------
*For purists, yes, it is actually a pseudo-random number generator, as are all computer generated random numbers.
Teapot wrote: 17 July 2020, 14:22 and could well be a factor in the backgammon artifact we've all noted.
We've all noted? I have yet to see an analysis in the backgammon forums that proves an issue. Please provide that analysis rather than simply making the assumption we have all seen an artifact.
Teapot wrote: 17 July 2020, 14:22 I don't see any dice issues in say Can't Stop. It seems unique to the backgammon code.
I take it you don't read the Can't Stop forums then. Several similar discussions of "these dice rolls don't feel like they should" are in there. Again, all without verifiable statistical analysis.
User avatar
hup40
Posts: 2
Joined: 28 March 2020, 11:55

Re: "dubious" luck

Post by hup40 »

Speaking of statistical analysis of the quality of random rolls, could you check if pairs of the same doubles in direct succession are way above the expected average?

It feels a lot like, way too often after a double has occured, the next player gets the same double "back". It does not feel like this in GnuBG or extreme Gammon (or in RL with less then perfect real dice) at all - this is pretty unique to BGA. My guess would be some race condition or run-time error as the culprit, where no true random number is fetched, but the last one is just repeated or reused.

While being at it: Are there any plans to introduce the doubling cube with basic rules for it? Or at least losing double or tripple for gammmons or backgammons?

As it is, BG on on BGA fosters actually bad playing behavior, that would be punished quickly in any real scenario. Since you can only lose one point here, people play much more risky strategies, that normally would be punished in losing several points at once by gammon or even backgammon, let alone the doubles by doubling cube. My concern is, that my gameplay will actually deteriorate here, compared to platforms and software that enforces offcial backgammon rules.

Since those tools and rules seem not to be very complicated to implement, I wonder why there is no rodmap to include them. As it is, Backgammon on BGA is a "hobby variant" of the game at best, it is not really Backgammon, the game most BG Players are very serious about.
User avatar
Jest Phulin
Posts: 1856
Joined: 08 July 2013, 21:50

Re: "dubious" luck

Post by Jest Phulin »

hup40 wrote: 02 August 2020, 16:02 Speaking of statistical analysis of the quality of random rolls, could you check if pairs of the same doubles in direct succession are way above the expected average?

It feels a lot like, way too often after a double has occured, the next player gets the same double "back".
Any game can be replayed, so if you feel there is a problem, you can check and publish your results.

As far as your other concerns, they are best addressed in a new topic, not clouding this one. The short answer though is that BGA is volunteer programming, so you need to find someone interested in doing it.
User avatar
CaractacusPots
Posts: 90
Joined: 31 August 2020, 18:08

Re: "dubious" luck

Post by CaractacusPots »

The debate on randomness specific to Backgammon is a long and old one. I have played BG for many years, I have studied the game, studied books and consider myself a very decent player. I know I am, no question. Good BG players know they are good. Good players have played Jellyfish and other professional BG software. They know how many games they should win out of say 10 against lesser players. They know hooky dice throws when they see them.

I have debated this with countless other people for years on various games forums and on Google Play Store and the like. What you find is that all the "professional" (i.e. really good) BG players will consistently say that the dice are nowhere near random. They know, instinctively.

I have yet to find one single online BG site that has totally random dice. No such sites exist imo. All gaming sites, especially those where money is involved, tend to "rig" dice in such a way that everyone gets a fair share of wins so as not to put people off. Money sites need customers and if people are getting pawned consistently by good players then those people drift away. Rigging dice throws or games is the only way to maintain a balance. Good players will always beat poor players over time. Anyone can win one game but over many the good players will always prevail.

I haven't played enough games here yet to make a firm judgement but thus far I suspect that the usual "balancing" system seems to exist.

Given I don't know of a single online BG/gaming site with real-time pure random dice throws, I have no expectations. It is what it is. Gaming sites are a business and leveling systems are par for the course and always will be.
User avatar
N_Faker
Posts: 1078
Joined: 09 September 2016, 10:16

Re: "dubious" luck

Post by N_Faker »

CaractacusPots wrote: 31 August 2020, 22:07
What are 'real-time pure random dice throws'?
User avatar
RicardoRix
Posts: 2540
Joined: 29 April 2012, 23:43

Re: "dubious" luck

Post by RicardoRix »

Teapot wrote: 17 July 2020, 14:22
Ze Monstah wrote: 08 March 2020, 23:11 Backgammon BGA adaptation has been developed by a member of the BGA community: You can send him a message if you want::
https://boardgamearena.com/player?id=2892085

Here is the PHP code that he wrote to roll the dice:

Code: Select all

        // Roll dices
        $dice1_value = bga_rand(1, 6);
        $dice2_value = bga_rand(1, 6);
bga_rand() function is defined like this:

Code: Select all

function bga_rand( $min=null, $max=null )
{
    if( $min === null && $max ===  null )
        return random_int( 0, getrandmax() );   // For compatibility
    else
        return random_int( $min, $max );
}
What is the purpose of getrandmax and default null inputs. Seems to me if the function is ever called with improper values it's a serious bug and could well be a factor in the backgammon artifact we've all noted. I don't see any dice issues in say Can't Stop. It seems unique to the backgammon code.

anyway to loop https://boardgamearena.com/player?id=2892085 into this thread?
As suggested in the comment, it's for backwards compatibility, because this is a function from the BGA framework. A lot of games will be using it. The default null inputs just means that the function can be called with or without parameters, either:

bga_rand(1,6)
or
bga_rand()

Given backgammon is always calling the function with bga_rand(1,6):

When you say,
if the function is ever called with improper values
You'll have to find that line of code.....you can't just simply make this conjecture.

It would be the same as saying, he has a knife in his kitchen, so it was him that stabbed him to death....You need the evidence.
Given you have ALL the source code for backgammon it shouldn't be too hard to find all the RNG lines of code.
User avatar
CaractacusPots
Posts: 90
Joined: 31 August 2020, 18:08

Re: "dubious" luck

Post by CaractacusPots »

N_Faker wrote: 31 August 2020, 22:51 What are 'real-time pure random dice throws'?

Numbers generated specifically at the point in time in the game for the specific player using a genuine random number generator without any prior generation of the numbers and without any manipulation associated with a player's expertise or newness to the site.

Posting program code for the select part of a program that deals with an RNG generation tells you nothing. Numerous gaming sites do the same but it's disingenuous because it is how the random numbers are used that matters not how they are generated and that part of the program is never revealed.

Go onto Google Play and look at the plethora of comments from people on the various BG game pages and you'll see the developers constantly citing some scientific source reference for the generation of the numbers. That tells you nothing. I can go generate 1 million random numbers in an instant using such sources, but it is what I then do with those numbers that matters.

Some games sites have pre-developed strings of "random" numbers. They were generated randomly at some point in time and saved. They then use those strings during people's games. This means that no player is getting any kind of random number generated right there and then as they play. They are simply participants in a theatrical play in which all the numbers were predetermined, following a script if you will. The sites can truthfully say that the numbers WERE randomly generated using some bonafied scientific generator but the reality is very different. You can generate lots of sets of 100 dice throws, all random. Then you can determine in any given game who gets which set of numbers.

I'm not suggesting this happens here, however as stated in previous post, thus far I don't know of a single online gaming site that has true random real time numbers. All online gambling sites are rigged imho and anyone who joins will magically experience a short "Honeymoon" period where they appear to be successful in their games or bets and that situation quickly reverses once they start putting money in.

There are many poor BG players here who don't understand the strategy and whose game strategy simply consists of trying not to leave open blots. Those people should lose probably 8 or 9 games out of every 10 against good players. Good players leave blots purposely and at the right times throughout games in order to maximize their chances of making key points. It's a massive difference.

In the end good players know if the dice are not real time and random or not. There's just no fooling good players.
User avatar
N_Faker
Posts: 1078
Joined: 09 September 2016, 10:16

Re: "dubious" luck

Post by N_Faker »

CaractacusPots wrote: 01 September 2020, 15:09 In the end good players know if the dice are not real time and random or not. There's just no fooling good players.
How would one differentiate between pre-generated pseudo-random numbers and real-time generated pseudo-random numbers?
CaractacusPots wrote: 01 September 2020, 15:09 There are many poor BG players here who don't understand the strategy and whose game strategy simply consists of trying not to leave open blots. Those people should lose probably 8 or 9 games out of every 10 against good players. Good players leave blots purposely and at the right times throughout games in order to maximize their chances of making key points. It's a massive difference.
It is closer to 7 out of 10 games. BGA only has cubeless single games of BG.
Post Reply

Return to “Backgammon”