Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/local/bin/gst -q
- Collection extend [
- apply: method [ ^self collect: [:x | x perform: method] ]
- ]
- fish := Bag from: ((stdin nextLine substrings: $,) apply: #asNumber).
- (1 to: 256) do: [ :t |
- next := Bag new.
- fish contents associations do: [ :group |
- | age |
- age := group key.
- (age = 0) ifTrue: [
- age := 7.
- next add: 8 withOccurrences: group value.
- ].
- next add: (age - 1) withOccurrences: group value.
- ].
- fish := next.
- (t = 80) ifTrue: [ ('Part 1: %1' % {fish size}) displayNl ]
- ].
- ('Part 2: %1' % {fish size}) displayNl.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement