2021-11-22 17:25:48 +00:00
|
|
|
accessing
|
|
|
|
optionsFromDictionary: aDictionary
|
|
|
|
|
|
|
|
aDictionary doWithIndex: [ :opt :i |
|
|
|
|
| key value prevKey |
|
|
|
|
i = 1
|
|
|
|
ifTrue: [ key := 1 to: (opt at: 'Chance') asInteger ]
|
|
|
|
ifFalse: [
|
|
|
|
prevKey := (aDictionary at: i - 1) at: 'Chance'.
|
|
|
|
key := prevKey asInteger + 1 to: (opt at: 'Chance') asInteger ].
|
2021-12-05 18:58:22 +00:00
|
|
|
value := (opt copy removeKey: 'Chance'; yourself).
|
2021-11-22 17:25:48 +00:00
|
|
|
self options at: key put: value ]
|