All Projects → exane → utility-ai

exane / utility-ai

Licence: MIT License
A small Utility Ai Framework

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to utility-ai

goto
Goto - The Good Way to Program
Stars: ✭ 14 (-12.5%)
Mutual labels:  utility
SimpleCore
.NET C# common/utilities library
Stars: ✭ 11 (-31.25%)
Mutual labels:  utility
multipurpose-bot
a multipurpose discord bot made with dbd.js
Stars: ✭ 32 (+100%)
Mutual labels:  utility
vscode-jump
🏃‍♂️ Jump/Select to the Start/End of a word in VSCode
Stars: ✭ 67 (+318.75%)
Mutual labels:  utility
chai
Don't let your Mac fall asleep, like a sir
Stars: ✭ 54 (+237.5%)
Mutual labels:  utility
ExecutionMaster
Windows utility for intercepting process creation and assigning standard actions to program startup
Stars: ✭ 54 (+237.5%)
Mutual labels:  utility
couchbackup
CouchDB backup and restore command-line utility.
Stars: ✭ 15 (-6.25%)
Mutual labels:  utility
go-tools
A utility tool library of Golang.
Stars: ✭ 44 (+175%)
Mutual labels:  utility
task-completed-checker-action
☑️ A GitHub action that checks if all tasks are completed in the pull requests.
Stars: ✭ 30 (+87.5%)
Mutual labels:  utility
Hytilities
Hypixel-focused Quality of Life mod.
Stars: ✭ 53 (+231.25%)
Mutual labels:  utility
missing
A utility library for Clojure of functions and macros that complement clojure.core
Stars: ✭ 26 (+62.5%)
Mutual labels:  utility
EnhanceDiskUtility
SIMBL plugin for Disk Utility that aims to enable Verify / Repair Permissions support
Stars: ✭ 17 (+6.25%)
Mutual labels:  utility
proxy-pants
Secured and reliable Proxy based utilities for more or less common tasks.
Stars: ✭ 36 (+125%)
Mutual labels:  utility
to-no-case
Remove an existing case from a string.
Stars: ✭ 15 (-6.25%)
Mutual labels:  utility
powerlet
⚡️ Chrome Extension to quickly find and run bookmarklets
Stars: ✭ 17 (+6.25%)
Mutual labels:  utility
po-util
Classic Edition of po-util: The Ultimate Local Particle Experience for Linux and macOS
Stars: ✭ 51 (+218.75%)
Mutual labels:  utility
oc-bootstrapper
Easily bootstrap a new October CMS project
Stars: ✭ 86 (+437.5%)
Mutual labels:  utility
lpk
Find go projects/packages in your GOPATH
Stars: ✭ 13 (-18.75%)
Mutual labels:  utility
react-component-pack
Library that allows you to create context provider groups
Stars: ✭ 32 (+100%)
Mutual labels:  utility
vimclip
Never type outside vim again
Stars: ✭ 70 (+337.5%)
Mutual labels:  utility

Build Status npm version


Utility Ai

A small Utility Ai Framework

Install

npm install utility-ai
yarn add utility-ai

Usage

  const UtilityAi = require("utility-ai")

  utility_ai = new UtilityAi

  // define your actions e.g "Move to Enemy", "Fire at Enemy", "Move to Cover", "Reload Gun"
  utility_ai.addAction("Move to Enemy", action => {

    // pre-conditions for actions, if not fulfilled all actions will be skipped
    action.condition(({ player }) => {
      if (player.isStuck()) {
        return false
      }

      // explicit return of true needed to fulfill condition
      return true
    })

    // each score expects a number as return value, the higher the better the action will be weighted
    action.score("Distance to Enemy", ({ player, enemy }) => {
      return player.distanceTo(enemy)
    })

    action.score("Gun is not loaded", ({ player }) => {
      return player.gunEmpty() && -100
    })

  })

  utility_ai.addAction("Fire at Enemy", action => {

    action.score("Proximity to Enemy < 50", ({ player, enemy }) => {
      return player.distanceTo(enemy) < 50 && 75
    })

    action.score("Cannot make it to cover", ({ player }) => {
      return player.nextCoverDistance() > 25 && 50
    })

    action.score("Gun is not loaded", ({ player }) => {
      return player.gunEmpty() && -125
    })

  })

  utility_ai.addAction("Move to Cover", action => {

    action.score("Is not in cover", ({ player }) => {
      return !player.isInCover() && 50
    })

    action.score("Proximity to Cover < 50", ({ player }) => {
      return player.nextCoverDistance() < 50 && 50
    })

  })

  utility_ai.addAction("Reload Gun", action => {

    action.score("Gun is not loaded", ({ player }) => {
      return player.gunEmpty() && 75
    })

    action.score("Is in Cover", ({ player }) => {
      return player.isInCover() && 50
    })

    action.score("Gun is loaded", ({ player }) => {
      return !player.gunEmpty() && -125
    })

  })

  const data = {
    player: {...},
    enemy: {...}
  }

  // starts the evaluation of a given world state and returns its best action
  const result = utility_ai.evaluate(data)
  // e.g. result = { action: "Move to Cover", score: 100 }
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].