QB64 Chess
Hi bplus,

Good to see that the original author of the program, QBguy/Dean Menezes, has replied on .net. If you are interested in how he wrote the code this might be instructive http://www.petesqbsite.com/sections/expr..._Chess.txt
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
Reply
Hi TempodiBasic,

Game Off doesn’t sound like a good idea because chess is as popular as ever and our version of the chess program doesn’t really bring anything new to the table.

There’s definitely plenty of room for improvement for the AI, as suggested by the original coder himself, like opening book, improvement to the evaluation function etc.
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
Reply
Hi Erik, at one point with the Chess Font, we had mouse down on piece and mouse up where you wanted to put it, Chess 2_2... (alternate click).bas (see .net for evolution of Chess.bas from OlDosLover mods) as close as we got to drag and drop.


Petesqbsite 2007 a blast of the past!
Hey look EK Virtanen! now there is a name, he made some contributions to SmallBASIC not to mention BP.org.
And look, an article on Cellular Automata by Mathias.
Wait... is that WHN?
Hey I wonder what happened in October 2008? latest date I found in scan.


For new twist idea:
I had a glimpse of a vision of a new kind of chess that eliminates the feudal system of Kings and Queens and pawn brokers...


Attached Files Thumbnail(s)

B += x
Reply
hi TempodiBasic,

I've added some randomness to the scoring function to make AI vary its play slightly. So you will not be able to beat it in 7 moves all the time. Smile


Attached Files .bas   chess 2_17-11-19 A.bas (Size: 52.6 KB / Downloads: 6)
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
Reply
hi bplus,

indeed, Pete's QB site brings back fond memories! time to write more QB programs!

hmmm....a new kind of chess? many chess variants have been suggested in the past, but will be interested to see your version Smile
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
Reply
Hey guys, how about focusing or optimizing the AI on the position of the enemy King? (We could even make it's position global and update it with the board, piece of cake!)

Also I am sure you have seen qbguy's post by now at .net, so what do you think?
Can this be adopted to play black or white? Does it even work?

I tried a simple copy / paste of EVALUATE and ran into a shipload of errors because of all our mods since Chess.bas.

Well I leave the AI to the chess pros and get back to building a better interface since I have been encouraged by these new developments.

Hints from the future of chess:
The old classic is too symmetric and static. When humans face bots or aliens, they will not have a clue as to the way the enemy pieces move, they will have to adapt very fast!
B += x
Reply
Can you make it play itself? Can you add/remove pieces during game play?
dndbbs project:

Links to my MUD: (strictly 16-bit); AKA XP:

Dndbbs executables
http://www.filegate.net/pdn/pdnbasic/dnd50a1e.zip

Dndbbs source
http://www.filegate.net/pdn/pdnbasic/dnd50a1s.zip

Dndbbs upgrade
http://www.filegate.net/pdn/pdnbasic/dnd50a1u.zip

DNDDOOR - https://bit.ly/EriksDNDDoor DUNGEON - https://bit.ly/EriksDungeon
Interpreter - https://bit.ly/EriksSICK Hex Editor - https://bit.ly/EriksHexEditor Utilities - https://bit.ly/EriksUtils
QB45 files: - https://bit.ly/EriksQB45 QB64shell - https://bit.ly/QB64shell Some old QB64 versions: - https://bit.ly/OldQB64
Reply
Hi Erik, 

TempodiBasic has a version, Chess_1.bas, where the AI plays itself in original graphics.
reply QB64 Speed Question ? http://www.qb64.net/forum/index.php?topi...#msg126627

As yet, we don't have a version which you can add or remove pieces.
B += x
Reply
hi bplus,

yes, we could change the evaluate function to give more weightage to squares around AI's king, but i doubt if that will significantly improve AI's play. It will however make AI slightly more aggressive in attacking human's position. Any big improvement to AI's playing strength will have to come from greater depth of search/code optimisation or a re-write of the evaluation code.
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
Reply
hi Erik,

Why would you want to add/remove pieces during game play? We have a setup function (not yet operational) that will allow you to setup any chess position and play from there.
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
Reply
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
Reply
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
Reply
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.
B += x
Reply
Hi Bplus
Hi Adrian

here a minor fix on Save and Load file in current mode
Addition:
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 Files .bas   chess 2_17-11-22 T.bas (Size: 58.76 KB / Downloads: 10)
Reply
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 said....to 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
Reply
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
Reply
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 Papi Commando - Who Dares Win III - Project Done ! (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.
B += x
Reply