미로 생성 25*25 격자가 콘솔창에 출력 되지 않고 있습니다.. 1.Board 코드 ***************************************************************************** using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace C__알고리즘_6_플레이어_이동 { class Board { const char CIRCLE = '\u25cf'; public TileType[,] Tile { get; private set; } //배열 public int Size { get; private set; } public int DestY { get; private set; } public int DestX { get; private set; } Player _player; public enum TileType { Empty, Wall, } public void Initialize(int size, Player player) { if (size % 2 == 0) return; _player = player; Tile = new TileType[size, size]; Size = size; DestY = Size - 2; DestX = Size - 2; GenerateBySideWinder(); } public void GenerateBySideWinder() { // 일단 길을 다 막아버리는 작업 for (int y = 0; y < Size; y++) { for (int x = 0; x < Size; x++) if (x % 2 == 0 || y % 2 == 0) Tile[y, x] = TileType.Wall; else Tile[y, x] = TileType.Empty; } // 랜덤으로 우측 혹은 아래로 길을 뚫는 작업 // Binary Tree Algorithm Random rand = new Random(); for (int y = 0; y < Size; y++) { int count = 1; for (int x = 0; x < Size; x++) { if (x % 2 == 0 || y % 2 == 0) continue; if (y == Size - 2 && x == Size - 2) continue; if (y == Size - 2) { Tile[y, x + 1] = TileType.Empty; continue; } if (x == Size - 2) { Tile[y + 1, x] = TileType.Empty; continue; } if ( rand.Next (0, 2) == 0) { Tile[y, x + 1] = TileType.Empty; count++; } else { int ramdomIndex = rand.Next (0, count); Tile[y + 1, x - ramdomIndex * 2] = TileType.Empty; count = 1; } } } } public void Render() { ConsoleColor prevColor = Console.ForegroundColor; for (int y = 0; y < Size; y++) { for (int x = 0; x < Size; x++) { // 플레이어 좌표를 갖고 와서, 그 좌표랑 현재 y, x가 일치하면 플레이어 전용 색상으로 표시 if (y == player.PosY && x == player.PosX) Console.ForegroundColor = ConsoleColor.Blue ; else if(y == DestY && x == DestX) Console.ForegroundColor = ConsoleColor.Yellow; else Console.ForegroundColor = GetTileColor(Tile[y, x]); Console.Write(CIRCLE); } Console.WriteLine(); } Console.ForegroundColor = prevColor; } ConsoleColor GetTileColor(TileType type) { switch (type) { case TileType.Empty: return ConsoleColor.Green ; case TileType.Wall: return ConsoleColor.Red ; default: return ConsoleColor.Green ; } } } } ***************************************************************************** 2. Player 코드 using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace C__알고리즘_6_플레이어_이동 { class Pos { public Pos(int y, int x) { Y = y; X = x; } public int Y; public int X; } class Player { public int PosY { get; private set; } public int PosX { get; private set; } Random _random = new Random(); Board _board; enum Dir { Up = 0, Left = 1, Down = 2, Right = 3 } int _dir = (int)Dir.Up; List<Pos> _points = new List<Pos>(); public void Initialize(int posY, int posX, Board board) { PosY = posY; PosX = posX; _board = board; // 현재 바라보고 있는 방향을 기준으로, 좌표 변화를 나타낸다. int[] frontY = new int[] { -1, 0, 1, 0 }; int[] frontX = new int[] { 0, -1, 0, 1 }; int[] rightY = new int[] { 0, -1, 0, 1 }; int[] rightX = new int[] { 1, 0, -1, 0 }; _points.Add(new Pos(PosY, PosX)); // 목적지 도착하기 전에는 계속 실행 while (PosY != board.DestY || posX != board.DestX) { // 1. 현재 바라보는 방향을 기준으로 오른쪽으로 갈 수 있는지 확인. if (_board.Tile[PosY + rightY[_dir], PosX + rightX[_dir]] == Board.TileType.Empty) { // 오른쪽 방향으로 90도 회전 dir = ( dir - 1 + 4) % 4; // 앞으로 한 보 전진. PosY = PosY + frontY[_dir]; PosX = PosX + frontX[_dir]; _points.Add(new Pos(PosY, PosX)); } // 2. 현재 바라보는 방향을 기준으로 전진 할 수 있는지 확인. else if (_board.Tile[PosY + frontY[_dir], PosX + frontX[_dir]] == Board.TileType.Empty) { // 앞으로 한 보 전진 PosY = PosY + frontY[_dir]; PosX = PosX + frontX[_dir]; _points.Add(new Pos(PosY, PosX)); } else { //왼쪽 방향으로 90도 회전 dir = ( dir + 1 + 4) % 4; } } } const int Move_TICK = 10; int _sumTick = 0; int _lastIndex = 0; public void Update(int deltaTick) { if (_lastIndex >= _points.Count) return; _sumTick += deltaTick; if(_sumTick >= Move_TICK) { _sumTick = 0; PosY = points[ lastIndex].Y; PosX = points[ lastIndex].X; _lastIndex++; } } } } ***************************************************************************** 3. Progarm 코드 namespace C__알고리즘_6_플레이어_이동 { internal class Program { static void Main(string[] args) { Board board = new Board(); Player player = new Player(); board.Initialize(25, player); player.Initialize(1, 1, board); Console.CursorVisible = false; const int WAIT_TICK = 1000 / 30; int lastTick = 0; while (true) { #region 프레임 관리 int currentTick = Environment.TickCount & Int32.MaxValue; // FPS 프레임 (60프레임 O 30프레임 이하 X) // 만약에 경과한 시간이 1/30초보다 작다면 if (currentTick - lastTick < WAIT_TICK) continue; int deltaTick = currentTick - lastTick; lastTick = currentTick; #endregion // 입력 // 로직 player.Update(deltaTick); // 렌더링 Console.SetCursorPosition(0, 0); board.Render(); } } } }
1 . RegisterGameplayTagEvent 델리게이트 질문 ASC->RegisterGameplayTagEvent(ABTAG_CHARACTER_INVINSIBLE, EGameplayTagEventType::NewOrRemoved).AddUObject(this, &UABGASHpBarUserWidget::OnInvisibleTagChanged); 다음 코드를 다음과 같이 이해했는데 맞을까요? INVINSIBLE 태그가 GE에 부착(count+1)되거나 탈착(count-1)될때 알림을 주는 델리게이트. 기본 count=0 2.Pre/PostGameplayEffectExecute 함수 질문 저는 이 함수가 ApplyGameplayEffectSpecTo~함수로 GE를 실행시키기 직전이랑 직후에 호출되는 걸로 알고 있습니다. PreGameplayEffectExecute 함수는 게임 플레이 이팩트 적용 전에 호출된다고 들었는데요. 하지만 확인해본 결과 ,공격할 때 게임 플레이 이팩트가 실행되어 DamageAttritbute값이 Modifier연산을 통해 30으로 변경된 이후에PreGameplayEffectExecute 함수가 호출되었습니다. "게임 플레이 이팩트 적용 전" 이란 말이 GE를 실행하기 직전, 즉 Modifier연산이 아직 되기 전으로 이해하고 있었는데 이게 아닌가요? PreGameplayEffectExecute와 PostGameplayEffectExecute의 정확한 차이가 뭔지 햇갈립니다. 그리고 GE_AttackHitBuff 가 발동하면 Pre/PostGameplayEffectExecute 함수가 호출되는지 테스트를 해봤는데 제 생각과는 다르게 호출이 안됩니다. (Data.EvaluatedData.Attribute == GetAttackRadiusAttribute()) 이런식으로 조건문을 넣어서 디버깅을 했는데 전혀 들어오지를 않네요.GE_AttackHitBuff도 다른 GE와 마찬가지로 Pre/PostGameplayEffectExecute 함수에 들어와야 정상아닌가요? 3 . 중첩 버프 질문 instant는 Base값을 변경하지만, 기간형은 Current값을 변경한다고 들었는데요. AttackRaius의 Base값이 50이고 Current값은 0 으로 시작해서, 공격할수록 Current에 +15씩 증가해 Base값을 직접 수정하지 않고 Current 값만 증가시켜서 어떻게 범위를 키우는 거죠? Base값은 아예 안쓰고 하나요? 내부적으로 어떻게 돌아가는지 좀 햇갈립니다. 그리고 Duration과 Stack 에 대해 다음과 같이 이해했는데 이게 맞을까요? Duration을 2초로 했을 때, 2초가 지나기 전에 공격해서 다시 한번 GE를 동작시키면 2초로 다시 리셋되고 스택이 쌓이는데, 2초를 놓칠경우 Current값이 처음으로 돌아와서 범위가 기본으로 리셋된다.
혹시 Transfer Data service ($36)에서 ECU단에서 CAN missing packet이 발생할 경우 해당 block sequence counter 를 재전송하는 recovery mechanism을 UDS에 있나요? 아그리고 padding byte의 경우에는 만약 ISOTP의 경우에는 FF가 아니라 0xCC로 해야하는 것인가요? 아니면 UDS에서 0xFF로 padding 을 권유하는 것인가요?
강사님 제가 개인프로젝트에서 따로 지금 만들고 있는데 강사님과 같이 ELB를 순서대로 등록했습니다. 아직 보안그룹 설정 및 헬스 체크까지 했는데 기존의 코드에 헬스체크를 넣어놔서 (/health-check) 밑 줄과 같이 DNS이름에 /health-check를 붙여서 넣었더니 [ 503 Service Temporarily Unavailable ] 라고 뜨더라고요. 제가 3000번 포트를 사용하고 있어서 잘못하였나 대상 그룹에 들어가서 보니 아래와 같이 나오고 있습니다. 아직 HTTPS를 받기 위한 인증서를 안받았는데 그래서 그런건가요???
강의 내용 외 개인적인 실습 사이트의 질문은 답변이 제공되지 않습니다. 문제가 생긴 코드, 에러 메세지 등을 꼭 같이 올려주 셔야 빠른 답변이 가능합니다. 코드를 이미지로 올려주시면 실행이 불가능하기 때문에 답변이 어렵습니다. 답변은 바로 제공되지 않을 수 있습니다. 실력 향상을 위해서는 직접 고민하고 검색해가며 해결하는 게 가장 좋습니다.
학습하는 분들께 도움이 되고, 더 좋은 답변을 드릴 수 있도록 질문 전에 다음을 꼭 확인해주세요. 1. 강의 내용과 관련된 질문을 남겨주세요. 2. 인프런의 질문 게시판과 자주 하는 질문(링크)을 먼저 확인해주세요. (자주 하는 질문 링크: https://bit.ly/3fX6ygx) 3. 질문 잘하기 메뉴얼(링크)을 먼저 읽어주세요. (질문 잘하기 메뉴얼 링크: https://bit.ly/2UfeqCG) 질문 시에는 위 내용은 삭제하고 다음 내용을 남겨주세요. ========================================= [질문 템플릿] 1. 강의 내용과 관련된 질문인가요? (예/아니오) 2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? (예/아니오) 3. 질문 잘하기 메뉴얼을 읽어보셨나요? (예/아니오) [질문 내용] 안녕하세요. 네트워크 프로그램6 - 자원 정리 를 복습하다가. 질문을 드립니다. 어제 네트워크 네트워크 프로그램 들을 복습하면서 혼자 만들어 보면서 따라하다가 어찌하다 보니 사진 처럼 SessionV4 필드에 private DataInputStream input; private DataOutputStream output; run()에서 객체를 생성하게 되었습니다. 그래서 이것을 코드들에 적용 시켜보자 하다가 이 코드가 나왔습니다. 그래서 질문은 이렇게 코드를 SessionV6에서 짜도 되는 지가 질문입니다. 아니면 영한님 처럼 생성자 에서 전부다 생성하고 초기화 하는게 맞는지 알고 싶습니다. 답변 부탁드립니다.
F11을 눌러서 확인 했을 때 public void GenerateBySideWinder() { // 일단 길을 다 막아버리는 작업 for (int y = 0; y < Size; y++) { for (int x = 0; x < Size; x++) if (x % 2 == 0 || y % 2 == 0) Tile[y, x] = TileType.Wall; else Tile[y, x] = TileType.Empty; } 이 부분에서 무한루프를 돌고 있습니다 아래는 전체 코드입니다. using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace C__알고리즘_6_플레이어_이동 { class Board { const char CIRCLE = '\u25cf'; public TileType[,] Tile { get; private set; } //배열 public int Size { get; private set; } public int DestY { get; private set; } public int DestX { get; private set; } Player _player; public enum TileType { Empty, Wall, } public void Initialize(int size, Player player) { if (size % 2 == 0) return; _player = player; Tile = new TileType[size, size]; Size = size; DestY = Size - 2; DestX = Size - 2; GenerateBySideWinder(); } public void GenerateBySideWinder() { // 일단 길을 다 막아버리는 작업 for (int y = 0; y < Size; y++) { for (int x = 0; x < Size; x++) if (x % 2 == 0 || y % 2 == 0) Tile[y, x] = TileType.Wall; else Tile[y, x] = TileType.Empty; } // 랜덤으로 우측 혹은 아래로 길을 뚫는 작업 // Binary Tree Algorithm Random rand = new Random(); for (int y = 0; y < Size; y++) { int count = 1; for (int x = 0; x < Size; x++) { if (x % 2 == 0 || y % 2 == 0) continue; if (y == Size - 2 && x == Size - 2) continue; if (y == Size - 2) { Tile[y, x + 1] = TileType.Empty; continue; } if (x == Size - 2) { Tile[y + 1, x] = TileType.Empty; continue; } if ( rand.Next (0, 2) == 0) { Tile[y, x + 1] = TileType.Empty; count++; } else { int ramdomIndex = rand.Next (0, count); Tile[y + 1, x - ramdomIndex * 2] = TileType.Empty; count = 1; } } } } public void Render() { ConsoleColor prevColor = Console.ForegroundColor; for (int y = 0; y < Size; y++) { for (int x = 0; x < Size; x++) { // 플레이어 좌표를 갖고 와서, 그 좌표랑 현재 y, x가 일치하면 플레이어 전용 색상으로 표시 if (y == player.PosY && x == player.PosX) Console.ForegroundColor = ConsoleColor.Blue ; else if(y == DestY && x == DestX) Console.ForegroundColor = ConsoleColor.Yellow; else Console.ForegroundColor = GetTileColor(Tile[y, x]); Console.Write(CIRCLE); } Console.WriteLine(); } Console.ForegroundColor = prevColor; } ConsoleColor GetTileColor(TileType type) { switch (type) { case TileType.Empty: return ConsoleColor.Green ; case TileType.Wall: return ConsoleColor.Red ; default: return ConsoleColor.Green ; } } } }
undefined가 되지 않기 위해 바디파서를 사용해서 우리가 필요한 자료구조로 전달받을 수 있고 바디파서를 사용한다는 의미로 app.use(express.json()); app.use(express.urlencoded({ extended: true })); 이 코드를 추가를 해주셨습니다. 궁금해서 app.use(express.urlencoded({ extended: true })); 를 주석처리하고 실행한 결과 그래도 정상 작동이 됩니다 app.use(express.json()); 이 부분을 주석처리하고 하면 undefined가 아닌 {} 빈 json을 전달 받습니다 각각 저 코드들이 하는 역할이 궁금합니다
안녕하세요. 선생님. 문제는 다 이해가 됐는데 코드 시간때문에 질문 올립니다. void make1(int num, vector<int>& pSum, map<int, int>& pCount) { for (int interval = 1; interval < num; interval++) // 피자 조각을 몇 개를 더 이어서 고를 것인지, 전부 선택은 제외 { for (int start = interval; start <= num + interval - 1; start++) { int sum = pSum[start] - pSum[start - interval]; pCount[sum]++; } } pCount[pSum[num]]++; // 전부 선택하는 경우 } void make2(int num, vector<int>& pSum, map<int, int>& pCount) { for (int start = 1; start <= num; start++) // 첫번째부터 출발 { for (int interval = 0; interval < num - 1; interval++) // 피자 조각을 몇 개를 더 이어서 고를 것인지, 전부 선택은 제외 { int tPSum = pSum[start + interval] - pSum[start - 1]; // 사이즈 pCount[tPSum]++; // 해당 사이즈 카운트 추가 } } pCount[pSum[num]]++; // 전부 선택하는 경우 } make1함수를 사용시 840ms정도 걸리고, make2함수 사용시 480ms정도 걸립니다. 왜 이럴까요...? 챗 지피티는 메모리 접근이 순차적이지만, '일정한 간격 유지'가 '인덱스 하나 고정 + 순차 증가'보다 cpu 캐시 히트가 더 유리해서 라는데, 혹시 제가 놓치고 있는 부분이 없을까요?
메모리 가시성에 대한 그림 예시에는 코어가 2개인 멀티 코어로 되어있어서 싱글코어인 상황도 궁금해졌습니다. 코어당 캐시 메모리가 있으니까 여러 스레드들이 같은 캐시 메모리에 접근하므로 메모리 가시성 문제가 발생하지 않을 것 같은데 , 싱글 코어에서도 가시성 문제가 발생하는지 궁금합니다.
안녕하세요~ 강의 잘 보고 있습니다! Target의 value에 Object 자료형을 사용하는 대신 public abstract T value { get; } 이런식으로 제네릭을 사용할 수도 있었을텐데, 혹시 따로 의도한게 있으신지 궁금합니다. 박싱/언박싱 성능 관련해서는 다른 Q&A보고 이해했습니다! 감사합니다!
안드로이드 설정 과정이 전체가 약간 헷갈려있게 되어있는 것 같아서,,, 이게 맞는지 궁금해서 남깁니다 npm i react-native-splash-screen --save 을 통해서 npm을 설치한다 앱로고와 스플래시 화면을 준비해준다 아래 사이트에서 앱 로고를 만들어준다 EasyAppIcon - Create Mobile App Icon 앱 아이콘들을 android폴더에 넣어준다 android/app/src/main/res의 아래에 mipmap-hdpi~로 시작하는 파일들에 이름에 맞춰서 앱 아이콘들을 넣어준다 스플래시 화면(아마도 이미지)을 android/app/src/main/res/drawable폴더에 넣어준다 반드시 launch_screen이라는 이름으로 넣어준다 -> launch_screen.png android/setting.gradle에 가서 아래처럼 설정해준다 include ':react-native-splash-screen' project(':react-native-splash-screen').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-splash-screen/android') android/app/build.gradle (113번 줄) implementation project(':react-native-splash-screen') android/app/src/main/java/com/coin/MainActivity.kt에 7번째 줄에 import android.os.Bundle; import org.devio.rn.splashscreen.SplashScreen; android/app/src/main/java/com/coin/MainActivity.kt에 12~15번째 줄에 override fun onCreate(savedInstanceState: Bundle?) { SplashScreen.show(this) super.onCreate(null) } . . . /Main Application .kt (14번 줄)에 import org.devio.rn.splashscreen.SplashScreenReactPackage . . . /Main Application .kt (24번 줄)에 SplashScreenReactPackage() 스플래시 화면을 숨겨주기 위해 App.tsx에 아래 내용을 추가해준다 useEffect(() => { setTimeout(() => { SplashScreen.hide(); }, 500); }); // 의존성 배열 없음 - 매 렌더링마다 실행됨 values.colors.xml파일을 만들어서 아래 내용을 추가해준다 <?xml version="1.0" encoding="utf-8"?> <resources> <!-- 다른 색상들이 있다면 유지하세요 --> <color name="status_bar_color">#000000</color> <!-- 원하는 색상 코드로 변경 가능 --> </resources> 질문1. 잘 나오는 것 같기는 한데 총 과정이 이게 맞을까요? 질문2. 그리고 스플래시화면이 뜨기 전에 앱 로고가 전체적으로 뜨고(흰바탕에 설정한 앱 로고가 중앙에 작게 나옴) 스플래시 화면이 뜨는데 원래 이런거 맞나요? 질문3. 그리고 values/colors.xml파일은 왜 설정해주는 건가요?