shagunbose / 8-queen Goto Github PK
View Code? Open in Web Editor NEWHow can you place 8 queens on a 8x8 chessboard such that they do not intercept each other? I wrote a recursive solution that incorporates backtracking as a strategy!
How can you place 8 queens on a 8x8 chessboard such that they do not intercept each other? I wrote a recursive solution that incorporates backtracking as a strategy!
The 8 Queen puzzle basically asks the question of how you could place 8 queens on a 8x8 chessboard such that they do not intercept each other. A queen can move forwards, backwards and diagonally. Through this project i wanted to attempt writing a recursive solution that incorporates backtracking as a strategy! Notes: - I used a little bit GUI - where you can refresh the board to see different solution - Please note that this GUI randomly places the first queen in the first row and so sometimes you might press refresh but the board remains the same. - I have added an image of the blue crown instead of blue squares - The recursive method is called findEightQueen, it uses the helper method calculateSafeSpots - The methods paintComponent and update are for graphics. I hope to animate the solutions so they pop up on the board as the computer calculates them, but I have't been able to successfully do so yet. - IMPORTANT: I have commented out a certain print statement as the console was getting many lines of code, however if you want to see what going on in the code at a deeper, feel free to uncomment it It shows which tiles have been marked safe/unsafe by which queen For future improvements: - I want to animate the game in such a way that you can watch it or play it manually. - In the automatic version, you should be able to watch as the program searches for the Queen whereas in the manual one the user can place queen and try to figure out where to place each queen. Compile and Run Instructions: Compile by - javac EightQueen.java Run by - java EightQueen Thank you!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.