SlideShare a Scribd company logo
1 of 13
Download to read offline
Piotr Wasiak I 2023
Advent of Code
Code Gol
fi
ng
Advent
of
Code
Advent
of
Code [Some participant] noticed 4 problems
that required algorithms on graphs:
• Day 12 where we need to compute
shortest paths to a given target (typical
algo: Dijkstra)
• Day 16 where we need to precompute all
distances from valves pairs (typical algo:
Floyd-Warshall or repeated Dijkstra) and
then traverse a graph (DFS traversal)
• Day 19 where we need to do a DFS
traversal on a graph with some smart
elimination of branches
• Day 24 where we need to do a BFS
traversal on a graph to
fi
nd a minimum
time
AoC
Statistics
• the further away
the more di
ffi
cult
• the less people participate
Advent of Code
Possible challenges
• Write solution and post as fast as possible
• Write beautiful code
• Write code for solution
fi
rst part
that will be easy adaptable to solve also second one
• Write shortest solution possible (code gol
fi
ng)
Advent of Code
What for can you join it?
• Improve parsing
fi
les abilities. Read more rubyapi.org
• Revisit some algorithms, or learn new :)
• Compare your solution with:
• other languages
• other Redit users (with nice visualisations and memes)
• test ChatGPT3
• Have fun with great puzzles
Code Golfing
Solve problem with
the shortest source code
Specialized languages for Code Golfing
• GolfScript
• Flogscript, Vyxal, CJam
• Pyth, Husk
• AoC winner language: Noulith
Showtime
• some solutions from my christmas tree
What I discovered during code golfing?
• More about control
fl
ow @ ruby
• STD lib functions
• scripting switches with $ can be useful
• Better parsing
fi
le abilities
• less code is not easier to understand :D
What I discovered
Recursive arrays
• it's quite uncommon to have it
Sources
• adventofcode.com
• Discord ruby code golfing sources from radarek
Thanks for listening

More Related Content

Similar to AoC code golfing

Introducing Systems Analysis Design Development
Introducing Systems Analysis Design DevelopmentIntroducing Systems Analysis Design Development
Introducing Systems Analysis Design Development
bsadd
 

Similar to AoC code golfing (20)

DSD-INT 2014 - NGHS Workshop Scripting in SOBEK 3 & Delft3D Flexible Mesh - P...
DSD-INT 2014 - NGHS Workshop Scripting in SOBEK 3 & Delft3D Flexible Mesh - P...DSD-INT 2014 - NGHS Workshop Scripting in SOBEK 3 & Delft3D Flexible Mesh - P...
DSD-INT 2014 - NGHS Workshop Scripting in SOBEK 3 & Delft3D Flexible Mesh - P...
 
Big Data and NoSQL for Database and BI Pros
Big Data and NoSQL for Database and BI ProsBig Data and NoSQL for Database and BI Pros
Big Data and NoSQL for Database and BI Pros
 
Linux I2C
Linux I2CLinux I2C
Linux I2C
 
Global Cluster Topologies in MongoDB Atlas
Global Cluster Topologies in MongoDB AtlasGlobal Cluster Topologies in MongoDB Atlas
Global Cluster Topologies in MongoDB Atlas
 
Serverless Summit - Quiz
Serverless Summit - QuizServerless Summit - Quiz
Serverless Summit - Quiz
 
Future Directions for Compute-for-Graphics
Future Directions for Compute-for-GraphicsFuture Directions for Compute-for-Graphics
Future Directions for Compute-for-Graphics
 
HDF and netCDF Data Support in ArcGIS
HDF and netCDF Data Support in ArcGISHDF and netCDF Data Support in ArcGIS
HDF and netCDF Data Support in ArcGIS
 
LDPC - Low Density Parity Check Matrix
LDPC - Low Density Parity Check MatrixLDPC - Low Density Parity Check Matrix
LDPC - Low Density Parity Check Matrix
 
Redis v5 & Streams
Redis v5 & StreamsRedis v5 & Streams
Redis v5 & Streams
 
De05_panagenda_Prepare-Applications-for-64-bit-Clients.pdf
De05_panagenda_Prepare-Applications-for-64-bit-Clients.pdfDe05_panagenda_Prepare-Applications-for-64-bit-Clients.pdf
De05_panagenda_Prepare-Applications-for-64-bit-Clients.pdf
 
11. From Hadoop to Spark 1:2
11. From Hadoop to Spark 1:211. From Hadoop to Spark 1:2
11. From Hadoop to Spark 1:2
 
