Complete proof of concept(all I needed was Smalltalk classNamed: x) to reflect the class at runtime so that the playground script doesn't get confused since the classes don't exist before script is evaluated. ([ "create the classes." ([ SimpleSwitchMorph subclass: #LOCell instanceVariableNames: 'mouseAction' classVariableNames: '' package: 'PBE-LightsOut'. BorderedMorph subclass: #LOGame instanceVariableNames: 'cells' classVariableNames: '' package: 'PBE-LightsOut'. ] value). "create LOCell methods." ([:this | this compile: 'mouseAction: a', (String cr), ' ^ mouseAction := a'. this compile: 'mouseUp: e', (String cr), ' mouseAction value'. this compile: 'initialize', (String cr), ' super initialize.', (String cr), ' self label: ''''.', (String cr), ' self borderWidth: 2.', (String cr), ' bounds := (0@0) corner: (16@16).', (String cr), ' offColor := Color paleYellow.', (String cr), ' onColor := Color paleBlue darker.', (String cr), ' self useSquareCorners.', (String cr), ' self turnOff.'. ] value: (Smalltalk classNamed: 'LOCell')). ([:this | this compile: 'cellsPerSide', (String cr), ' ^10'. this compile: 'toggleNeighboursOfCellAt: i at: j', (String cr), ' (i > 1) ifTrue: [', (String cr), ' (cells at: i - 1 at: j) toggleState.', (String cr), ' ].', (String cr), (String cr), ' (i < self cellsPerSide) ifTrue: [', (String cr), ' (cells at: i + 1 at: j) toggleState.', (String cr), ' ].', (String cr), (String cr), ' (j > 1) ifTrue: [', (String cr), ' (cells at: i at: j - 1) toggleState.', (String cr), ' ].', (String cr), (String cr), ' (j < self cellsPerSide) ifTrue: [', (String cr), ' (cells at: i at: j + 1) toggleState.', (String cr), ' ].'. this compile: 'newCellAt: i at: j', (String cr), ' | c origin | ', (String cr), (String cr), ' c := LOCell new.', (String cr), ' origin := self innerBounds origin.', (String cr), (String cr), ' self addMorph: c.', (String cr), ' ', (String cr), ' c position: ([', (String cr), ' | x_index y_index c_width c_height |', (String cr), (String cr), ' x_index := i - 1.', (String cr), ' y_index := j - 1.', (String cr), ' c_width := c width.', (String cr), ' c_height := c height.', (String cr), ' ', (String cr), ' (x_index * c_width)@(y_index * c_height) + origin', (String cr), ' ] value).', (String cr), (String cr), ' c mouseAction: [', (String cr), ' self toggleNeighboursOfCellAt: i at: j.', (String cr), ' ].', (String cr), ' ^ c.', (String cr). this compile: 'initialize', (String cr), ' | sampleCell width height n |', (String cr), (String cr), ' super initialize.', (String cr), ' n := self cellsPerSide.', (String cr), (String cr), ' sampleCell := LOCell new.', (String cr), ' width := sampleCell width.', (String cr), ' height := sampleCell height.', (String cr), (String cr), ' self bounds: ', (String cr), ' ((5@5) extent:', (String cr), ' (width * n)@(height * n) + ', (String cr), ' (2 * (self borderWidth))).', (String cr), (String cr), ' cells := Matrix new: n tabulate: [:i :j |', (String cr), ' self newCellAt: i at: j.', (String cr), ' ].'. ] value: (Smalltalk classNamed: 'LOGame')). ] value). -- View this message in context: http://forum.world.st/New-to-Pharo-a-bunch-of-questions-tp4917701p4917710.ht... Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.