Giter Club home page Giter Club logo

goban's People

Contributors

eh2406 avatar sagebati avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

goban's Issues

Shallow clone and Deep clone

Without the history feature, the legals() method clone the Goban to test if a move is actually legal.
The clone() is a shallow clone and it doesn't deep copy the structure which is nice for performance, so the goban cloned and the original share their state (and god fully don't add bugs).

But with the feature history enabled, we have an vector of goban structs and if we derive Clone all their state will be shared across clones, so I used a feature gate to only deep clone when history is enabled to avoid shared state.

The question is, how in the first place, it does work without deep cloning ? and if it works in all cases would it also work for history without cloning ?

Example of code :

The debug assert fails with shallow clone because it doesn't clear all the pointers. But with deep clone we can assume that we cleared all.

    ///
    /// Deletes all the Rc from the go_strings, then merges the two_string
    ///
    fn merge_two_strings(&mut self, first: GoString, other: GoStringPtr) -> GoString {
        for &point in other.stones() {
            self.go_strings[self.coord_util.to(point)] = Option::None;
        }
        #[cfg(feature = "history")]
        debug_assert!(
            Ptr::strong_count(&*other) == 1,
            "strong count: {}",
            Ptr::strong_count(&*other)
        );
        first.merge_with((**other).clone())
    }

Ko error

Hi there,
thank you for your great library. I was just using it in my rust yew project.
I just stumbled upon a situation. Just in some shapes, I get this situation, where after taking 2 stones, the API thinks that it is a ko, even though it's not.
In the screenshot, the transparent stone is the about to be placed stone, that is returning an error.
Would be great if you could have a look at it.
Thank you for your great library!

ps: I have this frontend in: https://github.com/janos-r/yewban

Screenshot from 2021-01-20 21-25-35

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.