#include "..\CookHeader.h"

int SIZE;
Array <string> stack;
int top = -1;

bool isStackEmpty() {  
	if (top == -1)
		return true;
	else
		return false;
}

bool isStackFull() {  
	if (top >= SIZE - 1)
		return true;
	else
		return false;
}

void push(string data) {   
	if (isStackFull()) {
		return;
	}
	top++;
	stack[top] = data;
}

string pop() {   
	if (isStackEmpty()) {
		return "None";
	}
	string data = stack[top];
	stack[top] = "None";
	top--;
	return data;
}

int main() {
	SIZE = 10;
	for (int i = 0; i < SIZE; i++)
		stack.push_back("None");

	Array <string> stoneAry = { "빨강", "파랑", "초록", "노랑", "보라", "주황" };
	randomInit(1, len(stoneAry)-1);
	for (int i = 0; i < len(stoneAry) * 100; i++) {
		int n1 = cookRandom(gen);
		int n2 = cookRandom(gen);
		swap(stoneAry[n1], stoneAry[n2]);
	}

	print("과자집에 가는 길 : ");
	for (int i = 0; i < len(stoneAry); i++) {
		string stone = stoneAry[i];
		push(stone);
		print(stone + "-->");
	}
	println("과자집");

	print("우리집에 오는 길 : ");
	while (true) {
		string stone = pop();
		if (stone == "None")
			break;
		print(stone + "-->");
	}
	println("우리집");	
}