GithubHelp home page GithubHelp logo

escapegame's Introduction

escapeGame

This is escapeGame using Java

A mouse is trying to escape from a maze where it starts moving from the top-left corner (0,0) to the exit in the bottom-right corner (6,6). It moves according to the following rules:

o The mouse has 40% chance to go forward along the same direction. o The mouse has 30% chance to turn left and 30% chance to turn right.
o The initial moving direction is indicated by the pointer. So, if the mouse chooses to go forward, it will reach (1,0) in the next step. o The new position must be within the boundaries of the maze. o The new position must not have been visited previously. o If the new position does not fulfil the criteria above, the mouse will try another move again. Every decision is independent of the others. o If the mouse reaches a dead-end - all directions are not enterable, it fails to leave the maze. o The mouse continues to move until it reaches the exit.

the Monte Carlo method to estimate the probability (P) of the mouse successfully escaping from the maze. The simulation should run one million times. Your program should print out the simulation results clearly and round the success rate P to 3 digits after the decimal point as follow:

The Monte Carlo simulation result of one million runs: No. of successful escape: 279451 Success Rate P: 0.279

The acceptable range of the success rate is 0.278 - 0.281 and the execution time should be less than 5 seconds.

escapegame's People

Contributors

lukluke avatar

Watchers

 avatar

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.