GithubHelp home page GithubHelp logo

paint_bot's Introduction

README

Given the following directions:

Design an application that allows a robot to move around a square grid and paint the spaces it
passes over.
Requirements
• Grid: The application should have a square grid that is 10 x 10.
• Robot Movement: The robot should be able to move in four directions: up, down, left,
and right. The movement can be controlled by the user through interactive controls or
automated in different ways, such as predefined sequences of movements.
• Painting Spaces: As the robot moves over the spaces in the grid, it should paint each
space it passes over.
• User Interface: After the robot finishes moving, the program should display the following
information:
o The final location of the robot on the grid.
o The number of spaces painted by the robot.
• Bonus: Incorporate historical data with math into the application for statistical analysis.

I decided to implement a rake task that prints the grid of configurable size. When running the task the user can press a key and the program will recognize if it's a valid input. You may download the demo video from here that shows the functionality described below.

  • Moving the bot: The program allows to move the bot in the 4 different directions (w for moving up, s for moving down, a for moving left and d for moving right). Grid boundaries validation are in place. Screen Shot 2024-05-14 at 9 41 48 PM

  • Displaying historical data: Pressing the h key and then enter will display the historical data of Bot moves and program~task runs. Screen Shot 2024-05-14 at 9 42 01 PM

  • Exiting the task: Pressing the e key will exit the task and prints the final location of the robot and the number of spaces ~ moves painted by it.

Screen Shot 2024-05-14 at 9 42 10 PM

  • Database: The BotMove model was created to record moves of the bot. The model was created using the Rails rails generate model BotMove guid:string direction:string && bundle exec rails db:migrate generator.

  • How to run the task: bundle exec rake "paint_bot:play[10]" where 10 can be any number greater than 0.

paint_bot's People

Contributors

emilioborraz 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.