Advertisement
Guest User

Untitled

a guest
Jun 21st, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. #include "my.h"
  2.  
  3. void createTable(int** tab, int size)
  4. {
  5.  
  6. for(int i = 0; i < size; i ++)
  7. {
  8. for(int j = 0; j < size; j ++)
  9. {
  10. tab[j][i] = 1;
  11. }
  12. }
  13. }
  14.  
  15. int main(int ac, char *av[])
  16. {
  17. if(ac == 2 && av[1][0] == '-' && av[1][1] == 'h')
  18. 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.");
  19. if (ac == 1) {
  20. int tableau[10][10];
  21. createTable(tableau, 10);
  22. char *move;
  23. size_t size = 32;
  24. move = (char *) malloc(sizeof(char));
  25. int exit = 1;
  26. int i, j;
  27.  
  28. for(i = 0; i<10; i ++)
  29. {
  30. for(j = 0; j < 10; j ++)
  31. {
  32. printf("%d", tableau[i][j]);
  33. }
  34. printf("\n");
  35. }
  36.  
  37. while(exit) {
  38. getline(&move,&size,stdin);
  39. if(move[0] == 'z')
  40. my_printf("Player go up\n");
  41. if(move[0] == 's')
  42. my_printf("Player go down\n");
  43. if(move[0] == 'd')
  44. my_printf("Player go right\n");
  45. if(move[0] == 'q')
  46. my_printf("Player go left\n");
  47. if(move[0] == 'x') {
  48. exit = 0;
  49. }
  50. }
  51. }
  52. return(0);
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement