All posts by jihem

mapOSM (WIP)

Hi,

I have found a new subject to scratch my head: i’m trying to work with OSM XML files (geographic data used to draw map). I made a program to convert the file into an sqlite database (nodes, ways, relations). The latitude-longitude values are converted in planar coordinates (to draw on screen) with a Lambert azimuthal projection.

MVD is very efficient for this. A lot of SQL statements are required which consume a lot of time. I choose to  put the sql file on a RAMdisk. Even if the RAMDisk is 200X more faster than my hard drive, the import of the XML file (a big one) take near 10 minutes. Fortunately, the import is only required one time.

Now, I’m able to draw streets and houses. It was a very interesting thing to explore. I have a lot to optimize and maybe some bugs to catch. I’m not sure I will release an application, more surely some tricks how to process.

Now, I would like to implement some aspect of the graph theory but that is another story 😉

See below…
Regards,
jihem

Lambert azimuthal equal-area projectionmapOSM-2

Show a part of an opentreetmap.org export
mapOSM-1

EAN13 barcode generator

EAN13

Hi,

EAN13 is a barcode generator. Enter a valid EAN13 code in the text box, click Generate. The barcode is displayed in the image. Then you can Save the picture. In the install folder (right click on the icon, show properties, access the application folder), the file <EAN13>_EAN13.png is created.

If you have a lot of barcodes to create, edit a text file (example EAN13.TXT) with a barcode per line. Sample:

EAN13.TXT
9782746036659
5030917196904

Put the text file in the application install folder (%APPDATA%\..\Local\EAN13 by default), launch a shell, then type :

C:\…> CD %APPDATA%\..\Local\EAN13
C:\…> EAN13 EAN13.TXT

A picture with the EAN13 barcode is generated for each valid EAN13 code in the EAN13.TXT file.

Note: If you don’t know the value of the check digit (13th), you can enter  twelve digits and let the program compute the last.

You can download the install program of EAN13 in english.

The application has been done with MyVisualDatabase (a cheap and well done environment similar to Delphi).

Regards,
jihem

podcastor

 

podcaster-en

Update: if you have a false positive issue with Windows Defender and wdGetFile.exe, you can replace it with the file in this archive (same program with a different signature). Extract the archive and put the file in the podcastor directory.

Hi,

Podcastor is a RSS stream downloader. You can download the install program of podcastor in english or in french. Run the installer and follow the instructions. After install, click on the icon of the program “podcaster” on the desktop.

Copy/Paste or type the URL of a RSS stream in the first field then click “Import” button. The application may apper unresponsive for some seconds (downloading/decoding/importing time). The content of the stream is displayed in the grid. Double-click to select some  items. Click “Download” to download them. They are stored in the application folder (where podcastor.exe remains).

The application has been done with MyVisualDatabase (a cheap and well done environment similar to Delphi). The download operations are made using an external program : wbGetFile (made with PureBasic).

In hope you find this app useful. I made it as a proof of concept (background downloading are is not provided by MyVisualDatabase)… and because I’m a big fan of the podcast “Du grain à moudre” (Hervé Gardette, France Culture).

Now, I’m begging Dmitry (MyVisualDatabase developer) to include the background download natively in MyVisualDatabase.

Regards,
jihem

podcastor-fr

Poscastor in french
(a good way to listen Hervé Gardette)

i_editor 2.0

i_editor.p8

I_EDITOR is a programming game. The goal is to write simple scripts to reproduce a drawing on screen. The commands used in the scripts move a pointer (“turtle”). The pointer has a pen, which can be up or down. When the pen is down, each move lays a print. There are additional instructions to make calculus, evaluate conditions and call previous declared sequences. The syntax and semantic are organized in language called I_CORE.

I_EDITOR 2.0 and its manuals are available as a PICO-8 cartridge (download the picture) and PDF files : english , french.

You can play the game online.

i_editor 1.5

i_editor-p8

. displays result in the drawing (up to 17 lines)

Sample 1
5 4 + .

Clipboard enabled (<CP, >CP)

CLR : clear
<CP : copy from clipboard
>CP : copy to clipboard

Copy the line below into the clipboard

:a 10 fd 90 tr ; a a a a

Paste in PICO-8, then activate <CP

pico-8_1

Sample 2
:a >a # <a / flr # b >b <a * – <a 2 / flr # ?a ; :b cl 4 c ; :c 1 – # 3 fd 3 bd 90 tr 1 fd 90 tl ?c ; pu 20 20 mv pd 62 128 a pu pd 20 24 mv 127 128 a pu 20 28 mv pd 73 128 a pu 20 32 mv pd 127 128 a pu 20 36 mv pd 62 128 a pu 20 40 mv pd 42 128 a
pico-8_0

/!\ WARNING:
Clipboard functions (<CP,>CP) aren’t working in HTML exported cartridge.
Copy from notepad (text in the html browser may contain tag or additional characters).

i_editor

i_editor-p8

Choose the command in the first column (up/down, x)
Change column (left/right)

Change the value in the second colum (x, then left/right to decrease/increase)
Delete instruction in the second colum with (o)

Have a look on i_core post to have more explanation about the language “I”.

I will make a tutorial soon and post a link and additional information here.

Sample 1 (gif)

:A 20 FD 90 TR ; :B 1 – # A ?B ; 4 B

Sample 2 (gif) made by roywig

pico-8_7

pico-8_8

You can accelerate the rendering process in the M:DRAW method. At the end, change from

self.vm:step()

to

i=4
while i>0 and self.vm:state()!=3 do
self.vm:step()
i-=1
end

i_core + turtle

i_turtle-p8

This cartridge includes i_core and the turtle extension.
It shows how to:
– bind a personal extension (turtle object, turtle binding) to the language core engine,
– initialize the external extension and call its methods (from PICO-I and i_core)
– pass parameters from PICO-8 to i_core (N).

The turtle extension includes the following commands:
– FD forward, 20 FD
– BD backward, 20 BD
– TR turn right, 90 TR
– TL turn left, 90 TL
– CL change color, 1 CL
– PU pen up, PU
– PD pen down, PD
– TO go to, 10 10 TO
– HD head to (0 right, 90 top, 180 left, 270 down), 0 HD

Sample :

‘:loop 20 fd <a tr 1 – # ?loop ; :side >n 360 <n / >a <n loop ; cls 4 side’

Have fun 😉

jihem

 

i_core

i_core-p8

 

This is the core engine of a language (‘I’) and its virtual machine (all of this in PICO-8).
You can extend this engine (see how _SHW or _CLS are implemented).
You can create synonyms for a simplier use (see _ADD and _+).

The programs must be writen in a line. Terms are separated by space.

The engine is stack based (like forth): ‘5 4 + .’ => shows 9

The operators + – * / and flr function are available.
The ‘#’ duplicates the last value (of the stack).

You can evaluate (5 + 4) * (3 + 2) with ‘5 4 + 3 2 + * .’ => 45

Create a sub function

:NAME <sequence of instructions> ;

‘:A 5 4 + ; :B 3 2 + ; A B * .’ => 45

You can call the sub function NAME with its NAME (see A and B in the sample).

Create SQUARE and evaluate 3^2:

‘:SQUARE # * ; 3 SQUARE .’ => 9

Conditional call

?NAME

If the last value in the stack isn’t zero it calls NAME else it goes to the next instruction.

This is usefull to create tests and loops:

‘:SA # . 1 – ; :LP SA # ?LP ; 5 LP 0 .’

Count down from 5 to 0 (then stop).

You can use variables:
>NAME (load value from stack)
<NAME (push value in the stack)

‘1 >A <A <A + .’ =>2

You can use many :EVAL call to enter your program (one line per call).
You can use as many i_core engines as you want at the same time (object).
You can execute the whole program (:EXEC) or run it :STEP by step.

:STATE returns 3 when done. You can restart with :STATE(0).

If you have read the description so far, you may have a question.
This sounds crazy… So, why?

I’m working on two games. In the first you have to build a program by stacking graphic items to draw on screen to replicate a drawing with the minimal amonth of items. In the second, some robots fight together using genetic algorithms to evolve (by sharing part of their own code to create new ones).

I think I can share this library and my interest in doing this.

jihem

VCT from PICO-8 to Monkey2

For the PICO-8 Jam#2, I have done a game : “VCT”. You can play it here or download the cartridge (below).

vct.p8

Now, I’m working on a enhanced version using Monkey2. The first step was the translation of the main methods :  _init, _update and  _draw. For this, I have made a basic version of the VCT “engine” (which uses vectors to  draw and animate) with pico-8. You can use left, right, up keys (or a gamepad) to test. The cartridge and explanations are available (or will be soon)  in picozine#5.

pz507

Then I started to write all the required stuff to produce the same with monkey2. The result is pretty good. I have to polish the switch between full screen and window mode. You can download and compare : windows binary (auto-extractible).

Right now, I’m sure Monkey2 is the good tool to go further.
Stay tuned, I’ll post updates in the next coming weeks about this.