jfrech.com
jblog
table of contents

R-Lines

2015-08-30, post № 60

art, programming, Pygame, Python, #black, #black and white, #draw, #line, #pseudo random, #random, #white

Starting at the screen’s center, this program draws randomly long lines in a random direction. The lines cannot leave the screen.

r-lines-2.png
r-lines-1.png
r-lines-3.png
Source code: r-lines.py

Trippy

2015-08-29, post № 59

programming, Pygame, Python, #aa, #antialiased, #black, #circles, #color, #colors, #different colors, #fade, #fading, #gfx, #gradient, #graphics, #onion, #pygame.gfxdraw()

Using the extended pygame graphics function pygame.gfxdraw [1], this program creates randomly colored trippy circles. There are 𝟣𝟢𝟢 circles, which get redrawn every 𝟣𝟢𝟢 ticks (~ 𝟣.𝟨 seconds).

trippy-1.png
trippy-2.png
trippy-7.png
Source code: trippy.py

Stacking Stones

2015-08-23, post № 58

art, #pile, #rock, #stack

Driven by pure boredom, I started picking up some stones near a lake and tried to stack them on top of each other. [1] I thought, they looked kind of cool — these are my favourite ones.

stacking-stones-9.jpg
stacking-stones-5.jpg
stacking-stones-1.jpg
stacking-stones-11.jpg

Random Resource Locator

2015-08-22, post № 57

programming, Python, #address, #com, #domain, #page, #pseudo random, #random, #rrl, #url, #web, #webpage, #webserver, #websize

I once heard that every domain containing three letters of the alphabet and ending with ‘.com’ was assigned to some web server. This would mean, all 𝟣𝟩𝟧𝟩𝟨 [1] domains were used.
To test it, I wrote this little Python program.

Usage

  • To use it, simply press enter to open a random page. Because you often will get redirected, the program will print out the url on the screen.
random-resource-locator-1.png
Source code: random-resource-locator.py

Jasteroids

2015-08-16, post № 56

games, programming, Pygame, Python, #asteroid, #asteroids, #black, #black and white, #comet, #missle, #random rocks, #rock, #rocket, #rocks, #space, #space craft, #space game, #space ship, #white

This game is my interpretation of the all-time classic arcade game Asteroids. Although it plays a little differently, it has all the components of the original game. The rocks are stationary, but — if destroyed — split into two smaller pieces. You can either destroy the rocks via missles or by just flying right into them.

Controls

  • Left arrow key tilts the space craft to the left,
  • Right arrow key tilts the space craft to the right,
  • Up arrow key propels the space craft,
  • ‘Space’ launches a missle.
jasteroids-1.png
jasteroids-3.png
jasteroids-4.png
Source code: jasteroids.py
Extra assets: jasteroids-2.png

Jonnect Jour

2015-08-15, post № 55

games, programming, Pygame, Python, #4, #connect, #connecting, #detection, #four, #four in a row, #game, #IV, #mouse control, #red, #win, #win detection, #yellow

After having programmed Jic-Jac-Joe — where you need to connect three pieces —, I now programmed Connect Four (four pieces).
This version — although it does not have a computer player — includes win detection.

Controls

  • Left-clicking puts your piece where the mouse cursor is positioned,
  • ‘Escape’ restarts the game.
jonnect-jour-1.png
jonnect-jour-3.png
jonnect-jour-5.png
Source code: jonnect-jour.py

Caesar Cipher

2015-08-09, post № 54

programming, Pygame, Python, #black, #Caesar cipher, #Caesar's cipher, #cipher, #code, #coding, #crypt, #cypher, #decrypt, #decryption, #encoder, #encoding, #encryption, #hidden, #key, #message, #private, #secret, #secret message, #unbreakable

This program lets you write a short line and encrypt it using Caesar’s Cipher. It shows the two prior and next rotations, as well as the current encryption key.

Usage

  • Normal letters let you type text,
  • ‘Backspace’ lets you delete the last letter,
  • ‘Tab’ sets the encryption key to zero,
  • ‘Escape’ toggles if key and other rotations are shown,
  • ‘Return’ toggles if special characters (characters that are not contained in the standard alphabet) are displayed,
  • Up arrow rotates up (encryption key decreases),
  • Down arrow rotates down (encryption key increases).
caesar-cipher-1.png
caesar-cipher-9.png
caesar-cipher-7.png
Source code: caesar-cipher.py

JClock IV

2015-08-08, post № 53

programming, Pygame, Python, #alternative, #arc, #around the center, #background, #clock, #clockface, #displaying time, #draw, #rgb, #rgb clock, #rgbw, #spawn time, #time, #time display, #time reading

Combining the built-in Pygame function pygame.draw.arc() with time, I came up with this alternative clock design.
The red arc represents hours, the green one minutes, the blue seconds and the white arc represents centiseconds (a hundredth of a second).
Although it is a clock, you read it anti-clockwise.

jclock-iv-2.png
Source code: jclock-iv.py
Extra assets: jclock-iv-1.png

Pattern

2015-08-02, post № 52

programming, Pygame, Python, #art, #backgroud, #color, #colors, #diamond, #entities, #entity, #gradient, #move, #movement, #moving, #pipes, #wallpaper

Using colors and entities, this program can generate some nice-looking pictures. The entities move randomly across the screen, always staying in a grid layout. Their color is defined by an increasing tick variable, which gives them a nice gradient.

Controls

  • ‘Space’ spawns in new entities,
  • ‘m’ pauses and resumes the movement of entities.
pattern-1.png
pattern-2.png
pattern-4.png
Source code: pattern.py

Jeakout

2015-08-01, post № 51

games, programming, Pygame, Python, #arcade, #arcade game, #Atari, #break, #break blocks, #breaking, #breaking blocks, #com, #computer play, #game, #games

Continuing with my arcade game replicas, I programmed Breakout.
This version is fairly simple. Your lives will be displayed at the lower right corner, your points in the screen’s caption. There also is a computer implementation, which — as in Jong — cannot lose.

Usage

  • Left arrow key moves the hitter to the left,
  • Right arrow key moves the hitter to the right,
  • ‘Space’ toggles computer play.
jeakout-1.png
jeakout-2.png
jeakout-3.png
Source code: jeakout.py

Bobble Throw

2015-07-26, post № 50

programming, Pygame, Python, #active, #art, #background, #black, #blue, #bobble, #bobbles, #bounce off, #colors, #mouse, #mouse control, #movement, #moving

Playing around with circles and colors, I came up with this good-looking program. If active, 𝟨𝟢 bobbles per second will spawn at your cursor position. They will bounce off the four edges of your screen, start fading towards black and eventually go away completely.

Controls

  • ‘Space’ toggles whether or not the bobbles are moving.
bobble-throw-2.png
bobble-throw-3.png
bobble-throw-1.png
Source code: bobble-throw.py