Add board validity check. Switch to 0-based index.