On Mon, Feb 08, 2016 at 12:01:41PM +0200, Lars Wirzenius wrote:
> Possibly someone should set up an online quiz thing, where you're
> shown a package name, its short description, and three randomly chosen
> short descriptions, and have to guess which short description is
> correct.
plee-the-bear
2D platform game
program for gridfitting, or "hinting," TrueType fonts
free AdLib sound library (utils)
(script attached)
Enrico
--
GPG key: 4096R/E7AD5568 2009-05-08 Enrico Zini <enrico@enricozini.org>
#!/usr/bin/python3
import apt
import random
cache = apt.Cache()
descs = {}
for pkg in cache:
ver = pkg.candidate
if ver is None: continue
tags = ver.record.get("Tag", None)
if tags is None or "role::program" not in tags: continue
descs[pkg.shortname] = ver.summary
names = list(descs.keys())
cand_idx = random.randint(0, len(names))
name = names.pop(cand_idx)
other_names = random.sample(names, 2)
cand_descs = [descs[name]] + [descs[x] for x in other_names]
print(name)
for d in cand_descs:
print(" ", d)
Attachment:
signature.asc
Description: PGP signature