Skip to content

Commit

Permalink
configure github pages deployer
Browse files Browse the repository at this point in the history
  • Loading branch information
garethgeorge committed Oct 12, 2023
1 parent 593d3ab commit 5c4315d
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
18 changes: 18 additions & 0 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: GitHub Actions Demo
on:
push:
branches:
- "main"
workflow_dispatch:

jobs:
deploy:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
- uses: actions/setup-node@v3
with:
node-version: "20"
- run: npm run build
6 changes: 6 additions & 0 deletions chessbot/src/evaluator/nneteval.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,12 @@ impl NnetEval {

impl Evaluator for NnetEval {
fn evaluate(&self, board: &chess::Board) -> anyhow::Result<f32> {
match board.status() {
chess::BoardStatus::Ongoing => {}
chess::BoardStatus::Checkmate => return Ok(-10000.0),
chess::BoardStatus::Stalemate => return Ok(-9000.0),
}

let tensor =
NnetEval::board_to_input(board).context("failed to create tensor for board")?;
let output = self
Expand Down
3 changes: 2 additions & 1 deletion modeltraining/training.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ def __getitem__(self, idx):
assert(len(bitvec) == lib.game.tensor_packed_len)
bin = np.frombuffer(bitvec, dtype=np.uint8)
bin = np.unpackbits(bin, axis=0).astype(np.single)[0:lib.game.tensor_len]
score = math.copysign(math.log2(abs(score / 10.0) + 1), score) # the more extreme the win the less we weight it, we just want to bias towards winning.
score = score / 100.0
# score = math.copysign(math.log2(abs(score / 10.0) + 1), score) # the more extreme the win the less we weight it, we just want to bias towards winning.
return {
'binary': bin,
'eval': np.array([score]).astype(np.single)
Expand Down

0 comments on commit 5c4315d

Please sign in to comment.