"Blank Slates in Ruby on Rails" was retired on April 30, 2018. You are now viewing the recommended replacement.
Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Well done!
You have completed Object-Oriented JavaScript: Challenge!
You have completed Object-Oriented JavaScript: Challenge!
Preview
Let's tackle the final stage of Four in a Row - adding in the Game logic.
This video doesn't have any notes.
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
[MUSIC]
0:00
Welcome to the final stage of this course.
0:04
At this point,
we've built out most of our classes.
0:06
We've created several objects
that are all working together and
0:09
interacting with each other.
0:12
We've rendered our visual components and
added interactivity so
0:14
a player can move their tokens around
the board and drop them into spaces.
0:17
But now what?
0:21
A turn isn't just dropping a token.
0:22
In a real life game,
0:25
a lot of the synthesis that happens after
someone drops a token is automatic.
0:26
We can clearly see a space
is filled with a token.
0:30
It's obvious whose turn it is, and
0:33
a winning move is visible
right in front of us.
0:35
In our game, though, we have to write
the logic for the series of calculations.
0:37
So throughout this stage,
0:42
you'll be creating new methods
to handle these tasks.
0:43
At the conclusion of this course,
you will write
0:46
a final method called update game state,
that calls them all in a specific order.
0:48
This update game state method is
the callback function that was
0:54
mentioned earlier in the course.
0:58
This function is passed as an argument
to the drop animation, and
0:59
is called once the animation is complete.
1:03
Calling the update games state callback
will trigger the following events.
1:05
Filling the target space with the active
token, checking for a winning move, and
1:09
switching the active player.
1:14
You'll tackle each of these steps
one by one and then together, we'll
1:16
come together for a solution video for
the completed update game state method.
1:20
That will be followed by
a final demo of the game.
1:24
Good luck, and see you soon.
1:27
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up