I am new to smalltalk and trying to make a simple TicTacToe game, I want my model class to be a matrix but I can't find a way to do it on Visual Works. I've been following this tutorial : http://nerdysermons.blogspot.fr/2012/03/tictactoe-game-in-pharo-smalltalk.html , it works just fine with Pharo but I'm having trouble with the Matrix type and also the simplebuttonmorph. Can anyone please explain the syntax/packages/libraries between Pharo and VisualWorks? Thank you .
The following is a suggestion - there are many ways to implement matrices.
cellNumberAt: row at: column ^(row - 1) * numberOfColumns + column at: row at: column put: value cells at: (self cellNumberAt: row at: column) put: value at: row at: column ^cells at: (self cellNumberAt: row at: column) rowAt: rowNumber | row | row := OrderedCollection new. 1 to: numberOfColumns do: [:columnNumber | row add: (self at: rowNumber at: columnNumber)]. ^row columnAt: columnNumber | column | column := OrderedCollection new. 1 to: numberOfRows do: [:rowNumber | column add: (self at: rowNumber at: columnNumber)]. ^column
I hope that helps.