hp
jblog
toc

The Hundredth Post

2016-01-16, post № 100

programming, Pygame, Python, #100, #100th, #char, #char count, #character, #character distribution, #characters, #chars, #data, #data plot, #distribution, #graph, #graphics, #hundredth, #plot, #plotted, #plotted data, #representating, #Zipf, #Zipf curve

The J-Blog has reached its hundredth post, this one. It being the hundredth post, I want to review my previous posts. But rather than going into the context of my previous 𝟫𝟫 posts, I decided to write a program to do this for me.

The program goes through a list fetched from my Table of contents page, looks up the html code, distills the post and counts how many characters of each type there are. [1] It then outputs its results in a nice text-based style (can be seen below).

To further visualize the data, I wrote another program to display it graphically. The results look like this. On the left the characters are sorted alphabetically (ASCII) and on the right they are sorted by occurrence (you may click on the images to view them closely).

the-hundredth-post_alphabetically.png
the-hundredth-post_highest-count.png
+------+-------+---------+    +------+-------+---------+
| char | count | percent |    | char | count | percent |
+------+-------+---------+    +------+-------+---------+
| all  | 33746 | 100.0   |    | all  | 33746 | 100.0   |
| '!'  |     8 |   0.023 |    | ' '  |  5693 |  16.870 |
| ' '  |  5693 |  16.870 |    | 'e'  |  3323 |   9.847 |
| '%'  |     2 |   0.005 |    | 't'  |  2422 |   7.177 |
| '&'  |     1 |   0.002 |    | 'o'  |  2013 |   5.965 |
| ')'  |   109 |   0.323 |    | 'a'  |  1949 |   5.775 |
| '('  |   109 |   0.323 |    | 'i'  |  1912 |   5.665 |
| '-'  |    45 |   0.133 |    | 'n'  |  1839 |   5.449 |
| ','  |   206 |   0.610 |    | 's'  |  1782 |   5.280 |
| '.'  |   364 |   1.078 |    | 'r'  |  1765 |   5.230 |
| '1'  |    33 |   0.097 |    | 'h'  |  1165 |   3.452 |
| '0'  |    88 |   0.260 |    | 'l'  |  1126 |   3.336 |
| '3'  |    12 |   0.035 |    | 'c'  |  1035 |   3.067 |
| '2'  |    20 |   0.059 |    | 'g'  |   802 |   2.376 |
| '5'  |    11 |   0.032 |    | 'd'  |   799 |   2.367 |
| '4'  |    21 |   0.062 |    | 'm'  |   714 |   2.115 |
| '7'  |     9 |   0.026 |    | 'u'  |   681 |   2.018 |
| '6'  |    14 |   0.041 |    | 'p'  |   656 |   1.943 |
| '9'  |     1 |   0.002 |    | 'y'  |   487 |   1.443 |
| '8'  |     4 |   0.011 |    | 'f'  |   466 |   1.380 |
| ';'  |     1 |   0.002 |    | 'w'  |   437 |   1.294 |
| ':'  |     9 |   0.026 |    | '.'  |   364 |   1.078 |
| '='  |     2 |   0.005 |    | 'b'  |   287 |   0.850 |
| '?'  |     2 |   0.005 |    | 'v'  |   233 |   0.690 |
| 'A'  |    40 |   0.118 |    | 'k'  |   215 |   0.637 |
| 'C'  |    58 |   0.171 |    | ','  |   206 |   0.610 |
| 'B'  |    32 |   0.094 |    | 'I'  |   151 |   0.447 |
| 'E'  |    10 |   0.029 |    | 'T'  |   134 |   0.397 |
| 'D'  |    15 |   0.044 |    | '('  |   109 |   0.323 |
| 'G'  |     8 |   0.023 |    | ')'  |   109 |   0.323 |
| 'F'  |    17 |   0.050 |    | 'x'  |    94 |   0.278 |
| 'I'  |   151 |   0.447 |    | '0'  |    88 |   0.260 |
| 'H'  |    13 |   0.038 |    | 'C'  |    58 |   0.171 |
| 'K'  |     1 |   0.002 |    | 'S'  |    48 |   0.142 |
| 'J'  |     9 |   0.026 |    | '-'  |    45 |   0.133 |
| 'M'  |    20 |   0.059 |    | 'A'  |    40 |   0.118 |
| 'L'  |    27 |   0.080 |    | '1'  |    33 |   0.097 |
| 'O'  |     6 |   0.017 |    | 'U'  |    33 |   0.097 |
| 'N'  |     5 |   0.014 |    | 'B'  |    32 |   0.094 |
| 'Q'  |     1 |   0.002 |    | 'L'  |    27 |   0.080 |
| 'P'  |    19 |   0.056 |    | 'z'  |    26 |   0.077 |
| 'S'  |    48 |   0.142 |    | 'q'  |    24 |   0.071 |
| 'R'  |    19 |   0.056 |    | '4'  |    21 |   0.062 |
| 'U'  |    33 |   0.097 |    | '2'  |    20 |   0.059 |
| 'T'  |   134 |   0.397 |    | 'M'  |    20 |   0.059 |
| 'W'  |    19 |   0.056 |    | 'P'  |    19 |   0.056 |
| 'V'  |     7 |   0.020 |    | 'R'  |    19 |   0.056 |
| 'Y'  |    14 |   0.041 |    | 'W'  |    19 |   0.056 |
| 'X'  |     4 |   0.011 |    | 'F'  |    17 |   0.050 |
| '_'  |     2 |   0.005 |    | 'j'  |    17 |   0.050 |
| 'a'  |  1949 |   5.775 |    | 'D'  |    15 |   0.044 |
| 'c'  |  1035 |   3.067 |    | '6'  |    14 |   0.041 |
| 'b'  |   287 |   0.850 |    | 'Y'  |    14 |   0.041 |
| 'e'  |  3323 |   9.847 |    | 'H'  |    13 |   0.038 |
| 'd'  |   799 |   2.367 |    | '3'  |    12 |   0.035 |
| 'g'  |   802 |   2.376 |    | '5'  |    11 |   0.032 |
| 'f'  |   466 |   1.380 |    | 'E'  |    10 |   0.029 |
| 'i'  |  1912 |   5.665 |    | ':'  |     9 |   0.026 |
| 'h'  |  1165 |   3.452 |    | 'J'  |     9 |   0.026 |
| 'k'  |   215 |   0.637 |    | '7'  |     9 |   0.026 |
| 'j'  |    17 |   0.050 |    | '!'  |     8 |   0.023 |
| 'm'  |   714 |   2.115 |    | 'G'  |     8 |   0.023 |
| 'l'  |  1126 |   3.336 |    | 'V'  |     7 |   0.020 |
| 'o'  |  2013 |   5.965 |    | 'O'  |     6 |   0.017 |
| 'n'  |  1839 |   5.449 |    | 'N'  |     5 |   0.014 |
| 'q'  |    24 |   0.071 |    | '8'  |     4 |   0.011 |
| 'p'  |   656 |   1.943 |    | 'X'  |     4 |   0.011 |
| 's'  |  1782 |   5.280 |    | '%'  |     2 |   0.005 |
| 'r'  |  1765 |   5.230 |    | '='  |     2 |   0.005 |
| 'u'  |   681 |   2.018 |    | '?'  |     2 |   0.005 |
| 't'  |  2422 |   7.177 |    | '_'  |     2 |   0.005 |
| 'w'  |   437 |   1.294 |    | '&'  |     1 |   0.002 |
| 'v'  |   233 |   0.690 |    | '~'  |     1 |   0.002 |
| 'y'  |   487 |   1.443 |    | '9'  |     1 |   0.002 |
| 'x'  |    94 |   0.278 |    | ';'  |     1 |   0.002 |
| 'z'  |    26 |   0.077 |    | 'K'  |     1 |   0.002 |
| '~'  |     1 |   0.002 |    | 'Q'  |     1 |   0.002 |
+------+-------+---------+    +------+-------+---------+

The main program (shell-based): the-hundredth-post.py
The visualization program: the-hundredth-post_data-visualization.py

J-Filters IV

2016-01-09, post № 99

programming, Pygame, Python, #filter, #image, #img, #roto, #rotozoom, #zoom

As in the previous post, I used pygame’s rotozoom() function. This time to turn an image around the screen while shrinking it in size to get an unusual image filter. The original image can be found in Stacking Stones post.

This filter is called Rotozoom.

j-filters-iv_rotozoom.png
Source code: j-filters-iv_rotozoom.py

Rotating Squares

2016-01-03, post № 98

programming, Pygame, Python, #2015, #color, #colorful, #rotate, #rotating, #spin, #spinning, #square, #squares

Using the pygame.transform.rotozoom() function, a velocity argument and changing colors, this program rotates squares across the screen.

Controls

  • Left click spawns in a new square at current mouse position,
  • ‘Space’ takes a screenshot.
rotating-squares-2.png
rotating-squares-5.png
rotating-squares-9.png
Source code: rotating-squares.py

White Fireworks

2016-01-02, post № 97

programming, Pygame, Python, #2015, #black, #black and white, #celebration, #exploding, #explosion, #new year, #sparks, #star shape, #white

In the spirit of the new year, this program tries to mimic white fireworks exploding in the night sky.

