[Competition] AHK dwitter!

Post your working scripts, libraries and tools for AHK v1.1 and older
User avatar
runie
Posts: 304
Joined: 03 May 2014, 14:50
Contact:

[Competition] AHK dwitter!

28 Dec 2017, 14:16

So I recently stumbled upon https://www.dwitter.net/ and it really inspired me to do something similar. I decided to try it out in AutoHotkey, and I've made some boilerplate so anyone can jump straight into doing this without worrying about GDI, game loop etc!

The code is on GitHub here: https://github.com/Run1e/ahk_gdi_fun/bl ... witter.ahk
The goal is to create your own u() function that could fit in a tweet.

To make it fun, I'm going to buy any $10 game on Steam to the one who posts the coolest function! The deadline is set at the 12th of January.

The rules are as follows:

Code: Select all

1. You are NOT allowed to edit code outside of the u() function.
2. Character count of u() (including function signature) has to be below (or at) 140.
NOTE: Tabs/spaces at the start of each line are NOT INCLUDED IN THIS COUNT. You can indent as you like.
The code has a comment at the top specifying what variables and functions are avaliable.

To enter, reply with your u() function below along with the character count and preferably a screenshot or gif showing what it does. See the first reply for an example.
If your code does not meet the rule requirements, you can still post it without entering the competition.

The entries will be judged by the "smartness" of the code, and how visually appealing the result is.

I hope to see your entry :)

o/
RUNIE
User avatar
runie
Posts: 304
Joined: 03 May 2014, 14:50
Contact:

Re: [Competition] AHK dwitter!

28 Dec 2017, 14:20

Example entry

Code: Select all

u(){
	f(r(,20,40)),f=0
	while 17>++f,p:=s(t*3-f/9),a=0
		loop 16
			fc(w/2+s(r:=p+a++*pi/8)*f*h/35,h/2+c(r)*f*h/35,4,h(t/2+(16-f)/16))
}
Character count: 129 (136 with indenting)

Result:
Image
geek
Posts: 1052
Joined: 02 Oct 2013, 22:13
Location: GeekDude
Contact:

Re: [Competition] AHK dwitter!

28 Dec 2017, 14:50

Cuttlefish Fins

Character count: 115

Code: Select all

u(){
f(),i=0,j=99
loop,%j%
dl(n:=w/2,m:=h/2,n+c(i/j*pi*2)*c(i/j*pi*4+t)*n,m+s(i/j*pi*2)*s(i/j*pi*4+t)*m,h(i++/j))
}
Image

Spinning Bauble

Character count: 91

Code: Select all

u(){
f(),i=0,j=256
loop,%j%
fc(w/2+sin(i/j*pi)*cos(i/j*pi*32+t)*w/2,h*i/j,3,h(i++/j+t/8))
}
Image

Cube

Character count: 138 :D

Code: Select all

