473,548 Members | 2,604 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Chess AI undoing a move

1 New Member
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 13762
dev7060
639 Recognized Expert Contributor
What kind of interpretation one could have from these lines to even remotely approach the solution?
Dec 9 '22 #2
markopalme
1 New Member
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
2917
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
3758
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 / 50 move rule / threefold repetition
5
5850
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 movements... anyone know where i can find a DLL that will generate chess moves? Ideally, the DLL would accept moves made by the human player and...
11
2557
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
2481
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 as in any other chess clients. Now i want to interface my program with the already available gnuchess program. Basically i want to feed the user...
63
15198
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 http://www.mailcom.com/ioccc/toledo/hint.htmBut this post is because I have discovered (asurprise for me) that it is also the worldsmallest chess program written in C language.It has a size...
2
3110
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 playing an opponent. And then the next stage in development comes after you learn how to beat an opponent. You really can only employ either...
2
2023
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 (bitboard) chess engine that implements an alphabeta search with iterative deepening. It also has a small opening book and stores most of its...
10
12538
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, queen, pawns etc...), i will have pure virtual functions in the base class for move(), attack() etc which are applicable to all units and would...
0
7707
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7951
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7466
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7803
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5362
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5082
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3495
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1926
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
751
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.