Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // файл newgame.c
- #include <stdio.h>
- #define SIZE 5
- int dispose();
- int random_dispose();
- int print_field(int arr[SIZE][SIZE]);
- int new_game() {
- int newgame_choice = 1;
- printf("бла бла бла, пишем умные слова про соединение и т.д. \n");
- printf("Необходимо расставить корабли. \n");
- printf("[1] - Расставить вручную \n");
- printf("[2] - Расставить рандомно \n");
- printf("Выберите действие: ");
- scanf("%d", &newgame_choice);
- switch (newgame_choice) {
- case 1:
- dispose();
- break;
- case 2:
- random_dispose();
- break;
- }
- }
- int dispose() {
- printf("OLO BLEAT1");
- int field[SIZE][SIZE];
- int ships = 2;
- int cruiser = 1, destroyer = 1;
- for (int i = 0; i < SIZE; i++) {
- for (int j = 0; j < SIZE; j++) {
- field[i][j] = 0;
- }
- }
- print_field(field);
- }
- int random_dispose() {
- }
- int print_field(int arr[SIZE][SIZE]) {
- for (int i = 0; i < SIZE; i++) {
- for (int j = 0; j < SIZE; j++) {
- if (arr[i][j] == 0 || arr[i][j] == 1) {
- printf(" |");
- }
- if (arr[i][j] == 2) {
- printf("O|");
- }
- if (arr[i][j] == 3) {
- printf("X|");
- }
- }
- printf("\n");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement