stillonearth / CheckersOnBevy

🏁 Checkers on bevy with AI and p2p network play
20 stars 3 forks source link

checkers rules #3

Open gilberto85 opened 2 years ago

gilberto85 commented 2 years ago

i dont know but i saw your video and this is not american checkers rules

https://www.itsyourturn.com/t_helptopic2030.html

stillonearth commented 2 years ago

Those should be English Checkers. Do you need American checkers?

gilberto85 commented 1 year ago

yes

stillonearth commented 1 year ago

Check the updated video. Rules as of now:

gilberto85 commented 1 year ago

Hi there thank you I saw the video but american checkers jumps are mandatory

stillonearth commented 1 year ago

They are. Check 16th second on vid

gilberto85 commented 1 year ago

Sorry the only video I see is this Checkers.on.Bevy.2022-11-16.19-08-04.mp4

And its not jumping according to American checkers rules btw you have a very good skills

stillonearth commented 1 year ago

Yeah, that's the one

Where exactly you see an error in this ruleset:

gilberto85 commented 1 year ago

If a piece is in front of another piece with a free square nehide him it need to jump and remove the piece from the board ( jumps are mandatory ) if you want you can see a video here

Look everytime they need to jump in a piece that piece needs to be removed from the board

https://youtube.com/shorts/-TnVXMNsoHI?feature=share

On Wed, Nov 16, 2022, 8:35 AM Sergei Surovtsev @.***> wrote:

Yeah, that's the one

Where exactly you see an error in this ruleset:

  • piece can move 1 square in advancing forward
  • piece get an extra move if it eaten an opponent's piece
  • after crowning a piece can move diagonally without restriction on number of squares

— Reply to this email directly, view it on GitHub https://github.com/stillonearth/CheckersOnBevy/issues/3#issuecomment-1317311194, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASY7Y64JR7KER4EYDL6AQILWIUEMDANCNFSM6AAAAAAR5GV4JY . You are receiving this because you authored the thread.Message ID: @.***>

stillonearth commented 1 year ago

Okay, seems I'm getting it now.

gilberto85 commented 1 year ago

Hope that video can help you

gilberto85 commented 1 year ago

Also multiple jumps are mandatory

gilberto85 commented 1 year ago

Is that much to change ? I don't know what kind of checkers is that rules now I don't know if it's Italian rules

stillonearth commented 1 year ago

No, it's not that much, I'll aim to update them this week.

пт, 18 нояб. 2022 г., 04:21 gilberto85 @.***>:

Is that much to change ? I don't know what kind of checkers is that rules now I don't know if it's Italian rules

— Reply to this email directly, view it on GitHub https://github.com/stillonearth/CheckersOnBevy/issues/3#issuecomment-1319428626, or unsubscribe https://github.com/notifications/unsubscribe-auth/AXHKFIIMU2N3GMWGN7NUSE3WI3KY3ANCNFSM6AAAAAAR5GV4JY . You are receiving this because you commented.Message ID: @.***>

gilberto85 commented 1 year ago

I am working on my own checkers website , the developer make something already and we can play already and creat rooms to play against other people. There are some bugs that I need to fix and some other checkers variants that I need to add , would you be interested in working on my site ?

Checkersvip.com

On Thu, Nov 17, 2022, 5:22 PM Sergei Surovtsev @.***> wrote:

No, it's not that much, I'll aim to update them this week.

пт, 18 нояб. 2022 г., 04:21 gilberto85 @.***>:

Is that much to change ? I don't know what kind of checkers is that rules now I don't know if it's Italian rules

— Reply to this email directly, view it on GitHub < https://github.com/stillonearth/CheckersOnBevy/issues/3#issuecomment-1319428626 , or unsubscribe < https://github.com/notifications/unsubscribe-auth/AXHKFIIMU2N3GMWGN7NUSE3WI3KY3ANCNFSM6AAAAAAR5GV4JY

. You are receiving this because you commented.Message ID: @.***>

— Reply to this email directly, view it on GitHub https://github.com/stillonearth/CheckersOnBevy/issues/3#issuecomment-1319429464, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASY7Y6673RC7V2Q7I6L65XLWI3K7DANCNFSM6AAAAAAR5GV4JY . You are receiving this because you authored the thread.Message ID: @.***>

stillonearth commented 1 year ago

This project supports wasm targets so you can depoy on web (though neural AI won't work with wasm, an investigation required). With some adjustments multiplayer is also possible. I'll make an example branch with american rules adjustments.

PRs are welcome if you'll choose to use this codebase.

stillonearth commented 1 year ago

This branch implements American ruleset (i.e. jump mandatory is possible): https://github.com/stillonearth/CheckersOnBevy/tree/american-ruleset

The changes are in pub fn possible_moves(&self) -> [Vec<Position>; 24]:

  1. Check whether current moveset for a given side contains a 'Take` move:

    let mut american_jump_possible: HashMap<Color, bool> = HashMap::new();
    for i in 0..24 {
    let p = self.state.pieces.iter().find(|p| p.id == i);
    if p.is_none() {
        continue;
    }
    
    let color = p.unwrap().color;
    for j in 0..24 {
        let p = self.state.pieces.iter().find(|p| p.id == j);
        if p.is_none() {
            continue;
        }
    
        let other_color = p.unwrap().color;
    
        if other_color == color {
            let jump_possible = moveset[j as usize].iter().any(|m| m.1 == MoveType::Take);
            if jump_possible {
                american_jump_possible.insert(color, true);
                break;
            }
        }
    }
    }
  2. Filter out regular moves if so.

That's enough to limit AI, and there's another check in Game::step

let moveset = self.possible_moves();
if moveset[piece.id as usize].len() == 0 {
    // self.state.turn.change();
    return (MoveType::Invalid, &self.state, self.check_termination());
}
gilberto85 commented 1 year ago

I saw the last video and you improved the code however keep in mind that of you or the oponent have multiple jumps those are mandatory as well

On Fri, Nov 18, 2022, 5:40 AM Sergei Surovtsev @.***> wrote:

This branch implements American ruleset (i.e. jump mandatory is possible): https://github.com/stillonearth/CheckersOnBevy/tree/american-ruleset

— Reply to this email directly, view it on GitHub https://github.com/stillonearth/CheckersOnBevy/issues/3#issuecomment-1320007126, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASY7Y67TOJZP2WCRWGQA7TTWI6BLZANCNFSM6AAAAAAR5GV4JY . You are receiving this because you authored the thread.Message ID: @.***>

gilberto85 commented 1 year ago

On second 11' of that video the AI had a chance make another jump and it waited until you moved to make the other jump

On Fri, Nov 18, 2022, 5:40 AM Sergei Surovtsev @.***> wrote:

This branch implements American ruleset (i.e. jump mandatory is possible): https://github.com/stillonearth/CheckersOnBevy/tree/american-ruleset

— Reply to this email directly, view it on GitHub https://github.com/stillonearth/CheckersOnBevy/issues/3#issuecomment-1320007126, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASY7Y67TOJZP2WCRWGQA7TTWI6BLZANCNFSM6AAAAAAR5GV4JY . You are receiving this because you authored the thread.Message ID: @.***>

gilberto85 commented 1 year ago

My website supports playonline already but I need users to play against an AI as well or creat bots so if a user creat a room a no one join the room in let's say 30 seconds a bot will join and play with the real user.

On Fri, Nov 18, 2022, 1:48 AM Sergei Surovtsev @.***> wrote:

This project support wasm targets so you can depoy on web. With some adjustments multiplayer is also possible. PRs are welcome. I'll make an example branch with american rules adjustments.

— Reply to this email directly, view it on GitHub https://github.com/stillonearth/CheckersOnBevy/issues/3#issuecomment-1319770219, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASY7Y6ZQU66SV6OANOZGJXDWI5GFBANCNFSM6AAAAAAR5GV4JY . You are receiving this because you authored the thread.Message ID: @.***>

stillonearth commented 1 year ago

You're talking about this vid right? https://github.com/stillonearth/CheckersOnBevy/tree/american-ruleset

In that branches attack moves are mandatory.

gilberto85 commented 1 year ago

Yes that video if you have multiple jumps ( 2, 3 , 4 etc ) are mandatory on the same turn they not need to waiti until the oponen moves

On Fri, Nov 18, 2022, 10:31 AM Sergei Surovtsev @.***> wrote:

You're talking about this vid right? https://github.com/stillonearth/CheckersOnBevy/tree/american-ruleset

In that branches attack moves are mandatory.

— Reply to this email directly, view it on GitHub https://github.com/stillonearth/CheckersOnBevy/issues/3#issuecomment-1320388587, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASY7Y673P7OA3UBDATEWESDWI7DRRANCNFSM6AAAAAAR5GV4JY . You are receiving this because you authored the thread.Message ID: @.***>

stillonearth commented 1 year ago

That's probably an animation issue, as they are not queued now.