Esempio n. 1
0
int main (void)
{
	char a[][14] = {"  0123456789 "," ----------- ","0|********** ","1|********** ",								"2|********** ","3|********** ","4|********** ","5|********** ",								"6|********** ","7|********** ","8|********** ","9|********** "," "};
	int i = 0, j;
	output(a);
	printf("you can input 4 4 to put a chess on board\n");
	while (1)
	{
		i = input(a,i);
		output(a);
		j = judgment(a);
		if (j == 0){
			printf("player 1 is  win\n");
			break;
		}
		else if(j == 1){
			printf("player 2 is  win\n");
		break;
		}
		else if(j == 3){
			printf ("A draw in chess\n");
			break;
		}
	}
	return 0;
}
Esempio n. 2
0
File: 10.cpp Progetto: jumiwo12/minu
void shift(char map[10][10]) {
	if (judgment() == 1) return;
	if (map[y + 1][x] == 0) {
		y++;
		map[y][x] = 2;
	}
	else if (map[y][x + 1] == 0) {
		x++;
		map[y][x] = 2;
	}
	else if (map[y][x - 1] == 0) {
		x--;
		map[y][x] = 2;
	}
	else if (map[y - 1][x] == 0) {
		y--;
		map[y][x] = 2;
	}
	else if (map[y + 1][x] == 2) {
		y++;
		map[y][x] = 3;
	}
	else if (map[y][x + 1] == 2) {
		x++;
		map[y][x] = 3;
	}
	else if (map[y][x - 1] == 2) {
		x--;
		map[y][x] = 3;
	}
	else if (map[y - 1][x] == 2) {
		y--;
		map[y][x] = 3;
	}
}
/*******************************************************************************
 * 関数定義
 ******************************************************************************/
int main(int argc, char *argv[])
{
	struct World world;
	int result;
	
	initWorld(&world);	// 世界の初期化(パーツ・コマンドリスト生成など)
	setPlayer(&world);	// プレイヤの受付とモンスターの生成
	
	do(judgment(&world, &result) != GAMEOVER) {	// 終了判定
		setCommand(&world);	// 各プレイヤからコマンドを受け付ける
		runAttack(&world);	// コマンドの実行
	}
Esempio n. 4
0
File: 10.cpp Progetto: jumiwo12/minu
int main(int argc, char * argv[]) {
	char map[10][10] = { {1,1,1,1,1,1,1,1,1,1}, 
						 {1,0,0,0,0,0,0,0,0,1},
					     {1,0,0,1,0,1,0,1,0,1},
					     {1,1,1,1,1,1,0,1,0,1},
					     {1,0,0,0,0,0,0,1,0,1},
					     {1,0,0,1,0,1,1,1,1,1},
					     {1,0,1,1,0,0,0,0,0,1},
					     {1,0,0,0,1,0,1,1,1,1},
					     {1,0,1,0,1,0,0,0,0,1},
						 {1,1,1,1,1,1,1,1,1,1} };
	while (1) {
		if (judgment() == 1) break;
		print_unit(map);
		shift(map);
	}
	print_unit(map);
	printf("GOAL~!!\n");
	system("pause");
}