[JavaScript] 테트리스 웹 게임 만들기 (3) 블록 정의 및 렌더링
테트리스 웹 게임 만들기 (3) - 블록 정의 및 렌더링 1. 블록 정의 이제 블록의 모양을 지정할 차례이다. 정의하기 전에 좌표를 설정하기 위해서 블록들을 그렸다. 이후 아래와 같이 블록 객체에 각 블록의 이름을 지정해주고 블록의 위치인 2차원 배열을 할당해주었다. // js/block.js const blocks = { square: [ [ [0, 1], [0, 2], [1, 1], [1, 2], ], [ [0, 1], [0, 2], [1, 1], [1, 2], ], [ [0, 1], [0, 2], [1, 1], [1, 2], ], [ [0, 1], [0, 2], [1, 1], [1, 2], ], ], I: [ // ... ], L: [ // ... ], L2: [ // ... ], Z: [ // ...
2022. 2. 11.
[백준] 13460번 - 구슬 탈출 2 (파이썬)
# 구슬 탈출 2 from collections import deque import sys input = sys.stdin.readline # . # 0 R B => 빈칸, 장애물, 구멍, 빨간구슬, 파란구슬 N, M = map(int, input().split()) arr = [] red_x, red_y = 0, 0 blue_x, blue_y = 0, 0 for i in range(N): arr.append(list(input().strip())) for j in range(len(arr[i])): if arr[i][j] == 'R': red_x, red_y = i, j arr[i][j] = '.' elif arr[i][j] == 'B': blue_x, blue_y = i, j arr[i][j] = '..
2022. 2. 11.
[백준] 13459번 - 구슬 탈출 (파이썬)
# 구슬 탈출 from collections import deque import sys input = sys.stdin.readline # . # 0 R B => 빈칸, 장애물, 구멍, 빨간구슬, 파란구슬 N, M = map(int, input().split()) arr = [] red_x, red_y = 0, 0 blue_x, blue_y = 0, 0 for i in range(N): arr.append(list(input().strip())) for j in range(len(arr[i])): if arr[i][j] == 'R': red_x, red_y = i, j arr[i][j] = '.' elif arr[i][j] == 'B': blue_x, blue_y = i, j arr[i][j] = '.'..
2022. 2. 11.