Check Your Subroutines - We are delivering our latest release to internal test today. Had a code review yesterday. Many issues were found. We are fixing the highest priority probl...
Python Tic Tac Toe
Although I did not have to use it, I figured I should try two dimensional arrays to represent the board. In Python, it would actually be a two dimensional list. The creation of such a beast is not intuitive. I found some weird ways to specify it. However I decided to start simple and create a list with brackets. Then I appended lists to that main list using append(). Then I append the actual moves that sub-list.
The good news is accessing the two dimensional list is just as you would an array: myList[x][y]. I learned a couple other things today. Looks like you have to enclose expressions in parentheses for your if statements. And when there are compound expressions with parentheses themselves, wrap the whole thing in extra parentheses.
I did take advantage of a neat feature in Python. You can return more than one value from a function. Just do a return value1, value2. The caller can use the syntax global1, global2 = fxn(). You don't see that syntax in many (any?) other languages. Now back to tic tac toe implementation.