Git Product home page Git Product logo

ctw-progress_tree's Introduction

#Progress Trees

This is a library to help implement advancement trees, such as talent trees or research trees.

Licensed under version 2.1 of the LGPL, or any later version.

API

Functions

progress_tree.new_tree() - Creates an empty tree
progress_tree.new_player_data(tree[, learned]) - Creates an instance of player advancement data in a particular progress tree. The optional argument is a set of node names to start off with.
progress_tree.deserialize_player_data(tree, learned_string) - Deserializes player data in relation to a particular tree.

Progress Tree Methods

add(node_name, parents) - Adds a new node with the name node_name. parents is a list of parent node names, which must already exist in the tree (or you will get an error).
new_player_data(learned) - Method version of progress_tree.new_player_data
deserialize_player_data(learned_string) - Method version of progress_tree.deserialize_player_data

Player Data Methods

serialize() - Serializes the data to a string
knows(node_name) - Determines if the player has learned the node
can_learn(node_name) - Determines if the player has completed the prerequisites for the node
learn(node_name) - Adds the given node to the known nodes. It can fail and return false if the node doesn't exist in the tree, or if it has already been learned, but will return true if nothing goes wrong. It will not fail if not all prerequisites have been completed, though.

ctw-progress_tree's People

Contributors

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