Created
September 25, 2011 16:44
-
-
Save whaley/1240816 to your computer and use it in GitHub Desktop.
TicTacToe Sealed Classes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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