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

Checkers #316

Merged
merged 23 commits into from Jul 14, 2019
Merged

Checkers #316

merged 23 commits into from Jul 14, 2019

Conversation

vdfdev
Copy link
Collaborator

@vdfdev vdfdev commented Jun 23, 2019

No description provided.

@coveralls
Copy link

coveralls commented Jun 23, 2019

Coverage Status

Coverage decreased (-1.3%) to 92.72% when pulling c09b3b1 on checkers into 24938ba on master.

@vdfdev vdfdev closed this Jul 1, 2019
@JosefKuchar JosefKuchar reopened this Jul 6, 2019
@JosefKuchar
Copy link
Collaborator

JosefKuchar commented Jul 7, 2019

TODO:

  • Multi-jumping
  • End game when there are 0 valid moves
  • Status bar
  • Basic AI
  • Description
  • Instructions
  • Thumbnail
  • Highlight valid moves
  • Tests
  • Distinguish man and king

@JosefKuchar JosefKuchar changed the title WIP Checkers Checkers Jul 10, 2019
@vdfdev
Copy link
Collaborator Author

vdfdev commented Jul 11, 2019

This looks really good! I will do some more testing tomorrow and we can merge soon

expect(move(G, ctx, { x: 1, y: 0 }, { x: 4, y: 4 })).toEqual(INVALID_MOVE);
});

it('should declare player 1 as the winner', () => {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add some specific tests for some corner cases like the double jump ? Some interesting test cases:

  • double jump
  • when the piece becomes king
  • king jumping backwards

let moves: IMove[] = [];
let jumped = false;

dirs.forEach(dir => {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not use:

for (const dir of does) ?

return a.x === b.x && a.y === b.y;
}

export function checkPosition(G: IG, playerID: string, piece: ICheckerPiece, coord: ICoord) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you make the return type explicit?


const piece = (id: number, player: number): ICheckerPiece => ({ id, playerID: player.toString(), isKing: false });

export const INITIAL_BOARD: Piece[] = [
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Smart to make one dimensional :)

@vdfdev vdfdev merged commit 21ea61e into master Jul 14, 2019
@vdfdev vdfdev deleted the checkers branch July 14, 2019 00:15
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

Successfully merging this pull request may close these issues.

None yet

4 participants