QB64 Chess
11-21-2017, 07:38 AM
Post: #131
 (Print Post)
Hi Bplus Hi Adrian

what do you think to work on general rules instead of particulare rules?
as QBGUY  himself said in his thread on .NET  CHESS.bas fixed
there are only two rules coded for Black (AI) and it must be improved!

I wait you thoughts about planning our efforts to get our goals... (a more suitable interface, a mouse event managing, an AI for the two colors, an AI empowered that can castle and get enpassant and make moves better, a save/load file,  review a game loaded)....
I think as already said some posts ago Bplus we must think to create and not only to fix the actual program.

Best regards
Find all posts by this user
Like Post
11-21-2017, 02:12 PM (This post was last modified: 11-21-2017 04:08 PM by Adrian Huang.)
Post: #132
 (Print Post)
hi TempodiBasic,

General rules may not be a bad idea. for example,

The Four Golden Rules of Chess Analysis

1. Always ask – ¨What is my opponent´s Threat?
2. What do my moves do to meet his Threat?
3. What am I threatening, & did his move answer my Threat?
4. Are there single or multiple Threats I can make?

I like to program in BASIC
With code that is simple and slick
I learnt it in school
And it is still cool
So it is my number one pick
Find all posts by this user
Like Post
11-21-2017, 05:28 PM
Post: #133
 (Print Post)
Hi all, 

I would like to see getInput$ extracted from IO sub and a new function created call AI$ that returns AI's move.

That way any AI you guys find or create can be plugged right into the Interface code and the Interface code can focus on updating screen and offering options to the human player without worry that the AI is going to reject the human player's move.

AI$ function needs 2 things the board array, already shared and knowing if it's playing Black or White so that it can deduce where the King's original square needs to be to castle legally. It can also assume all it's pieces are < 0 and it's pieces started out at the top two rows (if that should even matter?). Oh it would also need some Castle flags for legal castle moves, oh and it would need to know if it has option to capture by en passant. The AI should not be allowed to change anything on board or Castle flags, all it's info is read only.

Then it would be up to say some sort of referee function to say if human or AI's move is legal, of course this same code could serve double purpose of helping AI decide a legal move.

Then with the Red Sea parted, the Interface can make the way clear to the land of milk and honey by not having to wait and see if AI is going to accept the humans move or NOT plus we would be done with the Black Hack.

For a bad joke 
worse than Pete's Big Grin
Find all posts by this user
Like Post
11-22-2017, 07:06 AM
Post: #134
 (Print Post)
Hi Bplus
Hi Adrian

here a minor fix on Save and Load file in current mode
1. Now before to overwrite a file already existing user must confirm
2. output of saved file ok
3. output of loaded file ok

About the structure of the program
I think that Input of user must be managed in main loop because now user manage not only the choice of move to make but events of buttonbar. If you agree I code in that way...

Attached File(s)
.bas  chess 2_17-11-22 T.bas (Size: 58.76 KB / Downloads: 4)
Find all posts by this user
Like Post
11-28-2017, 10:31 AM (This post was last modified: 11-28-2017 01:56 PM by Adrian Huang.)
Post: #135
 (Print Post)
hi guys,

sorry, have not been active on this thread as i've been busy with other projects (e.g. adding GUI to Steinwender and Donninger's MiniMAX chess program). my gut feel is that the AI of qbguy's program will pretty much need a near total rewrite to play significantly better than its current strength (as TempodiBasic create rather than to fix). so i would be inclined to focus more on getting the other features of the program working well (load, save, setup, etc) as what you have already outlined.

I like to program in BASIC
With code that is simple and slick
I learnt it in school
And it is still cool
So it is my number one pick
Find all posts by this user
Like Post
11-29-2017, 07:28 AM
Post: #136
 (Print Post)
Hi Adrian
Hi Bplus

so I have had  little time to write code to show my ideas to you....
now I tell you what I'm coding to a better structured program...waiting your ideas or proposals...

