perladvent / Perl-Advent

The Perl Advent calendar
https://perladvent.org/
40 stars 58 forks source link

Fractal Christmas Tree #144

Closed wbraswell closed 1 year ago

wbraswell commented 2 years ago

Which Perl module do you want to write about: MathPerl::Fractal::ChristmasTree

Please give a short description of the article you want to write. Two to three sentences is fine: I'll develop a unique fractal algorithm for generating Christmas Tree graphics, hopefully with panning and zooming abilities as well. This should be interesting to those inclined toward mathematics, graphics programming, or the general Perl Christmas spirit! Note: this module does not exist yet, but its sister modules Julia and Mandelbrot do.

belg4mit commented 2 years ago

This sounds interesting. Might I suggest various discrete/space-filling things like Hilbert, Dragon or Siepersinki?

briandfoy commented 2 years ago

There's now a script to start your article for you and show off the pod enhancements you can use:

perl script/new_article

Good luck!

thibaultduponchelle commented 1 year ago

@wbraswell Gentle reminder 😄

oalders commented 1 year ago

Thank you so much for committing to provide an article to the Perl Advent calendar. It's a tradition that so many of us look forward to and we're happy you've volunteered your time to help us make 2022's calendar a success. Now, the initial submission deadline for an initial draft was Nov 1, 2022, but it's not too late to participate. We want help you to get your article merged. In order to avoid having the Advent Calendar team work furiously through the Holiday season in a rush to complete the calendar, we're asking you to submit your post by Dec 1, which is one week from today.

If we haven't heard from you by Dec 1st we will sadly need to close this issue and continue on without your article. We hope very much to make it to the magical number of 25 articles, but in order to accomplish this we need everyone who has offered to write an article to provide it. Please help us to make 2022 a year with a full calendar of fun, interesting and quirky Advent articles.

wbraswell commented 1 year ago

Hi Olaf, sorry I didn't realize the deadline is November 1st, yes I'm already working on my article now during the Thanksgiving holiday!

oalders commented 1 year ago

Excellent. Happy Thanksgiving, @wbraswell!

wbraswell commented 1 year ago

@oalders Just a quick update, I'm almost done with the code, will commence with writing the article today: https://github.com/wbraswell/mathperl/blob/master/script/sierpinski_triangle.pl

wbraswell commented 1 year ago

Animated Christmas tree code now completed, including graceful exit which is not exactly straightforward in SDL... https://github.com/wbraswell/mathperl/commit/4ccb4b4f0dc77852d2bee9d400f87c9a03a4b47a

The code is all self-documenting and contained in 1 file, so I will just need to write a short article with example output. Almost there! :-)

wbraswell commented 1 year ago

@briandfoy Is there an easy example of how to enable Perl syntax highlighting (presumably via Pod::Elemental::Transformer::SynHi) for my POD article?

oalders commented 1 year ago

You could follow this example: https://raw.githubusercontent.com/perladvent/Perl-Advent/main/2022/articles/2022-12-01.pod or https://raw.githubusercontent.com/perladvent/Perl-Advent/main/2022/articles/2022-12-02.pod

Either should be fine.

wbraswell commented 1 year ago

@oalders How do I see the output of Pod::Elemental::Transformer::SynHi on my POD file?

wbraswell commented 1 year ago

In other words, how do I see this: https://perladvent.org/2022/2022-12-01.html instead of just this: https://raw.githubusercontent.com/perladvent/Perl-Advent/main/2022/articles/2022-12-01.pod

oalders commented 1 year ago

You can run this script from the top level of this repo:

https://github.com/perladvent/Perl-Advent/blob/main/script/build-site.sh

Then:

cd out
plackup -MPlack::App::Directory -e 'Plack::App::Directory->new(root=>".");' -p 8080

Having said that, in order to see your article, you'll need to move a copy of the pod to the 2022/articles directory before building the site. Just give it a name where the date is from anywhere in the range from 1-25 and it should build for you. (Just like the other articles in that dir).

wbraswell commented 1 year ago

@oalders I'm getting an error from advcal, can you please assist?

wbraswell@starman:~/repos_github/perl-advent-fork$ cpanm --installdeps -v .
cpanm (App::cpanminus) 1.7042 on perl 5.022001 built for x86_64-linux-gnu-thread-multi
Work directory is /home/wbraswell/.cpanm/work/1670449480.367
You have make /usr/bin/make
You have LWP 6.15
You have /bin/tar: tar (GNU tar) 1.28
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by John Gilmore and Jay Fenlason.
You have /usr/bin/unzip
--> Working on .
Entering /home/wbraswell/repos_github/perl-advent-fork
Configuring /home/wbraswell/repos_github/perl-advent-fork ... OK
Checking if you have YAML::XS 0 ... Yes (0.41)
Checking if you have WWW::AdventCalendar 0 ... Yes (1.112)
Checking if you have Text::Markdown 0 ... Yes (1.000031)
<== Installed dependencies for .. Finishing.
wbraswell@starman:~/repos_github/perl-advent-fork$ pm_version.pl WWW::AdventCalendar
[[[ METHOD 1 ]]]
$WWW::AdventCalendar::VERSION = 1.112

[[[ METHOD 2 ]]]
WWW::AdventCalendar version 999 required--this is only version 1.112 at -e line 1.
BEGIN failed--compilation aborted at -e line 1.
wbraswell@starman:~/repos_github/perl-advent-fork$ which advcal
/home/wbraswell/perl5/bin/advcal
wbraswell@starman:~/repos_github/perl-advent-fork$ ./script/build-site.sh 
/home/wbraswell/repos_github/perl-advent-fork
Unknown option: https
advcal [-acoty] [long options...]
    -c STR --config STR       the ini file to read for configuration
    -a STR --article-dir STR  root of articles
    --share-dir STR           root of shared files
    -o STR --output-dir STR   output directory
    --today STR               the day we treat as "today"; default to
                              today

    -t STR --tracker-id STR   include Google Analytics; -t TRACKER-ID
    --uri STR                 base URI of the calendar, including
                              trailing slash
    -y --year-links           add year links to bottom of index.html
wbraswell@starman:~/repos_github/perl-advent-fork$
oalders commented 1 year ago

You can either delete the --https from build-site.sh or you can install the fork of WWW::AdventCalendar which is in this branch. https://github.com/perladvent/WWW-AdventCalendar/tree/perladvent

First option would be easier as SSL shouldn't be an issue locally. We've had to work around a couple of issues in the CPAN version of that module.

wbraswell commented 1 year ago

Okay removing the --https from build-site.sh worked! However, now advcal only wants to build the first 7 days of 2022 for some weird reason??? (I disabled the previous years for brevity, they all appeared to build correctly.)

wbraswell@starman:~/repos_github/perl-advent-fork$ ./script/build-site.sh 
/home/wbraswell/repos_github/perl-advent-fork
processing article for 2022-12-01...
processing article for 2022-12-02...
processing article for 2022-12-03...
processing article for 2022-12-04...
processing article for 2022-12-05...
processing article for 2022-12-06...
processing article for 2022-12-07...
/home/wbraswell/repos_github/perl-advent-fork/2022
openstrike commented 1 year ago

It's the 7th of December and that's not a coincidence. :)

If you are intending to preview one of the other articles just move/rename it to an available date and re-generate.

wbraswell commented 1 year ago

@openstrike Okay great, thanks!

thibaultduponchelle commented 1 year ago

Day 27