/*===========================================
            Plant and fireworks
              Martin Robinson
            L-systems iterator
===========================================*/

#pragma once
#ifndef lsys_deja
#define lsys_deja

#include <iostream>
#include <string>
#include <map>
#include <vector>

using namespace std;

typedef map<string,string> rule_t;

class Tree
{
    string _seed;                       //the whole Lsys base code
    string _tree;                       //the current tree with all iteration
    vector <rule_t> _rulez;             //list of rule set, vector of map , because there are several set of rules
    void _makeRule(string tmpRuleStr);  //extraction of individual rules
    
public:
    Tree();
    Tree(string );                      //constructor taking base Lsys code as string
    void init(string) ;
    void iterate(int, int);             //iterate one cycle, starting at index(default 0), with rule set number (default 0)
    const char operator [] (int);       //get character of _tree at given index
    operator string ();                 //return the _tree string
    int len();
    int len(int );                          //give count of character in _tree
    void print();                       //show the tree on terminal
    void trim(int);                     //ciseau à l'index donnée
};

#endif
