Code Monkey home page Code Monkey logo

oxag-ai-j's Introduction

Oxidizing Agents AI - j

This is a simple yet functional AI for the oxidizing agents robot.

Tools & Libraries

  • charting tools by do not panic!()
  • worldgen_unwrap by .unwrap().unwrap().unwrap() (bin only)
  • priority-queue
  • log for better logging
  • env_logger (bin only)
  • rand

Logic

These ai uses a priority queue (PQ) for storing tasks to perform.
A task is formed by an identifier and contains coordinates for the target tile of the task.

Each task obviously has a priority indicator since it's stored in a priority queue.
Priorities are:

  • destroy_fire: P1
  • destroy_garbage: P2
  • put_garbage_in_bin: P3

The ai also stores a current_task in its state to know what task should be performed at each tick, expetially when energy is missing to perform all calculations and the task in the same process tick.

On each process tick the ai performs the following actions:

  1. Detect: scan for near content using either robot_view or one_direction_view (this has some randomness and some logic related to the energy level of the robot)
    |--> found fire: insert in PQ with P1
    |--> found garbage: insert in PQ with P2
    |--> found bin: check whether the robot has garbage to put, if so insert in PQ with P3
    |--> found teleport: store in charted_map tool
  2. Determine current_task: checks whether the current_task is set, if not pops the queue to get the task with most priority and sets it to the current_task
  3. Execute: navigate to coordinates and execute the task. If the current_task is missing (meaning the queue was empty) then the robot will call the go function to move trough the map in a random way, still avoiding to go back to where it came from most of the times (it might also use teleports when elegible).
  4. Completion: if task is completed, then set the current_task to None, otherwise it will be continued in the following process tick.

Example

A fully functional project is present in the /bin folder.

Real-time monitoring

Considering making a web server with HTMX for the frontend and websockets to allow viewing the performed tasks in real-time.

oxag-ai-j's People

Contributors

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