Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
loks0n committed Jan 24, 2023
0 parents commit effb6c7
Show file tree
Hide file tree
Showing 14 changed files with 3,082 additions and 0 deletions.
24 changes: 24 additions & 0 deletions .gitignore
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?
27 changes: 27 additions & 0 deletions README.md
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 });

```

13 changes: 13 additions & 0 deletions examples/basic.ts
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 });
8 changes: 8 additions & 0 deletions examples/capture.ts
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));
1 change: 1 addition & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './dist/index'
Loading

0 comments on commit effb6c7

Please sign in to comment.