This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from functools import cache | |
| @cache | |
| def p(black_cards_in_deck, red_cards_in_deck): | |
| """ | |
| You flip cards from a deck of cards. | |
| At any point, you can stop and flip one last card. | |
| If that card is black, you win. If it is red, you lose. | |
| What is the probability of winning if you play optimally? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Insert this at the start of app/gniller.min.js | |
| // This needs to be redone after any update | |
| // Known issue: needs a game restart after restarting a new game+ | |
| const oldNow = Date.now; | |
| const timestamp = Date.now(); | |
| Date.now = () => { | |
| return timestamp + 1000 * (oldNow.call(Date) - timestamp); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| interface Cat { | |
| readonly name: string | undefined; | |
| } | |
| function catPrinter(cat: Cat) { | |
| if (cat.name === undefined) { | |
| return; | |
| } | |
| console.log(cat.name.trim()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "version": "0.2.0", | |
| "configurations": [ | |
| // Taken from https://medium.com/spektrakel-blog/debugging-typescript-from-vscode-3cb3a182bf63 | |
| { | |
| "type": "node", | |
| "request": "launch", | |
| "name": "Launch current file w/ ts-node", | |
| "protocol": "inspector", | |
| "args": ["${relativeFile}"], |