fundamentals of Computer graphics(Computer graphics tutorials)
 fundamentals of Computer graphics(Computer graphics tutorials) fundamentals of Computer graphics(Computer graphics tutorials)
fundamentals of Computer graphics(Computer graphics tutorials)
 
OMP GSE
OMP GSEOMP GSE
OMP GSE
 
Forge - DevCon 2016: Drawings! Drawings! Everywhere!
Forge - DevCon 2016: Drawings! Drawings! Everywhere!Forge - DevCon 2016: Drawings! Drawings! Everywhere!
Forge - DevCon 2016: Drawings! Drawings! Everywhere!
 
Introducing Systems Analysis Design Development
Introducing Systems Analysis Design DevelopmentIntroducing Systems Analysis Design Development
Introducing Systems Analysis Design Development
 
9781285852744 ppt ch01
9781285852744 ppt ch019781285852744 ppt ch01
9781285852744 ppt ch01
 
PCL (Point Cloud Library)
PCL (Point Cloud Library)PCL (Point Cloud Library)
PCL (Point Cloud Library)
 
ch11_031102.ppt
ch11_031102.pptch11_031102.ppt
ch11_031102.ppt
 
Global Cluster Topologies in MongoDB Atlas - Andrew Davidson
Global Cluster Topologies in MongoDB Atlas - Andrew DavidsonGlobal Cluster Topologies in MongoDB Atlas - Andrew Davidson
Global Cluster Topologies in MongoDB Atlas - Andrew Davidson
 
Code reviews: a short introduction
Code reviews: a short introductionCode reviews: a short introduction
Code reviews: a short introduction
 

Recently uploaded

Artificial intelligence presentation2-171219131633.pdf
Artificial intelligence presentation2-171219131633.pdfArtificial intelligence presentation2-171219131633.pdf
Artificial intelligence presentation2-171219131633.pdf
Kira Dess
 
一比一原版(Griffith毕业证书)格里菲斯大学毕业证成绩单学位证书
一比一原版(Griffith毕业证书)格里菲斯大学毕业证成绩单学位证书一比一原版(Griffith毕业证书)格里菲斯大学毕业证成绩单学位证书
一比一原版(Griffith毕业证书)格里菲斯大学毕业证成绩单学位证书
c3384a92eb32
 
21P35A0312 Internship eccccccReport.docx
21P35A0312 Internship eccccccReport.docx21P35A0312 Internship eccccccReport.docx
21P35A0312 Internship eccccccReport.docx
rahulmanepalli02
 

Recently uploaded (20)

Worksharing and 3D Modeling with Revit.pptx
Worksharing and 3D Modeling with Revit.pptxWorksharing and 3D Modeling with Revit.pptx
Worksharing and 3D Modeling with Revit.pptx
 
History of Indian Railways - the story of Growth & Modernization
History of Indian Railways - the story of Growth & ModernizationHistory of Indian Railways - the story of Growth & Modernization
History of Indian Railways - the story of Growth & Modernization
 
UNIT 4 PTRP final Convergence in probability.pptx
UNIT 4 PTRP final Convergence in probability.pptxUNIT 4 PTRP final Convergence in probability.pptx
UNIT 4 PTRP final Convergence in probability.pptx
 
Artificial intelligence presentation2-171219131633.pdf
Artificial intelligence presentation2-171219131633.pdfArtificial intelligence presentation2-171219131633.pdf
Artificial intelligence presentation2-171219131633.pdf
 
一比一原版(Griffith毕业证书)格里菲斯大学毕业证成绩单学位证书
一比一原版(Griffith毕业证书)格里菲斯大学毕业证成绩单学位证书一比一原版(Griffith毕业证书)格里菲斯大学毕业证成绩单学位证书
一比一原版(Griffith毕业证书)格里菲斯大学毕业证成绩单学位证书
 
Adsorption (mass transfer operations 2) ppt
Adsorption (mass transfer operations 2) pptAdsorption (mass transfer operations 2) ppt
Adsorption (mass transfer operations 2) ppt
 
SLIDESHARE PPT-DECISION MAKING METHODS.pptx
SLIDESHARE PPT-DECISION MAKING METHODS.pptxSLIDESHARE PPT-DECISION MAKING METHODS.pptx
SLIDESHARE PPT-DECISION MAKING METHODS.pptx
 
Diploma Engineering Drawing Qp-2024 Ece .pdf
Diploma Engineering Drawing Qp-2024 Ece .pdfDiploma Engineering Drawing Qp-2024 Ece .pdf
Diploma Engineering Drawing Qp-2024 Ece .pdf
 
Signal Processing and Linear System Analysis
Signal Processing and Linear System AnalysisSignal Processing and Linear System Analysis
Signal Processing and Linear System Analysis
 
Basics of Relay for Engineering Students
Basics of Relay for Engineering StudentsBasics of Relay for Engineering Students
Basics of Relay for Engineering Students
 
5G and 6G refer to generations of mobile network technology, each representin...
5G and 6G refer to generations of mobile network technology, each representin...5G and 6G refer to generations of mobile network technology, each representin...
5G and 6G refer to generations of mobile network technology, each representin...
 
21P35A0312 Internship eccccccReport.docx
21P35A0312 Internship eccccccReport.docx21P35A0312 Internship eccccccReport.docx
21P35A0312 Internship eccccccReport.docx
 
DBMS-Report on Student management system.pptx
DBMS-Report on Student management system.pptxDBMS-Report on Student management system.pptx
DBMS-Report on Student management system.pptx
 
NO1 Best Powerful Vashikaran Specialist Baba Vashikaran Specialist For Love V...
NO1 Best Powerful Vashikaran Specialist Baba Vashikaran Specialist For Love V...NO1 Best Powerful Vashikaran Specialist Baba Vashikaran Specialist For Love V...
NO1 Best Powerful Vashikaran Specialist Baba Vashikaran Specialist For Love V...
 
Independent Solar-Powered Electric Vehicle Charging Station
Independent Solar-Powered Electric Vehicle Charging StationIndependent Solar-Powered Electric Vehicle Charging Station
Independent Solar-Powered Electric Vehicle Charging Station
 
Developing a smart system for infant incubators using the internet of things ...
Developing a smart system for infant incubators using the internet of things ...Developing a smart system for infant incubators using the internet of things ...
Developing a smart system for infant incubators using the internet of things ...
 
Geometric constructions Engineering Drawing.pdf
Geometric constructions Engineering Drawing.pdfGeometric constructions Engineering Drawing.pdf
Geometric constructions Engineering Drawing.pdf
 
What is Coordinate Measuring Machine? CMM Types, Features, Functions
What is Coordinate Measuring Machine? CMM Types, Features, FunctionsWhat is Coordinate Measuring Machine? CMM Types, Features, Functions
What is Coordinate Measuring Machine? CMM Types, Features, Functions
 
Artificial Intelligence in due diligence
Artificial Intelligence in due diligenceArtificial Intelligence in due diligence
Artificial Intelligence in due diligence
 
handbook on reinforce concrete and detailing
handbook on reinforce concrete and detailinghandbook on reinforce concrete and detailing
handbook on reinforce concrete and detailing
 

AoC code golfing

  • 1. Piotr Wasiak I 2023 Advent of Code Code Gol fi ng
  • 3. Advent of Code [Some participant] noticed 4 problems that required algorithms on graphs: • Day 12 where we need to compute shortest paths to a given target (typical algo: Dijkstra) • Day 16 where we need to precompute all distances from valves pairs (typical algo: Floyd-Warshall or repeated Dijkstra) and then traverse a graph (DFS traversal) • Day 19 where we need to do a DFS traversal on a graph with some smart elimination of branches • Day 24 where we need to do a BFS traversal on a graph to fi nd a minimum time
  • 4. AoC Statistics • the further away the more di ffi cult • the less people participate
  • 5. Advent of Code Possible challenges • Write solution and post as fast as possible • Write beautiful code • Write code for solution fi rst part that will be easy adaptable to solve also second one • Write shortest solution possible (code gol fi ng)
  • 6. Advent of Code What for can you join it? • Improve parsing fi les abilities. Read more rubyapi.org • Revisit some algorithms, or learn new :) • Compare your solution with: • other languages • other Redit users (with nice visualisations and memes) • test ChatGPT3 • Have fun with great puzzles
  • 7. Code Golfing Solve problem with the shortest source code
  • 8. Specialized languages for Code Golfing • GolfScript • Flogscript, Vyxal, CJam • Pyth, Husk • AoC winner language: Noulith
  • 9. Showtime • some solutions from my christmas tree
  • 10. What I discovered during code golfing? • More about control fl ow @ ruby • STD lib functions • scripting switches with $ can be useful • Better parsing fi le abilities • less code is not easier to understand :D
  • 11. What I discovered Recursive arrays • it's quite uncommon to have it
  • 12. Sources • adventofcode.com • Discord ruby code golfing sources from radarek