Beispiel #1
0
void edit_show(LIFE life_pt[],CURSOR c,int xy){
	simshow();
	print_life(life_pt);
	if(life_pt[xy].live==1){
	attrset(COLOR_PAIR(2));
	}else{
	attrset(COLOR_PAIR(3));
	}
	mvprintw(c.y,c.x,"X");
	attrset(COLOR_PAIR(4));
	return;
}
Beispiel #2
0
int main(int argc, char *argv[])
{
    int i = 0;
    int step = 0;

    life_evolution_t life_evolution[LIFE_STEP_NUM];
    memset(life_evolution, 0, sizeof(life_evolution_t) * LIFE_STEP_NUM);

    life_common.head = 1;
    life_common.eyes = 2;
    life_common.mouth= 1;

    for (i = 0; i < LIFE_STEP_NUM; i++)
    {
        snprintf(life_evolution[i].life_stat, SHORT_BUF, "%s", ORIGINAL_LIFE);
        life_evolution[i].description = life_des[i];
        switch (i)
        {
            case 0:
                snprintf(life_evolution[i].life_stat, SHORT_BUF, "%s", NO_LIFE);
                break;

            case 1:
                life_evolution[i].tail = 1;
                break;

            case 2:
                life_evolution[i].tail = 1;
                life_evolution[i].legs = 2;
                break;

            case 3:
                life_evolution[i].tail = 1;
                life_evolution[i].legs = 4;
                break;

            case 4:
                snprintf(life_evolution[i].life_stat, SHORT_BUF, "%s", EVOLUTION_LIFE);

                life_evolution[i].tail = 0;
                life_evolution[i].legs = 4;
                life_evolution[i].breath = 1;
                break;

            default:
                fprintf(stderr, "Get wrong life step\n");
        }
    }

    if (argc > 1 && 0 != argv[1][0])
    {
        step = atoi(argv[1]);
    }

    if (step > -1 && step < LIFE_STEP_NUM)
    {
        print_life(&(life_evolution[step]));
    }
    else
    {
        fprintf(stderr, "Get wrong life step:[%d]\n", step);   
        fprintf(stderr, "It should be 0~%d\n", LIFE_STEP_NUM);   
    }

    return 0;
}
Beispiel #3
0
void edit_show(LIFE life_pt[],CURSOR c){
	simshow();
	print_life(life_pt);
	mvprintw(c.y,c.x,"X");
	return;
}