C\#L 형 바둑판 커버 구현 코드 와 효과
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ChessBoard
{
class Program
{
// , ,
static void Main(string[] args)
{
Function obj = new Function();
Console.WriteLine("Please intput CheseBoard Size(2^size):");
int size = (int)Math.Pow(2, Convert.ToInt32(Console.ReadLine()));
if (size != 1)
{
ConsoleColor FC = Console.ForegroundColor;
//string[] Color = { "Black" , "DarkBlue" , "DarkGreen" , "DarkCyan" , "Gray",
// "DarkRed" , "DarkMagenta" , "DarkYellow" , "Red",
// "DarkGray" , "Blue" , "Green" , "Cyan", "Magenta",
// "Yellow" , "White"};
string[,] Board = new string[size, size];
//Do you know ?
String[] Colors = ConsoleColor.GetNames(typeof(ConsoleColor));
Console.WriteLine("please input special grid position (row and col):");
int rows = Convert.ToInt32(Console.ReadLine());
int cols = Convert.ToInt32(Console.ReadLine());
obj.CheseBoard(Board, size, rows, cols);
for (int r = 0; r < Board.GetLength(0); r++)
{
for (int c = 0; c < Board.GetLength(1); c++)
{
int Value = Convert.ToInt32(Board[r, c].ToString());
if (Value > 0)
{
if (Value > 15)
{
Value %= 15;
}
if ((Value %= 15) == 0)
{
Value += 1;
}
Console.ForegroundColor = (ConsoleColor)Enum.Parse(typeof(ConsoleColor), Colors[Value]);
}
Console.Write(Board[r, c] + " ");
// Console.ForegroundColor = FC;
Console.ResetColor();
}
Console.WriteLine();
}
}
else
{
Console.WriteLine("Bugs Bug ! ! !");
}
Console.ReadKey();
}
}
}
//Class프로그램 실행 결과 캡 처
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
파이톤으로 바둑판 게임'뱅크스'가의 멈추기 쉬운 곳을 계산했어요.연말연시 보드게임'뱅크스'를 하며 멈추기 쉬운 집이 눈에 띄는 데 관심을 두고 시뮬레이션을 해 주차의 편의성을 계산했다. 환경은 아이폰의 파이토후니스타에서 진행된다. 출전: 결과만 알고 싶은 사람을 위해 먼저 실행 ...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.