generated from mwc/lab_retro
49 lines
1.4 KiB
Python
49 lines
1.4 KiB
Python
from retro.game import Game
|
|
from random import sample
|
|
from player import Player
|
|
from wall import Wall
|
|
|
|
def board_edges(board_size):
|
|
x,y = board_size
|
|
positions = []
|
|
top = [(i,0) for i in range(x)]
|
|
bottom = [(i,y-1) for i in range(x)]
|
|
left = [(0,j) for j in range(1,y-1)]
|
|
right = [(x-1,j) for j in range(1,y-1)]
|
|
return top + bottom + left + right
|
|
|
|
def inner_board(board_size):
|
|
x,y = board_size
|
|
positions = []
|
|
for i in range(1,x-1):
|
|
for j in range(1,y-1):
|
|
positions.append((i,j))
|
|
return positions
|
|
|
|
def level_one(board_size):
|
|
x,y = board_size
|
|
positions = []
|
|
for i in range(1,x-1):
|
|
for j in range(1,y//4):
|
|
if i <= x // 4 or i >= x - (x // 4):
|
|
positions.append((i,j))
|
|
for i in range(1,x//4):
|
|
for j in range((y - (y // 4)), y-1):
|
|
positions.append((i,j))
|
|
|
|
# for i in range(1,x-1):
|
|
# for j in range(1,y-1):
|
|
# if i >=4 and i <= 7 or i >= 13 and i <= 16:
|
|
# if j >= 4 and j <= 7 or j >= 13 and j <= 16:
|
|
# positions.append((i,j))
|
|
return positions
|
|
|
|
def level_two(board_size):
|
|
x,y = board_size
|
|
positions = []
|
|
for i in range(1,x-1):
|
|
for j in range(1,y-1):
|
|
if i >=4 and i <= 7 or i >= 13 and i <= 16:
|
|
if j >= 4 and j <= 7 or j >= 13 and j <= 16:
|
|
positions.append((i,j))
|
|
return positions |