Compare commits

..

1 commit

Author SHA1 Message Date
8b99548195
update stickerset 2023-06-16 17:30:47 +08:00
3 changed files with 240 additions and 200 deletions

6
bot.py
View file

@ -15,7 +15,6 @@ from telethon.errors.rpcbaseerrors import RPCError
import asyncio import asyncio
from game import Game from game import Game
from card import GREY_SET_ID
game = Game() game = Game()
@ -115,9 +114,8 @@ async def inline_query(fail=None):
if len(result_id) == 36: if len(result_id) == 36:
# uuid result for grey cards # uuid result for grey cards
sset = result.document.attributes[1].stickerset sset = result.document.attributes[1].stickerset
if str(sset.id) == GREY_SET_ID: game.add_grey_card(sset.id, result.document.id)
game.add_grey_card(result.document.id) continue
continue
except (AttributeError, IndexError): except (AttributeError, IndexError):
pass pass
except Exception as err: except Exception as err:

422
card.py
View file

@ -11,199 +11,239 @@ CHOOSE = 'colorchooser'
DRAW_FOUR = 'draw_four' DRAW_FOUR = 'draw_four'
SPECIALS = (CHOOSE, DRAW_FOUR) SPECIALS = (CHOOSE, DRAW_FOUR)
_ALL = {
"STICKERS": {
# those stickers below are only used for grey cards. "b_0": 43161736970240473,
"b_1": 43161736970240475,
# NOGREY is not used now "b_2": 43161736970240477,
# can't be used for userbot "b_3": 43161736970240479,
NOGREY = { "b_4": 43161736970240481,
'BQADBAAD-AIAAl9XmQABxEjEcFM-VHIC': 'option_draw', "b_5": 43161736970240483,
'BQADBAAD-gIAAl9XmQABcEkAAbaZ4SicAg': 'option_pass', "b_6": 43161736970240485,
'BQADBAADygIAAl9XmQABJoLfB9ntI2UC': 'option_bluff', "b_7": 43161736970240487,
'BQADBAADxAIAAl9XmQABC5v3Z77VLfEC': 'option_info' "b_8": 43161736970240489,
"b_9": 43161736970240491,
"b_draw": 43161736970240493,
"b_skip": 43161736970240497,
"b_reverse": 43161736970240495,
"g_0": 43161736970240503,
"g_1": 43161736970240505,
"g_2": 43161736970240507,
"g_3": 43161736970240509,
"g_4": 43161736970240511,
"g_5": 43161736970240513,
"g_6": 43161736970240515,
"g_7": 43161736970240517,
"g_8": 43161736970240519,
"g_9": 43161736970240521,
"g_draw": 43161736970240523,
"g_skip": 43161736970240527,
"g_reverse": 43161736970240525,
"r_0": 43161736970240529,
"r_1": 43161736970240531,
"r_2": 43161736970240533,
"r_3": 43161736970240535,
"r_4": 43161736970240537,
"r_5": 43161736970240539,
"r_6": 43161736970240541,
"r_7": 43161736970240543,
"r_8": 43161736970240545,
"r_9": 43161736970240547,
"r_draw": 43161736970240549,
"r_skip": 43161736970240553,
"r_reverse": 43161736970240551,
"y_0": 43161736970240555,
"y_1": 43161736970240557,
"y_2": 43161736970240559,
"y_3": 43161736970240561,
"y_4": 43161736970240563,
"y_5": 43161736970240565,
"y_6": 43161736970240567,
"y_7": 43161736970240569,
"y_8": 43161736970240571,
"y_9": 43161736970240573,
"y_draw": 43161736970240575,
"y_skip": 43161736970240579,
"y_reverse": 43161736970240577,
"draw_four": 43161736970240501,
"colorchooser": 43161736970240499
},
"STICKERS_GREY": {
"b_0": 43161736970240581,
"b_1": 43161736970240583,
"b_2": 43161736970240585,
"b_3": 43161736970240587,
"b_4": 43161736970240589,
"b_5": 43161736970240591,
"b_6": 43161736970240593,
"b_7": 43161736970240595,
"b_8": 43161736970240597,
"b_9": 43161736970240599,
"b_draw": 43161736970240601,
"b_skip": 43161736970240605,
"b_reverse": 43161736970240603,
"g_0": 43161736970240611,
"g_1": 43161736970240613,
"g_2": 43161736970240615,
"g_3": 43161736970240617,
"g_4": 43161736970240619,
"g_5": 43161736970240621,
"g_6": 43161736970240623,
"g_7": 43161736970240625,
"g_8": 43161736970240627,
"g_9": 43161736970240629,
"g_draw": 43161736970240631,
"g_skip": 43161736970240635,
"g_reverse": 43161736970240633,
"r_0": 43161736970240637,
"r_1": 43161736970240639,
"r_2": 43161736970240641,
"r_3": 43161736970240643,
"r_4": 43161736970240645,
"r_5": 43161736970240647,
"r_6": 43161736970240649,
"r_7": 43161736970240651,
"r_8": 43161736970240653,
"r_9": 43161736970240655,
"r_draw": 43161736970240657,
"r_skip": 43161736970240661,
"r_reverse": 43161736970240659,
"y_0": 43161736970240663,
"y_1": 43161736970240665,
"y_2": 43161736970240667,
"y_3": 43161736970240669,
"y_4": 43161736970240671,
"y_5": 43161736970240673,
"y_6": 43161736970240675,
"y_7": 43161736970240677,
"y_8": 43161736970240679,
"y_9": 43161736970240681,
"y_draw": 43161736970240683,
"y_skip": 43161736970240687,
"y_reverse": 43161736970240685,
"draw_four": 43161736970240609,
"colorchooser": 43161736970240607
},
"CB_STICKERS": {
"colorchooser": 5880002320636317358,
"draw_four": 5879982271728980065,
"r_0": 5877721426714169320,
"r_1": 5879880386514783717,
"r_2": 5879770246373445078,
"r_3": 5879933837382783126,
"r_4": 5877760081419835913,
"r_5": 5879900358112710487,
"r_6": 5877642725733436957,
"r_7": 5877749137843162933,
"r_8": 5877483266482639060,
"r_9": 5877311506445504217,
"r_draw": 5877319172962127805,
"r_reverse": 5879797923142701285,
"r_skip": 5879761158222646854,
"g_0": 5879503756537630286,
"g_1": 5879484605278457410,
"g_2": 5879660312390538712,
"g_3": 5879657340273168039,
"g_4": 5877333445138452550,
"g_5": 5879673223062228738,
"g_6": 5879937299126425174,
"g_7": 5879480885836780249,
"g_8": 5879703210523888872,
"g_9": 5879841577190297875,
"g_draw": 5879828352985993092,
"g_reverse": 5879536127706140722,
"g_skip": 5877663328691558252,
"b_0": 5877474899886346488,
"b_1": 5879595475564237681,
"b_2": 5879838149806396627,
"b_3": 5879644472551148854,
"b_4": 5879829976483630741,
"b_5": 5880005537566821550,
"b_6": 5879891184062567694,
"b_7": 5879693400818585891,
"b_8": 5877543314420403675,
"b_9": 5879815124486720957,
"b_draw": 5877337362148626071,
"b_reverse": 5879952477540847522,
"b_skip": 5879687933325217017,
"y_0": 5879826162552671917,
"y_1": 5879882976380063602,
"y_2": 5879670177930415760,
"y_3": 5879704855496363257,
"y_4": 5879532202106031757,
"y_5": 5879476148487851945,
"y_6": 5879621820893629813,
"y_7": 5879449949187345641,
"y_8": 5877679301674930177,
"y_9": 5879515370129198532,
"y_draw": 5879758787400699599,
"y_reverse": 5879737007621541967,
"y_skip": 5877368079754729022
},
"CB_STICKERS_GREY": {
"colorchooser": 5879664091961757349,
"draw_four": 5879690097988735793,
"r_0": 5877371103411704752,
"r_1": 5877302078992289364,
"r_2": 5879920475739524527,
"r_3": 5877448455772705743,
"r_4": 5877436661792509909,
"r_5": 5877206279746752859,
"r_6": 5879858589555757822,
"r_7": 5879564526029902234,
"r_8": 5879894658691108279,
"r_9": 5879865895295127863,
"r_draw": 5877318610321412183,
"r_reverse": 5880000104433193795,
"r_skip": 5877425756870544996,
"g_0": 5879665023969660659,
"g_1": 5879945807456636378,
"g_2": 5879827012956197138,
"g_3": 5879609584531804090,
"g_4": 5877240360312246189,
"g_5": 5877455293360640086,
"g_6": 5879591305150992178,
"g_7": 5877481174833566141,
"g_8": 5877624205834456665,
"g_9": 5879594152714311387,
"g_draw": 5877599861959822892,
"g_reverse": 5879475796300532820,
"g_skip": 5879569061515365986,
"b_0": 5877424945121727831,
"b_1": 5877244191423074517,
"b_2": 5879753839598374502,
"b_3": 5880000465210445948,
"b_4": 5879663598040518716,
"b_5": 5879889964291853901,
"b_6": 5879767643623264510,
"b_7": 5877307168528535701,
"b_8": 5879524471164899173,
"b_9": 5879799864467919022,
"b_draw": 5879549871601487285,
"b_reverse": 5879465080357130570,
"b_skip": 5879806680581018111,
"y_0": 5879699624226197743,
"y_1": 5879640207648623653,
"y_2": 5879913706871066164,
"y_3": 5879537051124109020,
"y_4": 5877545436134248386,
"y_5": 5879513377264374502,
"y_6": 5879961466907398077,
"y_7": 5879549613903449302,
"y_8": 5877716118134591342,
"y_9": 5877734590788931385,
"y_draw": 5879740731358187243,
"y_reverse": 5879596270133186486,
"y_skip": 5879469203525734731
},
"STICKERS_SET": 43161736970240002,
"STICKERS_GREY_SET": 43161736970240002,
"CB_STICKERS_SET": 43161736970240012,
"CB_STICKERS_GREY_SET": 43161736970240013
} }
# STICKERS is not used now
# can't be used for userbot
STICKERS = {
'BQADBAAD2QEAAl9XmQAB--inQsYcLTsC': 'b_0',
'BQADBAAD2wEAAl9XmQABBzh4U-rFicEC': 'b_1',
'BQADBAAD3QEAAl9XmQABo3l6TT0MzKwC': 'b_2',
'BQADBAAD3wEAAl9XmQAB2y-3TSapRtIC': 'b_3',
'BQADBAAD4QEAAl9XmQABT6nhOuolqKYC': 'b_4',
'BQADBAAD4wEAAl9XmQABwRfmekGnpn0C': 'b_5',
'BQADBAAD5QEAAl9XmQABQITgUsEsqxsC': 'b_6',
'BQADBAAD5wEAAl9XmQABVhPF6EcfWjEC': 'b_7',
'BQADBAAD6QEAAl9XmQABP6baig0pIvYC': 'b_8',
'BQADBAAD6wEAAl9XmQAB0CQdsQs_pXIC': 'b_9',
'BQADBAAD7QEAAl9XmQAB00Wii7R3gDUC': 'b_draw',
'BQADBAAD8QEAAl9XmQAB_RJHYKqlc-wC': 'b_skip',
'BQADBAAD7wEAAl9XmQABo7D0B9NUPmYC': 'b_reverse',
'BQADBAAD9wEAAl9XmQABb8CaxxsQ-Y8C': 'g_0',
'BQADBAAD-QEAAl9XmQAB9B6ti_j6UB0C': 'g_1',
'BQADBAAD-wEAAl9XmQABYpLjOzbRz8EC': 'g_2',
'BQADBAAD_QEAAl9XmQABKvc2ZCiY-D8C': 'g_3',
'BQADBAAD_wEAAl9XmQABJB52wzPdHssC': 'g_4',
'BQADBAADAQIAAl9XmQABp_Ep1I4GA2cC': 'g_5',
'BQADBAADAwIAAl9XmQABaaMxxa4MihwC': 'g_6',
'BQADBAADBQIAAl9XmQABv5Q264Crz8gC': 'g_7',
'BQADBAADBwIAAl9XmQABjMH-X9UHh8sC': 'g_8',
'BQADBAADCQIAAl9XmQAB26fZ2fW7vM0C': 'g_9',
'BQADBAADCwIAAl9XmQAB64jIZrgXrQUC': 'g_draw',
'BQADBAADDwIAAl9XmQAB17yhhnh46VQC': 'g_skip',
'BQADBAADDQIAAl9XmQAB_xcaab0DkegC': 'g_reverse',
'BQADBAADEQIAAl9XmQABiUfr1hz-zT8C': 'r_0',
'BQADBAADEwIAAl9XmQAB5bWfwJGs6Q0C': 'r_1',
'BQADBAADFQIAAl9XmQABHR4mg9Ifjw0C': 'r_2',
'BQADBAADFwIAAl9XmQABYBx5O_PG2QIC': 'r_3',
'BQADBAADGQIAAl9XmQABTQpGrlvet3cC': 'r_4',
'BQADBAADGwIAAl9XmQABbdLt4gdntBQC': 'r_5',
'BQADBAADHQIAAl9XmQABqEI274p3lSoC': 'r_6',
'BQADBAADHwIAAl9XmQABCw8u67Q4EK4C': 'r_7',
'BQADBAADIQIAAl9XmQAB8iDJmLxp8ogC': 'r_8',
'BQADBAADIwIAAl9XmQAB_HCAww1kNGYC': 'r_9',
'BQADBAADJQIAAl9XmQABuz0OZ4l3k6MC': 'r_draw',
'BQADBAADKQIAAl9XmQAC2AL5Ok_ULwI': 'r_skip',
'BQADBAADJwIAAl9XmQABu2tIeQTpDvUC': 'r_reverse',
'BQADBAADKwIAAl9XmQAB_nWoNKe8DOQC': 'y_0',
'BQADBAADLQIAAl9XmQABVprAGUDKgOQC': 'y_1',
'BQADBAADLwIAAl9XmQABqyT4_YTm54EC': 'y_2',
'BQADBAADMQIAAl9XmQABGC-Xxg_N6fIC': 'y_3',
'BQADBAADMwIAAl9XmQABbc-ZGL8kApAC': 'y_4',
'BQADBAADNQIAAl9XmQAB67QJZIF6XAcC': 'y_5',
'BQADBAADNwIAAl9XmQABJg_7XXoITsoC': 'y_6',
'BQADBAADOQIAAl9XmQABVrd7OcS2k34C': 'y_7',
'BQADBAADOwIAAl9XmQABRpJSahBWk3EC': 'y_8',
'BQADBAADPQIAAl9XmQAB9MwJWKLJogYC': 'y_9',
'BQADBAADPwIAAl9XmQABaPYK8oYg84cC': 'y_draw',
'BQADBAADQwIAAl9XmQABO_AZKtxY6IMC': 'y_skip',
'BQADBAADQQIAAl9XmQABZdQFahGG6UQC': 'y_reverse',
'BQADBAAD9QEAAl9XmQABVlkSNfhn76cC': 'draw_four',
'BQADBAAD8wEAAl9XmQABl9rUOPqx4E4C': 'colorchooser',
'BQADBAAD-AIAAl9XmQABxEjEcFM-VHIC': 'option_draw',
'BQADBAAD-gIAAl9XmQABcEkAAbaZ4SicAg': 'option_pass',
'BQADBAADygIAAl9XmQABJoLfB9ntI2UC': 'option_bluff',
'BQADBAADxAIAAl9XmQABC5v3Z77VLfEC': 'option_info'
}
# can't be used for userbot
STICKERS_GREY = {
'BQADBAADRQIAAl9XmQAB1IfkQ5xAiK4C': 'b_0',
'BQADBAADRwIAAl9XmQABbWvhTeKBii4C': 'b_1',
'BQADBAADSQIAAl9XmQABS1djHgyQokMC': 'b_2',
'BQADBAADSwIAAl9XmQABwQ6VTbgY-MIC': 'b_3',
'BQADBAADTQIAAl9XmQABAlKUYha8YccC': 'b_4',
'BQADBAADTwIAAl9XmQABMvx8xVDnhUEC': 'b_5',
'BQADBAADUQIAAl9XmQABDEbhP1Zd31kC': 'b_6',
'BQADBAADUwIAAl9XmQABXb5XQBBaAnIC': 'b_7',
'BQADBAADVQIAAl9XmQABgL5HRDLvrjgC': 'b_8',
'BQADBAADVwIAAl9XmQABtO3XDQWZLtYC': 'b_9',
'BQADBAADWQIAAl9XmQAB2kk__6_2IhMC': 'b_draw',
'BQADBAADXQIAAl9XmQABEGJI6CaH3vcC': 'b_skip',
'BQADBAADWwIAAl9XmQAB_kZA6UdHXU8C': 'b_reverse',
'BQADBAADYwIAAl9XmQABGD5a9oG7Yg4C': 'g_0',
'BQADBAADZQIAAl9XmQABqwABZHAXZIg0Ag': 'g_1',
'BQADBAADZwIAAl9XmQABTI3mrEhojRkC': 'g_2',
'BQADBAADaQIAAl9XmQABVi3rUyzWS3YC': 'g_3',
'BQADBAADawIAAl9XmQABZIf5ThaXnpUC': 'g_4',
'BQADBAADbQIAAl9XmQABNndVJSQCenIC': 'g_5',
'BQADBAADbwIAAl9XmQABpoy1c4ZkrvwC': 'g_6',
'BQADBAADcQIAAl9XmQABDeaT5fzxwREC': 'g_7',
'BQADBAADcwIAAl9XmQABLIQ06ZM5NnAC': 'g_8',
'BQADBAADdQIAAl9XmQABel-mC7eXGsMC': 'g_9',
'BQADBAADdwIAAl9XmQABOHEpxSztCf8C': 'g_draw',
'BQADBAADewIAAl9XmQABDaQdMxjjPsoC': 'g_skip',
'BQADBAADeQIAAl9XmQABek1lGz7SJNAC': 'g_reverse',
'BQADBAADfQIAAl9XmQABWrxoiXcsg0EC': 'r_0',
'BQADBAADfwIAAl9XmQABlav-bkgSgRcC': 'r_1',
'BQADBAADgQIAAl9XmQABDjZkqfJ4AdAC': 'r_2',
'BQADBAADgwIAAl9XmQABT7lH7VVcy3MC': 'r_3',
'BQADBAADhQIAAl9XmQAB1arPC5x0LrwC': 'r_4',
'BQADBAADhwIAAl9XmQABWvs7xkCDldkC': 'r_5',
'BQADBAADiQIAAl9XmQABjwABH5ZonWn8Ag': 'r_6',
'BQADBAADiwIAAl9XmQABjekJfm4fBDIC': 'r_7',
'BQADBAADjQIAAl9XmQABqFjchpsJeEkC': 'r_8',
'BQADBAADjwIAAl9XmQAB-sKdcgABdNKDAg': 'r_9',
'BQADBAADkQIAAl9XmQABtw9RPVDHZOQC': 'r_draw',
'BQADBAADlQIAAl9XmQABtG2GixCxtX4C': 'r_skip',
'BQADBAADkwIAAl9XmQABz2qyEbabnVsC': 'r_reverse',
'BQADBAADlwIAAl9XmQABAb3ZwTGS1lMC': 'y_0',
'BQADBAADmQIAAl9XmQAB9v5qJk9R0x8C': 'y_1',
'BQADBAADmwIAAl9XmQABCsgpRHC2g-cC': 'y_2',
'BQADBAADnQIAAl9XmQAB3kLLXCv-qY0C': 'y_3',
'BQADBAADnwIAAl9XmQAB7R_y-NexNLIC': 'y_4',
'BQADBAADoQIAAl9XmQABl-7mwsjD-cMC': 'y_5',
'BQADBAADowIAAl9XmQABwbVsyv2MfPkC': 'y_6',
'BQADBAADpQIAAl9XmQABoBqC0JsemVwC': 'y_7',
'BQADBAADpwIAAl9XmQABpkwAAeh9ldlHAg': 'y_8',
'BQADBAADqQIAAl9XmQABpSBEUfd4IM8C': 'y_9',
'BQADBAADqwIAAl9XmQABMt-2zW0VYb4C': 'y_draw',
'BQADBAADrwIAAl9XmQABIDf-_TuuxtEC': 'y_skip',
'BQADBAADrQIAAl9XmQABm9M0Zh-_UwkC': 'y_reverse',
'BQADBAADYQIAAl9XmQAB_HWlvZIscDEC': 'draw_four',
'BQADBAADXwIAAl9XmQABY_ksDdMex-wC': 'colorchooser'
}
# sticker_id
#sticker_id = [['b_0', '43161736970240581'], ['b_1', '43161736970240583'], ['b_2', '43161736970240585'], ['b_3', '43161736970240587'], ['b_4', '43161736970240589'], ['b_5', '43161736970240591'], ['b_6', '43161736970240593'], ['b_7', '43161736970240595'], ['b_8', '43161736970240597'], ['b_9', '43161736970240599'], ['b_draw', '43161736970240601'], ['b_skip', '43161736970240605'], ['b_reverse', '43161736970240603'], ['g_0', '43161736970240611'], ['g_1', '43161736970240613'], ['g_2', '43161736970240615'], ['g_3', '43161736970240617'], ['g_4', '43161736970240619'], ['g_5', '43161736970240621'], ['g_6', '43161736970240623'], ['g_7', '43161736970240625'], ['g_8', '43161736970240627'], ['g_9', '43161736970240629'], ['g_draw', '43161736970240631'], ['g_skip', '43161736970240635'], ['g_reverse', '43161736970240633'], ['r_0', '43161736970240637'], ['r_1', '43161736970240639'], ['r_2', '43161736970240641'], ['r_3', '43161736970240643'], ['r_4', '43161736970240645'], ['r_5', '43161736970240647'], ['r_6', '43161736970240649'], ['r_7', '43161736970240651'], ['r_8', '43161736970240653'], ['r_9', '43161736970240655'], ['r_draw', '43161736970240657'], ['r_skip', '43161736970240661'], ['r_reverse', '43161736970240659'], ['y_0', '43161736970240663'], ['y_1', '43161736970240665'], ['y_2', '43161736970240667'], ['y_3', '43161736970240669'], ['y_4', '43161736970240671'], ['y_5', '43161736970240673'], ['y_6', '43161736970240675'], ['y_7', '43161736970240677'], ['y_8', '43161736970240679'], ['y_9', '43161736970240681'], ['y_draw', '43161736970240683'], ['y_skip', '43161736970240687'], ['y_reverse', '43161736970240685'], ['draw_four', '43161736970240609'], ['colorchooser', '43161736970240607']]
GREY_SET_ID = '43161736970240002'
# only grey ordinary cards are useful # only grey ordinary cards are useful
GREY_ID = { GREY_ID = {
'43161736970240581': 'b_0', _ALL["STICKERS_GREY_SET"]: {v: k for k, v in _ALL["STICKERS_GREY"].items()},
'43161736970240583': 'b_1', _ALL["CB_STICKERS_GREY_SET"]: {v: k for k, v in _ALL["CB_STICKERS_GREY"].items()},
'43161736970240585': 'b_2',
'43161736970240587': 'b_3',
'43161736970240589': 'b_4',
'43161736970240591': 'b_5',
'43161736970240593': 'b_6',
'43161736970240595': 'b_7',
'43161736970240597': 'b_8',
'43161736970240599': 'b_9',
'43161736970240601': 'b_draw',
'43161736970240605': 'b_skip',
'43161736970240603': 'b_reverse',
'43161736970240611': 'g_0',
'43161736970240613': 'g_1',
'43161736970240615': 'g_2',
'43161736970240617': 'g_3',
'43161736970240619': 'g_4',
'43161736970240621': 'g_5',
'43161736970240623': 'g_6',
'43161736970240625': 'g_7',
'43161736970240627': 'g_8',
'43161736970240629': 'g_9',
'43161736970240631': 'g_draw',
'43161736970240635': 'g_skip',
'43161736970240633': 'g_reverse',
'43161736970240637': 'r_0',
'43161736970240639': 'r_1',
'43161736970240641': 'r_2',
'43161736970240643': 'r_3',
'43161736970240645': 'r_4',
'43161736970240647': 'r_5',
'43161736970240649': 'r_6',
'43161736970240651': 'r_7',
'43161736970240653': 'r_8',
'43161736970240655': 'r_9',
'43161736970240657': 'r_draw',
'43161736970240661': 'r_skip',
'43161736970240659': 'r_reverse',
'43161736970240663': 'y_0',
'43161736970240665': 'y_1',
'43161736970240667': 'y_2',
'43161736970240669': 'y_3',
'43161736970240671': 'y_4',
'43161736970240673': 'y_5',
'43161736970240675': 'y_6',
'43161736970240677': 'y_7',
'43161736970240679': 'y_8',
'43161736970240681': 'y_9',
'43161736970240683': 'y_draw',
'43161736970240687': 'y_skip',
'43161736970240685': 'y_reverse',
'43161736970240609': 'draw_four',
'43161736970240607': 'colorchooser'
} }

12
game.py
View file

@ -21,7 +21,9 @@ def cards_sum(deck):
# r, b, g, y # r, b, g, y
card_count = {RED: 0, BLUE: 0, GREEN: 0, YELLOW: 0} card_count = {RED: 0, BLUE: 0, GREEN: 0, YELLOW: 0}
for card in deck: for card in deck:
card_count[color_from_str(card)] += 1 c = color_from_str(card)
if c in card_count:
card_count[c] += 1
return card_count return card_count
def color_choice(deck, greydeck): def color_choice(deck, greydeck):
@ -114,9 +116,9 @@ class Game():
return str(self.choose_color + self.old_deck + ["[u]" + s for s in self.old_greydeck] + self.special + self.functional) return str(self.choose_color + self.old_deck + ["[u]" + s for s in self.old_greydeck] + self.special + self.functional)
else: else:
return str(self.deck + ["[u]" + s for s in self.greydeck] + self.special + self.functional) return str(self.deck + ["[u]" + s for s in self.greydeck] + self.special + self.functional)
def add_grey_card(self, card_id): def add_grey_card(self, set_id, card_id):
"""get grey_cards from id, and add them""" """get grey_cards from set_id + card_id, and add them"""
grey_card = GREY_ID.get(str(card_id), None) grey_card = GREY_ID.get(int(set_id), {}).get(int(card_id), None)
if grey_card: if grey_card:
self.greydeck.append(grey_card) self.greydeck.append(grey_card)
else: else:
@ -167,7 +169,7 @@ class Game():
return 'pass' return 'pass'
# still no? call his bluff! # still no? call his bluff!
else: else:
if 'call_bluff' in self.functional and randchance(0.4): if 'call_bluff' in self.functional and randchance(0.05):
return 'call_bluff' return 'call_bluff'
# what is left? probably draw( # what is left? probably draw(
else: else: