在Ruby或Python中解决这个max和min问题的优雅方法是什么?

时间:2011-03-06 13:51:50

标签: python ruby

以下可以通过一步一步,有些笨拙的方式来完成,但我想知道是否有优雅的方法来做到这一点。

有一个页面:http://www.mariowiki.com/Mario_Kart_Wii,其中有2个表......有

Mario    -   6   2   2   3   -   -
Luigi    2   6   -   -   -   -   -
Diddy Kong   -   -   3   -   3   -   5
  [...]

“Mario”等名称是Mario Kart Wii角色名称。 这些数字用于奖励积分:

Speed    Weight  Acceleration    Handling    Drift   Off-Road    Mini-Turbo

然后有表2

Standard Bike S 39  21  51  51  54  43  48  
Bullet Bike 53  24  32  35  67  29  67      
Bubble Bike / Jet Bubble    48  27  40  40  45  35  37  
  [...]

这些也是Bike或Kart的特点。

我想知道找到速度,重量,加速度等所有最大组合的最优雅解决方案是什么,也是最低限度,通过直接使用该页面上的HTML或将数字复制并粘贴到文本文件中

实际上,在那个角色表中,Mario to Bower Jr都是中等角色,Baby Mario to Dry Bones是小角色,其余都是大角色,除了小,中,或大Mii都是如此名字说。小角色只能骑小型自行车或小型卡丁车,等等大中型车。

更新:在打印结果时也可以过滤掉卡丁车类型或自行车,因为有些人只玩自行车,只有“进”或“出”漂移自行车的类型,因为有些人只使用“in”漂移类型。同样不错的是打印出具有相同最大值或最小值的结果(不同卡丁车或自行车上的不同字符加起来相同的值)。 Hugh打印出最高值和最低值的答案也很好,因为有些值非常接近,例如73或72.

3 个答案:

答案 0 :(得分:8)

您的问题分为两部分。解析HTML并进行分析。解析HTML是一项繁琐的工作,我怀疑你可以做很多事情来使它变得优雅。分析并不难,但有一些方法可以在Python中做到这一点,我认为可能会被认为是优雅的。我将讨论以优雅和简洁的方式表达蛮力分析的方法。我不打算比蛮力更快地讨论如何做到这一点,因为数据集非常小。

import collections

Stats = collections.namedtuple("Stats", "speed weight acceleration handling drift offroad turbo")

首先,我们创建一个名为“Stats”的命名元组。这是我们用来表示驾驶员或车辆的统计数据的对象。命名元组很好,因为:

  • 可以非常简洁地定义它们。
  • 它们提供了一个只按顺序获取字段的构造函数。
  • 他们让我们按名称访问任何字段,例如driver.weight
  • 它们提供易于阅读的__str__格式:"Stats(speed=73, weight=56, acceleration=21, handling=17, drift=27, offroad=19, turbo=16)"
  • 它们可以作为序列访问,就像常规元组一样。

让我们定义一个函数来添加两组统计数据:

def add_stats(xs, ys):
    return Stats(*[(x+y) for (x,y) in zip(xs,ys)])

Zip采用两个序列并从每个序列返回一系列项目。例如。 zip([1,2,3],['a','b','c'])== [(1,'a'),(2,'b'),(3,'c') ])。然后我们使用列表推导([blah for blah in blah])将每个对中的统计数据加在一起。最后,我们将其提供给Stats构造函数。 *表示我们希望将序列中的每个项目用作函数的参数。

class ThingWithStats(object):
    def __init__(self, name, stats):
        self.name = name
        self.stats = Stats(*stats)
    def __str__(self):
        return self.name + " (" + str(self.stats) + ")"

class Driver(ThingWithStats):
    pass

class Vehicle(ThingWithStats):
    pass

class Combination(ThingWithStats):
    def __init__(self, driver, vehicle):
        self.name = driver.name + " riding " + vehicle.name
        self.stats = add_stats(driver.stats, vehicle.stats)

现在我们已经定义了类来表示驱动程序,车辆和两者的组合。请注意,Driver和Vehicle的构造函数(继承自ThingWithStats)可以采用任何适当长度的序列作为其stats参数。他们使用*将序列转换为Stats对象。我们很快就会明白为什么这很方便。

def make_combinations(drivers, vehicles):
    return [
        Combination(driver, vehicle)
        for driver in drivers
        for vehicle in vehicles]

此功能使用列表推导来查找某些驱动程序列表和某些车辆列表的所有组合。请注意,通过在单个理解中使用多个“for”,我们得到所有组合。这有时也被称为笛卡尔积。

现在这里有一点点 - 数据。我复制并粘贴了这些并使用了一些vim魔法将它们按到正确的格式。对不起,我没有更聪明的事情。请注意,对于stats参数,我们传递一个常规元组。如上所述,构造函数转换为Stats对象。这为我们节省了一点点混乱。

medium_drivers = [
    Driver("Mario",        (0, 6, 2, 2, 3, 0, 0)),
    Driver("Luigi",        (2, 6, 0, 0, 0, 0, 0)),
    Driver("Peach",        (2, 0, 5, 0, 6, 0, 0)),
    Driver("Daisy",        (4, 0, 0, 2, 0, 0, 3)),
    Driver("Yoshi",        (0, 3, 0, 0, 3, 5, 0)),
    Driver("Birdo",        (0, 3, 0, 0, 0, 3, 5)),
    Driver("Diddy Kong",   (0, 0, 3, 0, 3, 0, 5)),
    Driver("Bowser Jr.",   (0, 0, 0, 0, 0, 3, 3)),
    Driver("Medium Mii",   (3, 3, 0, 0, 0, 3, 3)),
    ]

small_drivers = [
    Driver("Baby Mario",   (0, 8, 0, 6, 0, 0, 0)),
    Driver("Baby Luigi",   (5, 8, 0, 0, 0, 0, 0)),
    Driver("Baby Peach",   (3, 6, 3, 3, 0, 0, 0)),
    Driver("Baby Daisy",   (5, 6, 0, 0, 0, 0, 3)),
    Driver("Toad",         (0, 0, 6, 0, 6, 0, 0)),
    Driver("Toadette",     (3, 0, 0, 0, 0, 6, 0)),
    Driver("Koopa Troopa", (0, 0, 0, 3, 0, 0, 6)),
    Driver("Dry Bones",    (0, 0, 3, 0, 3, 0, 6)),
    Driver("Small Mii",    (3, 3, 0, 0, 3, 0, 3)),
    ]

large_drivers = [
    Driver("Wario",        (0, 3, 0, 0, 0, 3, 6)),
    Driver("Waluigi",      (0, 0, 6, 0, 5, 3, 0)),
    Driver("Donkey Kong",  (0, 3, 2, 2, 0, 0, 3)),
    Driver("Bowser",       (2, 5, 0, 0, 3, 0, 0)),
    Driver("King Boo",     (0, 0, 0, 5, 0, 3, 0)),
    Driver("Rosalina",     (3, 0, 0, 3, 0, 0, 3)),
    Driver("Funky Kong",   (4, 0, 0, 0, 0, 3, 0)),
    Driver("Dry Bowser",   (0, 0, 0, 0, 0, 6, 6)),
    Driver("Large Mii",    (3, 0, 3, 3, 3, 0, 3)),
    ]

small_vehicles = [
    Vehicle("Standard Kart S",             (41, 29, 48, 48, 51, 40, 45)),
    Vehicle("Baby Booster / Booster Seat", (27, 27, 56, 64, 37, 54, 59)),
    Vehicle("Concerto / Mini Beast",       (55, 32, 29, 32, 64, 27, 64)),
    Vehicle("Cheep Charger",               (34, 24, 64, 56, 59, 45, 54)),
    Vehicle("Rally Romper / Tiny Titan",   (46, 35, 43, 43, 29, 64, 40)),
    Vehicle("Blue Falcon",                 (60, 29, 35, 29, 43, 24, 29)),

    Vehicle("Standard Bike S",             (39, 21, 51, 51, 54, 43, 48)),
    Vehicle("Bullet Bike",                 (53, 24, 32, 35, 67, 29, 67)),
    Vehicle("Nano Bike / Bit Bike",        (25, 18, 59, 67, 40, 56, 62)),
    Vehicle("Quacker",                     (32, 17, 67, 60, 62, 48, 57)),
    Vehicle("Magikruiser",                 (43, 24, 45, 45, 32, 67, 43)),
    Vehicle("Bubble Bike / Jet Bubble",    (48, 27, 40, 40, 45, 35, 37)),
    ]

medium_vehicles = [
    Vehicle("Standard Kart M",                (46, 45, 40, 43, 45, 35, 40)),
    Vehicle("Nostalgia 1 / Classic Dragster", (37, 43, 59, 54, 54, 40, 51)),
    Vehicle("Wild Wing",                      (57, 51, 21, 29, 59, 24, 59)),
    Vehicle("Turbo Blooper / Super Blooper",  (50, 40, 35, 37, 21, 54, 35)),
    Vehicle("Royal Racer / Daytripper",       (34, 45, 51, 59, 32, 48, 54)),
    Vehicle("B Dasher Mk. 2 / Sprinter",      (64, 48, 27, 24, 37, 21, 24)),

    Vehicle("Standard Bike M",                (43, 37, 43, 45, 48, 37, 43)),
    Vehicle("Mach Bike",                      (55, 37, 24, 32, 62, 27, 62)),
    Vehicle("Bon Bon / Sugarscoot",           (32, 32, 54, 62, 35, 51, 56)),
    Vehicle("Rapide / Zip Zip",               (41, 35, 45, 51, 29, 62, 45)),
    Vehicle("Nitrocycle / Sneakster",         (62, 40, 29, 27, 40, 24, 27)),
    Vehicle("Dolphin Dasher",                 (48, 43, 37, 40, 24, 56, 37)),
    ]

large_vehicles = [
    Vehicle("Standard Kart L",              (48, 59, 37, 40, 40, 35, 35)),
    Vehicle("Offroader",                    (39, 64, 48, 54, 18, 43, 45)),
    Vehicle("Flame Flyer",                  (62, 59, 16, 21, 48, 18, 48)),
    Vehicle("Piranha Prowler",              (55, 67, 29, 35, 35, 29, 27)),
    Vehicle("Aero Glider / Jetsetter",      (69, 56, 21, 17, 27, 16, 16)),
    Vehicle("Dragonetti / Honeycoupe",      (53, 62, 27, 29, 56, 24, 56)),

    Vehicle("Standard Bike L",              (46, 54, 40, 43, 43, 37, 37)),
    Vehicle("Bowser Bike / Flame Runner",   (60, 54, 18, 24, 51, 21, 51)),
    Vehicle("Wario Bike",                   (37, 59, 51, 56, 21, 45, 48)),
    Vehicle("Twinkle Star / Shooting Star", (50, 48, 29, 32, 59, 27, 59)),
    Vehicle("Torpedo / Spear",              (67, 56, 24, 18, 29, 18, 18)),
    Vehicle("Phantom",                      (43, 51, 43, 48, 17, 56, 40)),
    ]

