https://github.com/david-rodden/hashscript-example
Example of HashScript implemented through RSPeer's API
https://github.com/david-rodden/hashscript-example
Last synced: 11 months ago
JSON representation
Example of HashScript implemented through RSPeer's API
- Host: GitHub
- URL: https://github.com/david-rodden/hashscript-example
- Owner: David-Rodden
- Created: 2020-03-30T01:44:11.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-03-30T01:57:02.000Z (over 6 years ago)
- Last Synced: 2025-05-31T09:46:53.134Z (about 1 year ago)
- Language: Java
- Size: 3.91 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
**HashScript Concept**
The intention of a HashScript is to find a separate data structure for quick and easy location & execution of tasks within a script.
A HashScript's key/value pair is as follows:
- A key comprising a player's state defined with certain binary attributes
- Eg. Within a certain area, wearing certain armor, has a full inventory, etc.
- A value represented as the HashNode which has the code to execute a certain task.
Naturally, multiple keys (or states) can be mapped to a single value.
As such, the user can define however many states there can be for a specific task to execute.
Through this barebones implementation, the pros & cons are as follows:
_Pros_
- Provides an O(1) method of finding a task and executing it during runtime.
- Lets user know if there is a conditional overlap, as an IllegalStateException would be thrown
_Cons_
- Depending on approach, can have a lot of conditional overhead
- Eg. Writing out every single permutation for a current player's status