#include <stdio.h>
#define BASE = 0;
char map0[]="A HAPP";
int map0base;
int map0size;
char map1[]="Y NEW YE";
int map1base;
int map1size;
char map2[]="AR!!!";
int map2base;
int map2size;
char map3[]="I WISH YOU ";
int map3size;
int map3base;
void print(int player);
char table(int add);

void main(){
	map0base=0;
	map0size=(sizeof map0)-1;
	map1base=map0base+map0size;
	map1size=(sizeof map1)-1;
	map2base=map1base+map1size;
	map2size=(sizeof map2)-1;
	map3size=(sizeof map3)-1;
	map3base=map0base-map3size;

	int w=2014;
	int player=3;
	while(1){
		print(player);
		printf("P position:%d\n",player);
		printf("\n\n");
		printf("Which way? 1:left 2:right 0:Exit\n");
		scanf("%d",&w);
		if(w==0)
			break;
		if(w==2)
			player++;
		else if(w==1)
			player--;
		else
			break;
	}
	return;
}

void print(int player){
	int offset;
	int add;
	int map;
	for(offset=-3;offset<=3;offset++){
		add=player+offset;
		char map=table(add);
			printf("%c",map);
	}
	printf("\n");
	for(offset=-3;offset<=3;offset++){
		if(offset==0)
			printf("P");
		else
			printf(" ");
	}
	printf("\n");
}

char table(int add){
	int m=0;
	if(map0base<=add && add<map0base+map0size)
		m=map0[add-map0base];
	else if(map1base<=add && add<map1base+map1size){
		m=map1[add-map1base];
	}
	else if(map2base<=add && add<map2base+map2size){
		m=map2[add-map2base];
	}
	else if(map3base<=add && add<map3base+map3size){
		m=map3[add-map3base];
	}
	else
		m=' ';

	return m;
}