u(){
f(),q=pi*2/3
loop,3
dl(j+c(d*q+t-u:=q/2)*j:=w/2,k:=h*2/3,n:=j+c(d*q+t)*j,l:=h/3)dl(j,0,n,l)dl(j,h,m:=j+c(++d*q+t-u)*j,k)dl(n,l,m,k)
}
175 :( :
Spoiler
Image

Mandelbrot

Character count: 136

Code: Select all

u(){
y:=0,x=mod(++t|=0,w)
Loop,%h%{
sp(x,y++,i<30?h(i/30):0),a=b=i=0
while,b*b+a*a<4&&++i<30
a:=(a*a-b*b+x*3/w-2,b=2*a*b+y*2.5/h-5/4)
}}
Image

Kissing Up (edit: now in color!)

Character count: 140

Code: Select all

u(){
q=Q_q@FiRIf@_Ez@_P_@_BdH_@_@_UU@@
f()
loop,480
(1<<z:=mod(d|0,5))&*(((t*5+y:=d++//5)&31)*2+&q)?fr(y*a:=w/96,a*z+h/2-a*2.5,a,a,h(t/5))
}
Image

Tweet Tweet!

Character count: 139

Code: Select all

u(){
l=DJCDHIPLOIPETCYDZE^C[G^F[IZRQZG[AYFXJVBQGRALGN
i:=&l-2,b=2*a:=7/c:=31
while,x:=*(i+=2)&c,y=*(i+=2)&c
dl(a*w,b*h,w*a:=x/c,h*b:=y/c)
}
Image
Scratch Art

Character count: 113

Code: Select all

u(){
CoordMode,Mouse,Client
MouseGetPos,x,y
GetKeyState("LButton")?fc(x,y,6,h(Sqrt((x-w/2)**2+(y-h/2)**2)/w*2))
}
Image
User avatar
Delta Pythagorean
Posts: 627
Joined: 13 Feb 2017, 13:44
Location: Somewhere in the US
Contact:

Re: [Competition] AHK dwitter!

28 Dec 2017, 16:01

The Bauble reminds me of the imagery illusion, "Which way is the image spinning?"

[AHK]......: v2.0.12 | 64-bit
[OS].......: Windows 11 | 23H2 (OS Build: 22621.3296)
[GITHUB]...: github.com/DelPyth
[PAYPAL]...: paypal.me/DelPyth
[DISCORD]..: tophatcat

Helgef
Posts: 4709
Joined: 17 Jul 2016, 01:02
Contact:

Re: [Competition] AHK dwitter!

28 Dec 2017, 18:47

Wow! This looks like fun, I will try this later :ugeek:

Cheers and thanks for sharing :thumbup:
User avatar
runie
Posts: 304
Joined: 03 May 2014, 14:50
Contact:

Re: [Competition] AHK dwitter!

29 Dec 2017, 01:09

GeekDude wrote:Cube

Character count: 138 :D

Code: Select all

u(){
f(),q=pi*2/3
loop,3
dl(j+c(d*q+t-u:=q/2)*j:=w/2,k:=h*2/3,n:=j+c(d*q+t)*j,l:=h/3)dl(j,0,n,l)dl(j,h,m:=j+c(++d*q+t-u)*j,k)dl(n,l,m,k)
}
Apparently you don't even need commas between function calls! This is some amazing compression. 138 chars! :clap:
User avatar
waetherman
Posts: 112
Joined: 05 Feb 2016, 17:00

Re: [Competition] AHK dwitter!

29 Dec 2017, 05:39

Mandala

Code: Select all

u(){
	loop 3 {
		i := A_Index
		loop 3 {
			a := 9*t
			d := 4*t
			x := (A_Index-0.5)/3 * w + s(a)*d
			y := (i-0.5)/3 * h + c(a)*d
			sp( x, y, h(t/9) )
		}
	}
}
Character count: 140 (163 with indenting)

Result:
Image
Image
User avatar
waetherman
Posts: 112
Joined: 05 Feb 2016, 17:00

Re: [Competition] AHK dwitter!

29 Dec 2017, 13:05

QuanturdImage

Code: Select all

u(i=.3){
	j:=i?t-.2:t
	y=-.5
	while 4>++y,x=-.5
		loop 4
			fc(w/2+ ++x*s(j)*80,h/2+y*c(j)*80,a(s(j))*3+c(j)*3+5,c:=h(x/y*.98+t/99,.7-i))
	i?u(0)
}
Character count: 138 (147 with indenting)

Look at it longer and it will change color.

Preview:
Image
Image
User avatar
waetherman
Posts: 112
Joined: 05 Feb 2016, 17:00

Re: [Competition] AHK dwitter!

30 Dec 2017, 05:21

Interchange from hell

Code: Select all

u(i=1,y=-.5){
	(t<1)?f(9999)
	while 4>++y,x=-.5,j=t-.2*i
		loop 4     
			fc(++x*s(j/x)*80+w/2,h/2+y*c(j/y)*80,s(j)+c(j)+7-i,h(x/y,.7-i))
	i?u(0)
}
Character count: 139 (147 with indenting)

Result:
Image
Image
User avatar
waetherman
Posts: 112
Joined: 05 Feb 2016, 17:00

Re: [Competition] AHK dwitter!

30 Dec 2017, 11:41

Something more related to current northern hemisphere situation

Code: Select all

u(i=0){
	static s:=[]
	if (f()t<1)
		while 999>++i,s[i]:=r
			Random r,0,% w
	while 500>++i,a=i*2
		sp(s[a+1]+s(t+i)*20,Mod(s[a]+t*99,h))
}
Character count: 136129 (146139 with indenting) edit: removed ,8**8-1, as apparently color defaults to white, thx GeekDude!

Result:
Image
Image
User avatar
waetherman
Posts: 112
Joined: 05 Feb 2016, 17:00

Re: [Competition] AHK dwitter!

30 Dec 2017, 16:22

Something more related to current global situation

Code: Select all

u(r=1){
	r?u(0)
	p:=Mod(t+.1*r,q:=pi/2),i=0
	loop 98
		fc(w/2+s(a:=++i/24*q)*d:=(s(p)*15)**2,h/3+c(a)*d+(p*3)**3,p*7-r*3,h(t//q/3+i/2,452/d*r))
}
Character count: 140 (145 with indenting)

Result:
Preview will be available tomorrow
Image
User avatar
runie
Posts: 304
Joined: 03 May 2014, 14:50
Contact:

Re: [Competition] AHK dwitter!

02 Jan 2018, 02:17

Color pulsar

Code: Select all

u(d=3,x=0){
	while 256>++x,y=0
		while 3>++y
			fc(s(t*4-x/8+pi*y)*d*x+w/2,c(t*4-x/8+pi*y)*d*x+w/2,11,h(t/4+y/2))
}
Character count: 110, 115 with indenting

I think there's way too much color for a .gifv (let alone .gif) to show it properly, run the code to see it properly :P https://i.imgur.com/MBzNCHB.gifv
guest2018

Re: [Competition] AHK dwitter!

02 Jan 2018, 21:26

Nice stuf again Runie :clap: Enjoying it!
Please also add DrawArc and other gdi functions :xmas:
I also noticed things being off-center with larger pen sizes or radii? Guess one needs to remove half the pen size or radii from the x/y coordinates then.. or something like that. i'm no got good with sines and stuff but it's fun. Keep it coming :thumbup:
User avatar
waetherman
Posts: 112
Joined: 05 Feb 2016, 17:00

Re: [Competition] AHK dwitter!

03 Jan 2018, 06:49

guest2018 wrote:Guess one needs to remove half the pen size or radii from the x/y coordinates
yes
Image
User avatar
waetherman
Posts: 112
Joined: 05 Feb 2016, 17:00

Re: [Competition] AHK dwitter!

03 Jan 2018, 19:02

Look at my balls

Code: Select all

u() {
	f()
	Loop 2 {
		i := A_Index
		p := (Mod(t/9+a(t(i)),pi/2))
		fc(s(t/99)*20+a(s(p))*w*(1+i/99),h-a(c(t+i/9))*h*c(p)**2-8,4,h(i/9))
	}
}
Ball count: 2 (my balls are amazing)
Image
User avatar
runie
Posts: 304
Joined: 03 May 2014, 14:50
Contact:

Re: [Competition] AHK dwitter!

04 Jan 2018, 03:04

waetherman wrote:Look at my balls
Got inspired and made this :D

Code: Select all

u(){
	static x,y,a:=0.5,s
	s+=(d,x+=a)
	y+=s
	if(y+8>h)
		s*=-0.9,a*=0.97,y:=h-8
	if(x<0||x+8>w)
		a*=-1,x:=(x<0?0:h-8)
	fc(x,y,4,h(t))
}
Character count: 127 (137 with indenting)
User avatar
rommmcek
Posts: 1470
Joined: 15 Aug 2014, 15:18

Re: [Competition] AHK dwitter!

04 Jan 2018, 08:20

Critical mass

Code: Select all

u(){
i:=2*r:=A_Index/2
fc(0,0,r,i)
fc(w-i,0,r,i)
fc(0,h-i,r,i)
fc(w-i,h-i,r,i)
if i<100
	Sleep 1
if i>5000
	pause
}
123 char (125)
Attachments
Critcal mass300x300.gif
Critcal mass300x300.gif (733.06 KiB) Viewed 6319 times
Last edited by rommmcek on 04 Jan 2018, 13:52, edited 1 time in total.
User avatar
waetherman
Posts: 112
Joined: 05 Feb 2016, 17:00

Re: [Competition] AHK dwitter!

04 Jan 2018, 10:26

rommmcek wrote:Critical mass

Code: Select all

u(){
i:=2*r:=A_Index/2
fc(0,0,r,i)
fc(w-i,0,r,i)
fc(0,h-i,r,i)
fc(w-i,h-i,r,i)
if i<100
	Sleep 1
if i>5000
	pause
}
123 char (125)
Amazing! This is why you leave your woman alone during her period.
Image
User avatar
rommmcek
Posts: 1470
Joined: 15 Aug 2014, 15:18

Re: [Competition] AHK dwitter!

04 Jan 2018, 11:48

For waetherman's better half: Critical mass v.polychromatic

Code: Select all

i:=2*r:=A_Index/2
fc(0,0,r,h(t))
fc(w-i,0,r,h(t))
fc(0,h-i,r,h(t))
fc(w-i,h-i,r,h(t))
if i<100
	Sleep 1
if i>5000
	pause
}
137 char (139)
Attachments
Critical mass v.polychromatic.png
Critical mass v.polychromatic.png (97.06 KiB) Viewed 6343 times
Last edited by rommmcek on 05 Jan 2018, 06:06, edited 2 times in total.
User avatar
runie
Posts: 304
Joined: 03 May 2014, 14:50
Contact:

Re: [Competition] AHK dwitter!

04 Jan 2018, 12:20

rommmcek wrote:Critical mass

Code: Select all

u(){
i:=2*r:=A_Index/2
fc(0,0,r,i)
fc(w-i,0,r,i)
fc(0,h-i,r,i)
fc(w-i,h-i,r,i)
if i<100
	Sleep 1
if i>5000
	pause
}
123 char (125)
Super cool :D

Return to “Scripts and Functions (v1)”

Who is online

Users browsing this forum: sanmaodo and 97 guests