I want to make a really simple maze game in Python. I need to use tkinter and GUI to make this happened.
Under you can see the description of the task, but i need help to getting startet. If there is an other easier way I'm just happy for the help!!
task Description:
You have to create a maze game. The goal of the game is to get out of the maze. The game should read The maze from a text file with the format specified below. . Here is an example of a file as specifies a maze:

Files that specify a maze should start with two numbers on each line. The numbers indicate the width and
the height of the maze. Sample file indicates that the maze should be 7 squares wide and 6 squares high. then
comes the labyrinth itself. Each line of text file is a row in the maze and each character in the text file marks
what should be included in a particular cell in the maze. The sign "#" marks a wall, an open space
marks once, "*" marks where the player starts and "-" marks the exit. An example of this
how the game may look based on sample file above is given below. The red circle is
the player, black squares are walls, green squares are times, and the yellow box is the exit. Note that yours
solution does not need to use these symbols.

assignments
a) Create classes for the three route types Wall, hall, and exit. hall corresponds to a regular route from the class under and a wall corresponds to an obstacle from the class under. If the player moves to the exit has the player won and the game to end.
b) Create a Class Player that stores the position of the player in the board
c) Create a GUI class showing the maze.
d) Create a method in the GUI class that reads in a text file (picture over with maze) and creates a two-dimensional array of
labyrinth routes based on the recorded file.
e) Create methods in the GUI class to move the player in the four directions up, down, right and
left.
f) Tie the events of the arrow keys to call the four methods from task e).
class Route:
def __init __ (self, position):
self.position = position
def move_here (self, player):
player.setScore (self.posisjon)
return (f's player moves to position {self.position} ')
def __repr __ (self):
return f'Route {self.position} '
class obstacle:
def __init __ (self, position):
self position = position
def move_here (self, player):
return (f'It is an obstacle in the way, so you stay on {self.position} ')
def __repr __ (self):
return (f' obstacle {self.position} ')
PLEASE HELP!!
Python CODE ::
![def move(self,w,h): 36 37 38 39 if self.check move (w,h): self.player[0]+h self.player[1]+w self.draw maze (self.cv) self.che](http://img.homeworklib.com/images/44fb6f4d-c3ba-4ca2-9889-83c65870210a.png?x-oss-process=image/resize,w_560)

Execution :


Python RAW CODE ::
____________________________Mazegame.py_________________________________
from tkinter import *
filename = "maze.txt"
class Maze:
def __init__(self):
self.read_maze(filename)
def read_maze(self,file):
Lines = [x.replace("\n","") for x
in open(file,'r').readlines()]
self.w = int(Lines.pop(0))
self.h = int(Lines.pop(0))
self.Maze = [list(x) for x in
Lines]
for h in range(self.h):
for w in
range(self.w):
if self.Maze[h][w] == '-':
self.Maze[h][w] == ' '
self.end = [h,w]
if self.Maze[h][w] == '*':
self.Maze[h][w] == ' '
self.player = [h,w]
def draw_maze(self,cv):
self.cv = cv
for h in range(self.h):
for w in
range(self.w):
obj = self.Maze[h][w]
if obj == '#':
cv.create_rectangle(w*50,h*50,(w+1)*50,(h+1)*50,fill='black')
elif self.end == [h,w]:
cv.create_rectangle(w*50,h*50,(w+1)*50,(h+1)*50,fill='yellow')
else:
cv.create_rectangle(w*50,h*50,(w+1)*50,(h+1)*50,fill='green')
h = self.player[0] ; w =
self.player[1]
x = (w+1)*50 - 25 ; y = (h+1)*50 -
25; r = 50/2
cv.create_oval(x-r, y-r, x+r, y+r,
fill='red')
def move(self,w,h):
if self.check_move(w,h):
self.player[0]
+= h
self.player[1]
+= w
self.draw_maze(self.cv)
self.check_win()
def check_move(self,w,h):
x = self.player[1] ; y =
self.player[0]
if 0 <= x+w < self.h:
if 0 <= y+h
< self.w:
if self.Maze[y+h][x+w] in [' ' ,'*' ,'-']
:
return True
else:
print("Obstacle")
return False
def check_win(self):
global mw
if self.player == self.end:
mw.destroy()
mw = Tk()
Button(mw,text='You Won', command=mw.destroy).pack(fill=X)
class Game:
def __init__(self,maze,window):
self.maze = maze
self.game =
self.create_game(window)
self.cv = Canvas(window,
width=maze.w*50, height=maze.h*50)
window.bind('<Left>',
left)
window.bind('<Right>',
right)
window.bind('<Up>', up)
window.bind('<Down>',
down)
self.cv.pack()
self.maze.draw_maze(self.cv)
def create_game(self,mw):
mw.title("Maze Game ..")
mw.geometry("%sx%s"%(self.maze.w*50,self.maze.h*50))
mw.resizable(0, 0)
mw.configure(background='black')
def up(event):
maze.move(0,-1)
def down(event):
maze.move(0,1)
def right(event):
maze.move(1,0)
def left(event):
maze.move(-1,0)
mw = Tk()
maze = Maze()
G = Game(maze,mw)
mw.mainloop()
************************************************************************************************************************
______________________________________maze.txt_______________________________________
7
6
#####-#
#*# # #
# # #
### # #
# #
#######
************************************************************************************************************************
You need to fill spaces in the path,


**********************************
YOU RATING MEANS A LOT : )
I want to make a really simple maze game in Python. I need to use tkinter and GUI to make this ha...
I need to complete the code by implementing the min function and the alpha betta pruning in order to complete the tic tac toe game using pything. code: # -*- coding: utf-8 -*- """ Created on: @author: """ import random from collections import namedtuple GameState = namedtuple('GameState', 'to_move, utility, board, moves') infinity = float('inf') game_result = { 1:"Player 1 Wins", -1:"Player 2 Wins", 0:"It is a Tie" } class Game: """To create a game, subclass this class and implement actions,...
Need help with Intro to Comp Sci 2 (Python) problem:
This is what is provided:
(Copy/Paste version):
from tkinter import Tk, Label, Entry, Button
from random import *
class Craps(Tk):
#set up the main window
def __init__(self, parent=None):
Tk.__init__(self, parent)
self.title('Play Craps')
self.new_game()
self.make_widgets()
#when a new game is started, the firstRoll will start at 0
def new_game(self):
self.firstRoll = 0
#create and place the widgets in the window
def make_widgets(self):
Label(self, text="Die 1").grid(row=0, column=0, columnspan=1)
Label(self, text="Die 2").grid(row=0,...
JAVA Program The Game This is a simple game played on a linear board with squares numbered from 0 to 100. The player starts at position 0, and the object of the game is to land on position 100 exactly. Objectives By the end of this program, the student will have demonstrated the ability to Write static methods Call a static method in another class Pass parameters to a method Return values from a method Write loops Write if statements...
9p
This is for Python I need help.
Pet #pet.py mName mAge class Pet: + __init__(name, age) + getName + getAge0 def init (self, name, age): self.mName = name self.mAge = age Dog Cat def getName(self): return self.mName mSize mColor + __init__(name, age,size) + getSize() + momCommento + getDog Years() +_init__(name, age,color) + getColor + pretty Factor + getCatYears def getAge(self): return self.mAge #dog.py import pet #cat.py import pet class Dog (pet. Pet): class Cat (pet. Pet): def init (self,...
Use of search structures! how can i make this program in python? Learning Objectives: You should consider and program an example of using search structures where you will evaluate search trees against hash tables. Given the three text files under containing the following: - A list of students (classes Student in the distributed code) - A list of marks obtained by the students (classes Exam results in the distributed code) - A list of topics (classes Subject in the distributed...
The Problem A robot is asked to navigate a maze. It is placed at a certain position (the starting position) in the maze and is asked to try to reach another position (the goal position). Positions in the maze will either be open or blocked with an obstacle. Positions are identified by (x,y) coordinates. At any given moment, the robot can only move 1 step in one of 4 directions. Valid moves are: ● Go North: (x,y) -> (x,y-1) ●...
Maze Solving with Stacks Problem Statement Consider a maze made up of rectangular array of squares, such as the following one: X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X Figure...
You will create a PYTHON program for Tic-Tac-Toe game. Tic-Tac-Toe is normally played with two people. One player is X and the other player is O. Players take turns placing their X or O. If a player gets three of his/her marks on the board in a row, column, or diagonal, he/she wins. When the board fills up with neither player winning, the game ends in a draw 1) Player 1 VS Player 2: Two players are playing the game...
For your Project, you will develop a simple battleship game. Battleship is a guessing game for two players. It is played on four grids. Two grids (one for each player) are used to mark each players' fleets of ships (including battleships). The locations of the fleet (these first two grids) are concealed from the other player so that they do not know the locations of the opponent’s ships. Players alternate turns by ‘firing torpedoes’ at the other player's ships. The...
******Java Programming Hi guys, I really need you help. I created a code for my java course, but it keep giving me error messages. Majority of my code is fine but some keep display error on my console. I was hoping someone could pin points the problem. .There are three classes with the testCenter class being the main class. In the following is the assignment, and the bottom is my code. Please help! Assignment: Concepts: GUI User Design Graphics Deployment...