Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more trivia questions #1491

Open
1 of 2 tasks
jonathan-d-zhang opened this issue Mar 27, 2024 · 1 comment
Open
1 of 2 tasks

Add more trivia questions #1491

jonathan-d-zhang opened this issue Mar 27, 2024 · 1 comment
Labels
status: approved The issue has received a core developer's approval type: feature Relating to the functionality of the application.

Comments

@jonathan-d-zhang
Copy link
Contributor

jonathan-d-zhang commented Mar 27, 2024

Description

Add more trivia questions.

Using a format i can copy and paste into a python script to generate the json.

list[tuple[str, list[str], Optional[str]]] = [(question, [answer1, answer2], hint)]

Python

[
("What common operation does this function implement?\n```py\nmystery = lambda *args: map(lambda *x: x, *args)\n```", ["zip"], None),
("What common operation does this function implement?\n```py\ndef f(a):\n    b = []\n    for b[len(b):] in a:3\n    return b\n```", ["flatten"], None),
("What algorithm does this function implement?\n```py\nmystery = lambda xs: xs and [*mystery([x for x in xs[1:] if x <= xs[0]]), xs[0], *mystery([x for x in xs[1:] if x > xs[0]])]\n```", ["quicksort"], "It is a sorting algorithm."),
("In what year did Python 2 reach End of Life?", ["2020"], None),
]

CS

A question I thought would be fun is generating a random directed graph and asking people to find the shortest path between two randomly selected nodes. Variations could be solving TSP, and so on. Would need to send images though, which would require some modifications to a lot of code. Additionally, we would need to bring in another dependency like networkx or graphviz. Maybe this would be turned into another issue/PR? I'm not sure what the protocol for that is, would like thoughts on that from maintainer people.

Another question I thought would be interesting is: "give a string matching this regular expression". And randomly generate regexes. Regex crosswords, even.

[
("What lemma is commonly used to prove non-regularity of languages?", ["pumping lemma", "pumping"], None),
("TCP congestion and flow control throttle the sender by adjusting the?", ["window size"], None),
("What algorithm was famously created at a cafe in 20 minutes?", ["dijkstra"], None),
("What is the minimal time complexity for a comparison-based sorting algorithm?", ["O(n log n)", "O(nlogn)", "n log n", "nlogn"], None),
("How many valid code points are in the Unicode codespace?", ["1112064", "2^16-2^11+2^20"], None),
("Deterministic finite automata are equivalent to nondeterministic finite automata (true/false).", ["true"], None),
("Deterministic pushdown automata are equivalent to context free grammars (true/false).", ["false"], None),
("The family of algorithms for choosing a simple random sample without replacement from a stream of unknown size in a single pass is called?", ["reservoir sampling"], None),
("A hash function with no hash collisions is known as?", ["perfect", "perfect hash function"], None),
]

Reasoning

More trivia questions good.

Proposed Implementation

Modify the json file for static questions. For the dynamic question we would implement this as a function that generates a graph and associated image.

Would you like to implement this yourself?

  • I'd like to implement this feature myself
  • Anyone can implement this feature
@jonathan-d-zhang jonathan-d-zhang added status: planning Discussing details type: feature Relating to the functionality of the application. labels Mar 27, 2024
@wookie184
Copy link
Contributor

The fixed questions all look good. Feel free to open a PR with them.

I like the regex idea, that would be cool. I think it would be good as it's own category. Feel free to open a (separate) PR with that if you want (you can also break the idea out into another issue if you think there are any details about behaviour/implementation to discuss first).

The graph idea also sounds cool, though I think it would require a bit more discussion first - I think it would be good to open a separate issue for it. It could be worth looking into if there's a Python package or API that could handle converting a graph to an image so we don't need to worry about installing graphviz.

@Xithrius Xithrius added status: approved The issue has received a core developer's approval and removed status: planning Discussing details labels Mar 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: approved The issue has received a core developer's approval type: feature Relating to the functionality of the application.
Projects
None yet
Development

No branches or pull requests

3 participants