Skip to content

About

๐ŸŒ One algorithm, every programming language: the Italian Fiscal Code implemented and verified in 64 languages and beyond โ€” a community challenge promoted by @openapiยฎ

Topics

Resources

Code of conduct

Contributing

Stars

1 star

Watchers

0 watching

Forks

Latest commit

ย 

History

6 Commits

Folders and files

Repository files navigation

๐ŸŒ Every Language

One algorithm. Every programming language. Every implementation verified.

From COBOL to Rust, from FORTRAN to Prolog: one real-world algorithm, written by the community in every language that can run it, all checked by the same test suite.

Verify implementations Verified languages Test vectors Spec License: MIT PRs welcome Hacktoberfest

Add your language โ†’ ยท Specification ยท Languages ยท The challenge


๐ŸŽฏ The challenge

Collecting snippets in many languages is easy. Showing that a hundred completely different programs behave identically is not.

Each implementation in this repository:

  • ๐Ÿง  is written from scratch in its own language, with no wrappers, no libraries that do the work and no API calls;
  • ๐Ÿ“ฆ runs in its own container, built from a pinned toolchain;
  • โœ… passes the same 87 test vectors with identical JSON output;
  • ๐Ÿ” leaves evidence: source hashes, environment, per-test results and logs.

Our first goal is 64 languages, then 99, 128, 256 and beyond. See Why 64? and the roadmap.

64     2โถ    โ–ˆโ–ˆโ–ˆโ–โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘   10 / 64     โ† we are here
99     ๐Ÿบ    โ–ˆโ–ˆโ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘   10 / 99
128    2โท    โ–ˆโ–Œโ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘   10 / 128
256    2โธ    โ–Šโ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘   10 / 256

๐Ÿ”ข Why 64?

Because computers count in powers of two, and 64 is the number computing keeps coming back to:

  • 2โถ = 64. Six bits, 000000 to 111111, are exactly enough to give every language on the board its own ID.
  • 64-bit. It is the word size of almost every processor running today: x86-64 in laptops and servers, ARM64 in phones and the cloud. Your code runs on 64 bits.
  • Base64. Its 64-character alphabet carries binary data through text everywhere: email attachments, data: URLs, JSON Web Tokens.
  • Commodore 64 and Nintendo 64. Two machines that brought generations to programming and gaming. The C64 is often cited as the best-selling single computer model of all time.
  • The 64 squares of a chessboard. In the old legend, one grain of wheat on the first square, doubled on every next square, adds up to 2โถโด โˆ’ 1, which is also the largest unsigned 64-bit integer. It is still the classic way to explain exponential growth.

So we set the bar at 64 languages. Next comes 99, a toast to 99 Bottles of Beer, the classic collection of one song in a thousand languages. After that the ladder goes back to binary: 128 is 2โท, the size of the ASCII table, and 256 is 2โธ, the values of a single byte.

๐Ÿ‡ฎ๐Ÿ‡น The algorithm: the Italian Fiscal Code

Every Italian resident has a 16-character codice fiscale. It looks simple, but computing it exercises string manipulation, vowel and consonant rules, date encoding, lookup tables and modular arithmetic. That makes it complex enough to be a real program and small enough to write in COBOL or Assembly.

            ROSSI ยท MARIO ยท 1980-01-01 ยท M ยท born in Rome (H501)

             RSS   MRA   80   A   01   H501   U
             โ”‚     โ”‚     โ”‚    โ”‚   โ”‚    โ”‚      โ””โ”€ check character
             โ”‚     โ”‚     โ”‚    โ”‚   โ”‚    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ place of birth
             โ”‚     โ”‚     โ”‚    โ”‚   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ day (+40 if female)
             โ”‚     โ”‚     โ”‚    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ month (A, B, C, D, E, H, L, M, P, R, S, T)
             โ”‚     โ”‚     โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ year
             โ”‚     โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ name consonants
             โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ surname consonants

The full rules are in SPECIFICATION.md.

๐Ÿ—บ๏ธ Language board

Language Language Language Language
โœ… C โœ… C++ โœ… Go โœ… Java
โœ… JavaScript โœ… Perl โœ… PHP โœ… Python
โœ… Ruby โœ… Rust ๐Ÿ™‹ Haskell ๐Ÿ™‹ Prolog
๐Ÿ™‹ COBOL ๐Ÿ™‹ FORTRAN ๐Ÿ™‹ Common Lisp ๐Ÿ™‹ โ€ฆyour favourite

