Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "my.h"
- void createTable(int** tab, int size)
- {
- for(int i = 0; i < size; i ++)
- {
- for(int j = 0; j < size; j ++)
- {
- tab[j][i] = 1;
- }
- }
- }
- int main(int ac, char *av[])
- {
- if(ac == 2 && av[1][0] == '-' && av[1][1] == 'h')
- my_printf("USAGE\n\t./sokoban map\nDESCRIPTION\n\tmap : file representing the warehouse map, containing '#' for walls,\n\t\t 'p' for the player, 'X' for boxes and '0' for storage locations.");
- if (ac == 1) {
- int tableau[10][10];
- createTable(tableau, 10);
- char *move;
- size_t size = 32;
- move = (char *) malloc(sizeof(char));
- int exit = 1;
- int i, j;
- for(i = 0; i<10; i ++)
- {
- for(j = 0; j < 10; j ++)
- {
- printf("%d", tableau[i][j]);
- }
- printf("\n");
- }
- while(exit) {
- getline(&move,&size,stdin);
- if(move[0] == 'z')
- my_printf("Player go up\n");
- if(move[0] == 's')
- my_printf("Player go down\n");
- if(move[0] == 'd')
- my_printf("Player go right\n");
- if(move[0] == 'q')
- my_printf("Player go left\n");
- if(move[0] == 'x') {
- exit = 0;
- }
- }
- }
- return(0);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement