oke,
so I need a single Object here that contains this in a initialize function :
oke, then time to figure out how to change my functions because I have the feeling that I still miss some of the pieces: Robot >> move: aInstruction aInstruction = $R ifTrue: [ ^ self direction: (PositioningSystem new turnRight: direction) ]. aInstruction = $L ifTrue: [ ^ self direction: (PositioningSystem new turnLeft: direction) ]. ^ self position: (PositioningSystem new moveForWard: position direction: self direction)PositionSystem class >> initialize Directions := {('north' -> (0 @ 1)). ('east' -> (1 @ 0)). ('south' -> (0 @ -1)). ('west' -> (-1 @ 0))} PositionSystem >> turnRight: aDirection "comment stating purpose of message" | old | old := Directions detect: [ :b | b key = aDirection ]. ^ (Directions after: old ifAbsent: [ Directions first ]) key Roelof Op 6-4-2019 om 15:15 schreef K K Subbu: On 06/04/19 4:49 PM, Roelof Wobben wrote: |
- [Pharo-users] difference between double dispatch and the m... Roelof Wobben
- Re: [Pharo-users] difference between double dispatch ... K K Subbu
- Re: [Pharo-users] difference between double dispa... Roelof Wobben
- Re: [Pharo-users] difference between double dispa... Roelof Wobben
- Re: [Pharo-users] difference between double d... Richard O'Keefe
- Re: [Pharo-users] difference between doub... Roelof Wobben
- Re: [Pharo-users] difference between... Richard O'Keefe
- Re: [Pharo-users] difference bet... Roelof Wobben
- Re: [Pharo-users] difference bet... Roelof Wobben
- Re: [Pharo-users] difference... Richard O'Keefe
- Re: [Pharo-users] difference... Roelof Wobben
- Re: [Pharo-users] difference... Richard O'Keefe
- Re: [Pharo-users] difference... Roelof Wobben