除此之外,我们列出了所有组合:

small_combinations = make_combinations(small_drivers, small_vehicles)
medium_combinations = make_combinations(medium_drivers, medium_vehicles)
large_combinations = make_combinations(large_drivers, large_vehicles)

all_combinations = small_combinations + medium_combinations + large_combinations

最后,我们对所有组合列表进行一些基本分析:

print "Max speed:", max(all_combinations, key=lambda c:c.stats.speed)
print "Max weight:", max(all_combinations, key=lambda c:c.stats.weight)
print "Max acceleration:", max(all_combinations, key=lambda c:c.stats.acceleration)
print "Max handling:", max(all_combinations, key=lambda c:c.stats.handling)
print "Max drift:", max(all_combinations, key=lambda c:c.stats.drift)
print "Max offroad:", max(all_combinations, key=lambda c:c.stats.offroad)
print "Max turbo:", max(all_combinations, key=lambda c:c.stats.turbo)
print
print "Min speed:", min(all_combinations, key=lambda c:c.stats.speed)
print "Min weight:", min(all_combinations, key=lambda c:c.stats.weight)
print "Min acceleration:", min(all_combinations, key=lambda c:c.stats.acceleration)
print "Min handling:", min(all_combinations, key=lambda c:c.stats.handling)
print "Min drift:", min(all_combinations, key=lambda c:c.stats.drift)
print "Min offroad:", min(all_combinations, key=lambda c:c.stats.offroad)
print "Min turbo:", min(all_combinations, key=lambda c:c.stats.turbo)

minmax函数为此提供了key参数。它需要一个函数从列表中获取一个项目并返回您想要排序的值。结果如下:

Max speed: Funky Kong riding Aero Glider / Jetsetter (Stats(speed=73, weight=56, acceleration=21, handling=17, drift=27, offroad=19, turbo=16))
Max weight: Bowser riding Piranha Prowler (Stats(speed=57, weight=72, acceleration=29, handling=35, drift=38, offroad=29, turbo=27))
Max acceleration: Toad riding Quacker (Stats(speed=32, weight=17, acceleration=73, handling=60, drift=68, offroad=48, turbo=57))
Max handling: Baby Mario riding Nano Bike / Bit Bike (Stats(speed=25, weight=26, acceleration=59, handling=73, drift=40, offroad=56, turbo=62))
Max drift: Toad riding Bullet Bike (Stats(speed=53, weight=24, acceleration=38, handling=35, drift=73, offroad=29, turbo=67))
Max offroad: Toadette riding Magikruiser (Stats(speed=46, weight=24, acceleration=45, handling=45, drift=32, offroad=73, turbo=43))
Max turbo: Koopa Troopa riding Bullet Bike (Stats(speed=53, weight=24, acceleration=32, handling=38, drift=67, offroad=29, turbo=73))

Min speed: Baby Mario riding Nano Bike / Bit Bike (Stats(speed=25, weight=26, acceleration=59, handling=73, drift=40, offroad=56, turbo=62))
Min weight: Toad riding Quacker (Stats(speed=32, weight=17, acceleration=73, handling=60, drift=68, offroad=48, turbo=57))
Min acceleration: Wario riding Flame Flyer (Stats(speed=62, weight=62, acceleration=16, handling=21, drift=48, offroad=21, turbo=54))
Min handling: Wario riding Aero Glider / Jetsetter (Stats(speed=69, weight=59, acceleration=21, handling=17, drift=27, offroad=19, turbo=22))
Min drift: Wario riding Phantom (Stats(speed=43, weight=54, acceleration=43, handling=48, drift=17, offroad=59, turbo=46))
Min offroad: Donkey Kong riding Aero Glider / Jetsetter (Stats(speed=69, weight=59, acceleration=23, handling=19, drift=27, offroad=16, turbo=19))
Min turbo: Waluigi riding Aero Glider / Jetsetter (Stats(speed=69, weight=56, acceleration=27, handling=17, drift=32, offroad=19, turbo=16))

进一步的想法

如果您 想要将其应用于更大的数据集,您可以找到每个统计数据的最小值和最大值的驱动程序和车辆,然后对于每个统计数据,将最大驱动程序与最小车辆和最小车辆的最小驾驶员。那将是O(M log M + N log N)而不是O(M * N log M * N)。但在我认为这是一个问题之前,你真的需要接触成千上万的司机和车辆。

如果要将其应用于甚至不适合内存的海量数据集,可以使用生成器表达式而不是列表推导。您需要将其与可以一次读取并生成一个驱动程序/车辆的解析器结合使用。

您可以通过添加约束来执行更具体的搜索。例如,要找到turbo> = 50并处理> = 40的最快组合:

