Blog

 

Triangles (2010)

triangles2010 by Tibor 'Igor2' Palinkas on 2020-02-27

Tags: 2010, ec, 2010ec, solver, eval, image, scaled

node source

 

 

Abstract: n/a

 

Datasheet

Task 2010
When 2010 EC C
Description html
Input pack zip

Triangles (2010)

A classic, "brute force", "scaled" (scored against other teams' best solutions) problem. We wanted to have a problem that involved image processing. We made a mistake and we learned the lesson: jpeg is so complex that different libs will decode the same jpeg file into slightly different raw bitmap. After this EC we decided to use png or raw bitmaps instead.

Our tools

Download as a tarball .

Solver

The reference solver is in concept/. It assumes Linux with gcc and depends on libsdl1.2 (libsdl2 won't work). Usage:


cd concept
make
./tri example.jpg 200

200 triangle approximation of example.jpg using tri

An alternate solver is tri2, that uses example.jpg and 200 triangles, hardwired but assumes variable transparency (which is now how the task specification ended up):


cd concept
make tri2
./tri2

200 triangle approximation of example.jpg using tri2

Eval

The eval program is eval/eval.c and has the same dependencies as the solver. To feed in your solution, insert two lines on top: first line of the file shall be the input number (1..10, inclusive), the second line shall be 0.

Extra

The original draft idea with a reference to the inspiration, all written in Hungarian.

All code is Copyright (C) 2010 Mate Nagy and is licensed under the GNU GPL version 2.