• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Queen 8 ChessBoard Example Help

 
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I wanted to post here in hopes someone could provide me some direction of now to fix my problem.:

I have a simple chessboard made up of JPanels for each location on the chessboard. Each JPanel on the board has a JLable inside of it. This label has a color (black or white). As the user clicks on the location from the board, the program swaps out the JPanel with a new one with a Queen image. This seems to be working correctly, however, the application is place a "blank" JPanel to the left of the location where the queen is placed. I opine this is causing a reschuffle of the chessboard.

Could any please give me some pointers on how I can correct this.

Here is the code:


Any assisitance would be greatly appreciated as I have been working with this issue well over three days.

Russ
 
Russell Ray
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I figured it out.........

The problem was in the mouseReleaseed method. What was happening was exactly as I thought...... I was removing a JPanel and replacing it with a JLabel...... I didn't think Swing Components was doing this.

Here is the code:




Russ
 
Ranch Hand
Posts: 750
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, how is your chess program going?
Are you using Alpha-beta pruning. You probably are, it is essential
for any chess program.
Have you managed to implement checkmate and stalemate?
Thats the only problem with mine, you can set it up a position, such as mate in 3, and it will solve it correctly, but however if there are a few
pieces on board, it seems to walk right into stalemate.
I just wondered if you knew how to implement checkmate and stalemate with alpha-beta.
The problem I've found is that the algorithm is too complex to test, even with 3 pieces on the board.
Basically I'm looking for some psuedocode of alpha-beta pruning that incorporates checkmate and stalemate.

Thanks, let me know how your doing if you can.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic