about summary refs log tree commit diff stats
path: root/data/maps/the_hinterlands/rooms
diff options
context:
space:
mode:
Diffstat (limited to 'data/maps/the_hinterlands/rooms')
0 files changed, 0 insertions, 0 deletions
>af20d60 ^
262c445 ^
c51eb50 ^



262c445 ^


9fa36f9 ^
262c445 ^
9fa36f9 ^

262c445 ^










aec5389

262c445 ^















3351472 ^
262c445 ^

3351472 ^
262c445 ^
3351472 ^
262c445 ^






c51eb50 ^


0b419d5 ^
c51eb50 ^








aec5389

0b419d5 ^
262c445 ^
a0cb30e ^
262c445 ^

aec5389
44f53a1 ^
262c445 ^
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97




                          
                                    
                   

                 


                               







                                                             
 



                                                  


                                                                         
                         
                              

                                                                                        










                                                                       

          















                                                               
                                                  

                
                                                                  
                                         
                                                      






                                          


                                                                            
     








                                                                               

     
                                           
 
                                                       

                           
   
 
 
#include <yaml-cpp/yaml.h>
#include <string>
#include <iostream>
#include <list>
#include <algorithm>
#include <mastodonpp/mastodonpp.hpp>
#include <verbly.h>
#include <chrono>
#include <thread>

int main(int argc, char** argv)
{
  if (argc != 2)
  {
    std::cout << "usage: wordplay [configfile]" << std::endl;
    return -1;
  }

  std::string configfile(argv[1]);
  YAML::Node config = YAML::LoadFile(configfile);

  mastodonpp::Instance instance{
    config["mastodon_instance"].as<std::string>(),
    config["mastodon_token"].as<std::string>()};
  mastodonpp::Connection connection{instance};

  verbly::database database(config["verbly_datafile"].as<std::string>());

  // Blacklist some stuff
  verbly::filter cleanFilter =
    !(verbly::word::usageDomains %= (verbly::notion::wnid == 106718862)) // ethnic slurs
    && !(verbly::notion::wnid == 110630093); // "spastic"

  verbly::filter nounFilter =
    cleanFilter
    && (verbly::notion::partOfSpeech == verbly::part_of_speech::noun)
    && (verbly::notion::hypernyms %= cleanFilter);

  verbly::query<verbly::word> adjectiveQuery = database.words(
    (verbly::notion::partOfSpeech == verbly::part_of_speech::adjective)
    && (verbly::pronunciation::rhymes %= nounFilter)
    && (verbly::word::synonyms));

  for (;;)
  {
    verbly::word adjective = adjectiveQuery.first();

    verbly::word noun = database.words(
      nounFilter
      && (verbly::pronunciation::rhymes %= adjective)).first();

    verbly::word hypernym = database.words(
      cleanFilter
      && (verbly::notion::hyponyms %= noun)).first();

    verbly::word synonym = database.words(
      (verbly::word::synonyms %= adjective)).first();

    verbly::token action = verbly::token::separator("\n", {
      verbly::token::punctuation("?", {
        "What do you call",
        verbly::token::indefiniteArticle(synonym),
        hypernym
      }),
      verbly::token::capitalize(verbly::token::casing::capitalize,
        verbly::token::punctuation("!", {
          verbly::token::indefiniteArticle(adjective),
          noun
        }))
    });

    std::string result = action.compile();
    std::cout << result << std::endl;

    const mastodonpp::parametermap parameters{{"status", result}};
    auto answer{connection.post(mastodonpp::API::v1::statuses, parameters)};
    if (!answer)
    {
      if (answer.curl_error_code == 0)
      {
        std::cout << "HTTP status: " << answer.http_status << std::endl;
      }
      else
      {
        std::cout << "libcurl error " << std::to_string(answer.curl_error_code)
             << ": " << answer.error_message << std::endl;
      }
    }

    std::cout << "Waiting..." << std::endl;

    std::this_thread::sleep_for(std::chrono::hours(2));

    std::cout << std::endl;
  }
}