-
Notifications
You must be signed in to change notification settings - Fork 44
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
Memory Homework #47
base: gh-pages
Are you sure you want to change the base?
Memory Homework #47
Conversation
My first revision - still some kinks to work out
Has a bug. When you click on the same tile twice, the code considers the "tiles matching" and the tile disappears.
Fixed some errors displayed when I created the pull request.
Not at all – this looks really good!
Ah. Remember in the first class when we were talking about different types in JavaScript, and how two objects that look the same aren't triple-equal ( var a = {};
var b = {};
a === b; // false You ran into that exact issue here, because
Hope that helps? Remind me to bring this up in class – it's tricky! |
Fixed bug with the help of Aidan. Thanks. Fixed cursor type on div tags. Re-factored some of the larger functions. Still need to fix the action().
Add missing semicolons
Add New Game button. Refactored some more functions.
Moved most of code out of document.ready()
Re-arrange order of functions
This reverts commit 38eec98.
Final version on Tuesday night. Hopefully more can be done tomorrow night.
Added another class for buttons Added another board to make sure all objects operate independently More tweaks
More tweaks to pass Travis CI tests
var Game = function(boardElements) { | ||
this.boardElements = boardElements; | ||
this.tileClass = boardElements.tileHtmlElementClass.substr(1); | ||
this.maxValue = boardElements.height*boardElements.width/2; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't be afraid of whitespace within lines 😉 Makes things more readable.
Left a bunch of nitpicky comments, but great work overall! |
This code is mostly working, but it has a bug. When you click on the same tile twice, the code considers the "tiles matching" and removes the tile. I tried checking if this.$td and tile.$td were equal in Tile.prototype.matches(), but I didn't get the results I expected. Is there a way to prevent this bug? Or is my whole design flawed? :-(