• CRM Science

Dr. Nim is struck by lightning!

The last Lab Coat Lesson used the tried and true tools of Apex and Visualforce. Times are changing and Lightning isn't just the future, it's the here and now. This Dr. Nim series of lab coat lessons wouldn't be complete without a Lightning implementation of Dr. Nim. We took advantage of the Lightning Design System to give the game a sleek user interface and Lightning Components to run the entire game client-side. No trips to the server means the Artificially Intelligent opponent will beat you even faster!

Here's the redesigned app, with built-in responsiveness so you can play on your phone.


Here's a little extra styling. This gives the game a little extra breathing room.

Here's the controller

Here's the helper

The challenge is in the helper. There is a function named doPlayer2Turn that is empty. Convert the algorithm from the last post from Apex to Javascript and add a few more lines and the game will be complete! For bonus points, make the game even prettier by changing out the Os we're using for the coins to an SVG icon from the Lightning Design System of your choosing.

Recent Posts

At CRM Science, we use our Salesforce expertise to transform your enterprise. Partnering with our clients throughout the Salesforce journey, we work with leaders to strategize and optimize business processes, and design and develop solutions across every Salesforce cloud. We help you maximize the value of the Salesforce platform. 

CRM Science is a Salesforce Gold Consulting Partner and a Salesforce.org Impact Partner. Our strategic consulting services were recognized by Salesforce in four consecutive Salesforce Partner Innovation Awards, an annual recognition for partners that deliver outstanding client success. 

Connect with us
Email Us
860 First Ave, Suite 2
King of Prussia, PA 19406
(484) 775-0333
  • Twitter
  • Facebook
  • YouTube

Copyright © 2011-2021 CRM Science, Inc. All rights reserved.