We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.

This lesson's interactive features are locked, please to keep using them

Polymorphism Practice

Let's extend the Card logic we built to make a simple high-card low-card game.

Assignment

We will be building a simple game where we compare two cards and depending on the round (high or low) determine the winner.

  • HighCardRound: The highest card wins
  • LowCardRound: The lowest card wins
      • 1 if card1 is higher than card2
      • 2 if card2 is higher than card1
      • 0 if the cards are equal
      • 1 if card1 is lower than card2
      • 2 if card2 is lower than card1
      • 0 if the cards are equal