Advertisement
ozpavel

newgame.c

May 21st, 2018
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.48 KB | None | 0 0
  1. // файл newgame.c
  2.  
  3. #include <stdio.h>
  4.  
  5. #define SIZE 5
  6.  
  7. int dispose();
  8. int random_dispose();
  9. int print_field(int arr[SIZE][SIZE]);
  10.  
  11. int new_game() {
  12.     int newgame_choice = 1;
  13.  
  14.     printf("бла бла бла, пишем умные слова про соединение и т.д. \n");
  15.  
  16.     printf("Необходимо расставить корабли. \n");
  17.     printf("[1] - Расставить вручную \n");
  18.     printf("[2] - Расставить рандомно \n");
  19.     printf("Выберите действие: ");
  20.     scanf("%d", &newgame_choice);
  21.  
  22.     switch (newgame_choice) {
  23.         case 1:
  24.             dispose();
  25.             break;
  26.         case 2:
  27.             random_dispose();
  28.             break;
  29.     }
  30. }
  31.  
  32. int dispose() {
  33.     printf("OLO BLEAT1");
  34.     int field[SIZE][SIZE];
  35.     int ships = 2;
  36.     int cruiser = 1, destroyer = 1;
  37.  
  38.     for (int i = 0; i < SIZE; i++) {
  39.         for (int j = 0; j < SIZE; j++) {
  40.             field[i][j] = 0;
  41.         }
  42.     }
  43.  
  44.     print_field(field);
  45.  
  46. }
  47.  
  48. int random_dispose() {
  49.  
  50. }
  51.  
  52. int print_field(int arr[SIZE][SIZE]) {
  53.     for (int i = 0; i < SIZE; i++) {
  54.         for (int j = 0; j < SIZE; j++) {
  55.             if (arr[i][j] == 0 || arr[i][j] == 1) {
  56.                 printf(" |");
  57.             }
  58.             if (arr[i][j] == 2) {
  59.                 printf("O|");
  60.             }
  61.             if (arr[i][j] == 3) {
  62.                 printf("X|");
  63.             }
  64.         }
  65.         printf("\n");
  66.     }
  67. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement