-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit effb6c7
Showing
14 changed files
with
3,082 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
pnpm-debug.log* | ||
lerna-debug.log* | ||
|
||
node_modules | ||
dist | ||
dist-ssr | ||
*.local | ||
|
||
# Editor directories and files | ||
.vscode/* | ||
!.vscode/extensions.json | ||
.idea | ||
.DS_Store | ||
*.suo | ||
*.ntvs* | ||
*.njsproj | ||
*.sln | ||
*.sw? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# rapid-draughts | ||
|
||
**rapid-draughts** is a *super speedy, blazing fast, rocket-powered* 8x8 board Typescript draughts/checkers engine. | ||
|
||
rapid-draights uses Bitboards, a technique to represent the entire draughts board in three 32 bit unsigned integers. One for the white pieces, black pieces and the king pieces. | ||
|
||
Bitboards enable fast move generation and have minimal memory usage. | ||
|
||
## How to use | ||
|
||
```typescript | ||
import { Draughts } from 'rapid-draughts'; | ||
|
||
// Initialise the board | ||
let draughts = new Draughts(); | ||
|
||
// Play 10 moves | ||
for (let i = 0; i < 10; i++) { | ||
draughts = draughts.move(draughts.moves()[0]); | ||
} | ||
|
||
// Show the bitboard result | ||
const { white, black, king } = draughts; | ||
console.table({ white, black, king }); | ||
|
||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { Draughts } from "../src"; | ||
|
||
// Initialise the board | ||
let draughts = new Draughts(); | ||
|
||
// Play 10 moves | ||
for (let i = 0; i < 10; i++) { | ||
draughts = draughts.move(draughts.moves()[0]); | ||
} | ||
|
||
// Show the bitboard result | ||
const { white, black, king } = draughts; | ||
console.table({ white, black, king }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { Draughts } from "../src"; | ||
import { moveToSquares, S } from "../src/bitboard"; | ||
|
||
// Initialise the board | ||
let draughts = new Draughts(S[13], S[18] | S[28]); | ||
|
||
// Show the moves | ||
console.table(draughts.moves().map(moveToSquares)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './dist/index' |
Oops, something went wrong.