Skip to content

Instantly share code, notes, and snippets.

@whaley
Created September 25, 2011 16:44
Show Gist options
  • Select an option

  • Save whaley/1240816 to your computer and use it in GitHub Desktop.

Select an option

Save whaley/1240816 to your computer and use it in GitHub Desktop.
TicTacToe Sealed Classes
package com.jasonwhaley.tictactoe
sealed abstract class TicTacToeSpace {
val representation : String
override def toString() : String = {
return representation
}
}
case class X extends TicTacToeSpace {
override val representation = "X"
}
case class O extends TicTacToeSpace{
override val representation = "O"
}
case class Empty extends TicTacToeSpace {
override val representation = " "
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment