
 [ AI AVALON KeyCode ]
                          Copyright (c) 2022 Hidetoshi NAGAI
                          Copyright (c) 2022 Kyutech AI AVALON Team

Supported Protocol Version: 0.9.0 and above


*** Values specified as message Key *********
# unsigned 7bit binary representation

---- special values(3) ----------------------------
# upper 3bit = 000
0000000 =   0 # Invalid key or terminator
0000001 =   1 # "status"
0001101 =  13 # "exit"
0001110 =  14 # "query"
0001111 =  15 # IDhead "ID"
-----------------------------------------

---- query-specific(3) ------------------------
# upper 3bit = 001
0010000 =  16 # "get"
0010001 =  17 # "range"
0010010 =  18 # "last_trial"
-----------------------------------------

---- role-names(8) ----------------------------
# 4bit  010xxxx : upper 2bit = 01
# "justice" side 0100xxx : upper 4bit = 0100
0100000 =  32 "Loyal Servant of Arthor"
0100001 =  33 "Merlin"
0100010 =  34  "Percival"
# "evil" side 0101xxx : upper 4bit = 0101
# Except for "Oberon" 01010xx : upper 5bit = 01010
0101000 =  40 "Minion of Mordred"
0101001 =  41 "Assassin"
0101010 =  42 "Mordred"
0101011 =  43 "Morgana"
# "Oberon" 01011xx : upper 5bit = 01011
0101100 =  44 "Oberon"
----------------------------------------

---- related to phase-management + messages --------------
# upper 2bit = 10
---- related to phase-management (13)----------------
# 4bit  100xxxx : upper 3bit = 100
----< progress management >------------------------
# upper 4bit = 1000
1000000 =  64  "construct"
1000001 =  65  "require"
1000010 =  66  "quest"
1000011 =  67  "voice"
1000100 =  68  "victory"
1000101 =  69  "finish"
1000110 =  70  "point"
----------------------------------------
----< keys in phase >-------------------
# upper 4bit = 1001
----< setup >----------------------------
1001000 =  72  "role"
----< construction >---------------------
1001001 =  73  "team"
1001010 =  74  "vote"
----< quest >----------------------------
1001011 =  75  "action"
1001100 =  76  "result"
----< assassination >--------------------
1001101 =  77  "assassinate"
-----------------------------------------

---- message types(6) ------------------------
# 3bit  1010xxx : 上位 3bit = 101
1010000 =  80  "quit"
1010001 =  81  "claim"
1010010 =  82  "request"
1010011 =  83  "inquiry"
1010100 =  84  "reason"
1010101 =  85  "interrupt"
-----------------------------------------

---- claim component(18) ---------------------
# 5bit  11xxxxx : upper 2bit = 11
1100000 =  96  "agree"
1100001 =  97  "disagree"
1100010 =  98  "justice"
1100011 =  99  "evil"
1100100 = 100  "trust"
1100101 = 101  "distrust"
1100110 = 102  "include"
1100111 = 103  "exclude"
1101000 = 104  "confidence"
1101001 = 105  "nonconfidence"
1101010 = 106  "consistent"
1101011 = 107  "inconsistent"
1101100 = 108  "succeed"
1101101 = 109  "fail"
1101110 = 110  "win"
1101111 = 111  "lose"
1110000 = 112  "servants"
1110001 = 113  "minions"
1110010 = 114  "endeavor"
1110011 = 115  "obstruct"
-----------------------------------------


*** Values not specified as message Key *********
---- status code ---------------------
0x01  ErrFormat   # Transmission format error (header or footer invalid)
0x02  ErrSize     # Message size error
0x03  ErrCode     # Message error: Unknown code
0x04  ErrStruct   # Message error: Inappropriate structure (element count)
0x05  ErrParam    # Message error: Abnormal parameter value
0x0C  ErrBroken   # Timeout (communication interrupted before reading the
 #                           specified data size)
0x0D  ErrTimeout  # Timeout (expected message not received)
0x0E  AcceptQuery # QUERY received
0x0F  OK          # Successfully received
-----------------------------------------
---- claim/explanation ----------------------------
# signed 16bit
int16 target-ID   # 1 to 32767
int16 future-time # -10 to -60

# special/logical : negative values of signed 8bit
-1    "omit"    # out of range of target-ID or future-time
-2    "hunch"   # out of range of target-ID or future-time
-100  AT()      # out of range of target-ID or future-time
-101  OR()      # out of range of target-ID or future-time
-102  AND()     # out of range of target-ID or future-time
-103  IF()      # out of range of target-ID or future-time
-104  PRESUME() # out of range of target-ID or future-time
-105  FACT()    # out of range of target-ID or future-time
-99   UNDEF     # out of range of target-ID or future-time
-----------------------------------------
---- reply to request(3) --------------------------
1  "accept"
0  "deny"
-1 "omit"
-----------------------------------------
---- success or failure of a quest(2)----------------------
1 "success"
0 "failure"
-----------------------------------------

-----------------------------------------------------------------------------
end of document
-----------------------------------------------------------------------------
