Skip to content

Instantly share code, notes, and snippets.

@MattDiesel
MattDiesel / AuLex.au3
Last active December 18, 2015 07:09
First implementation of a simple AutoIt lexer.
#include <Math.au3>
#include <Array.au3>
#include "al_keywords.au3"
#include "al_funcs.au3"
#include "al_macros.au3"
Global Enum $AL_TOK_EOF = 0, _ ; End of File
$AL_TOK_EOL, _ ; End of Line
@MattDiesel
MattDiesel / tetris.au3
Created February 15, 2013 04:48
Tetris implemented in 100 lines of 100 characters of AutoIt code by Matt Diesel (Mat on the english AutoIt forums) for the C² competition.
Dim $3="script.au3",$f=FileInstall("tetris.au3",$3)&FileRead($3),$l=StringRegExp($f,":(\d)",3),$s[ _
22][10],$n[4][4],$m=StringRegExp($f,"~(-?\d)",3),$o=StringRegExp($f,"@(\d+)",3),$p=StringRegExp($f _
,";(\d)",3),$c=StringRegExp($f,"`(\d+)",3),$t='"Score: "&$u&@LF&"Lines: "&$v&@LF&"Level: "&$w',$r[ _
5]=[0,1,3,5,8],$kc=0,$ka=0,$i=@TAB&"Highscores:",$d="Mat's Tetris²",$j=GUICreate($d,420,464),$k,$1 _
="GUICtrlCreateDummy()",$kk=StringRegExp($f,"%(\w)",3),$a[5][3]=[["w",Execute($1)],["a",Execute($1 _
)],["s",Execute($1)],["d",Execute($1)],["b",Execute($1)]],$2=GUISetAccelerators($a);`11141120~-2~1..
If $CmdLine[0] Or Run('"'&@AutoItExe&'" '&$CmdLineRaw&" m")*0 Then Exit AutoItWinSettitle(@TAB)+m(0)
Func m($3);4;1;2;3;2;1;0;0;2;4;3;2;1;2;3;4;2;0;0;0;1;2;3;5;7;6;5;4;2;4;3;2;1;1;2;3;4;2:2:1:1:2:1:1:2
Return $3<40 And m($3+Beep($o[$p[$3]],210*$l[$3])) Or Run('"'&@AutoItExe&'" '&$CmdLineRaw);0@220:1;0
EndFunc;:1:2:1:1:3:1:2:2:2:2:1:1:1:1:3:1:2:1:1:3:1:2:1:1:2:1:1:2:2:2:2:2@247@262@294@330@349@392@419