Saturday, October 20, 2018

Site Plans Winter 2018

Working on my Masters of Science in Computer Science is proving to be very time consuming. While I am trying to allocate blocks of time towards my porting and site work, the amount of time that I am actually able to devote to these side tasks is not as much as I would like. This means that there may be changes to the blog post next year. As the book is mostly written, there will not be any changes to this blog. The emulator work has slowed down so I will have to decide how to handle things once I catch up with my current work. Worst case scenario is that I cut back to monthly updates though will likely write some side-trip articles covering other aspects of the development such as the creation of test games and assembly libraries. will continue to be updated each month with a port of an existing game. As you have already seen, the October game was changed to Pent Up Anger. While I was going to release Coffee Quest 2 next month, instead I am going to release Cribbage Square and will use my new Coffee Quest engine to do an enhanced version of Santa’s Search for the December game.

I do plan on releasing a Coffee Quest episode every quarter of next year, with more information on the Coffee Quest porting plans to be made next fortnight as next fortnight’s port will be on the making of HTML5 Coffee Quest.

Even though the Dozen Days of Dice series is not overly popular, I really don’t have time to do a worthy port of One of those Weeks, so until I have enough time to do a proper OotW port, the Dozen Days series will be a placeholder with an episode every quarter.

This leaves four games open.  These will probably be used for holiday games but I have not yet made up my mind what I will be releasing so consider the other four releases for next year to be mystery games. They may even be new games if I end up creating some for University assignments.

Next fortnight, as mentioned above, will be a look at my Coffee Quest port and what the plans are for that series.

Saturday, October 6, 2018

4.8 Winning and Losing

As you know, the game ends when the last gem has been taken. Also obvious is the fact that there are two possible outcomes for this game. The player can win the game, or the computer can win the game. Knowing this, our movie is going to have to be able to handle either situation. This will require a bit of JavaScript. Here is the final version of the gemRemoved function with the new lines bolded.

function gemRemoved(gemCount) {
   if (gemCount <= gemsRemaining) {
          if (gemCount == 0) {
                 if (gamestate == GAMESTATE_PLAYER_ANIMATING)
          if (gamestate == GAMESTATE_PLAYER_ANIMATING)
          else {
                 gamestate = GAMESTATE_PLAYER_PLAYING;
Both sequences start out with the final gem growing larger while moving to the left side of the screen. This is a simple scaling operation combined with a movement operation. The end result is shown in the image below.

To keep the code simple, the end sequence will simply display the results for a few seconds before returning to the title screen. An alternative approach would be to have a button that the user clicks to return to the title screen. To return to the title screen we simply call a returnToTitle function at the end of the winning screen and at the end of the losing screen.
The line of code that needs to be added to both:


Finally, we need a function in the global script called returnToTitle that actually does the work:

function returnToTitle() {

And now we have a our completed NIM game!