잠을 잘 못잤는지 어깨가 빠질거 같다 ;ㅁ;
견뎌~.. 견뎌...!
못견뎌..털썩 ㅇ<-<
const int LENGTH10 = 10;
const int LENGTH30 = 30;
public static void AlignmentPrint(string[] text, int type)
{
int idx = 0;
while (idx < text.Length)
{
string curStr = text[idx];
switch (idx)
{
case 0:
Console.Write($" {curStr, -LENGTH10}");
break;
case 1:
Console.Write(" ");
int length = curStr.Length + 8;
if (type == 0) Console.Write("방어력 "); else Console.Write("공격력 ");
("+").PrintWithColor(ConsoleColor.Yellow, false);
curStr.PrintWithColor(ConsoleColor.Magenta, false);
while (12 - length >= 0)
{
Console.Write(" ");
length++;
}
break;
case 2:
Console.Write($" {curStr, -LENGTH30}");
break;
case 3:
bool isSoldOut = (curStr == "구매 완료");
(" " + curStr).PrintWithColor(isSoldOut ? ConsoleColor.Yellow : ConsoleColor.Magenta, false);
if (!isSoldOut) Console.Write(" G");
break;
}
if (idx != text.Length - 1) ("|").PrintWithColor(ConsoleColor.Yellow, false);
idx++;
}
}
// 플레이어의 현재 아이템 인벤토리 상태를 보여주는 함수
// type이 0이면 인벤토리, type이 1이면 인벤토리 - 장착 관리 상태
public void DisplayItemInventory(int type)
{
Console.WriteLine("[ 아이템 목록 ]");
int idx = 1;
foreach (Item item in itemList)
{
// 아이템 이름
(" -").PrintWithColor(ConsoleColor.Yellow, false);
// 장착 관리 상태일 경우 번호 표시
if (type == 1) (" " + idx.ToString()).PrintWithColor(ConsoleColor.Magenta, false);
if (item.IsEquipped) Console.Write(" [E] ");
Extension.AlignmentPrint(new string[] { item.Name, item.Value.ToString(), item.Description }, item.Type);
Console.WriteLine();
idx++;
}
}
저녁 먹고 알고리즘 문제 쪼끔 풀어봤다
맨날 자바로 풀다가 C#으로 풀려니 약간 어색하려나 했는데 다행히도 둘이 비슷해서 딱히 어려움은 없었다
일단은 내배캠 노션에 있는 문제 리스트부터 다 풀어보기로 했는데 완전 기초부터 있어서 빨리 풀고 지나가는게 나을듯!!
static class Solution
{
public static int solution(int num1, int num2)
{
return (int)(num1 / num2);
}
}
public class Solution
{
public static int solution(int[] array)
{
int answer = 0;
Dictionary<int, int> countNum = new Dictionary<int, int>();
foreach (int i in array)
{
int num = 0;
if (countNum.TryGetValue(i, out num))
{
countNum[i] += 1;
}
else countNum.Add(i, 1);
}
int count = 0;
int max = -1;
foreach(KeyValuePair<int, int> entry in countNum)
{
if (entry.Value > max)
{
max = entry.Value;
answer = entry.Key;
count = 0;
}
else if (entry.Value == max) count++;
}
return (count == 0) ? answer : -1;
}
}
public class Solution
{
public static int[] solution(int[] numbers)
{
int[] answer = new int[numbers.Length];
for (int i = 0; i < numbers.Length; i++)
{
answer[i] = numbers[i] * 2;
}
return answer;
}
}
public class Solution
{
public static int[] solution(int[] num_list)
{
int[] answer = new int[num_list.Length];
for (int i = 0, j = num_list.Length - 1; i < num_list.Length; i++, j--)
{
answer[i] = num_list[j];
}
return answer;
}
}
오늘 공부는 여기까지!!!
더 하고싶지만 어깨가 바스라질거 같다 X_X
개인 과제로 Firebase 통신도 해보고 싶었는데 아직은 쫌 더 공부해야 될 것 같다!!!
난 왜 이렇게 이게 헷갈리지~~~
암튼 끗 ~.~