def r(id, short_name, name=None, ncards=144, layout=None):
    assert layout
    if not name:
        name = "Mahjongg " + short_name
    classname = re.sub('\W', '', name)
    # create class
    gameclass = type(classname, (AbstractMahjonggGame, ), {})
    gameclass.L = layout
    gameclass.NCARDS = ncards
    decks, ranks, trumps = comp_cardset(ncards)
    gi = GameInfo(
        id,
        gameclass,
        name,
        GI.GT_MAHJONGG,
        4 * decks,
        0,  # GI.SL_MOSTLY_SKILL,
        category=GI.GC_MAHJONGG,
        short_name=short_name,
        suits=list(range(3)),
        ranks=list(range(ranks)),
        trumps=list(range(trumps)),
        si={
            "decks": decks,
            "ncards": ncards
        })
    gi.ncards = ncards
    gi.rules_filename = "mahjongg.html"
    registerGame(gi)
    return gi
示例#2
0
def r(id, gameclass, name, rules_filename="shisensho.html"):
    decks, ranks, trumps = comp_cardset(gameclass.NCARDS)
    gi = GameInfo(id, gameclass, name,
                  GI.GT_SHISEN_SHO, 4*decks, 0, GI.SL_MOSTLY_SKILL,
                  category=GI.GC_MAHJONGG, short_name=name,
                  suits=range(3), ranks=range(ranks), trumps=range(trumps),
                  si={"decks": decks, "ncards": gameclass.NCARDS})
    gi.ncards = gameclass.NCARDS
    gi.rules_filename = rules_filename
    registerGame(gi)
    return gi
示例#3
0
def r(id, gameclass, name, rules_filename="shisensho.html"):
    decks, ranks, trumps = comp_cardset(gameclass.NCARDS)
    gi = GameInfo(id, gameclass, name,
                  GI.GT_SHISEN_SHO, 4*decks, 0, GI.SL_MOSTLY_SKILL,
                  category=GI.GC_MAHJONGG, short_name=name,
                  suits=range(3), ranks=range(ranks), trumps=range(trumps),
                  si={"decks": decks, "ncards": gameclass.NCARDS})
    gi.ncards = gameclass.NCARDS
    gi.rules_filename = rules_filename
    registerGame(gi)
    return gi
示例#4
0
def r(id, gameclass, short_name):
    name = short_name
    ncards = int(name[:2]) * int(name[:2])
    gi = GameInfo(id, gameclass, name,
                GI.GT_MATRIX, 1, 0, GI.SL_SKILL,
                category=GI.GC_TRUMP_ONLY, short_name=short_name,
                suits=(), ranks=(), trumps=range(ncards),
                si = {"decks": 1, "ncards": ncards})
    gi.ncards = ncards
    gi.rules_filename = "matrix.html"
    registerGame(gi)
    return gi
示例#5
0
def r(id, short_name, name=None, ncards=144, layout=None):
    assert layout
    if not name:
        name = "Mahjongg " + short_name
    classname = re.sub('\W', '', name)
    # create class
    gameclass = classobj(classname, (AbstractMahjonggGame,), {})
    gameclass.L = layout
    gameclass.NCARDS = ncards
    decks, ranks, trumps = comp_cardset(ncards)
    gi = GameInfo(id, gameclass, name,
                  GI.GT_MAHJONGG, 4*decks, 0, ##GI.SL_MOSTLY_SKILL,
                  category=GI.GC_MAHJONGG, short_name=short_name,
                  suits=range(3), ranks=range(ranks), trumps=range(trumps),
                  si={"decks": decks, "ncards": ncards})
    gi.ncards = ncards
    gi.rules_filename = "mahjongg.html"
    registerGame(gi)
    return gi
示例#6
0
def r(id, gameclass, short_name):
    name = short_name
    ncards = int(name[:2]) * int(name[:2])
    gi = GameInfo(id,
                  gameclass,
                  name,
                  GI.GT_MATRIX,
                  1,
                  0,
                  GI.SL_SKILL,
                  category=GI.GC_TRUMP_ONLY,
                  short_name=short_name,
                  suits=(),
                  ranks=(),
                  trumps=range(ncards),
                  si={
                      "decks": 1,
                      "ncards": ncards
                  })
    gi.ncards = ncards
    gi.rules_filename = "matrix.html"
    registerGame(gi)
    return gi
示例#7
0
def r(id, short_name, width):
    name = short_name
    ncards = width**2
    gi = GameInfo(id,
                  LightsOut,
                  name,
                  GI.GT_LIGHTS_OUT,
                  1,
                  0,
                  GI.SL_SKILL,
                  category=GI.GC_TRUMP_ONLY,
                  short_name=short_name,
                  suits=(),
                  ranks=(),
                  trumps=list(range(ncards)),
                  si={
                      "decks": 1,
                      "ncards": ncards
                  })
    gi.ncards = ncards
    gi.rules_filename = "lightsout.html"
    registerGame(gi)
    return gi