Advent of Code 2022 - Day 2

  Рет қаралды 8,893

Jonathan Paulson

Jonathan Paulson

Күн бұрын

Пікірлер: 21
@Aurarora
@Aurarora 2 жыл бұрын
I think I had a really nice solution where I used the index from a list to get the relations of rock, paper and scissors. So for example I always win if my opponents index +1 (modulo 3) equals my index and so on. This way I didn't have to define every situation and could just compare the indices.
@riddhiman2926
@riddhiman2926 2 жыл бұрын
yup i did this way
@benkester1518
@benkester1518 2 жыл бұрын
Wait you put logic in the code rather than putting the answer in the code? Is that...legal?
@DanDanilyuk
@DanDanilyuk 2 жыл бұрын
I ran a dictionary as well with keys equal to each line without splitting them
@mathnovice8886
@mathnovice8886 2 жыл бұрын
Damn, I didnt think of dictionary, so instead I write a very longggggg if else statement lmao. Well done btw
@codingtoad
@codingtoad 2 жыл бұрын
learning moment I can remember that same feeling .... just keep coding you will get better that is at least what I keep telling myself...
@aderegil
@aderegil 2 жыл бұрын
I'll use dictionaries next time. Thanks for the video. I did the combinations concatenating both movements and then simple ifs because I think is clear and short: if set == "AX" or set == "BY" or set == "CZ": score += 3 # draw if set == "AZ" or set == "BX" or set == "CY": score += 0 # loose if set == "AY" or set == "BZ" or set == "CX": score += 6 # win
@batlin
@batlin 2 жыл бұрын
I ended up switching from multiple case expressions in part 2, but... my brain was about 4 times slower than yours.
@CantLoseTheBlues
@CantLoseTheBlues 2 жыл бұрын
Was using dicts as well.. why vim though ?
@mieispeeking
@mieispeeking 2 жыл бұрын
I've no idea what the question in part 2 is asking. Can anybody explain it for me plsss? Thanks.
@jonathanpaulson5053
@jonathanpaulson5053 2 жыл бұрын
If you played the move in each game that would make you lose/draw/win, what would your score be? Instead of X Y Z telling you what move you played, it’s telling you whether you lost/drew/won and you have to figure out what move you played.
@Racrdude24
@Racrdude24 2 жыл бұрын
And here I thought I was clever using mods with offsets when I could have just made a table with an entry for every outcome 🤦‍♂
@hypercodedOld
@hypercodedOld 2 жыл бұрын
haha same, i guess in certain scenarios its just faster to hardcode everything
@Kirarak
@Kirarak 2 жыл бұрын
@@hypercodedOld the thing is you can't predict part two... somewhat robust solution can often help you down the road...
@NKCSS
@NKCSS 2 жыл бұрын
Just doing all the permutations was clever 😊Did it in a data-driven way myself, but spent 52 minutes on it (drawback of streaming, you can easily tell just how long you took to do it 🤣)
@derekc.gorman595
@derekc.gorman595 2 жыл бұрын
See my first thought was to use a dictionary but I've never used one before so I was getting confused. Just used a bunch of if else statements lol
@miunify
@miunify 2 жыл бұрын
do i have to submit my github repo or just the answer?????
@jonathanpaulson5053
@jonathanpaulson5053 2 жыл бұрын
Just the answer. GitHub is not required! I’m just using it so people can see my final code.
@bertrodgers2420
@bertrodgers2420 2 жыл бұрын
What colour scheme is this please?
@jonathanpaulson5053
@jonathanpaulson5053 2 жыл бұрын
Windows Terminal
@toshiro6589
@toshiro6589 2 жыл бұрын
i like your videos because i have same logic as you, but i am not very good at python.From all youtubers that soleve puzzles i cann keep up with you on easy ones. thank you
Advent of Code 2022 - Day 3
7:33
Jonathan Paulson
Рет қаралды 5 М.
Advent of Code 2024 Day 11
19:20
Jonathan Paulson
Рет қаралды 3,3 М.
To Brawl AND BEYOND!
00:51
Brawl Stars
Рет қаралды 17 МЛН
Chain Game Strong ⛓️
00:21
Anwar Jibawi
Рет қаралды 41 МЛН
Quilt Challenge, No Skills, Just Luck#Funnyfamily #Partygames #Funny
00:32
Family Games Media
Рет қаралды 55 МЛН
Advent of Code 2024 Day 15
25:05
Jonathan Paulson
Рет қаралды 1,8 М.
Advent of Code 2024 Day 16
16:50
Jonathan Paulson
Рет қаралды 2,4 М.
Advent of Code 2024 Day 24
1:42:19
Jonathan Paulson
Рет қаралды 1,7 М.
Advent of Code 2024 Day 20
58:18
Jonathan Paulson
Рет қаралды 1,8 М.
Advent of Code 2024 Day 14
27:49
Jonathan Paulson
Рет қаралды 4 М.
Advent of Code 2024 Day 19
7:46
Jonathan Paulson
Рет қаралды 2,1 М.
Advent of Code 2024 Day 18
10:40
Jonathan Paulson
Рет қаралды 1,8 М.
The Dome Paradox: A Loophole in Newton's Laws
22:59
Up and Atom
Рет қаралды 707 М.
Exploring Abandoned Games From Our Childhood
20:00
globert
Рет қаралды 162 М.
ПОСТАРЕЛА ЗА 1 ДЕНЬ НА 20 ЛЕТ - МУЖСКОЕ ЖЕНСКОЕ
55:44
ПРИЯТНЫЙ ИЛЬДАР
Рет қаралды 677 М.
НЕ ДАМ ЕЁ В ОБИДУ😡 #shorts
0:24
Паша Осадчий
Рет қаралды 1,6 МЛН
для всей семьи
0:56
Стакановец
Рет қаралды 191 М.
Её автомобиль никто не хотел ремонтировать!
20:12
Гараж Автоэлектрика
Рет қаралды 1,5 МЛН
для всей семьи
0:56
Стакановец
Рет қаралды 191 М.
три кошака и ростелеком
0:26
Мистер Денала
Рет қаралды 2,4 МЛН