473,287 Members | 1,800 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,287 software developers and data experts.

Chess AI undoing a move

I have created a chess program but am stuck on one specific part. If I am playing against an AI but want to undo a move, I am unable to do so. Instead of undoing my previous move, the AI just picks another move. Here is the code:
Expand|Select|Wrap|Line Numbers
  1.                 if e.key == p.K_z: 
  2.                     GS.UndoMove() #Undo the last move
  3.                     MoveMade = True
  4.                     Animate = False #Don't animate the pieces returning to their previous positions
  5.                     GameOver = False #No player has won yet
  6.                     if AIThinking:
  7.                         MoveFinderProcess.terminate() #Stops the AI about thinking about potential moves as we don't know what move will be played next
  8.                         AIThinking = False
  9.                     MoveUndone = True
  10.  
I understand that this question isn't the clearest but any help would be much appreciated
Dec 3 '22 #1
2 13739
dev7060
626 Expert 512MB
What kind of interpretation one could have from these lines to even remotely approach the solution?
Dec 9 '22 #2
markopalme
1 Bit
Thanks for this interesting information!
Dec 10 '22 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: Michel | last post by:
I am trying to display a position, on a chessboard, corresponding to a sequence of moves recorded in a MySql database. Any clue? Michel
5
by: Will McGugan | last post by:
Hi folks, I've written a Python chess module that does the following. * Reads / Writes PGN files * Write FEN files * Validates moves * Lists legal moves * Detects check / mate / stalemate /...
5
by: derian | last post by:
Do you guys know if there is a program that can generate chess moves? I recently wrote a chess game but its only 2 player... I deceided it was too difficult to come up with the logic for the AI...
11
by: Gregc. | last post by:
G'day I am writing a chess program. Here is my code: #include <stdio.h> #include <stdlib.h> bool isInCheck (int krow, int kcol, int qrow, int qcol) { double check;
1
by: Varun Hiremath | last post by:
Hello, I have written a chess client using python which is a graphic interface to play chess. It is at present a two player version, players move their peices by clicking two squares on the board...
63
by: biyubi | last post by:
Hi, a year ago I won the 2005 Best Game categoryof the International Obfuscated C Code Contestwith a chess program. http://www.ioccc.org/whowon2005.html...
2
by: CoreyWhite | last post by:
When playing games, perhaps the most simple is tic-tac-toe. The game has two simple strategies, one is defensive and the other offensive. It is not hard at first to learn how to tie games when...
2
by: shatranjchess | last post by:
I'm releasing a new python chess module called shatranj. You can get it from www.employees.org/~stannous/shatranj until I move the project to sourceforge or some other place. It's a text based...
10
by: sam_cit | last post by:
Hi Everyone, I'm working on developing a chess game and i decided to use c++ for its object oriented approach. I have a bass class unit and is inherited to distinct number of units (like king,...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.