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

Implementing random moves UP TO 20% of the time #3

Merged
merged 4 commits into from
Oct 10, 2017
Merged

Conversation

CognizantMickey
Copy link
Collaborator

What's this PR do?

Adds a new mickeyBot which makes a random move up to 20% of the time.

Where should the reviewer start?

mickeyBot.js

How should this be manually tested?

quick-connect username password mickeyBot

Any background context you want to provide?

No.

New dependencies? What are they used for?

No.

What are the relevant tickets?

No.

What gif best describes how this PR makes you feel?

* master:
  Bumping version
  Simplify playerHasWon logic
  Remove optimization for checking win states
  Splits out utility functions and tests into individual files. Adds a couple utility functions and makes the API more consistent between functions.
  Fix specs
  Adds utility functions available through BotUtils
const buildConsecutive = checkForWinMove(boardModel, player, gameState, winLength - 1); // try to get 3 in a row
const whatevs = getMove(boardModel, gameState); // place a token somewhere near the center

return win || survive || blockProgress || buildConsecutive || whatevs;
Copy link
Owner

Choose a reason for hiding this comment

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

Just FYI here, if you did those variables inline instead of precomputing them, then it would short circuit on the first true one and save time in the average case.

@dbe dbe merged commit 4627798 into master Oct 10, 2017
@dbe dbe deleted the f/randomFailMickBot branch October 10, 2017 18:45
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.

2 participants