From f5d5529e4d887824d36fd945d603df23321e06c7 Mon Sep 17 00:00:00 2001 From: Allianzcortex Date: Mon, 1 Dec 2025 10:52:27 -0500 Subject: [PATCH 1/2] add solution for 2025 --- advent_of_code/2025(python)/__init__.py | 0 .../__pycache__/day1.cpython-313.pyc | Bin 0 -> 1304 bytes advent_of_code/2025(python)/day1.py | 52 ++++++++++++++++++ advent_of_code/2025(python)/test_day1.py | 29 ++++++++++ run-ci.sh | 3 +- 5 files changed, 82 insertions(+), 2 deletions(-) create mode 100644 advent_of_code/2025(python)/__init__.py create mode 100644 advent_of_code/2025(python)/__pycache__/day1.cpython-313.pyc create mode 100644 advent_of_code/2025(python)/day1.py create mode 100644 advent_of_code/2025(python)/test_day1.py diff --git a/advent_of_code/2025(python)/__init__.py b/advent_of_code/2025(python)/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/advent_of_code/2025(python)/__pycache__/day1.cpython-313.pyc b/advent_of_code/2025(python)/__pycache__/day1.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d3742dc2721b24abd382ccf16c8ca7f9138ed2cc GIT binary patch literal 1304 zcmaKrK}#D!6vyA}ZZw$0L^qnW+Ez^}jTmhr78+_xTaZ$s7MDPvfv_Z78%Q^CcWX&c zfnE~Z!%8VA^x!exdX&;H5pvlsQUp)A+2#xM%_c^x)`5A@e8(ejVcacq=w~nmSRjHemIM$70LCEc4g2sfNuXYA5WOP+0+%3RjFidB zkkDhrVu~2)>O^v}9~gn09C%WK3Bq3Qax;p` zO`OoA2{yB6OcFQA>K-xKoUDaxX0Mphas^p6ovJ1(S~@GODUxKeilmy1m@zq3lZq<6 z%orW!y~S86Q^-o`Od+3_ti35QyCKP1y6_5}St%908=b#XENQO`awwG*OOcsk$@Hj& z{DzdKpXnkV6jAU60P_d+1DY}z{7^Y=^f}5;kNSry%z=m3pXlqlqAz}SY^!zmM1?c@ zJ^DaZ`ZeG+Jfn3_P59eT0c7F%>ZjcZ0=+o!KgcGw!fge_$9 zl&!9o^Nbdyud8(heV`)13TlCZK!egxjhhb_9LdFXKKk&pL( zI=zSfV8wMgT#*JJJb_D(8@^zTG<>02eqU_NJTm+v+v_{_9rg<7{=W&+I|t(|g)wTu zsPK5f4;4Sg(dJg^s~)q2kU!iYakr*!5Vy7AFGkTO Ag8%>k literal 0 HcmV?d00001 diff --git a/advent_of_code/2025(python)/day1.py b/advent_of_code/2025(python)/day1.py new file mode 100644 index 0000000..c4b4b2b --- /dev/null +++ b/advent_of_code/2025(python)/day1.py @@ -0,0 +1,52 @@ + +def solve_day1_part1(actions): + start_degree = 50 + res = 0 + + for ac in actions: + step = (int(ac[1:])) % 100 + match ac[0]: + case 'L': + start_degree -= step + if start_degree < 0: + start_degree = 100 + start_degree + case 'R': + start_degree += step + if start_degree >= 100: + start_degree = start_degree-100 + + res += 1 if start_degree == 0 else 0 + + return res + + +def solve_day1_part2(actions): + start_degree = 50 + res = 0 + + for ac in actions: + step = (int(ac[1:])) + res += step//100 + + step = step % 100 + start_degree = start_degree % 100 + if step == 0: + continue + + initial_start = start_degree + match ac[0]: + case 'L': + start_degree -= step + if start_degree <= 0: + start_degree = 100 + start_degree + if initial_start != 0 and start_degree != 0: + res += 1 + case 'R': + start_degree += step + if start_degree >= 100: + start_degree = start_degree-100 + if initial_start != 0 and start_degree != 0: + res += 1 + res += 1 if start_degree == 0 else 0 + + return res diff --git a/advent_of_code/2025(python)/test_day1.py b/advent_of_code/2025(python)/test_day1.py new file mode 100644 index 0000000..a7f069b --- /dev/null +++ b/advent_of_code/2025(python)/test_day1.py @@ -0,0 +1,29 @@ +import unittest + +from day1 import solve_day1_part1, solve_day1_part2 + +question_input = [ + "L68", + "L30", + "R48", + "L5", + "R60", + "L55", + "L1", + "L99", + "R14", + "L82", +] + + +class TestSample(unittest.TestCase): + + def test_part1(self): + self.assertEqual(solve_day1_part1(question_input), 3) + + def test_part2(self): + self.assertEqual(solve_day1_part2(question_input), 6) + + +if __name__ == "__main__": + unittest.main() diff --git a/run-ci.sh b/run-ci.sh index dfa7f9c..16a37f6 100644 --- a/run-ci.sh +++ b/run-ci.sh @@ -20,5 +20,4 @@ done # For solutions with Python # may need to use another list for python folders next year echo "==entering Python solution folder==" -cd "2024(python)" -python -m unittest discover \ No newline at end of file +cd "2024(python)" && python -m unittest discover && cd .. && cd "2025(python)" && python -m unittest discover \ No newline at end of file From c0b1ae58d0e883c0964a91199f2274f7607034ce Mon Sep 17 00:00:00 2001 From: Allianzcortex Date: Mon, 1 Dec 2025 10:53:04 -0500 Subject: [PATCH 2/2] rm pyc file --- .../__pycache__/day1.cpython-313.pyc | Bin 1304 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 advent_of_code/2025(python)/__pycache__/day1.cpython-313.pyc diff --git a/advent_of_code/2025(python)/__pycache__/day1.cpython-313.pyc b/advent_of_code/2025(python)/__pycache__/day1.cpython-313.pyc deleted file mode 100644 index d3742dc2721b24abd382ccf16c8ca7f9138ed2cc..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1304 zcmaKrK}#D!6vyA}ZZw$0L^qnW+Ez^}jTmhr78+_xTaZ$s7MDPvfv_Z78%Q^CcWX&c zfnE~Z!%8VA^x!exdX&;H5pvlsQUp)A+2#xM%_c^x)`5A@e8(ejVcacq=w~nmSRjHemIM$70LCEc4g2sfNuXYA5WOP+0+%3RjFidB zkkDhrVu~2)>O^v}9~gn09C%WK3Bq3Qax;p` zO`OoA2{yB6OcFQA>K-xKoUDaxX0Mphas^p6ovJ1(S~@GODUxKeilmy1m@zq3lZq<6 z%orW!y~S86Q^-o`Od+3_ti35QyCKP1y6_5}St%908=b#XENQO`awwG*OOcsk$@Hj& z{DzdKpXnkV6jAU60P_d+1DY}z{7^Y=^f}5;kNSry%z=m3pXlqlqAz}SY^!zmM1?c@ zJ^DaZ`ZeG+Jfn3_P59eT0c7F%>ZjcZ0=+o!KgcGw!fge_$9 zl&!9o^Nbdyud8(heV`)13TlCZK!egxjhhb_9LdFXKKk&pL( zI=zSfV8wMgT#*JJJb_D(8@^zTG<>02eqU_NJTm+v+v_{_9rg<7{=W&+I|t(|g)wTu zsPK5f4;4Sg(dJg^s~)q2kU!iYakr*!5Vy7AFGkTO Ag8%>k