max((combination
    for combination in all_combinations
    if combination.stats.turbo >= 50
    and combination.stats.handling >= 40),
    key=lambda c:c.stats.speed)

如果你想把所有那些并列为最佳位置,你可以这样做:

def all_max(sequence, key):
    top_value = key(max(sequence, key=key))
    return [item for item in sequence if key(item) == top_value]

将其称为与调用max相同的名称。它返回所有那些项目的列表,这些项目与任何键指定的最大值相关联。

答案 1 :(得分:3)

由于没有很多角色和自行车,你可能会强行蛮力。也就是说,用他们可以使用的每辆可用车辆检查每个角色并找到最高的。

答案 2 :(得分:3)

我以几个小方式扩展了@ Weeble的答案:

  1. 直接从维基百科页面中提取数据
  2. 使用itertools.product而不是自定义make_combinations()
  3. 自动迭代可用属性
  4. 显示每个骑手尺寸
  5. 的每个属性的前N个和下N个项目

    from BeautifulSoup import BeautifulSoup
    import urllib2
    import collections
    import itertools
    
    def value(s):
        "Parse string to integer (return 0 on bad string)"
        try:
            return int(s)
        except ValueError:
            return 0
    
    attrs = ('speed','weight','acceleration','handling','drift','offroad','turbo')
    Stats = collections.namedtuple('Stats', attrs)
    def add_stats(xs,ys):
        return Stats(*(x+y for x,y in zip(xs,ys)))
    
    class ThingWithStats(object):
        def __init__(self, stats):
            super(ThingWithStats,self).__init__()
            self.stats = Stats(*stats)
        def __str__(self):
            return str(self.stats)
    
    class Driver(ThingWithStats):
        @classmethod
        def fromRow(cls,size,row):
            name  = row.th.getText().strip()
            stats = [value(col.getText()) for col in row.findAll('td')]
            return cls(name, size, stats)
        def __init__(self, name, size, stats):
            super(Driver,self).__init__(stats)
            self.name = name
            self.size = size
        def __str__(self):
            return "{0:32} ({1}): {2}".format(self.name, self.size, self.stats)
    
    class Vehicle(ThingWithStats):
        @classmethod
        def fromRow(cls, size, kind, row):
            items = [col.getText() for col in row.findAll('td')]
            name  = items[0].strip()
            stats = [value(item) for item in items[1:8]]
            return cls(name, size, kind, stats)
        def __init__(self, name, size, kind, stats):
            super(Vehicle,self).__init__(stats)
            self.name     = name
            self.size     = size
            self.kind     = kind
        def __str__(self):
            return "{0:30} ({1} {2}): {3}".format(self.name, self.size, self.kind, self.stats)
    
    class DrivenVehicle(ThingWithStats):
        def __init__(self, driver, vehicle):
            if driver.size != vehicle.size:
                raise ValueError('Driver {0} cannot fit vehicle {1}'.format(driver.name, vehicle.name))
            self.driver  = driver
            self.vehicle = vehicle
            self.stats   = add_stats(driver.stats, vehicle.stats)
        def __str__(self):
            return "{0} riding {1}: {2}".format(self.driver.name, self.vehicle.name, self.stats)
    
    def getDrivers(table):
        rows  = table.findAll('tr')[2:]        # skip two header rows
        sizes = 'm'*8 + 's'*8 + 'l'*8 + 'sml'  # this is cheating a bit, but I don't see any way to get it from the table
        return [Driver.fromRow(size,row) for size,row in zip(sizes,rows)]
    
    def getVehicles(table):
        sz = {'Small':'s', 'Medium':'m', 'Large':'l'}
        kd = {'Karts':'k', 'Bikes':'b'}
        size,kind = None,None
        cars = []
        for row in table.findAll('tr'):
            heads = row.findAll('th')
            if len(heads)==1:      # main table heading
                pass
            elif len(heads)==10:   # sub-heading
                s,k = heads[0].getText().strip().split()
                size,kind = sz[s], kd[k]
            else:                  # data
                cars.append(Vehicle.fromRow(size,kind,row))
        return cars
    
    def getData():
        url = 'http://www.mariowiki.com/Mario_Kart_Wii'    # page to look at
        data = urllib2.urlopen(url).read()                 # get raw html
        soup = BeautifulSoup(data)                         # parse
    
        drivers = []
        cars = []
        for table in soup.findAll('table'):                # look at all tables in page
            try:
                head = table.th.getText()
                if 'Character Bonuses' in head:
                    drivers = getDrivers(table)
                elif 'Vehicle Stats' in head:
                    cars = getVehicles(table)
            except AttributeError:
                pass
    
        return drivers,cars
    
    def binBy(attr, lst):
        res = collections.defaultdict(list)
        for item in lst:
            res[getattr(item,attr)].append(item)
        return res
    
    def main():
        drivers,cars = getData()
    
        drivers = binBy('size', drivers)
        cars    = binBy('size', cars)
    
        sizes = list(set(drivers.keys()) & set(cars.keys()))
        sizes.sort()
    
        combos  = {}
        for size in sizes:
            combos[size] = [DrivenVehicle(driver,car) for driver,car in itertools.product(drivers[size], cars[size])]
    
        topN = 3
        for attr in attrs:
            print "By {0}:".format(attr)
            for size in sizes:
                combos[size].sort(key=lambda dv: getattr(dv.stats,attr), reverse=True)
                print "  ({0})".format(size)
                for dv in combos[size][:topN]:
                    print '    '+str(dv)
                print '    ...'
                for dv in combos[size][-topN:]:
                    print '    '+str(dv)
    
    if __name__=="__main__":
        main()
    

    和最终结果:

    By speed:
      (l)
        Funky Kong riding Aero Glider/ Jetsetter: Stats(speed=73, weight=56, acceleration=21, handling=17, drift=27, offroad=19, turbo=16)
        Rosalina riding Aero Glider/ Jetsetter: Stats(speed=72, weight=56, acceleration=21, handling=20, drift=27, offroad=16, turbo=19)
        Large Mii riding Aero Glider/ Jetsetter: Stats(speed=72, weight=56, acceleration=24, handling=20, drift=30, offroad=16, turbo=19)
        ...
        Donkey Kong riding Wario Bike: Stats(speed=37, weight=62, acceleration=53, handling=58, drift=21, offroad=45, turbo=51)
        King Boo riding Wario Bike: Stats(speed=37, weight=59, acceleration=51, handling=61, drift=21, offroad=48, turbo=48)
        Dry Bowser riding Wario Bike: Stats(speed=37, weight=59, acceleration=51, handling=56, drift=21, offroad=51, turbo=54)
      (m)
        Daisy riding B Dasher Mk. 2/ Sprinter: Stats(speed=68, weight=48, acceleration=27, handling=26, drift=37, offroad=21, turbo=27)
        Medium Mii riding B Dasher Mk. 2/ Sprinter: Stats(speed=67, weight=51, acceleration=27, handling=24, drift=37, offroad=24, turbo=27)
        Luigi riding B Dasher Mk. 2/ Sprinter: Stats(speed=66, weight=54, acceleration=27, handling=24, drift=37, offroad=21, turbo=24)
        ...
        Birdo riding Bon Bon/ Sugarscoot: Stats(speed=32, weight=35, acceleration=54, handling=62, drift=35, offroad=54, turbo=61)
        Diddy Kong riding Bon Bon/ Sugarscoot: Stats(speed=32, weight=32, acceleration=57, handling=62, drift=38, offroad=51, turbo=61)
        Bowser Jr. riding Bon Bon/ Sugarscoot: Stats(speed=32, weight=32, acceleration=54, handling=62, drift=35, offroad=54, turbo=59)
      (s)
        Baby Luigi riding Blue Falcon: Stats(speed=65, weight=37, acceleration=35, handling=29, drift=43, offroad=24, turbo=29)
        Baby Daisy riding Blue Falcon: Stats(speed=65, weight=35, acceleration=35, handling=29, drift=43, offroad=24, turbo=32)
        Baby Peach riding Blue Falcon: Stats(speed=63, weight=35, acceleration=38, handling=32, drift=43, offroad=24, turbo=29)
        ...
        Toad riding Nano Bike/ Bit Bike: Stats(speed=25, weight=18, acceleration=65, handling=67, drift=46, offroad=56, turbo=62)
        Koopa Troopa riding Nano Bike/ Bit Bike: Stats(speed=25, weight=18, acceleration=59, handling=70, drift=40, offroad=56, turbo=68)
        Dry Bones riding Nano Bike/ Bit Bike: Stats(speed=25, weight=18, acceleration=62, handling=67, drift=43, offroad=56, turbo=68)
    By weight:
      (l)
        Bowser riding Piranha Prowler: Stats(speed=57, weight=72, acceleration=29, handling=35, drift=38, offroad=29, turbo=27)
        Wario riding Piranha Prowler: Stats(speed=55, weight=70, acceleration=29, handling=35, drift=35, offroad=32, turbo=33)
        Donkey Kong riding Piranha Prowler: Stats(speed=55, weight=70, acceleration=31, handling=37, drift=35, offroad=29, turbo=30)
        ...
        Waluigi riding Twinkle Star/ Shooting Star: Stats(speed=50, weight=48, acceleration=35, handling=32, drift=64, offroad=30, turbo=59)
        King Boo riding Twinkle Star/ Shooting Star: Stats(speed=50, weight=48, acceleration=29, handling=37, drift=59, offroad=30, turbo=59)
        Dry Bowser riding Twinkle Star/ Shooting Star: Stats(speed=50, weight=48, acceleration=29, handling=32, drift=59, offroad=33, turbo=65)
      (m)
        Luigi riding Wild Wing: Stats(speed=59, weight=57, acceleration=21, handling=29, drift=59, offroad=24, turbo=59)
        Mario riding Wild Wing: Stats(speed=57, weight=57, acceleration=23, handling=31, drift=62, offroad=24, turbo=59)
        Luigi riding B Dasher Mk. 2/ Sprinter: Stats(speed=66, weight=54, acceleration=27, handling=24, drift=37, offroad=21, turbo=24)
        ...
        Peach riding Bon Bon/ Sugarscoot: Stats(speed=34, weight=32, acceleration=59, handling=62, drift=41, offroad=51, turbo=56)
        Diddy Kong riding Bon Bon/ Sugarscoot: Stats(speed=32, weight=32, acceleration=57, handling=62, drift=38, offroad=51, turbo=61)
        Bowser Jr. riding Bon Bon/ Sugarscoot: Stats(speed=32, weight=32, acceleration=54, handling=62, drift=35, offroad=54, turbo=59)
      (s)
        Baby Luigi riding Rally Romper/ Tiny Titan: Stats(speed=51, weight=43, acceleration=43, handling=43, drift=29, offroad=64, turbo=40)
        Baby Mario riding Rally Romper/ Tiny Titan: Stats(speed=46, weight=43, acceleration=43, handling=49, drift=29, offroad=64, turbo=40)
        Baby Daisy riding Rally Romper/ Tiny Titan: Stats(speed=51, weight=41, acceleration=43, handling=43, drift=29, offroad=64, turbo=43)
        ...
        Toad riding Quacker: Stats(speed=32, weight=17, acceleration=73, handling=60, drift=68, offroad=48, turbo=57)
        Koopa Troopa riding Quacker: Stats(speed=32, weight=17, acceleration=67, handling=63, drift=62, offroad=48, turbo=63)
        Dry Bones riding Quacker: Stats(speed=32, weight=17, acceleration=70, handling=60, drift=65, offroad=48, turbo=63)
    By acceleration:
      (l)
        Waluigi riding Wario Bike: Stats(speed=37, weight=59, acceleration=57, handling=56, drift=26, offroad=48, turbo=48)
        Waluigi riding Offroader: Stats(speed=39, weight=64, acceleration=54, handling=54, drift=23, offroad=46, turbo=45)
        Large Mii riding Wario Bike: Stats(speed=40, weight=59, acceleration=54, handling=59, drift=24, offroad=45, turbo=51)
        ...
        Rosalina riding Flame Flyer: Stats(speed=65, weight=59, acceleration=16, handling=24, drift=48, offroad=18, turbo=51)
        King Boo riding Flame Flyer: Stats(speed=62, weight=59, acceleration=16, handling=26, drift=48, offroad=21, turbo=48)
        Dry Bowser riding Flame Flyer: Stats(speed=62, weight=59, acceleration=16, handling=21, drift=48, offroad=24, turbo=54)
      (m)
        Peach riding Nostalgia 1/ Classic Dragster: Stats(speed=39, weight=43, acceleration=64, handling=54, drift=60, offroad=40, turbo=51)
        Diddy Kong riding Nostalgia 1/ Classic Dragster: Stats(speed=37, weight=43, acceleration=62, handling=54, drift=57, offroad=40, turbo=56)
        Mario riding Nostalgia 1/ Classic Dragster: Stats(speed=37, weight=49, acceleration=61, handling=56, drift=57, offroad=40, turbo=51)
        ...
        Birdo riding Wild Wing: Stats(speed=57, weight=54, acceleration=21, handling=29, drift=59, offroad=27, turbo=64)
        Daisy riding Wild Wing: Stats(speed=61, weight=51, acceleration=21, handling=31, drift=59, offroad=24, turbo=62)
        Bowser Jr. riding Wild Wing: Stats(speed=57, weight=51, acceleration=21, handling=29, drift=59, offroad=27, turbo=62)
      (s)
        Toad riding Quacker: Stats(speed=32, weight=17, acceleration=73, handling=60, drift=68, offroad=48, turbo=57)
        Toad riding Cheep Charger: Stats(speed=34, weight=24, acceleration=70, handling=56, drift=65, offroad=45, turbo=54)
        Baby Peach riding Quacker: Stats(speed=35, weight=23, acceleration=70, handling=63, drift=62, offroad=48, turbo=57)
        ...
        Small Mii riding Concerto/ Mini Beast: Stats(speed=58, weight=35, acceleration=29, handling=32, drift=67, offroad=27, turbo=67)
        Toadette riding Concerto/ Mini Beast: Stats(speed=58, weight=32, acceleration=29, handling=32, drift=64, offroad=33, turbo=64)
        Koopa Troopa riding Concerto/ Mini Beast: Stats(speed=55, weight=32, acceleration=29, handling=35, drift=64, offroad=27, turbo=70)
    By handling:
      (l)
        King Boo riding Wario Bike: Stats(speed=37, weight=59, acceleration=51, handling=61, drift=21, offroad=48, turbo=48)
        Large Mii riding Wario Bike: Stats(speed=40, weight=59, acceleration=54, handling=59, drift=24, offroad=45, turbo=51)
        Rosalina riding Wario Bike: Stats(speed=40, weight=59, acceleration=51, handling=59, drift=21, offroad=45, turbo=51)
        ...
        Wario riding Aero Glider/ Jetsetter: Stats(speed=69, weight=59, acceleration=21, handling=17, drift=27, offroad=19, turbo=22)
        Funky Kong riding Aero Glider/ Jetsetter: Stats(speed=73, weight=56, acceleration=21, handling=17, drift=27, offroad=19, turbo=16)
        Dry Bowser riding Aero Glider/ Jetsetter: Stats(speed=69, weight=56, acceleration=21, handling=17, drift=27, offroad=22, turbo=22)
      (m)
        Mario riding Bon Bon/ Sugarscoot: Stats(speed=32, weight=38, acceleration=56, handling=64, drift=38, offroad=51, turbo=56)
        Daisy riding Bon Bon/ Sugarscoot: Stats(speed=36, weight=32, acceleration=54, handling=64, drift=35, offroad=51, turbo=59)
        Peach riding Bon Bon/ Sugarscoot: Stats(speed=34, weight=32, acceleration=59, handling=62, drift=41, offroad=51, turbo=56)
        ...
        Yoshi riding B Dasher Mk. 2/ Sprinter: Stats(speed=64, weight=51, acceleration=27, handling=24, drift=40, offroad=26, turbo=24)
        Birdo riding B Dasher Mk. 2/ Sprinter: Stats(speed=64, weight=51, acceleration=27, handling=24, drift=37, offroad=24, turbo=29)
        Bowser Jr. riding B Dasher Mk. 2/ Sprinter: Stats(speed=64, weight=48, acceleration=27, handling=24, drift=37, offroad=24, turbo=27)
      (s)
        Baby Mario riding Nano Bike/ Bit Bike: Stats(speed=25, weight=26, acceleration=59, handling=73, drift=40, offroad=56, turbo=62)
        Baby Peach riding Nano Bike/ Bit Bike: Stats(speed=28, weight=24, acceleration=62, handling=70, drift=40, offroad=56, turbo=62)
        Koopa Troopa riding Nano Bike/ Bit Bike: Stats(speed=25, weight=18, acceleration=59, handling=70, drift=40, offroad=56, turbo=68)
        ...
        Baby Daisy riding Blue Falcon: Stats(speed=65, weight=35, acceleration=35, handling=29, drift=43, offroad=24, turbo=32)
        Small Mii riding Blue Falcon: Stats(speed=63, weight=32, acceleration=35, handling=29, drift=46, offroad=24, turbo=32)
        Toadette riding Blue Falcon: Stats(speed=63, weight=29, acceleration=35, handling=29, drift=43, offroad=30, turbo=29)
    By drift:
      (l)
        Waluigi riding Twinkle Star/ Shooting Star: Stats(speed=50, weight=48, acceleration=35, handling=32, drift=64, offroad=30, turbo=59)
        Large Mii riding Twinkle Star/ Shooting Star: Stats(speed=53, weight=48, acceleration=32, handling=35, drift=62, offroad=27, turbo=62)
        Bowser riding Twinkle Star/ Shooting Star: Stats(speed=52, weight=53, acceleration=29, handling=32, drift=62, offroad=27, turbo=59)
        ...
        Wario riding Phantom: Stats(speed=43, weight=54, acceleration=43, handling=48, drift=17, offroad=59, turbo=46)
        Funky Kong riding Phantom: Stats(speed=47, weight=51, acceleration=43, handling=48, drift=17, offroad=59, turbo=40)
        Dry Bowser riding Phantom: Stats(speed=43, weight=51, acceleration=43, handling=48, drift=17, offroad=62, turbo=46)
      (m)
        Peach riding Mach Bike: Stats(speed=57, weight=37, acceleration=29, handling=32, drift=68, offroad=27, turbo=62)
        Mario riding Mach Bike: Stats(speed=55, weight=43, acceleration=26, handling=34, drift=65, offroad=27, turbo=62)
        Diddy Kong riding Mach Bike: Stats(speed=55, weight=37, acceleration=27, handling=32, drift=65, offroad=27, turbo=67)
        ...
        Medium Mii riding Turbo Blooper/ Super Blooper: Stats(speed=53, weight=43, acceleration=35, handling=37, drift=21, offroad=57, turbo=38)
        Birdo riding Turbo Blooper/ Super Blooper: Stats(speed=50, weight=43, acceleration=35, handling=37, drift=21, offroad=57, turbo=40)
        Bowser Jr. riding Turbo Blooper/ Super Blooper: Stats(speed=50, weight=40, acceleration=35, handling=37, drift=21, offroad=57, turbo=38)
      (s)
        Toad riding Bullet Bike: Stats(speed=53, weight=24, acceleration=38, handling=35, drift=73, offroad=29, turbo=67)
        Dry Bones riding Bullet Bike: Stats(speed=53, weight=24, acceleration=35, handling=35, drift=70, offroad=29, turbo=73)
        Small Mii riding Bullet Bike: Stats(speed=56, weight=27, acceleration=32, handling=35, drift=70, offroad=29, turbo=70)
        ...
        Baby Luigi riding Rally Romper/ Tiny Titan: Stats(speed=51, weight=43, acceleration=43, handling=43, drift=29, offroad=64, turbo=40)
        Baby Daisy riding Rally Romper/ Tiny Titan: Stats(speed=51, weight=41, acceleration=43, handling=43, drift=29, offroad=64, turbo=43)
        Toadette riding Rally Romper/ Tiny Titan: Stats(speed=49, weight=35, acceleration=43, handling=43, drift=29, offroad=70, turbo=40)
    By offroad:
      (l)
        Dry Bowser riding Phantom: Stats(speed=43, weight=51, acceleration=43, handling=48, drift=17, offroad=62, turbo=46)
        Waluigi riding Phantom: Stats(speed=43, weight=51, acceleration=49, handling=48, drift=22, offroad=59, turbo=40)
        King Boo riding Phantom: Stats(speed=43, weight=51, acceleration=43, handling=53, drift=17, offroad=59, turbo=40)
        ...
        Bowser riding Aero Glider/ Jetsetter: Stats(speed=71, weight=61, acceleration=21, handling=17, drift=30, offroad=16, turbo=16)
        Rosalina riding Aero Glider/ Jetsetter: Stats(speed=72, weight=56, acceleration=21, handling=20, drift=27, offroad=16, turbo=19)
        Donkey Kong riding Aero Glider/ Jetsetter: Stats(speed=69, weight=59, acceleration=23, handling=19, drift=27, offroad=16, turbo=19)
      (m)
        Yoshi riding Rapide/ Zip Zip: Stats(speed=41, weight=38, acceleration=45, handling=51, drift=32, offroad=67, turbo=45)
        Medium Mii riding Rapide/ Zip Zip: Stats(speed=44, weight=38, acceleration=45, handling=51, drift=29, offroad=65, turbo=48)
        Birdo riding Rapide/ Zip Zip: Stats(speed=41, weight=38, acceleration=45, handling=51, drift=29, offroad=65, turbo=50)
        ...
        Diddy Kong riding B Dasher Mk. 2/ Sprinter: Stats(speed=64, weight=48, acceleration=30, handling=24, drift=40, offroad=21, turbo=29)
        Daisy riding B Dasher Mk. 2/ Sprinter: Stats(speed=68, weight=48, acceleration=27, handling=26, drift=37, offroad=21, turbo=27)
        Luigi riding B Dasher Mk. 2/ Sprinter: Stats(speed=66, weight=54, acceleration=27, handling=24, drift=37, offroad=21, turbo=24)
      (s)
        Toadette riding Magikruiser: Stats(speed=46, weight=24, acceleration=45, handling=45, drift=32, offroad=73, turbo=43)
        Toadette riding Rally Romper/ Tiny Titan: Stats(speed=49, weight=35, acceleration=43, handling=43, drift=29, offroad=70, turbo=40)
        Toad riding Magikruiser: Stats(speed=43, weight=24, acceleration=51, handling=45, drift=38, offroad=67, turbo=43)
        ...
        Koopa Troopa riding Blue Falcon: Stats(speed=60, weight=29, acceleration=35, handling=32, drift=43, offroad=24, turbo=35)
        Baby Luigi riding Blue Falcon: Stats(speed=65, weight=37, acceleration=35, handling=29, drift=43, offroad=24, turbo=29)
        Baby Daisy riding Blue Falcon: Stats(speed=65, weight=35, acceleration=35, handling=29, drift=43, offroad=24, turbo=32)
    By turbo:
      (l)
        Dry Bowser riding Twinkle Star/ Shooting Star: Stats(speed=50, weight=48, acceleration=29, handling=32, drift=59, offroad=33, turbo=65)
        Wario riding Twinkle Star/ Shooting Star: Stats(speed=50, weight=51, acceleration=29, handling=32, drift=59, offroad=30, turbo=65)
        Dry Bowser riding Dragonetti/ Honeycoupe: Stats(speed=53, weight=62, acceleration=27, handling=29, drift=56, offroad=30, turbo=62)
        ...
        King Boo riding Aero Glider/ Jetsetter: Stats(speed=69, weight=56, acceleration=21, handling=22, drift=27, offroad=19, turbo=16)
        Funky Kong riding Aero Glider/ Jetsetter: Stats(speed=73, weight=56, acceleration=21, handling=17, drift=27, offroad=19, turbo=16)
        Bowser riding Aero Glider/ Jetsetter: Stats(speed=71, weight=61, acceleration=21, handling=17, drift=30, offroad=16, turbo=16)
      (m)
        Birdo riding Mach Bike: Stats(speed=55, weight=40, acceleration=24, handling=32, drift=62, offroad=30, turbo=67)
        Diddy Kong riding Mach Bike: Stats(speed=55, weight=37, acceleration=27, handling=32, drift=65, offroad=27, turbo=67)
        Medium Mii riding Mach Bike: Stats(speed=58, weight=40, acceleration=24, handling=32, drift=62, offroad=30, turbo=65)
        ...
        Peach riding B Dasher Mk. 2/ Sprinter: Stats(speed=66, weight=48, acceleration=32, handling=24, drift=43, offroad=21, turbo=24)
        Mario riding B Dasher Mk. 2/ Sprinter: Stats(speed=64, weight=54, acceleration=29, handling=26, drift=40, offroad=21, turbo=24)
        Luigi riding B Dasher Mk. 2/ Sprinter: Stats(speed=66, weight=54, acceleration=27, handling=24, drift=37, offroad=21, turbo=24)
      (s)
        Dry Bones riding Bullet Bike: Stats(speed=53, weight=24, acceleration=35, handling=35, drift=70, offroad=29, turbo=73)
        Koopa Troopa riding Bullet Bike: Stats(speed=53, weight=24, acceleration=32, handling=38, drift=67, offroad=29, turbo=73)
        Small Mii riding Bullet Bike: Stats(speed=56, weight=27, acceleration=32, handling=35, drift=70, offroad=29, turbo=70)
        ...
        Baby Mario riding Blue Falcon: Stats(speed=60, weight=37, acceleration=35, handling=35, drift=43, offroad=24, turbo=29)
        Baby Peach riding Blue Falcon: Stats(speed=63, weight=35, acceleration=38, handling=32, drift=43, offroad=24, turbo=29)
        Baby Luigi riding Blue Falcon: Stats(speed=65, weight=37, acceleration=35, handling=29, drift=43, offroad=24, turbo=29)