O84
Design Snake Game Simulation
Problem Statement & Objective
Design a Snake game that is played on a device with screen size height x width and food coordinates.
Function Signature (Python)
design_snake_game_simulation(width: int, height: int, foods: list, moves: list) -> list[int]Input & Output Contract
Output Rule:Her hamle sonrası skoru (-1 dahil) içeren tam sayı listesi.
System Constraints
1 <= genislik, yukseklik <= 1000
0 <= yemler.length <= 100
1 <= hamleler.length <= 1000Example Execution Walkthrough
genislik = 3, yukseklik = 2, yemler = [[1, 2], [0, 1]], hamleler = ['R', 'D', 'R', 'U', 'L', 'U']
(0,0) -> R -> (0,1): skor 0
(0,1) -> D -> (1,1): skor 0
(1,1) -> R -> (1,2): yem yendi -> skor 1
(1,2) -> U -> (0,2): skor 1
(0,2) -> L -> (0,1): yem yendi -> skor 2
(0,1) -> U -> (-1, 1): duvara çarptı -> -1Example Test Scenarios (3)
Example 1: Temel Oyun
Input:
[3,2,[[1,2],[0,1]],["R","D","R","U","L","U"]]Expected Output:
[0,0,1,1,2,-1]Example 2: İki Hamle
Input:
[2,2,[[0,1]],["R","D"]]Expected Output:
[1,1]Example 3: İlk Adımda Çarpma
Input:
[2,2,[],["U"]]Expected Output:
[-1]