#import "snake.h"

@implementation Snake

- (id) initWithPosition:(int)p andDirection:(int)d andMaximum:(int)mx
{
  self = [super initWithPosition:p];
  if (self)
    {
      dir = d;
      max = mx;
    }
  return self;
}

- (void) update
{
  pos += dir;
  if (pos == 0 || pos == max)
    {
      dir *= -1;
    }
}

- (NSString *) displayChar
{
  return [NSString stringWithCString:"~"];
}

@end
