URI: 
       Add cuneiforme number support to annna. - annna - Annna the nice friendly bot.
  HTML git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/annna/
   DIR Log
   DIR Files
   DIR Refs
   DIR Tags
   DIR README
       ---
   DIR commit 446ead25be8c9a927e75b0cdc465c9025567f7d2
   DIR parent efcd795d1ed9c33eb40c95ee8937c768dcf7a0d5
  HTML Author: Annna Robert-Houdin <annna@bitreich.org>
       Date:   Fri, 11 Apr 2025 17:19:13 +0200
       
       Add cuneiforme number support to annna.
       
       Diffstat:
         M annna-message-common                |       5 +++++
         A int2cunei                           |      94 +++++++++++++++++++++++++++++++
       
       2 files changed, 99 insertions(+), 0 deletions(-)
       ---
   DIR diff --git a/annna-message-common b/annna-message-common
       @@ -725,6 +725,11 @@ case "${text}" in
                suri="$(pohlcode.awk "${word}" | head -n 1)"
                annna-say -s "${server}" -c "${channel}" "${suri}"
                ;;
       +"${ircuser}, please cunei "*)
       +        word="$(printf "%s\n" "${text}" | cut -c 21- | sed 's,\t,    ,g')"
       +        suri="$(int2cunei "${word}" | head -n 1)"
       +        annna-say -s "${server}" -c "${channel}" "${suri}"
       +        ;;
        "${ircuser}, what can I cook with "*)
                ingredients="$(printf "%s\n" "${text}" | cut -c 29- | sed 's,\t,    ,g')"
                case "$ingredients" in
   DIR diff --git a/int2cunei b/int2cunei
       @@ -0,0 +1,94 @@
       +#!/usr/bin/env python
       +# coding=utf-8
       +#
       +# Idea from: https://trinket.io/python/3023f6104c42
       +#
       +
       +import os
       +import sys
       +import getopt
       +import math
       +
       +def usage(app):
       +    app = os.path.basename(app)
       +    print("usage: %s [-h] int" % (app), file=sys.stderr)
       +    sys.exit(1)
       +
       +def main(args):
       +    try:
       +        opts, largs = getopt.getopt(args[1:], "h")
       +    except getopt.GetoptError as err:
       +        print(str(err))
       +        usage(args[0])
       +
       +    for o, a in opts:
       +        if o == "-h":
       +            usage(args[0])
       +        else:
       +            assert False, "unhandled option"
       +
       +    if len(largs) < 1:
       +        usage(args[0])
       +
       +    inint = int(largs[0])
       +
       +    symbol_list=['-',"𒐕"]
       +    symbol_list.append("𒐖")
       +    symbol_list.append("𒐗")
       +    symbol_list.append("𒐘")
       +    symbol_list.append("𒐙")
       +    symbol_list.append("𒐚")
       +    symbol_list.append("𒑂")
       +    symbol_list.append("𒑄")
       +    symbol_list.append("𒑆")
       +    symbol_list.append("𒌋")
       +    for i in range(1,10):
       +        symbol_list.append(symbol_list[10]+symbol_list[i])
       +    symbol_list.append(symbol_list[10]+symbol_list[10])
       +    for i in range(1,10):
       +        symbol_list.append(symbol_list[20]+symbol_list[i])
       +    symbol_list.append(symbol_list[10]+symbol_list[10]+symbol_list[10])
       +    for i in range(1,10):
       +        symbol_list.append(symbol_list[30]+symbol_list[i])
       +    symbol_list.append("𒑩")
       +    for i in range(1,10):
       +        symbol_list.append(symbol_list[40]+symbol_list[i])
       +    symbol_list.append("𒑪")
       +    for i in range(1,10):
       +        symbol_list.append(symbol_list[50]+symbol_list[i])
       +
       +    def numberToBase(n, b):
       +        if n == 0:
       +            return [0]
       +        digits = []
       +        while n:
       +            digits.append(int(n % b))
       +            n //= b
       +        return digits[::-1]
       +
       +    def baseToInt(l, b):
       +        rint = 0
       +        i = 0
       +        for d in reversed(l):
       +            rint += d * (b**i)
       +            i += 1
       +        return rint
       +
       +    def cunei_print(l):
       +        s = ""
       +        for d in range(len(l)):
       +            s += symbol_list[l[d]] + ""
       +        return s
       +
       +    def find_leg(w,d):
       +        return math.sqrt(d * d - w * w)
       +
       +    base = numberToBase(inint, 60)
       +    cuneis = cunei_print(base)
       +    print("%s" % (cuneis))
       +
       +    return 0
       +
       +if __name__ == "__main__":
       +    sys.exit(main(sys.argv))
       +