FALSY_LIST = ["false", "no", "0", "none"]


def ask(god, query, pantheon={}):
    return to_god_lang(god.answer(query, pantheon))


def to_lie(val):
    if isinstance(val, bool):
        if val:
            return False
        return True
    if isinstance(val, basestring):
        if val.lower() in FALSY_LIST:
            return True
        return False


def to_god_lang(val, yes_word="ja", no_word="da"):
    if val:
        return yes_word
    else:
        return no_word


def test_query(p, q):
    """
    Tests a query and prints out full run details

    :param p: Pantheon to test
    :type p: boolos.model.Pantheon
    :param q: Query string to be processed by boolos.model.Role.evaluate()
    :type q: str
    """
    eng_val = p.a.answer(q, p)
    god_val = ask(p.a, q, p)

    test_string = """
    QUERY:   {0}
    ENGLISH: {1}
    GOD-ESE: {2}
    GODS:    {3}
    """

    print(test_string.format(q, eng_val, god_val, p))

@@ -1,16 +1,31 @@
+import random%0A%0A
 FALSY_LIST = %5B%22f
@@ -136,16 +136,22 @@
 antheon)
+, True
 )%0A%0A%0Adef 
@@ -395,16 +395,34 @@
 ang(val,
+ rand_words=False,
  yes_wor
@@ -444,16 +444,192 @@
 =%22da%22):%0A
+    if rand_words:%0A        if random.randint(0, 1):%0A            yes_word = %22ja%22%0A            no_word = %22da%22%0A        else:%0A            yes_word = %22da%22%0A            no_word = %22ja%22%0A
     if v
@@ -1030,19 +1030,19 @@
    QUERY
-:  
+ A:
  %7B0%7D%0A   

rand ja/da as yes/no