Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- alias doshits {
- var %x 1
- while %x < 183 {
- echo -a $replace($read($$1,%x),[,<,],>) $+
- inc %x
- }
- }
- menu * {
- Path Frequency Analysis:/path.init
- }
- alias path.init {
- if ($window(@Path)) window -c @Path
- window -pe @Path
- }
- alias -l path.creategrid {
- drawrect -rf @Path $rgb(255,255,255) 1 0 0 $window(@Path).w $window(@Path).h
- %path.gridX = $1 * 20
- %path.gridY = $iif($2,$2,$1) * 20
- %x.padding = 40
- %y.padding = 10
- var %x %x.padding,%y %y.padding
- }
- alias -l path.cleargrid {
- path.creategrid $calc(%path.gridX / 20) $calc(%path.gridY / 20)
- }
- alias -l path.comparePaths {
- path.cleargrid
- var %count $iif($iif($2,$2,3) > 0,$v1,1)
- var %x $calc(%path.gridX / 20 / 2)
- var %y $calc(%path.gridY / 20 / 2)
- var %text.y $window(@Path).h - 80
- var %modifier 0
- while (%count) {
- var %path $path.createPath($iif($1,$1,25),%x,%y,%modifier)
- hadd -m @Path $token(%path,1,32) $token(%path,2,32)
- dec %text.y 10
- dec %count
- inc %modifier 0
- }
- var %count 1
- var %text.y $window(@Path).h - 80
- var %n %x
- var %k %y
- while ($hget(@Path,%count).item != $null) {
- var %x 1
- var %z $v1
- hadd -m @Path $+ %z Dist -1
- while ($hget(@Path,%x).item != $null) {
- var %y $v1
- if (%y != %z) {
- var %t $abs($calc($hget(@Path,%z) - $hget(@Path,%y)))
- if (%t < $hget(@Path $+ %z,Dist) || $hget(@Path $+ %z,Dist) == -1) {
- hadd -m @Path $+ %z Dist %t
- hadd -m @Path $+ %z Color %y
- }
- }
- inc %x
- }
- drawtext -nr @Path %z 5 %text.y Path Frequency: $hget(@Path,%z)
- drawtext -nr @Path %z 200 %text.y Closest Match:
- drawtext -nr @Path $hget(@Path $+ %z,Color) 320 %text.y Path
- dec %text.y 10
- inc %count
- }
- drawdot -nrf @Path 0 5 $calc(%n * 20 + %x.padding) $calc(%k * 20 + %y.padding)
- hfree -w @Path*
- drawdot @Path
- }
- alias -l path.createpath {
- var %z $iif($1,$1,20)
- var %color $rand(0,$rgb(255,255,255))
- var %nigger $rand(0,1)
- var %gridX %path.gridX / 20
- var %gridY %path.gridY / 20
- var %x $iif($2,$2,$rand(0,%gridX))
- var %y $iif($3,$3,$rand(0,%gridY))
- var %lastX %x
- var %lastY %y
- var %frequency 0
- while (%z) {
- ;;%frequency = $calc(%frequency + (%x + %gridY * %y))
- %frequency = $calc(%frequency + (%x + %y))
- drawdot -nrf @Path %color 4 $calc(%x * 20 + %x.padding + $4) $calc(%y * 20 + %y.padding + $4)
- drawline -nrf @Path %color 1 $calc(%lastx * 20 + %x.padding - 2 + $4) $calc(%lasty * 20 + %y.padding - 2 + $4) $calc(%x * 20 + %x.padding - 2 + $4) $calc(%y * 20 + %y.padding - 2 + $4)
- %lastX = %x
- %lastY = %y
- %x = $calc(%x + ($rand(0,2) - 1))
- ;; %y = $calc(%y + ($rand(0,2) - 1))
- %y = %y $iif(%nigger,+,-) 1
- dec %z
- }
- drawdot @Path
- return %color %frequency
- }
- on 1:input:@Path: {
- if ($1 == creategrid) {
- path.createGrid $iif($2,$2,50)
- }
- if ($1 == cleargrid) {
- path.cleargrid
- }
- if ($1 == compare) {
- path.comparepaths $2 $3
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement