15 lines
490 B
Smalltalk
15 lines
490 B
Smalltalk
accessing
|
|
fromDictionary: aDictionary
|
|
| optionsTable |
|
|
name := aDictionary at: 'Name'.
|
|
optionsTable := aDictionary at: 'Table'.
|
|
optionsTable doWithIndex: [:opt :i | | key value prevKey |
|
|
(i = 1)
|
|
ifTrue: [key := 1 to: (opt at: 'Chance') asInteger]
|
|
ifFalse: [
|
|
prevKey := ((optionsTable at: (i-1)) at: 'Chance').
|
|
key := (prevKey asInteger + 1) to: (opt at: 'Chance') asInteger.
|
|
].
|
|
value := (opt at: 'Description') capitalized.
|
|
self options at: key put: value .
|
|
]. |