Advertisement
LeRoY_Go

Untitled

Mar 21st, 2022
1,067
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 4.20 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3.  
  4. namespace C_Sharp_Junior
  5. {
  6.     class Program
  7.     {
  8.         static void Main(string[] args)
  9.         {                                                                                                                                            
  10.             SeaBattle seaBattle = new SeaBattle();
  11.             seaBattle.DrawingMap();
  12.             Console.ReadKey();
  13.         }
  14.     }
  15.  
  16.     class SeaBattle
  17.     {
  18.         private User user;
  19.  
  20.         public SeaBattle()
  21.         {
  22.             user = new User();
  23.         }
  24.  
  25.         public void DrawingMap()
  26.         {
  27.             char[,] myGameMap = {{' ', ' ', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '&'},
  28.                                  {' ', '&', '&', '&', '&', '&', '&', '&', '&', '&', '&', '&', '&'},
  29.                                  {'A', '&', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '&'},
  30.                                  {'Б', '&', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '&'},
  31.                                  {'В', '&', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '&'},
  32.                                  {'Г', '&', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '&'},
  33.                                  {'Д', '&', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '&'},
  34.                                  {'Е', '&', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '&'},
  35.                                  {'Ё', '&', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '&'},
  36.                                  {'Ж', '&', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '&'},
  37.                                  {'З', '&', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '&'},
  38.                                  {'И', '&', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '&'},
  39.                                  {' ', '&', '&', '&', '&', '&', '&', '&', '&', '&', '&', '&', '&'}};
  40.             char[,] enemyGameMap = {{' ', ' ', '1', '2', '3', '4', '5', '6', '7', '8', '9', '1', '&'},
  41.                                     {' ', '&', '&', '&', '&', '&', '&', '&', '&', '&', '&', '&', '&'},
  42.                                     {'A', '&', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '&'},
  43.                                     {'Б', '&', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '&'},
  44.                                     {'В', '&', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '&'},
  45.                                     {'Г', '&', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '&'},
  46.                                     {'Д', '&', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '&'},
  47.                                     {'Е', '&', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '&'},
  48.                                     {'Ё', '&', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '&'},
  49.                                     {'Ж', '&', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '&'},
  50.                                     {'З', '&', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '&'},
  51.                                     {'И', '&', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '&'},
  52.                                     {' ', '&', '&', '&', '&', '&', '&', '&', '&', '&', '&', '&', '&'}};
  53.  
  54.             Console.WriteLine("  Моё поле");
  55.             for (int i = 0; i < myGameMap.GetLength(0); i++)
  56.             {
  57.                 for (int j = 0; j < myGameMap.GetLength(1); j++)
  58.                 {
  59.                     Console.Write(myGameMap[i,j]);
  60.                 }
  61.                 Console.WriteLine();
  62.             }
  63.             Console.SetCursorPosition(16, 0);
  64.             Console.WriteLine("Вражеское поле");
  65.             for (int i = 0; i < enemyGameMap.GetLength(0); i++)
  66.             {
  67.                 Console.SetCursorPosition(17, i + 2);
  68.                 for (int j = 0; j < enemyGameMap.GetLength(1); j++)
  69.                 {
  70.                     Console.Write(enemyGameMap[i, j]
  71.                 }
  72.                 Console.WriteLine();
  73.             }
  74.         }
  75.     }
  76.  
  77.     class User
  78.     {
  79.         public void ChoosingAttackLocation()
  80.         {
  81.             Console.SetCursorPosition(0, 20);
  82.             Console.WriteLine("Введите номер клетки:");
  83.  
  84.         }
  85.     }
  86. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement