Krzysztof J. Weblog

Indie game developement, pixel art, open source and linux

Game of Life for BBC Micro:bit

August 24, 2017 — Krzysztof Jankowski

This incredible little machine is both cute and intresting. What you can do with 16Mhz, 16KB RAM and a screen capable of 5x5 resolution?

Game of Life on micro:bit Game of Life on micro:bit

You can make Game of Life!

I don't have the real unit yet so I'm using web emulator. But to make it more challanging and fun I'm using only Microsoft Block Editor to program micro:bit controller.

block-ide

My first attemt was to use two-dimmensional arrays. But blocks don't support this well. Also it takes more ram. The solution was to use more calculations on a flat array. The screen resolution is 5x5 that gives us 25 cells. Then I created second array for sorrounding cells positions. This simplifies the code. Less code equals to less blocks in the editor. Final code turns out very nice. Both as algorithm and visual structure. And blinking LED are always cool.

source-code

Radio

Another cool thing about micro:bit and it's software is radio module. It is the simplies way to communicate between multiple devices I have ever seen and used. It's super fun. I tested it implementing sharing feature for this Game of Life. Each moment you can pause and share world state with another micro:bits.

Not Only For Kids

BBC Micro:bit is designed for kids. But is as usefull for adults as well. I woudl never made this kind of solution for Game of Life before using e.g. Python. This turns out as a nice, refreshing exercise/experiment. And as a bonus when I finally buy real device I will have a nice code to run.

Play

  • [Shake] to generate new random state.
  • [A] send state to other devices via radio
  • [B] start/stop simulation
  • [A]+[B] print generation number

Tags: microbit, code, Microsoft-Block-Editor

Word Grinder

August 12, 2017 — Krzysztof Jankowski

Word Grinder

Once in a while I found some new software that's so perfect for my needs as if I write it myself. One of those is a Word Grinder. It's a terminal word processor for processing words (quote from the homepage). Nothing less, nothing more. Perfect.

Why?

Word Grinder simplicity

Most important thing while writing longer text is to avoid any distractions. Word Grinder puts you right into the document and hides everything else. No menus, no toolbars. There is a status bar at the bottom by default but it can be easly hidden (toggle view). Afther that it looks and behave like any modern "distraction free" editor. So the real question is why do you need those when there is already Word Grinder.

It works on any Linux powered computer. It's super fast and lightweight. All you need is a terminal. Raspberry Pi Zero can do that. And on Debian it's already installed.

Word Grinder menus

It is a word processor not a text editor. For those that don't know the difference: one can make text bolder, underline, set heading, bullet lists, etc and the other not. It can import/export Open Document Format files. So it's compatible with LibreOffice Writer. It can export as HTML and Markdown also. For my simple needs it's more than enough.

I just like terminal applications. Perhaps I'm just old enough that it reminds me the good old days. Or I'm old enough to understand that all those visual effects like windows, toolbars or icons are unnesesary. At last for applications like this. All I need is a blank page to fill.

Conclusion

I always try to make VIM as simple and as easy to write articles. It was possible but it requies config and some plugins. Managing thoes on multiple computers (including bunch of Raspberry Pi's) was too complicated.

Word Grinder makes this all obsolete. I's perfect as it is. Combining it with good mechanical keyboard is an "end game" of distraction writing for me.

Highly recommended. Give it a try. You'll love it.

Tags: linux, terminal

RaspberryPi Zero Timelapse

June 25, 2017 — Krzysztof Jankowski

ZeroLapse

I finaly dicover the perfect use for my Zero. I want to build the ultimate timelapse device.

Parts

It will have:

  • moving arm
  • infrared camera 5MP
  • scripts to automate the process

For now I'm working on the timelapse workflow. I'll have the moving arm in few weeks.

Setup

I ducktaped the camera to window and power up Raspberry with good power bank. Cron is runing raspiLapseCam.py script at each reboot.

piLapseCam.py by James Moore

I leave the Pi computer for and hour and then grab all images it takes.

gallery

Postproduction

Then I use bake.sh to make a 2K video file.

ls *.jpg > list.txt mencoder -nosound -ovc lavc -lavcopts vcodec=mpeg4:aspect=2.39/1:vbitrate=8000000 -vf scale=2048:858 -o timelapse.avi -mf type=jpeg:fps=24 mf://@list.txt

There's always room for image quality improvements. LightWorks is perfect for this.

LightWorks

Colors

Final Videos

Tags: raspberrypi, photography, video

Benefits of being a Hipster

June 20, 2017 — Krzysztof Jankowski

Subtitle: Don't get in the hype of buying latest and greatest each year

Every company in the world will try to convence you that having a latest gadget in any category is a must have. That this year product is the best ever. But the next year it's the same story. I will share my story as an example.

I always wanted to have a pro video camera. I never like to use DSLR for video. And mirrorless cameras are even worse. Smartphonce are just silly. I like to use real camera. The one I can easly hold and balance in my hand. That have most important buttons in easy to access places. Semi-pro camera cost around 20K PLN ($5292). This is a huge price. So what I did?

I bought a semi-pro Sony VX2100 video camera for 1500 PLN ($397). In the time that camera was the best semi-pro camera around I has 15 years old. It cost much more than 20K back then. It was a dream to have one. Now 15 years later I have it.

And it's better than I could emagine. I am blown away of the image quality, camera build, super ergonomy in usage. And evrything works so smoothly. Even auto-focus is faster than legendary Canon 5DmkII in still mode. And at top of that all the battery holds for 850 minutes of work. 14 hours of operation. This is insane in todays world standards.

The only downside it have: SD resolution. Do not think as SD quality. No. It's super, almost film like footage but rendered on 560i frame. It sounds like very little. But in reality the most important part is always the content. And adding to it superb colors and low-light capabilities I get very nice image of it. Then I blow it up to 720p and it looks as the movie on DVD. Do you remember those? The same hype as today 4K. But we all watch those videos online (more compression) and on small screens. Smartphones and small portable laptops. In eader way SD quality is still enough.

So what about this super sharp 4K? I will test that in another 10 years. When I can get Sony semi-pro camera just taking some money from monthly paycheck. Because more than megapixels I love just making that damn videos! To master the skill 10 years will be not enough. So why bother about pixels and just concentrate on good lighting and composition.

And the conclusion is that in todays world nobody will quesion my camera choice. Evryone just thinks it's a hipster thing and they even like the "SD quality". It's a win-win situation.

Tags: notes