Skip to content
This repository has been archived by the owner on Aug 14, 2023. It is now read-only.

Solve the C++ challenge using the shortest amount of code (what is known as codegolf).

Notifications You must be signed in to change notification settings

robertlisaru/visma-shortest-code-contest-1st-edition

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

visma-shortest-code-contest-1st-edition (April 2016)

Solve the C++ challenge using the shortest amount of code (what is known as codegolf).

The challenge

Write a C++ program that generates this text file: totem.txt

My 175 characters solution

which got me 3rd place 🥉

#include <fstream>
int i,j,n=-7;
int main(){
    for(std::ofstream f("totem.txt"); ~n; )
		for(i=7, f<<7+n++<<"\n"; i-- +6; f<<"\n")
			for(j=7; j-- +6; f<<( (i*i+j*j>n*n ? i*j : abs(i)+abs(j)+n) ?'.':'*' ));
}

🍻 Big credit to my very good friend and roommate at that time, Marius, who helped reduce my file size from 188 down to 175. Advancing the solution from 11th place up to 3rd place. And he didn't even want me to split the prize with him at the end. What a good pal 🥲.

Silly notes and sketches during problem solving

3 2 1 4

About

Solve the C++ challenge using the shortest amount of code (what is known as codegolf).

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages