[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Need a little help with Python script error
From: |
MK |
Subject: |
Re: Need a little help with Python script error |
Date: |
Sun, 28 Jan 2024 12:34:21 -0700 |
User-agent: |
Mozilla Thunderbird |
Hi Philippe,
Thanks for the response. Before anything else, let me say again
that even though I criticize GnuBG and you team very harshly, I
also praise GnuBG almost as often. It's far far better than XG,
at least for my purposes of experimenting and finding out things
for myself. The things we can do with it can't be even imagined
with XG. I just want it to be a better bot, in ways that may not
seem useful to you but you should at least heed my suggestions
to fix the bugs and deficiencies in the existing functionalities.
Now, about my experiment scripts. The one I posted here was my
first script after spending only a few hours to learn just enough
about Python to see if I could code a working script. It was very
crude but I improved it a lot since then and I will share it with
you all in a different post.
I was able to figure out ways to deal with all the problems I have
encountered even if in very cumbersome ways. So, for my own sake,
I really don't care if you guys implement my suggestions but I hope
that you will. For that, I will respond to your comments and expand
on other issues.
On 1/28/2024 10:12 AM, Philippe Michel wrote:
but resigned, that is posinfo['resigned'], is not a 0/1
false/true flag, it is the number of points resigned.
Here its value is 2. You should use if resigned >= 1:
Yes I discovered that. I know check for > 0.
I have to agree that the error message is silly. But what
it means is that you tried to find the best checkers move
without having rolled the dice.
No. The dice was rolled but cleared.
could reproduce the dancing-related failure you mention in
a recent post to rec.games.backammon, but in this case this
looks more complicated ; I think I understand what happens but
didn't found exactly how it does and have no correction to offer.
In the dance cases, I see something like:
you roll a 4-1 dancing number, gnubg detects this, prints
"You cannot move." and carries on without letting you interact
since you have nothing to do.
it's your turn, you are expected to double or roll but you try
to find a best move, presumably for the previous 4-1, because you
didn't realize what happend since then.
I or the human player of the script doesn't get a chance to realize
what happened because GnuBG decides I dance and without alerting me,
it lets the bot roll and move. What is really confusing is that the
bot's move is displayed before the "You can't move" message.
The findbestmove returns zeroes for partially unplayable rolls and
it should do the same, i.e. return all zeroes, for fully unplayable
rolls, i.e. when human dances.
GnuBG shouldn't decide by hard-coded logic that I have nothing to
do after dancing. It should return 0, 0, 0, 0 and allow me a chance
to decide what I want to do.
See the makemove function in the new script I will share, about
how I dealt with this problem.
This is related to hard-coded logic to turn on automatictask when
both players are the bot, which causes all kinds of other problems.
Read my response to Ian Shaw. There should be a primary auto-roll
and auto-move flags for both players. If the user wants them to
auto-play, he can just check the boxes and everything will work
fine just as now. If the flags aren't checked, don't make any
hard-coded decisions for the user and let both players (whether
bot and/or human) wait before rolling and playing. You should
never hard-code anything unless absolutely unavoidable. Especially
don't decide anything for the user based on your own assumptions
of what is the right thing to do.
In my scripts, I need to count the rolls/moves for various reasons.
Since the bot always auto-rolls and auto-moves, in the main loop
I have to add to the moves count after bot plays, without knowing
if it made a checker move or a cube action. So, after the fact, I
have to do all kinds of awkward subtractions from the move count
for the bot's cube actions (see the script I will share). This is
really bad software design and programing. :( The auto-roll and
auto-move mess needs to be corrected.
There is also a problem in the match info with the winner and the
player who made the last move being swapped. So, any script that
uses those needs to swap them back (see the script I will share).
Okay, enough for now with these issues. I will soon send a new
post about my improved script with links to files and results.
MK