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

Split maze Subtypes into Subtypes and ResultsHandlers #20882

Merged
merged 11 commits into from Mar 1, 2018
Merged

Conversation

Hamms
Copy link
Contributor

@Hamms Hamms commented Feb 24, 2018

Where Subtypes preserve all those bits of logic that care about the actual gameplay of the subtype (where you can move, what things you can do, how you manipulate the state of the game) and ResultsHandlers preserve all those bits of logic that care about success/failure handling and feedback (which game states count as passing, what feedback we show based on what game state, etc)

@Hamms Hamms force-pushed the subtype-results branch 2 times, most recently from 000f7f8 to 828a2be Compare February 27, 2018 02:09
@Hamms Hamms changed the title [WIP] Split maze Subtypes into Subtypes and ResultsHandlers Split maze Subtypes into Subtypes and ResultsHandlers Feb 28, 2018
Copy link
Contributor

@joshlory joshlory left a comment

Choose a reason for hiding this comment

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

I'd like to understand a little better what the extraction plan is for maze/results/*.

If we do extract it, there are some trailing references to TestResults, StudioApp, etc. If we don't, we're reaching into a lot of the Maze internal state. I'm sure you already have a plan for this, just trying to get up to speed 😄.

// at each location, tracks whether user checked to see if it was a flower or
// honeycomb using an if block
this.userChecks_ = [];

this.overrideStepSpeed = 2;
this.honey_;
this.nectars_;
Copy link
Contributor

Choose a reason for hiding this comment

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

Same feedback: let's init these to undefined otherwise it's a no-op.

@@ -40,6 +42,7 @@ module.exports = class Maze {

this.cachedBlockStates = [];

this.resultsHandler;
this.response;
this.result;
this.testResults;
Copy link
Contributor

Choose a reason for hiding this comment

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

No-op.

const PlanterHandler = require('./planter');
const ResultsHandler = require('./resultsHandler');

export function createResultsHandlerForSubtype(controller, config) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not a huge fan of this helper but I can't quite put my finger on why. Can we use a hash of the subtype name to the appropriate handler, and look up by controller.subtype.constructor.name?

Will the extracted repo include maze/results/*?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure!

And (as answered in another comment) no it will not

BeeTerminationValue as TerminationValue
} from '../../constants.js';

export default class Bee extends Gatherer {
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's export BeeHandler here, to match how it's used in maze/results/utils.js.

@Hamms
Copy link
Contributor Author

Hamms commented Feb 28, 2018

The idea is that /maze/results is not going to be extracted, but all the subtypes themselves are.

The idea is that results is looking into a lot of maze state, because that's where we have the concept of success or failure as it relates to maze state. But it should not in any way be modifying maze state

@Hamms
Copy link
Contributor Author

Hamms commented Feb 28, 2018

PTAL

Copy link
Contributor

@joshlory joshlory left a comment

Choose a reason for hiding this comment

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

The idea is that results is looking into a lot of maze state, because that's where we have the concept of success or failure as it relates to maze state.

That sounds reasonable. I do wonder whether those failure modes are useful in the standalone repo as well.

@Hamms
Copy link
Contributor Author

Hamms commented Mar 1, 2018

I based this split off of the assumption that they were not; if we discover that assumption was false, it shouldn't be too hard to do some rearranging afterwards

@Hamms Hamms merged commit e631a01 into staging Mar 1, 2018
@Hamms Hamms deleted the subtype-results branch May 31, 2018 18:49
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

2 participants