import pygame, random
from pygame.locals import *


CONST_WIDTH = 640 #* 2
CONST_HEIGHT = 480 #* 2
CONST_BOX_WIDTH = 8 
CONST_BOX_HEIGHT = 8

#Colors
BackgroundBarva = (0,0,0,0)
BARVE = []
Bela = (255,255,255,255)
BARVE.append(Bela)
Crna = (0,0,0,255)
BARVE.append(Crna)
Rdeca = (255,0,0,255)
BARVE.append(Rdeca)
Modra = (0,0,255,255)
BARVE.append(Modra)
Rumena = (255,255,0,255)
BARVE.append(Rumena)
Oranzna = (255,128,0,255)
BARVE.append(Oranzna)
Zelena = (0,255,0,255)
BARVE.append(Zelena)
Roza=(255,0,255, 255)
BARVE.append(Roza)
Vijolicna= (127,0,255,255)
BARVE.append(Vijolicna)




class Labirint:
	def __init__(self, labPodlaga, resitevPodlaga):
		self.state = 'create'
		self.labArr = []
		self.lPodlaga = labPodlaga
		self.lPodlaga.fill(BackgroundBarva) #fill with black
		self.resPodlaga = resitevPodlaga # surface
		self.resPodlaga.fill(BackgroundBarva)
		for i in range(CONST_HEIGHT/CONST_BOX_HEIGHT):
			pygame.draw.line(self.lPodlaga, Crna, (0, i * CONST_BOX_HEIGHT), (CONST_WIDTH, i * CONST_BOX_HEIGHT))
			for j in range(CONST_WIDTH/CONST_BOX_WIDTH):
				self.labArr.append(0x0000)
				if (i == 0):
					pygame.draw.line(self.lPodlaga, Crna, (j * CONST_BOX_WIDTH, 0), (j * CONST_BOX_WIDTH, CONST_HEIGHT))

		pygame.draw.rect(self.resPodlaga, Modra, Rect(0,0,CONST_BOX_WIDTH, CONST_BOX_HEIGHT))
		pygame.draw.rect(self.resPodlaga, Modra, Rect((CONST_WIDTH-CONST_BOX_WIDTH),(CONST_HEIGHT - CONST_BOX_HEIGHT),CONST_BOX_WIDTH, CONST_BOX_HEIGHT))
		self.vseCelice = (CONST_HEIGHT/CONST_BOX_HEIGHT) * (CONST_WIDTH/ CONST_BOX_WIDTH)
		self.stackCelic = []
		self.trenutnaCelica = random.randint(0, self.vseCelice-1)