Initial commit
This commit is contained in:
commit
f242d2b0df
420 changed files with 62521 additions and 0 deletions
17
2023/day07/day07.bqn
Normal file
17
2023/day07/day07.bqn
Normal file
|
@ -0,0 +1,17 @@
|
|||
input←(5⊸↑⋈6⊸↓)¨•FLines"input"
|
||||
hands←(('0'+↕10)∾"TJQKA")⊸⊐¨⊑¨input
|
||||
bids←•ParseFloat¨1⊸⊑¨input
|
||||
|
||||
types←⟨1‿1‿1‿1‿1,2‿1‿1‿1,2‿2‿1,3‿1‿1,3‿2,4‿1,⟨5⟩⟩
|
||||
Ranks←{(⍋types⊐{∨/⁼⊐𝕩}¨∧𝕩)⊏⍋𝕩}
|
||||
Winnings←{+´(1+↕≠𝕨)ר𝕩⊏𝕨}
|
||||
•Show bids Winnings Ranks hands
|
||||
|
||||
>hands2←("J"∾('1'+↕9)∾"TQKA")⊸⊐¨⊑¨input
|
||||
HandType←{
|
||||
𝕊(0‿0‿0‿0‿0): ⟨5⟩;
|
||||
js←0=𝕩
|
||||
(+´js)⊸+⌾⊑ ∨/⁼⊐(¬js)/𝕩
|
||||
}
|
||||
Ranks2←{(⍋types⊐HandType¨∧𝕩)⊏⍋𝕩}
|
||||
•Show bids Winnings Ranks2 hands2
|
1000
2023/day07/input
Normal file
1000
2023/day07/input
Normal file
File diff suppressed because it is too large
Load diff
5
2023/day07/test
Normal file
5
2023/day07/test
Normal file
|
@ -0,0 +1,5 @@
|
|||
32T3K 765
|
||||
T55J5 684
|
||||
KK677 28
|
||||
KTJJT 220
|
||||
QQQJA 483
|
Loading…
Add table
Add a link
Reference in a new issue