コード例 #1
0
ファイル: sort_stack.c プロジェクト: ftriquet/push_swap
void	sort_stack(t_stack *a, t_stack *b)
{
	int		min_max[2];

	if (g_v_opt)
		print_stacks(a, b);
	check_bottom(a, b);
	while (!check_top(a, b) || !check_last_push(a, b) || !empty(b))
	{
		if (get_min_max(a, min_max, min_max + 1) == 1)
			rot_to_min(a, b, min_max, 0);
		else
			rot_to_min(a, b, min_max, 1);
	}
}
コード例 #2
0
ファイル: quiz.c プロジェクト: loverabbit/kbs-redis
int quiz_again()
{
    int rank;
    char ans[4];
    rank = check_top(score);
    move(t_lines-3, 0);
    if (rank==1) {
        setfcolor(RED, 1);
        prints("恭喜你,你上排行榜啦!!!");
        save_board();
    }
    resetcolor();
    getdata(t_lines-2, 0, "重新玩吗?", ans, 3, 1, NULL, 1);
    return toupper(ans[0])=='Y';
}
コード例 #3
0
ファイル: check.c プロジェクト: kederiku/Reversi
int	verify_playable(char** map, int x, int y, int player)
{
	if (map[y][x] != 0)
		return -1;
	if (check_top(map, x, y, player) == 0)
		return 0;
	if (check_bottom(map, x, y, player) == 0)
		return 0;
	if (check_left(map, x, y, player) == 0)
		return 0;
	if (check_right(map, x, y, player) == 0)
		return 0;
	if (check_top_left(map, x, y, player) == 0)
		return 0;
	if (check_top_right(map, x, y, player) == 0)
		return 0;
	if (check_bottom_left(map, x, y, player) == 0)
		return 0;
	if (check_bottom_right(map, x, y, player) == 0)
		return 0;
	return -1;
}
コード例 #4
0
ファイル: check_square.c プロジェクト: Sereniiity/Taquin
int	check_axe(t_terrain* button, t_terrain* terrain)
{
    if (check_left(button, terrain))
    {
        move_left(button, terrain);
        return (1);
    }
    else if (check_right(button, terrain))
    {
        move_right(button, terrain);
        return (1);
    }
    else if (check_top(button, terrain))
    {
        move_top(button, terrain);
        return (1);
    }
    else if (check_bot(button, terrain))
    {
        move_bot(button, terrain);
        return (1);
    }
    return (0);
}