From 46f72c2afabd5c9638aff65191be5f80ab17f9a8 Mon Sep 17 00:00:00 2001 From: Dimitri Sokolyuk Date: Sun, 26 Feb 2017 00:06:26 +0100 Subject: Cleanup --- philo.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/philo.go b/philo.go index d5bc02a..930b23f 100644 --- a/philo.go +++ b/philo.go @@ -28,13 +28,13 @@ func (p Philo) Print(s string) { fmt.Printf("%10s %s\n", p.Name, s) } -func (p *Philo) Arrive() stateFn { +func (p Philo) Arrive() stateFn { p.Print("arrives") return p.Hungry } -func (p *Philo) Hungry() stateFn { +func (p Philo) Hungry() stateFn { p.Print("is hungry") p.Left.Grab() @@ -46,7 +46,7 @@ func (p *Philo) Hungry() stateFn { return p.Starve } -func (p *Philo) Starve() stateFn { +func (p Philo) Starve() stateFn { p.Print("is starving") p.Delay() @@ -67,14 +67,14 @@ func (p *Philo) Eat() stateFn { return p.Think } -func (p *Philo) Think() stateFn { +func (p Philo) Think() stateFn { p.Print("is thinking") p.Delay() return p.Hungry } -func (p *Philo) Leave() stateFn { +func (p Philo) Leave() stateFn { p.Print("leaves") return nil @@ -82,7 +82,7 @@ func (p *Philo) Leave() stateFn { type stateFn func() stateFn -func (p *Philo) Dine() { +func (p Philo) Dine() { for state := p.Arrive; state != nil; { state = state() } -- cgit v1.2.3