Skip to content

pcbrom/amazeR

Repository files navigation

amazeR (a maze R)

mazeR.R

generate_results_doSNOW.R

  • Purpose: To simulate a player's random step in the maze.

Objects of interest

  • N: Total number of simulations.
  • xx e yy: Board size.
  • ini: Initial game conditions (simple random sampling without replacement).
  • first_plot: Starting plot of the board.
  • results: Outputs of the simulations already organized to be used in Machine Learning.
  • game: Conditions played.

Game example

  • Red: Player's position.
  • Green: Entrance to the maze.
  • Blue: Exit the maze.

maze

Output example

game results

amazeR_functions.R

Functions:

get_game(nb, input, exit, position)

  • Purpose: To create the maze by adding input, output and position of the player.
  • nb: Simplified maze board.
  • input: Coordinate of entrance of the labyrinth.
  • exit: Coordinate of exit from the labyrinth.
  • position: Character's current position.
  • Inside get_game() has fobj(), an objective function, which scores the reward.

get_result_state(results)

  • Purpose: To organize game information.
  • results: Collection of some matches for the same board.

plot_maze(board_cells, input, exit, boxes)

  • Purpose: Plot the game using ggplot. In the generated graph the lines are in reverse coordinate of the board. X axis represents columns and y axis lines.
  • board_cells: Board generated by mazeR.R.
  • entrance: Coordinate of entrance of the labyrinth.
  • exit: Coordinate of exit from the labyrinth.
  • boxes: Matrix containing valid coordinates in random walk.

plot_update(first_plot, position)

  • Purpose: Update the player's position on the graph.
  • first_plot: Object that stores the first plot_maze().
  • position: Player's current position.

get_pos(position)

  • Purpose: Returns the current position.

get_moves(position, nb)

  • Purpose: Given the current position, return the possible movements.
  • position: Character's current position.
  • nb: Simplified maze board.

nb_update(nb, input, exit, position)

  • Purpose: Update the player's position on the board.
  • nb: Simplified maze board.
  • input: Coordinate of entrance of the labyrinth.
  • exit: Coordinate of exit from the labyrinth.
  • position: Character's current position.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages