Toronto Code Golf Tournament:
Compete & Collaborate to condense code into less and less characters!
ποΈ What's Code Golf?
Code Golf is a unique programming competition where the goal is to solve problems using the least number of characters of code. It challenges your hacker mindset to reach deeper dungeons of the possibilities, that few know about. It's a test for depth of knowledge of your language, your hacking skills and creativity! There will be a winner, and "There can only be one!" (is our motto)
π― Objective: Participate in 3 code golf challenges, each lasting exactly 1 hour. The goal? Write the shortest code that fulfills the challenge's criteria.
π¨ Example:
Write a bionic reader program:
(Perl 95 chars)
perl -ple's`(\w+)(\W*)`$l=length$1;$l=$l>2?int$l*.4:1;$1=~s~.{$l}~\033[1m$&\033[0m~r."$2 "`ge'
(Python 99 chars)
python -c "print(*((b:=len(w)*2//5|1,f'\033[1m{w[:b]}\033[0m{w[b:]}')[1]for w in input().split()))"
(Ruby 108 chars)
ruby -pe'$_.gsub!(/(\w+)(\W*)/i){w=$1;l=w.size>2?(w.size*0.4):1;w[0...l]="\033[1m#{w[0...l]}\033[0m";w+$2}'
Read about this example problem here.
π
Date: Octobor 28th, 2023 (Event 0X001)
π Venue: WeWork @ 100 University
β° Time: 2:00 PM - 5:00 PM.
π» Equipment: Bring your computer and your preferred programming language. Esolangs allowed!
π₯ Capacity: Exclusive to 12 Engineers
π₯ RSVP here
Sharpen Your Skills Ahead of Time:
- wiki page for code golf: https://en.wikipedia.org/wiki/Code_golf/
- good forum: https://codegolf.stackexchange.com/
- good practice: https://code.golf/
See you all at the event, stay hacking!
- Taha
Slides are here
# Problem 2, Test Cases
[10,20,30] -> [10,20,30]
[[10]] -> [10]
[["Hi"],[[10]]] -> ["Hi",10]
[[[20],["Hi"],"Hi",20]] -> [20,"Hi","Hi",20]
[[["[]"],"[]"]] -> ["[]","[]"]
------------------------
βThe primary thing when you take a sword in your hands is your intention to cut the enemy, whatever the means. Whenever you parry, hit, spring, strike or touch the enemyβs cutting sword, you must cut the enemy in the same movement. It is essential to attain this. If you think only of hitting, springing, striking or touching the enemy, you will not be able actually to cut him. More than anything, you must be thinking of carrying your movement through to cutting him.β
[ Miyamoto Musashi, The Book of Five Rings ]
let x=1760,
z=0,y=0;setInterval
(()=>{z+=.07,y+=.03;const
a=[...new Array(x)].map( (a,r
)=>r % 80 === 79 ?"\n":" "),r=new
Array(x).fill(0), t= Math.cos(z),e=
Math.sin(z),n=Math.cos(y), o=Math.sin
(y);for(let s=0;s<6.28; s+=.07){const c
=Math.cos(s),h= Math.sin(s);for(let
s=0;s<6.28;s+= .02){const v=Math
.sin(s),M=Math .cos(s),i=c+2,l=1
/(v*i*e+h*t+5 ),p=v*i*t-h*e,d=0
|40+30*l*(M*i*n -p*o),m=0|12+15*l*
(M*i*o+p*n),f=0|8*((h*e-v*c*t)*n-v*c*
e-h*t-M*c*o), y=d+80*m;m<22&&m>=0
&&d>=0&&d<79&&l>r[y] &&(r[y]=l,
a[y]= ".,-~:;=!*#$@"[f>0?f:0
])}}pre.innerHTML=a.join
("")},50); /* JS by
@housamz */
[ JS program that creates donut ]
Β© 2023 Taha Ashtiani