From VisualWorks®, Release 5i.4 of August 9, 2001 on June 28, 2002 at 4:19:44 pm CormasModelGame CormasNS.Kernel CormasNS.Kernel.CormasModel false none playersNames playersBlocks interface gameStep logDirectory repetitionDecisionsSheets decisionsSheets CormasKernel-Interface CormasNS.Kernel.CormasModelGame accessing decisionsSheets ^decisionsSheets decisionsSheets: anObject decisionsSheets := anObject gameStep ^gameStep gameStep: anObject gameStep := anObject interface ^interface interface: anObject interface := anObject playersBlocks ^playersBlocks playersBlocks: anObject playersBlocks := anObject playersNames ^playersNames playersNames: anObject playersNames := anObject repetitionDecisionsSheets ^repetitionDecisionsSheets isNil ifTrue: [0] ifFalse: [repetitionDecisionsSheets] repetitionDecisionsSheets: anObject repetitionDecisionsSheets := anObject CormasNS.Kernel.CormasModelGame logFiles initLog | name answer directory | directory := 'testGame'. name := (Cormas dataPath: self class name) construct: directory. name asFilename exists ifFalse: [name asFilename makeDirectory. self logDirectory: name] ifTrue: [answer := Dialog request: 'Nom de sauvegarde existant !!! \l''utiliser quand meme ???' withCRs initialAnswer: directory. (answer notNil and: [answer isEmpty not]) ifTrue: [name := (Cormas dataPath: self class name) construct: answer. name asFilename exists ifFalse: [name asFilename makeDirectory]. self logDirectory: name]]. (self logDirectory construct: 'actionsJoueurs.txt') asFilename exists ifTrue: [(self logDirectory construct: 'actionsJoueurs.txt') asFilename delete] logDirectory ^logDirectory logDirectory: anObject logDirectory := anObject CormasNS.Kernel.CormasModelGame interface window openInterface self initInterface. self interface open updateName self interface builder window label: self class name asString , ' Decisions sheet GameStep #' , self gameStep printString updateName: playerName self interface selectedPlayer: playerName. self interface builder window label: self class name asString , ' Decisions sheet for ' , playerName , ' at gameStep #' , self gameStep printString CormasNS.Kernel.CormasModelGame init initGame "self initInterface." self decisionsSheets: Dictionary new. self playersNames: OrderedCollection new. self initPlayers. self playersNames do: [:name | self decisionsSheets at: name put: Dictionary new]. self decisionsSheets at: 'Events' put: Dictionary new. self playersBlocks: Dictionary new. self initPlayersBlocks. self initLog. self gameStep: 0 initInterface | interfaceClass | interfaceClass := self class allClassesInCategory detect: [:c | c inheritsFrom: CormasModelGameInterface] ifNone: [nil]. interfaceClass isNil ifTrue: [self halt] ifFalse: [self interface: interfaceClass new. self interface model: self] initPlayers self subclassResponsibility initPlayersBlocks self subclassResponsibility CormasNS.Kernel.CormasModelGame actions runDecisionsSheets self interface playersScheduling list do: [:aName | (self perform: aName asSymbol) runDecisions: (self decisionsSheets at: aName)] CormasNS.Kernel.CormasModelGame control stepDecisionsSheets self gameStep: self gameStep + 1. self repetitionDecisionsSheets isZero ifTrue: [self openInterface] ifFalse: [self runDecisionsSheets. self repetitionDecisionsSheets: self repetitionDecisionsSheets - 1]