473,395 Members | 1,348 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,395 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 13748
dev7060
636 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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.