โœ… verified ยท ๐Ÿ™‹ wanted: pick an open issue or propose another language

โšก Try it in 30 seconds

You only need Docker and bash. Every toolchain, including the test runner, lives in a container, so nothing gets installed on your machine.

$ git clone https://github.com/openapi/every-language-fiscal-code.git
$ cd every-language-fiscal-code

$ echo '{"surname":"ROSSI","name":"MARIO","birth_date":"1980-01-01","sex":"M","birthplace_code":"H501"}' | ./elc run python
{"fiscal_code": "RSSMRA80A01H501U"}

$ ./elc test
LANGUAGE             STATUS     TESTS
PHP                  verified   87/87
Python               verified   87/87

Verified: 2/2 โ€” report written to reports/report.json
Command What it does
./elc list list implementations
./elc test build and verify every implementation
./elc test rust go verify only some of them
./elc run <lang> pipe stdin through one implementation
./elc shell <lang> open a shell inside a language image

โš™๏ธ How verification works

flowchart LR
    A["languages/&lt;lang&gt;/<br/>source + Dockerfile"] --> B["docker build<br/>(pinned toolchain)"]
    B --> C["87 test vectors<br/>JSON on stdin"]
    C --> D{"output and exit code<br/>match?"}
    D -- "100%" --> E["โœ… verified"]
    D -- "any failure" --> F["โŒ rejected"]
    E --> G["report.json<br/>+ evidence"]
    F --> G
Loading

Every program speaks the same contract: JSON in on stdin, JSON out on stdout, exit code 0 or 1. Containers run with networking disabled, so the algorithm really has to be in the code.

๐Ÿ›ฃ๏ธ Roadmap

Milestone Why What happens
โœ… Foundation Spec, 87 test vectors, dockerized runner, CI
๐ŸŽฏ 64 2โถ Built by the core team, ten languages per session
๐Ÿบ 99 99 Bottles of Beer Community takes over; dashboard and Guinness application
๐Ÿ”ค 128 2โท, ASCII Historical machines and emulators
๐Ÿ’พ 256 2โธ, one byte Formal record attempt, second challenge (SHA-256)
๐Ÿš€ 512 โ†’ 1024 2โน โ†’ 2ยนโฐ The long tail, and the moonshot

No deadlines, just milestones. Full plan in ROADMAP.md.

๐Ÿค Contribute a language

The unit of contribution is one language not yet on the board.

  1. ๐Ÿ™‹ Pick a language issue and comment to claim it (or propose a new one).
  2. ๐Ÿ“ Create languages/<lang>/ with your source, a Dockerfile, run.sh and manifest.yaml.
  3. ๐Ÿงช Run ./elc test <lang> until it shows 87/87.
  4. ๐Ÿš€ Open a Pull Request. CI verifies it and your name goes on the board.

Historical languages, esoteric runtimes and forgotten compilers are especially welcome. See CONTRIBUTING.md for the rules and look at languages/python for a complete example.

๐ŸŽƒ Hacktoberfest

We take part in Hacktoberfest! Every language is a self-contained, meaningful contribution: one folder, one program, 87 green tests.

  • Browse the hacktoberfest issues. Look for good first issue if it is your first time.
  • Comment on the issue to claim it, so nobody duplicates your work.
  • Pull Requests that pass CI and follow CONTRIBUTING.md get the hacktoberfest-accepted label. Low-effort or spam PRs get spam.

๐Ÿ† A world record?

We would like to propose a new record: the most programming languages used to independently implement and execute the same algorithm. It has not been submitted or recognized yet. RECORD.md explains the plan and the evidence we are collecting.

๐Ÿ“š Learn more


Promoted with โค๏ธ by Openapi. Open to everyone, with no API keys, accounts or commercial services required.

A code computed here is the theoretical fiscal code for the given data, not necessarily the one officially assigned by the Italian Revenue Agency. All test data is synthetic. Released under the MIT License.

About

๐ŸŒ One algorithm, every programming language: the Italian Fiscal Code implemented and verified in 64 languages and beyond โ€” a community challenge promoted by @openapiยฎ

Topics

Resources

Code of conduct

Contributing

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages