//
//  Game.m
//  Clock-Test
//
//  Created by Ashley on 27/10/2006.
//  Copyright 2006 __MyCompanyName__. All rights reserved.
//

#import "Game.h"

@implementation Game

- (id) init
{
	if ((self = [super init])!=nil) {
		_hours = 0;
		_minutes = 0;
		_level = 1;
	}
	
	return self;
}

- (void) randomTime
{
	NSLog(@"Game randomTime");
	int hours = (int)(12*drand48());
	hours = (hours==0)?12:hours;
	[self setHours:hours];
	int minutes;
	if ([self level]==1) {
		minutes = 15*(int)(4*drand48());
	 } else if ([self level]==2) {
		minutes = 5*(int)(12*drand48());
	 }
	[self setMinutes:minutes];
	printf("h = %d m = %d\n", [self hours], [self minutes]);
}

- (void) setLevel:(int)level
{
	_level = level;
}

- (int) level
{
	return _level;
}

- (void) setHours:(int)hours
{
	_hours = hours;
}

- (int) hours
{
	return _hours;
}

- (void) setMinutes:(int)minutes
{
	_minutes = minutes;
}

- (int) minutes
{
	return _minutes;
}

- (BOOL) checkTimeIfHours:(int)hours andMinutes:(int)minutes
{
	int gameHours = [self hours];
	int gameMinutes = [self minutes];
	return (hours==gameHours) && (minutes==gameMinutes);
}

- (void) setController:(id)controller
{
	_controller = controller;
}

- (id) controller
{
	return _controller;
}

@end