white-fireworks-2.png
white-fireworks-5.png
white-fireworks-8.png
Source code: white-fireworks.py

Happy New Year

2015-12-31, post № 96

art, #2016, #firework, #fireworks, #gif, #happy, #happy new year, #new, #new year, #pixel, #pixel guy, #rocket, #year

Little pixel guy wishes you a happy 2016.

happy-new-year.gif

Prime Circle

2015-12-27, post № 95

mathematics, programming, Pygame, Python, #circles, #prime, #prime generator, #prime number, #prime numbers, #prime visualizer, #primes, #visualizing primes

Using circles to visualize prime appearance. The picture below is 𝟣𝟢𝟪𝟢 ⨉ 𝟩𝟤𝟢 pixels, thus showing numbers up to 𝟧𝟦𝟢 (on the far left and right).

prime-circle-1.png
Source code: prime-circle.py

Spinning Shapes

2015-12-26, post № 94

programming, Pygame, Python, #angle, #black, #generate, #generating, #generator, #length, #rotating, #shapes, #spinning, #white

Drawing lines according to length and angle, which change over time, this program creates pretty shapes. The changing values for both length and angle are saved in the image’s name.

spinning-shapes-30_length0.995_angle+99.png
spinning-shapes-38_length0.999_angle+90.1.png
spinning-shapes-44_length1.0001_angle+90.1.png
Source code: spinning-shapes.py
Extra assets: spinning-shapes-00.png, spinning-shapes-01.png, spinning-shapes-02.png, spinning-shapes-03.png, spinning-shapes-04_length0.7_angle+100.png, spinning-shapes-05_length0.9_angle+100.png, spinning-shapes-06_length0.9_angle+91.png, spinning-shapes-07_length1_angle+91.png, spinning-shapes-08_length1_angle+89.png, spinning-shapes-09_length1.00001_angle+89.png, spinning-shapes-10_length1.001_angle+89.png, spinning-shapes-11_length0.999_angle+89.png, spinning-shapes-12_length0.999_angle+89.png, spinning-shapes-13_length0.999_angle+89.png, spinning-shapes-14_length0.999_angle+89.png, spinning-shapes-15_length0.75_angle+30.png, spinning-shapes-16_length0.75_angle+40.png, spinning-shapes-17_length0.99_angle+90.png, spinning-shapes-18_length0.99_angle+90.png, spinning-shapes-19_length0.75_angle+60.png, spinning-shapes-20_length0.75_angle+61.png, spinning-shapes-21_length0.99_angle+61.png, spinning-shapes-22_length0.99_angle+61.png, spinning-shapes-23_length0.99_angle+61.png, spinning-shapes-24_length0.99_angle+61.png, spinning-shapes-25_length0.99_angle+61.png, spinning-shapes-26_length0.99_angle+99.png, spinning-shapes-27_length0.95_angle+99.png, spinning-shapes-28_length0.999_angle+99.png, spinning-shapes-29_length0.999_angle+99.png, spinning-shapes-31_length0.8_angle+99.png, spinning-shapes-32_length0.85_angle+99.png, spinning-shapes-33_length1.001_angle+99.png, spinning-shapes-34_length1.001_angle+99.png, spinning-shapes-35_length0.99_angle+90.png, spinning-shapes-36_length0.99_angle+90.01.png, spinning-shapes-37_length0.99_angle+90.1.png, spinning-shapes-39_length0.999_angle+90.1.png, spinning-shapes-40_length0.999_angle+90.1.png, spinning-shapes-41_length1.0001_angle+90.1.png, spinning-shapes-42_length1.0001_angle+90.1.png, spinning-shapes-43_length1.0001_angle+90.1.png, spinning-shapes-45_length0.9999999_angle+90.1.png, spinning-shapes-46_length0.9_angle+70.png, spinning-shapes-47_length0.99_angle+70.png, spinning-shapes-48_length0.999_angle+70.png

Merry Christmas

2015-12-24, post № 93

art, #animated gif, #candles, #Christmas, #Christmas gif, #Christmas tree, #gif, #happy, #happy Christmas, #merry, #merry Christmas, #pixel, #pixel art, #pixel Christmas, #pixel gif, #pixel guy, #tree, #x-mas, #xmas, #xmas gif

Little pixel guy wishes you a Merry Christmas.

merry-christmas.gif
Jonathan Frech's blog; built 2024/11/02 16:03:59 CET