#include <stdio.h>
int guess(void);//prototype

int myarray[5][6] = { { 0,0,0,0,0,0 },{ 0, 0, 0, 0, 0,0 },
{ 0,0,0,0,0,0 },{ 0,0,0,1,0,0 },{ 0,0,0,0,0,0 } };

void main()
{
	
	int i,j;
	int correct = 0;
	int turns = 0;

	for (i = 0; i < 5; i++)//row
	{
		for (j = 0; j < 6; j++)//column
		{
			printf("%d ", myarray[i][j]);
		}
		printf("\n");

	}
	printf("Welcome to the Treasure Hunt\n\n");
	while (correct == 0)
	{
		correct = guess();//call the function
		turns = turns + 1;
	}
	printf("You took %d turns", turns);
}

int guess()
{
	int x, y;
	printf("Please enter your x coordinate:");
	scanf("%d", &x);

	printf("Please enter your y coordinate:");
	scanf("%d", &y);

	if (myarray[x][y] == 1)
	{
		printf("Hooray!");
		return 1;
	}
	else
	{
		printf("Sorry no luck");
		return 0;
	}
}