I have thought another way to get input from user.... now we get input in getinput$ function that is in IO sub because we have built on the original code where user must only give a move for white pieces....

in the while we have built a mouse interface, a list of moves an area of I/O with user, an area to show pieces captured that becomes area of choosing promotion of pawn, a button bar to make so many action.... and a fine board that is managed by keyboard and mouse.
For these different areas user can do some actions... so input of user must be out of the loop of play a game... it must be indipendent and pass the results to the program, where the flow can translate user input in good response of program following the action of the different areas...

Best Regards
Find all posts by this user
Like Post
11-29-2017, 12:46 PM
Post: #137
 (Print Post)
Hi All,

For awhile I thought we were stuck in a Catch-22, when in order to fix A you need to fix B first but in order to fix B you had to fix A.

But it is clear what needs to be fixed first, as I said in reply #133 (2017-11-21) and TempodiBasic has just repeated in his words, the user Input part has to be extracted from the IO sub and put in the main game loop and the AI moves have to be determined from any given board position presented it with AI told to play move for Black or White...

I don't see any point wasting more time on bells and whistles for a program that has AI that is fundamentally designed to play only Black or the negative valued pieces. 

So now we have to figure out how an AI works so that we can hand it any board and command it to find best move for Black or White. 

AI function << Input a board position and side to play >> output a move from the AI.

I have looked at IO function several times and run into brick wall trying to figure out how to get to that ideal AI function from it.

If we could separate out the part where it checks the humans player's move... and then find all the parts where it only checks for negative / positive values and have it able to check either depending on the playWhite or playBlack value it has been called to handle... it's probably already there in code... it might be helpful to keep black on one side of board and white on the other, so that Kings occupy the same numbered squares at start of standard games.

or just start over and build a better AI! better because we built our own and know how it is supposed to work and thus how to modify it for the better.

For a bad joke 
worse than Pete's Big Grin
Find all posts by this user
Like Post

Forum Jump:

User(s) browsing this thread: 1 Guest(s)

QB64 Member Project - Martin Fractals version four
QB64 Member Project - Touche
QB64 Member Project - Dreamy Clock
QB64 Member Project - Pivet version one
QB64 Member Project - Color Rotating Text
QB64 Member Project - Swirl
QB64 Member Project - Score 4
QB64 Member Project - Blokus
QB64 Member Project - Inside Moves
QB64 Member Project - Isolation
QB64 Member Project - Exit
QB64 Member Project - 9 Board
QB64 Member Project - Foursight
QB64 Member Project - Kings Valley verion one
QB64 Member Project - Bowditch curve
QB64 Member Project - MAPTRIANGLE
QB64 Member Project - Othello
QB64 Member Project - Martin Fractals version three
QB64 Member Project - Sabotage
QB64 Member Project - Kings Court
QB64 Member Project - Kobolts Monopoly
QB64 Member Project - STxAxTIC 3D World
QB64 Member Project - ARB Checkers
QB64 Member Project - Full Color LED Sign
QB64 Member Project - Input
QB64 Member Project - Rubix's Magic
QB64 Member Project - Connect Four
QB64 Member Project - OpenGL Triangles
QB64 Member Project - Overboard
QB64 Member Project - Kings Vallery version two
QB64 Member Project - Domain
QB64 Member Project - Spinning Color Wheel
QB64 Member Project - Pivot version two
QB64 Member Project - Amazon
QB64 Member Project - Rotating Background
QB64 Member Project - Spiro Roses
QB64 Member Project - Red Scrolling LED Sign
QB64 Member Project - Color Triangles
QB64 Member Project - Dakapo
QB64 Member Project - Algeria Weather
QB64 Member Project - RGB Color Wheel
QB64 Member Project - Basic Dithering
QB64 Member Project - Martin Fractals version two
QB64 Member Project - Quarto
QB64 Member Project - Splatter
QB64 Member Project - Martin Fractals version one
QB64 Member Project - Line Thickness
QB64 Member Project - Point Blank
QB64 Member Project - Qubic