Make Unreal REAL.
article thumbnail
Level 0. 주사위 게임 2

Level 0. 주사위 게임 2 #include #include using namespace std; int solution(int a, int b, int c) { unordered_set uset; uset.emplace(a); uset.emplace(b); uset.emplace(c); if (uset.size() == 3) return (a + b + c); else if (uset.size() == 2) return (a + b + c) * (a*a + b*b + c*c); else return (a + b + c) * (a*a + b*b + c*c) * (a*a*a + b*b*b + c*c*c); }

article thumbnail
Level 0. 간단한 식 계산하기

Level 0. 간단한 식 계산하기 #include #include using namespace std; int solution(string binomial) { istringstream iss(binomial); int a, b; char op; iss >> a >> op >> b; switch (op) { case '+': return a + b; case '-': return a - b; case '*': return a * b; default: return 0; } }

article thumbnail
Level 0. ad 제거하기

Level 0. ad 제거하기 #include #include #include using namespace std; vector solution(vector strArr) { auto new_end = remove_if(strArr.begin(), strArr.end(), [](string& s) { return s.find("ad") != string::npos; }); strArr.erase(new_end, strArr.end()); return strArr; }

article thumbnail
Level 0. 9로 나눈 나머지

Level 0. 9로 나눈 나머지 #include #include using namespace std; int solution(string number) { return accumulate(number.begin(), number.end(), 0, [](int sum, int num) { return sum + num - '0'; }) % 9; }

article thumbnail
기본 무기 시스템 구현
게임 개발/<ARAG> 2023. 7. 1. 17:53

ARAG (A Really Awesome Game) Commit 76686 이번 작업 결과는 다음과 같다. [무기] 상속을 통해 기본 무기 시스템 구현 무기의 장착, 해제, 공격 구현 활, 검 무기 추가 이번 작업에서 느낀 점 👨‍💻👨‍💻👨‍💻 상속을 통해 베이스 클래스만 잘 만들어두면, 나중에 활용하기가 매우 편리하다. 어떤 클래스를 설계할 때 각 함수나 멤버 변수의 역할을 명확하게 하여 추상화하는 것이 중요한 것 같다. 델리게이트를 사용하면 다른 클래스 간 디커플링을 할 수 있지만, 사소한 부분에까지 남발할 필요는 없는 것 같다. Enhanced Input은 런타임 도중 Input Mapping Context를 교체하는 것만으로도 쉽게 입력을 변경할 수 있어 정말 유용한 것 같다. 이번 작업과 관련된..

article thumbnail
Level 0. 문자열 뒤집기

Level 0. 문자열 뒤집기 #include #include using namespace std; string solution(string my_string, int s, int e) { reverse(my_string.begin() + s, my_string.begin() + ++e); return my_string; }

검색 태그