| |
|
|
| |
|
|
| |
| |
|
A move is only valid if the square is not occupied and if the typed number is larger than 0 and smaller than 10. In case of an invalid move, generate an error and prompt for a new move. Make sure that your program does not accept nonnumeric input.
-------------
| 1 | 2 | 3 |
-------------
| 4 | 5 | 6 |
-------------
| 7 | 8 | 9 |
-------------
check_for_winner(ByRef the_board(,) as Short) as Short
that returns either a winner or no winner.
- Always have Option Strinct On and Option Explicit On set.
- Include sufficient commenting in your code so that others who are not familiar with your application can comfortably read your code and understand what it does. You will be asked to review each others' code; so you should make it legible and easily understandable.
- Use mnemonic variable names; i.e., use names that represent what they mean. For instance, if you have a counter of sorts, call it counter, rather than i or j. (i and j for loop indexes are fine, however).
- Introduce a function/subroutine naming convention that makes it easy for people reading your code to distinguish between functions and subroutines that you wrote versus the ones that come supplied with VB.Net; e.g., start all your functions and subroutines with an underscore; e.g., _myFunction(). (There exists a sizable literature on naming conventions, name spaces, etc. We do not need to detail any of this here, but it makes sense to introduce at least a few, simple conventions that increase the readability of your code). Make sure that you include your naming conventions in a comment block (there is little point in having the convention if you don't tell your reader what it is!).
- Thoroughly check for errors and exceptions. Colleagues reviewing your code will be asked to try and 'break it.' Make sure they cannot.