Git Product home page Git Product logo

randomly-generated-maze's People

Contributors

alfro avatar fredster64 avatar

Watchers

 avatar

Forkers

alfro

randomly-generated-maze's Issues

Main Loop Cleanup

Need to reduce the amount of code in the main loop. This could be done by moving inline code into function calls, and placing these function calls in appropriate files.

Graph storage is messy

Should create a graph class for more efficient and well-organised storage of a graph. This could involve use of an adjacency matrix to store graph data.

This will help with implementing Dijkstra's algorithm, since this will be made easier by access to organised graph data. It will also improve the speed of graph searching and drawing.

Game is too hard

The opponent always moves in the optimal direction. This often makes the game impossibly difficult. Possible solutions are:

  • Add some extra edges to the maze upon its creation, in order to give the player more places to run
  • Implement some randomness in the movement of the opponent. Both the frequency of their moves and the direction could be variable.

game crashes

The following error occurs sometimes he game works.

Traceback (most recent call last):
File "Maze.py", line 14, in
main()
File "Maze.py", line 10, in main
gameLoop(gameEngine)
File "/home/itadmin/Desktop/DSA project/Randomly-Generated-Maze-master (1)/GameEngine.py", line 95, in gameLoop
self.opponent.currentDirection = getOpponentDirection(self.player.pos, self.opponent.pos, self.maze, opponentMoveCount )
File "/home/itadmin/Desktop/DSA project/Randomly-Generated-Maze-master (1)/MazeIncludes.py", line 177, in getOpponentDirection
return moveList[randint(0, 2)]
IndexError: list index out of range

Movement slows as game goes on

The movement of both game characters is quick and responsive in the early stages of the game. However, when the player is nearing the endpoint of the maze, gameplay slows down dramatically.

Maze creation is slow

For 10x10 mazes and above, creation and drawing is slow. This needs to be attended to.

NameError: name 's' is not defined

Branch: master
After creating the maze, the program throws an Exception:

  File "/home/alfro/projects/Randomly-Generated-Maze/Objects.py", line 138, in centre
    return v(0.5*(self.v1[0]+self.v2[0]), 0.5*(self.v1[1]+self.v2[1]), s)
NameError: name 's' is not defined

The function "centre" does not have an 's' variable, and neither is present as a global.

Full output:

pygame 1.9.4
Hello from the pygame community. https://www.pygame.org/contribute.html
Welcome to the maze!
You start in the top-left corner and can move left, right, up or down.
Please choose how long and wide you want the maze to be.
What length? 10
What width? 10
Would you like to play as a cat or a dog?
dog
Loading...
Traceback (most recent call last):
  File "Maze.py", line 14, in <module>
    main()
  File "Maze.py", line 9, in main
    gameEngine = GameEngine()
  File "/home/alfro/projects/Randomly-Generated-Maze/GameEngine.py", line 44, in __init__
    dm.drawMaze(self.maze, s, self.gameDisplay, self.surface)
  File "/home/alfro/projects/Randomly-Generated-Maze/Drawing_Maze.py", line 45, in drawMaze
    rotv1 = rot(pi/2, v1, centre(edgeToAdd))
  File "/home/alfro/projects/Randomly-Generated-Maze/Objects.py", line 138, in centre
    return v(0.5*(self.v1[0]+self.v2[0]), 0.5*(self.v1[1]+self.v2[1]), s)
NameError: name 's' is not defined

Python2: name 'cat' is not defined.

The game errors when selecting the character, if using Python 2.7. This is due to the use of "input()".

  File "/home/alfro/projects/Randomly-Generated-Maze/MazeIncludes.py", line 202, in getSprites
    answer = input()

This didn't take long to figure out, but maybe the README should have a note pointing that this is meant to be run on python 3

Full error (for completion's sake):

(venv2) ➜  Randomly-Generated-Maze master ✗ python Maze.py    
pygame 1.9.4
Hello from the pygame community. https://www.pygame.org/contribute.html
Welcome to the maze!
You start in the top-left corner and can move left, right, up or down.
Please choose how long and wide you want the maze to be.
What length? 20
What width? 20
Would you like to play as a cat or a dog?
cat
Traceback (most recent call last):
  File "Maze.py", line 14, in <module>
    main()
  File "Maze.py", line 9, in main
    gameEngine = GameEngine()
  File "/home/alfro/projects/Randomly-Generated-Maze/GameEngine.py", line 24, in __init__
    playerSpriteDict = getSprites(0)
  File "/home/alfro/projects/Randomly-Generated-Maze/MazeIncludes.py", line 202, in getSprites
    answer = input()
  File "<string>", line 1, in <module>
NameError: name 'cat' is not defined

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.