Python programming and analysis

Tests your Python skills and capacity to plan a statistical analysis. You need to develop a simple game consisting of a rectangular grid (of size height x width) where each cell has a random value between 0 and n. An agent starts at the upper-left corner of the grid and must reach the lower-right corner of the grid as fast as possible. Accordingly, the task consists of finding the shortest path.

There are two game modes:
⦁ The time spent on a cell is the number on this cell
• The time spent on a cell is the absolute of the difference between the previous cell the agent was on and the current cell it is on

– The task is divided in the following parts:

– Implementation of the game. Implement the game in a structured and flexible way to allow the selection of game modes and parameters. Build a method to build and visualize the grid filled with random numbers. Build a method to visualise a path. (30%)

– Develop your own heuristic algorithm. Identify simple criteria and strategies to find short paths. This algorithm should be taken as a baseline. It does not have to be optimized to perform fast or well, but should be better than random movements. Please implement this part without searching for standard algorithms to find short paths. (10%)

– Implement the Dijkstra’s algorithm to find the shortest path between two points. There are many refined versions of this algorithm that you can find in the literature. Implement a simple version close to the original algorithm, using a simple priority queue. Write your own code as much as possible and provide detailed comments of each step. Relying on more sophisticated implementations available online is not the objective of the task, but to be able to write your own code. (30%)

– Plan and implement a statistical analysis to characterize the length of the shortest path in dependence of several parameters of the grid and comparing the two game modes. Relevant parameters are size of the grid, distribution from which cell numbers are generated, etc. (30%)

You can use the built-in libraries of python (math, random, …), numpy, and matplotlib.