Exemplo n.º 1
0
void display(game_state_t *state)
{
    int i, j;
    attron(COLOR_PAIR(2));
    for (i = 0; i < DISPLAY_ROWS; i++) {
        display_edge(state->paddle_a_y, i);
        for (j = 1; j < DISPLAY_COLS - 1; j++) {
            if (state->puck_x == j && state->puck_y == i) {
                attron(COLOR_PAIR(WHITE));
                printw(" ");
                attron(COLOR_PAIR(BLACK));
            } else {
                printw(" ");
            }
        }
        display_edge(state->paddle_b_y, i);
        printw("\n");
    }
    printw("Player a: %d\t\tPlayer b: %d\n", state->score_a, state->score_b);
    printw("Controls: w/s\t\t i/k\t\t ctr-c to quit\n");
}
Exemplo n.º 2
0
/*************************************************************
 * Support Functionality
 *************************************************************/
static void display_node(netloc_node_t *node, char * prefix)
{
    int i;

    printf("%s%s\n",
           prefix,
           netloc_pretty_print_node_t(node) );

    for(i = 0; i < node->num_edges; ++i ) {
        display_edge(node->edges[i], strdup("\t"));
    }
}
int main()
{
    int n,i;
    
    // code to take number of vertices
    printf("Enter number of vertceis\n");
    scanf("%d",&n); 
      
    // code to make adjacent list and display 
    printf("\nInstruction:\n\nfirst enter adjacent node and give one space and then enter wieght of edge \nand then do sam for next nodes and if adajcent finish \nthen enter 0 and Press Enter Key\n\n",i); 
    for(i=1;i<=n;i++)
    {
        scan_adj(i);
        //printf("adj complete\n");                
    }
    display_list(n);
    
    //code for spanning tree
    mst_prim(n);
    display_edge(n);
    
    system("pause");
    return 0;
}