This commit is contained in:
Miloslav Ciz 2024-11-13 01:37:31 +01:00
parent db7839946f
commit da00222f76
31 changed files with 2180 additions and 1926 deletions

View file

@ -214,13 +214,14 @@ Bear in mind the main purpose of this quiz is for you to test your understanding
107. Ronald died and wasn't missed, he was just a capitalist. Every action of that bitch only served to make him rich. Things he built but always sold, patents he would always hold. As he jerked off to his brands, dick got zipped up in his pants. Ron did one last happy dance, had idiot death insurance. Do you know what kind of note this stupid's grave would be bestowed?
108. Explain at least one of the following [chess](chess.md) concepts: fork, pin, smothered mate.
109. There is a cube-shaped planet that has 8 houses (numbered 1 to 8), each house on one of the 8 cube vertices. Each house is inhabited by one alien (they're named *A* to *H*). Sometimes they get bored and want to switch houses with others, so they organize a big moving day in which some aliens switch houses (it's possible that everyone moves elsewhere or that just some move and some stay where they are). However they like their neighbors (aliens living in houses directly connected by the same edge), so any time this house switching occurs, at the end of the day everyone must have the same neighbors as before. How many possible ways there are to assign aliens to the houses so that they always have the same neighbors?
110. A [troll](trolling.md) joins homosexual gayming stream and starts spamming Hitler quotes by which he increases the amount of lulz by X percent. However the gay starts crying so the stream censor quickly bans the poor troll, dropping the lulz to the original level. By how many percent have the lulz decreased now?
111. What happens in [Forth](forth.md) when you try to define a word with the same name as another already existing word? Will the old word be deleted? Or is this forbidden to do? Also say why.
112. What's the difference between [lazy](lazy.md) and strict evaluation? Show simple example.
113. Write code in [Brainfuck](brainfuck.md) that copies the value in current cell to the cell on to the right, while KEEPING the value in current cell. Of course you may use another temporary cell to do this.
114. What's the first sentence of the lyrics of the [Free Software](free_software.md) Song by [Richard Stallman](rms.md)?
115. Consider we record moves in [chess](chess.md) with a simple notation as *<SQUARE_FROM><SQUARE_TO>*, for example *e3e5* or *g1f3* (i.e. we don't care about which chessman moves, if check or promotion happens etc., only start and end square are recorded). How many such moves exist if we only consider those that can ever legally happen (i.e. don't count moves such as *a2g1*, *b3b3* and so on)? Castling just means moving the king to his castled position.
116. Did you enjoy this quiz?
110. Consider the game of [chess](chess.md) and ignore the 50 move rule: is it possible, from the normal starting position, by any series of moves, to achieve the starting position in which the black will have the first move? I.e. by cooperatively shuffling the pieces can the players make the black start instead of white? Prove why or why not.
111. A [troll](trolling.md) joins homosexual gayming stream and starts spamming Hitler quotes by which he increases the amount of lulz by X percent. However the gay starts crying so the stream censor quickly bans the poor troll, dropping the lulz to the original level. By how many percent have the lulz decreased now?
112. What happens in [Forth](forth.md) when you try to define a word with the same name as another already existing word? Will the old word be deleted? Or is this forbidden to do? Also say why.
113. What's the difference between [lazy](lazy.md) and strict evaluation? Show simple example.
114. Write code in [Brainfuck](brainfuck.md) that copies the value in current cell to the cell on to the right, while KEEPING the value in current cell. Of course you may use another temporary cell to do this.
115. What's the first sentence of the lyrics of the [Free Software](free_software.md) Song by [Richard Stallman](rms.md)?
116. Consider we record moves in [chess](chess.md) with a simple notation as *<SQUARE_FROM><SQUARE_TO>*, for example *e3e5* or *g1f3* (i.e. we don't care about which chessman moves, if check or promotion happens etc., only start and end square are recorded). How many such moves exist if we only consider those that can ever legally happen (i.e. don't count moves such as *a2g1*, *b3b3* and so on)? Castling just means moving the king to his castled position.
117. Did you enjoy this quiz?
### Answers
@ -334,13 +335,14 @@ sin(x) / cos(x) - log2(2) = tg(x) - 1*, so we get *tg(x) >= 1*. So that will hol
107. Retard -- read the first letter of each sentence.
108. Fork: attacking two (or more) pieces at once (often done with knight) so that the opponent can only save one. Pin: attacking a piece so that if it moves away, it will reveal another piece behind it to be taken (often pinning to king). Smothered mate: checkmate by knight in which king can't move anywhere because he's blocked by own pieces.
109. This is counting graph [automorphisms](automorphism.md). Let's say we assign alien *X* to house 1; we can count how many possible allowed configurations there are for this case and then multiply it all by 8 (for case when *X* would be assigned to house 2, then 3, 4 etc.). Let's say neighbors of *X* are *U*, *V* and *W*. There are 3 edges going from house 1, i.e. 3 possible ways for the first neighbor, *U*, to be placed -- again, consider we put *U* in one place; we'll count the possibilities and eventually multiply them by 3. Now we have 2 edges (2 neighbor houses) remaining and 2 neighbors (*V* and *W*) to put there; again, consider one case and then multiply that by 2. Now we have *X* and all his neighbors in place, how many possible configurations are left here? There is one house that's the neighbor of both *U* and *V* and there is only one possibility of who can live there: the shared neighbor of *U* and *V* -- there is just one option so this house's inhabitant is determined. Same for *V*/*W* and *U*/*W*. That's already 7 houses assigned and the one last remaining has to be in the one house left, so in fact by placing *X* and its neighbors we've uniquely determined the rest of the houses, there's just one way. So in the end we have 8 * 3 * 2 * 1 = 48 possible ways.
110. If the original level of lulz is *a* and lulz increase is *n*, then *X = 100 * n / a*. The decrease is then *100 * n / (a + n) = 100 * (a * X / 100) / (a + a * X / 100) = X / (1 + X / 100) = 100 * X / (100 + X)*.
111. It can be done (and it's useful), the new word will shadow the old one -- i.e. invoking the word will execute the latest word of that name -- but the old word will still exist in the dictionary, so that if the new word is deleted the old one becomes accessible again. This is because the dictionary is searched from the newest entries to the oldest (it's usually a linked list starting with the latest defined word).
112. They're both strategies for evaluating [expressions](expression.md): lazy (also *by need*) evaluates an argument ONLY once it's actually needed, while strict evaluation evaluates all arguments, even if some might not be needed. Example: let's have a function `or3(a,b,c)` which performs logical OR of three values; under strict evaluation all *a*, *b* and *c* will be evaluated and then logical OR will be performed; under lazy evaluation the function may first evaluate one argument, let's say *a*, and if it ends up being TRUE, there is no need to further evaluate *b* and *c* (the result is already known to be TRUE), so they won't be evaluated.
113. For example `[->+>+<<]>>[-<<+>>]<<`: first we copy the current cell into TWO cells to the right -- one of them is used as a temporary cell; after this we use another loop to copy the value from the temporary cell back to the original location that we zeroes during the first copying.
114. "Join us now and share the software."
115. Should be 1792 { Unless I counted it wrong lol. ~drummyfish }. We can count this by just considering each square on the board and summing all possible queen and knight moves from that square (queen and knight together cover all possible moves). Queen can obviously end up on any square and from knight's walk we know we can place a knight anywhere as well. This can probably be computed even manually but writing a quick program does the job quicker.
116. yes
110. No, the [proof](proof.md) follows. We can only ever move the knights, that's obvious (rooks can't be moved as we'd lose castling rights, BUT even if we didn't it wouldn't help because a rook could only move there and back, an even number of moves, achieving nothing). So a white will make a series of knight moves over the board and in the end land them where they started, or swap them. Meanwhile black will to do the same on his side. For a black to have a move after this the parity of the moves performed by black and white has to be different, i.e. white must have made odd number of moves and black even or vice versa because in order for it to be black's turn, the sum of the moves (or rather plies) must be odd, i.e. odd plus even or even plus odd. When a knight moves, he always moves from black square to white or vice versa, never from black to black or white to white (trivially proven). So to make a knight walk ending on the original starting square will always take even number of moves. So by moving knights in any way and eventually getting them back will always result in even number of moves by both players. The only other option is to swap the knights, however this will also take even number of moves. The two knights are on different colored squares so moving one to the other's place will take ODD number of moves, however we have to swap BOTH knights so the total number of moves will again be even because twice odd is even. However some chess960 starting positions will allow to do this (where queen is placed immediately next to two knights).
111. If the original level of lulz is *a* and lulz increase is *n*, then *X = 100 * n / a*. The decrease is then *100 * n / (a + n) = 100 * (a * X / 100) / (a + a * X / 100) = X / (1 + X / 100) = 100 * X / (100 + X)*.
112. It can be done (and it's useful), the new word will shadow the old one -- i.e. invoking the word will execute the latest word of that name -- but the old word will still exist in the dictionary, so that if the new word is deleted the old one becomes accessible again. This is because the dictionary is searched from the newest entries to the oldest (it's usually a linked list starting with the latest defined word).
113. They're both strategies for evaluating [expressions](expression.md): lazy (also *by need*) evaluates an argument ONLY once it's actually needed, while strict evaluation evaluates all arguments, even if some might not be needed. Example: let's have a function `or3(a,b,c)` which performs logical OR of three values; under strict evaluation all *a*, *b* and *c* will be evaluated and then logical OR will be performed; under lazy evaluation the function may first evaluate one argument, let's say *a*, and if it ends up being TRUE, there is no need to further evaluate *b* and *c* (the result is already known to be TRUE), so they won't be evaluated.
114. For example `[->+>+<<]>>[-<<+>>]<<`: first we copy the current cell into TWO cells to the right -- one of them is used as a temporary cell; after this we use another loop to copy the value from the temporary cell back to the original location that we zeroes during the first copying.
115. "Join us now and share the software."
116. Should be 1792 { Unless I counted it wrong lol. ~drummyfish }. We can count this by just considering each square on the board and summing all possible queen and knight moves from that square (queen and knight together cover all possible moves). Queen can obviously end up on any square and from knight's walk we know we can place a knight anywhere as well. This can probably be computed even manually but writing a quick program does the job quicker.
117. yes
## Other