Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automove in viewer #98

Open
coyotte508 opened this issue Apr 29, 2021 · 0 comments
Open

Automove in viewer #98

coyotte508 opened this issue Apr 29, 2021 · 0 comments

Comments

@coyotte508
Copy link
Member

coyotte508 commented Apr 29, 2021

I'm not sure, current code:

    if (move) {
      copy.move(move);
      copy.generateAvailableCommandsIfNeeded();

      // Only save updated version if a full turn was done
      if (copy.newTurn) {
        engine = copy;
      }
    }

Possible code

    if (move) {
      // automove returns true only if at least a full move is done
      if (copy.autoMove(move)) {
        while(copy.autoMove()) {}
        // Only save updated version if a full turn was done
        engine = copy;
      } else {
        copy.move(move)
      }

      copy.generateAvailableCommandsIfNeeded();
    }

possible refacto too to make it seamless / use the same thing in engine/wrapper and viewer/self-contained

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant