Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Checkers written in Rust and exported to WASM (kevinalbs.com)
89 points by keepamovin 4 months ago | hide | past | favorite | 37 comments


I thought this was going to be a type checker :)


You’re not alone


I like the attribute-based approach to wasm bindings in rust, it keeps it clean and to one file, and refreshing how you just have a plain HTML file and just instantiate the module with

import init, { Checkers } from "./pkg/checkers.js";


I wish the Rust web frameworks were this simple. I mean, they're not insane, but they're just really complex due to all of the use cases they support. Dioxus needs a "lite" mode.


Bunch of cool games are here: https://kevinalbs.com/#!games

:)


Please rename to checke.rs :D



Hello, original author here. I was delightedly surprised to see this game got attention. I believe I referenced https://wcdf.net/rules.htm when writing the game. The game has been updated. If a piece is clicked and has no moves, pieces with moves are briefly highlighted.


You got the src on github or something? Am learning rust myself and it seems like a neat little sample project


There’s a link on the page of the game.


Oh, you mean Draughts, I thought this was some sort of parser


Can't take backwards, looks like a bug.


If your piece isn't a king, capturing backwards isn't legal.


Only if you aren't using the metric system ;)


it got locked after 10 moves or something like that (firefox browser). I couldn't move anything no matter where i clicked (and i was far from the end of the game)

EDIT : sorry, seems like i probably had to make a forced jump move, which i didn't know was a thing.

EDIT 2 : aren't you supposed to be able to capture in reverse direction ?


For me it locked after 1 move. But then I found out that I was also playing for the opponent.


I like how these engineers think they found a bug but were actually just beaten by the correct implementation of the rules of checkers hahaha


It's pretty surprising to me the number of people who don't know the rules of checkers here. I guess they were probably taught by a friend or family member who was using house rules.


in my case it's just that the last game i played was more than 30 years ago..


That is an achievement in itself! Brag and be proud, sir :)


> aren't you supposed to be able to capture in reverse direction ?

Only after promotion.


checke(rs)


I was about to comment saying it was broken and forces you to jump. But it turns out I've just been playing checkers wrong my whole life.


All checkers games I ever played started with a long negotiation about the rules...


Exactly. I was surprised that this one doesn't support multi capture when available.


It does. Don’t forget, only a king can go backwards.


Was curious about this, so checked:

> In American checkers, men can jump only forwards; in international draughts and Russian draughts, men can jump both forwards and backwards. [0]

[0]: https://en.wikipedia.org/wiki/Checkers


Moreover a king in Russian draughts can travel an arbitrary number of squares.


a King? in checkers? we call the game "Dame" (as in Dame Judy Dench) and the piece transforms into said Dame with "the usual" super powers. Which are different from the King's. Of course. :-)


But how many squares can they travel?


Only one, American checkers' kings are so uncool.


It does, not sure what you're seeing. Maybe the second jump was in the reverse direction, and thus not legal?


It forces multi capture when available.


Does it not?


I believe I referenced https://wcdf.net/rules.htm for rules. I had these questions myself when writing the game. Updated the README to link to the intended rules.


I guess I have too? So has everyone I’ve ever played with.


There’s a lot of different checkers variants.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: