Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace Knowledge
- {
- /* Knowledge Utility Functions */
- void Print (std::string Conclusion)
- {
- std::cout << Conclusion << '\n';
- }
- void PrintData (std::string Key = "", std::string Value = "")
- {
- Print(" \"" + Key + "\": \"" + Value + "\",");
- }
- bool StartsWith (std::string Argument, std::string Prefix)
- {
- if(Argument.substr(0, Prefix.size()) == Prefix)
- return true;
- else return false;
- }
- std::string Extract (std::string Characters, int Length)
- {
- Characters = Characters.substr(Length);
- if (Characters[0] == ' ')
- Characters = Characters.substr(1);
- return Characters;
- }
- /* Knowledge Intelligent Agents */
- namespace Nutrition
- {
- void Notion ()
- {
- Print("{");
- PrintData("1", "Knowledge://Knowledge:80/%Notion=Nutrition Notion");
- PrintData("1", "Knowledge://Knowledge:80/%Notion=Nutrition Facts %Food");
- Print("}");
- }
- void Facts (std::string Food)
- {
- Print("{");
- PrintData("Facts.Name", Food);
- PrintData("Facts.Kcal", "200");
- PrintData("Facts.SFat", "20%");
- PrintData("Facts.TFat", "20%");
- PrintData("Facts.Salt", "10%");
- PrintData("Facts.Carbs", "8g");
- PrintData("Facts.Fiber", "8g");
- PrintData("Facts.Sugar", "2g");
- PrintData("Facts.Vitamins.A", "1%");
- PrintData("Facts.Vitamins.C", "1%");
- PrintData("Facts.Vitamins.E", "1%");
- Print("}");
- }
- }
- void Notion ()
- {
- Print("{");
- PrintData("1", "Knowledge://Knowledge:80/%Notion=Knowledge Notion");
- Print("}");
- }
- void Interpret (std::string Notion)
- {
- if (Notion == "Knowledge Notion")
- Knowledge::Notion();
- else if (Notion == "Nutrition Notion")
- Nutrition::Notion();
- else if (StartsWith(Notion, "Nutrition Facts"))
- Nutrition::Facts(Extract(Notion, 15));
- else
- {
- Print("{");
- PrintData("String.Length", "1");
- PrintData("String.Values", "['0']");
- PrintData("String.Counts", "['0']");
- Print("}");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement