Skip to content

Commit

Permalink
Merge pull request #1078 from Ayushkumargit7/queen
Browse files Browse the repository at this point in the history
Added Eight Queens Game
  • Loading branch information
panwar8279 committed Aug 10, 2023
2 parents 2bb041b + f2247a6 commit c55794f
Show file tree
Hide file tree
Showing 24 changed files with 13,599 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Games/Eight Queens Game/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/.idea
/node_modules
/build
npm-debug.log*
yarn-debug.log*
yarn-error.log*
70 changes: 70 additions & 0 deletions src/Games/Eight Queens Game/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# Getting Started with Create React App

This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).

## Available Scripts

In the project directory, you can run:

### `npm start`

Runs the app in the development mode.\
Open [http://localhost:3000](http://localhost:3000) to view it in your browser.

The page will reload when you make changes.\
You may also see any lint errors in the console.

### `npm test`

Launches the test runner in the interactive watch mode.\
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.

### `npm run build`

Builds the app for production to the `build` folder.\
It correctly bundles React in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes.\
Your app is ready to be deployed!

See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.

### `npm run eject`

**Note: this is a one-way operation. Once you `eject`, you can't go back!**

If you aren't satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.

Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own.

You don't have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it.

## Learn More

You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).

To learn React, check out the [React documentation](https://reactjs.org/).

### Code Splitting

This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting)

### Analyzing the Bundle Size

This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size)

### Making a Progressive Web App

This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app)

### Advanced Configuration

This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration)

### Deployment

This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment)

### `npm run build` fails to minify

This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)
38 changes: 38 additions & 0 deletions src/Games/Eight Queens Game/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"name": "eight-queens",
"version": "1.0.0",
"private": true,
"homepage": ".",
"dependencies": {
"chessboardjsx": "^2.3.0",
"deep-diff": "1.0.1",
"lodash.isequal": "4.17.12",
"react": "^16.8.6",
"react-dnd": "2.6.0",
"react-dnd-html5-backend": "4.0.5",
"react-dnd-multi-backend": "3.1.2",
"react-dom": "^16.8.6",
"react-scripts": "^4.0.3"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
Binary file added src/Games/Eight Queens Game/public/favicon.ico
Binary file not shown.
45 changes: 45 additions & 0 deletions src/Games/Eight Queens Game/public/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />

<!-- Open Graph properties - http://ogp.me/ -->
<meta property="og:title" content="Eight Queens chess game" />
<meta property="og:type" content="website" />
<meta property="og:image" content="%PUBLIC_URL%/favicon.ico" />
<meta property="og:url" content="%PUBLIC_URL%" />

<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>Eight Queens chess game</title>
</head>
<body>
<noscript>Please enable JavaScript to play the Eight Queens chess game</noscript>
<div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.
To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
</body>
</html>
15 changes: 15 additions & 0 deletions src/Games/Eight Queens Game/public/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"short_name": "Eight Queens",
"name": "Eight Queens chess game",
"icons": [
{
"src": "favicon.ico",
"sizes": "64x64 32x32 24x24 16x16",
"type": "image/x-icon"
}
],
"start_url": ".",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
}
74 changes: 74 additions & 0 deletions src/Games/Eight Queens Game/src/DidYouKnow.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
/**
* Eight Queens chess game
* Did You Know
*/

