I finished working on a basic AI and it moves using a case switch; either 0 (illegal move), 1 and 2 (legal moves). The way I coded the AI is so that the value of the case switch should never be 0. To be safe, I coded what it should do as followed:
if(csZetType > 0) //csZetType is the value for the switchcase, this can't be anything else
//than 0, 1 or 2 unless hardcoded.
{
Move();
}
else
{
MessageBox.Show("Impossible Move of AI", "BUG detected!");
throw new NotImplementedException(); //Only one I know
}
The NotImplementedException()
is the only version I know. I'm currently using it but I know this is not the right one. Which one do I need for this situation?
the method Move exists out of a proper switch case by the way, don't worry.
So if it reaches to else
block then it looks like a invalid operation been tried to performed. Then it would be a good case for InvalidOperationException
but that again a suggestive answer.