Skip to content

Instantly share code, notes, and snippets.

@errorseven
errorseven / aoc2023_day4_Scratchcards.ahk
Created December 10, 2023 03:22
Advent of Code 2023 - Day 4: Scratchcards
; Copy Problem Data to Clipboard before you Run
data := StrSplit(trim(clipboard), "`r", "`n")
results := 0
for each, line in data {
winningCard := {}, x := 0
line := StrSplit(StrReplace(line, " ", " "), ": ").2
cards := StrSplit(line, " | ")
for e, v in StrSplit(Trim(cards.1), " ")
winningCard[v] := 1
@errorseven
errorseven / aoc2020_day3_part1.ahk
Created December 6, 2020 23:04
Advent of Code 2020 - Day 3
/*
--- Day 3: Toboggan Trajectory ---
With the toboggan login problems resolved, you set off toward the airport. While
travel by toboggan might be easy, it's certainly not safe: there's very minimal
steering and the area is covered in trees. You'll need to see which angles will
take you near the fewest trees.
Due to the local geology, trees in this area only grow on exact integer
coordinates in a grid. You make a map (your puzzle input) of the open squares
(.) and trees (#) you can see. For example:
@errorseven
errorseven / aoc2020_day1_part2.ahk
Created December 6, 2020 20:13
Advent of Code 2020 - Day 2
/*
--- Part Two ---
While it appears you validated the passwords correctly, they don't seem to be
what the Official Toboggan Corporate Authentication System is expecting.
The shopkeeper suddenly realizes that he just accidentally explained the
password policy rules from his old job at the sled rental place down the street!
The Official Toboggan Corporate Policy actually works a little differently.
Each policy actually describes two positions in the password, where 1 means the
@errorseven
errorseven / aoc2020_day1_part1.ahk
Created December 6, 2020 18:30
Advent of Code 2020 - Day 1
/*
Advent of Code 2020
After saving Christmas five years in a row, you've decided to take a vacation at
a nice resort on a tropical island. Surely, Christmas will go on without you.
The tropical island has its own currency and is entirely cash-only. The gold
coins used there have a little picture of a starfish; the locals just call them
stars. None of the currency exchanges seem to have heard of them, but somehow,
you'll need to find fifty of these coins by the time you arrive so you can pay
@errorseven
errorseven / 2048.ahk
Last active June 22, 2019 16:30
2048 Console Edition Coded in AutoHotkey
/* ____ ___ _ _ ___
|___ \ / _ \ | || | ( _ )
__) | | | | | | || |_ / _ \
/ __/ | |_| | |__ _| | (_) |
|_____| \___/ |_| \___/
Console Edition!
Coded by errorseven @ 5/28
2048 is played on a gray 4×4 grid, with numbered tiles that slide smoothly when
@errorseven
errorseven / roman.ahk
Last active November 21, 2018 05:20
Integer to Roman Numerals - Supports up to 1 less than 4 Billion
/*
_____ _ ____ __
\_ \_ __ | |_ |___ \ /__\ ___ _ __ ___ __ _ _ __
/ /\| '_ \| __| __) | / \/// _ \| '_ ` _ \ / _` | '_ \
/\/ /_ | | | | |_ / __/ / _ | (_) | | | | | | (_| | | | |
\____/ |_| |_|\__| |_____| \/ \_/\___/|_| |_| |_|\__,_|_| |_|
Coded by errorseven @ 11-19-2018
@errorseven
errorseven / blackJack.ahk
Last active November 17, 2018 08:20
BlackJack Class & Game - Class Handles: Scoring, creating decks, players, dealer hands, money, tracking bets
class BlackJack {
static _ := "".base.base := blackJack
__New(deckNumber, player) {
this.deck := this.BuildDeck(deckNumber)
this.cards := {"A": "Ace", "Q": "Queen", "K": "King"
, "J": "Jack", "T": 10}
@errorseven
errorseven / extobj.ahk
Last active June 3, 2017 02:04
Extended Objects - Ideas for built in methods came from Tidbits Object Wishlist - https://autohotkey.com/boards/viewtopic.php?t=7101
/*
__ _ _ _ ___ _ _ _
/__\_ _| |_ ___ _ __ __| | ___ __| | /___\ |__ (_) ___ ___| |_ ___
/_\ \ \/ / __/ _ \ '_ \ / _` |/ _ \/ _` | // // '_ \| |/ _ \/ __| __/ __|
//__ > <| || __/ | | | (_| | __/ (_| | / \_//| |_) | | __/ (__| |_\__ \
\__/ /_/\_\\__\___|_| |_|\__,_|\___|\__,_| \___/ |_.__// |\___|\___|\__|___/
Coded by errorseven @ 5-14-17 |__/ v1.1.2
Change Log:
-----------
@errorseven
errorseven / L33TSpeakTrans.ahk
Created April 25, 2017 21:11
Reddit/r/dailyprogrammer - [2017-04-24] Challenge #312 [Easy] L33tspeak Translator
Chalinput :=
(
"I am elite.
Da pain!
Eye need help!
3Y3 (\)33d j00 t0 g37 d4 d0c70r.
1 n33d m4 p1llz!"
)
for e, line in StrSplit(Chalinput, "`n", "`r")
@errorseven
errorseven / TwoSum.ahk
Last active March 4, 2024 05:46
TwoSum - Solutions: Naive O(n2), Sorted O(nlogn), Hash O(n)
/*
_____ __
/__ \__ _____ / _\_ _ _ __ ___
/ /\/\ \ /\ / / _ \\ \| | | | '_ ` _ \
/ / \ V V / (_) |\ \ |_| | | | | | |
\/ \_/\_/ \___/\__/\__,_|_| |_| |_|
Coded by errorseven @ 1/26/17
The two sum problem is a common interview question, and it is a variation of the
subset sum problem. There is a popular dynamic programming solution for the