const didYouKnow = [
"",
// following tidbits modified from <https://en.wikipedia.org/wiki/Eight_queens_puzzle>
// License: Creative Commons Attribution-ShareAlike License
"The eight queens puzzle is an example of the n queens problem of placing n non-attacking queens on an n×n chessboard.",
"Chess composer Max Bezzel published the original eight queens puzzle in 1848.",
"Franz Nauck published a solution to the eight queens puzzle in 1850.",
"Many mathematicians, including Carl Friedrich Gauss, have worked on the 8 queens puzzle and its generalized n-queens version.",
"In 1874, S. Gunther proposed a method using determinants to find solutions to the eight queens puzzle.",
"In 1972, Edsger Dijkstra used the eight queens problem to illustrate the power of structured programming.",
"The problem of finding all solutions to the 8-queens problem can be computationally expensive.",
"There are 4,426,165,368 possible arrangements of eight queens on an 8×8 board.",
"There are 92 solutions to the eight queens problem!",
"There are only 12 fundamental solutions if you ignore symmetry operations, rotation and reflection",
"A fundamental solution usually has eight variants.",
"Finding all solutions to the eight queens puzzle is a good example of a simple but nontrivial problem.",
"Eight queens is often used as an example problem for programming techniques.",
"8 queens is often an example problem for constraint programming, logic programming and genetic algorithms.",
"Eight queens can be solved with a recursive algorithm.",
"In 1976 Niklaus Wirth wrote a Pascal program to find one solution to the eight queens puzzle",
// following tidbits modified from <http://csplib.org/Problems/prob054/>
// by Bilal Syed Hussain
// License: Creative Commons Attribution 4.0 International License.
"The eight queens problem is extremely well studied in the mathematical literature.",
"In chess a queen attacks other squares on the same row, column, or either diagonal as itself.",
"The n-queens problem is to find a set of n locations on a chessboard, no two of which are on the same row, column or diagonal.",
"The eight queens problem has inherent symmetry.",
"For any solution we obtain another solution by any of the 8 symmetries of the chessboard.",
"The n-queens problem is solvable for n=1 and n≥4.",
"A solution to the n-queens problem for any n≠2,3 was given in 1874 by Pauls.",
"The parameter n for n-queens only needs log(n) bits to specify, so O(n) is exponential in the input size.",
"The number of symmetrically distinct solutions to the n-queens problem is Sequence number A002562 in the On-Line Encyclopedia of Integer Sequences.",
"The number of solutions to the n-queens problem is Sequence number A000170 in the On-Line Encyclopedia of Integer Sequences.",
// following tidbits modified from:
// Taheri Sarvetamin M, Khatibi A, Zahedi MA.
// A New Approach to Solve N-Queen Problem with Parallel Genetic Algorithm.
// J. ADV COMP ENG TECHNOL, 4(2) Spring 2018 : 69-78
// License: Creative Commons Attribution 4.0 International Licence.
"The N-Queen problem is a well-known Constraint Satisfaction Problem.",
"Traditional methods of solving the N-queens problem are based on back-tracking.",
"The N-Queen problem shows a large class of nondeterministic problems that cannot be solved using deterministic algorithms in reasonable time.",
"Many algorithms and methods have been used to resolve the n-Queen problem.",
"Ahrabian et al. used the DNA Sticker algorithm to resolve the n-Queen problem.",
"Khan et al. used the ant colony algorithm to solve the n-Queen problem.",
"Farhan et al. used a genetic algorithm to solve this problem and found all 92 possible solutions to the 8-queen problem.",
"A depth-first search backtracking algorithm may resolve the n-Queens problem in acceptable time, but just for small values of n.",
"The n-Queen problem can be successfully run with parallel genetic algorithms.",
"The n-Queens problem is a traditional intractable problem that is used to discuss numerous kinds of searching problems.",
// following tidbits modified from <https://upjoke.com/chess-jokes>
// License: acquiescence
"If you forget the rules of Chess don't worry... you're allowed to check.",
"So the other day in the lobby I hear two chess masters bragging about their past wins. They were chess nuts boasting in an open foyer.",
"I went to lunch with a champion chess player. It took them 8 minutes to pass me the salt.",
"Finally got a job making chess pieces. I start on nights next week.",
"A computer beat me at chess. But I really got the better of it in boxing.",
"Why shouldn't you eat a chess sandwich? It's stale, mate.",
"Why did the chess player throw away his bread? Because it was stalemate.",
// following tidbits from EightQueens contributors
// License: MIT License
"Hint: how does a knight move?",
"Is this a chess puzzle, a chess problem, or a chess game?",
"Of the 92 possible solutions, there are 12 fundamental solutions.",
"How to programmatically solve the 8 Queens problem is often used as a test during programmer interviews.",
"How to programmatically solve the 8 Queens problem is often used as an assignment in computer science classes.",
"Mathematicians love eight queens.",
"Help, I'm stuck inside an interactive, virtualized, modularized cloud-based chess game!",
];

export default didYouKnow;
44 changes: 44 additions & 0 deletions src/Games/Eight Queens Game/src/EightQueens.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
.EightQueens {
align-items: center;
display: flex;
flex-direction: column;
justify-content: center;
}

.EightQueens-header {
align-items: center;
display: flex;
flex-direction: row;
justify-content: center;
margin: 0 0 5px 0;
}

.EightQueens-instructions {
font-size: 90%;
}

.EightQueens-paths {
color: #373737;
font-size: 12px;
margin: 8px 15px 0 0;
padding: 4px;
}

.EightQueens-restart {
font-size: 12px;
margin: 8px 0 0 0;
}

.EightQueens-restart a {
color: #373737;
padding: 4px;
text-decoration: none;
}

.EightQueens-didyouknow {
color: saddlebrown;
font-family: "Times New Roman", serif;
margin: 8px 0 8px 0;
max-width: 1200px;
}

Loading

0 comments on commit c55794f

Please sign in to comment.