ÎÌÌÌ̈ˆˆ¬ªªª¬ˆˆˆ¬ÌÌ̬ÌÀ̬ÌÀ̬ÌÀÌÌÌìÌÀÀî̬ÀÌÀ¬ÀÀÀ¬ÀÀÀ¬ÀÀÎÌÌÌ̈ˆˆ¬ªªª¬ˆˆˆ¬ÌÌ̬ÌÌ̬ÌÀ̬ÌÀÌÌÌìÌÀÀî̬ÀÌ̬ÀÀÀ¬ÀÀÀ¬ÀÀ¬ÌÌ̬ªªª¬ª¬ª¬ªÊ̬ªªªŒˆˆˆÌÀÌÎÌÌÎ̬̪ªÀ쬪ÀÀÀÌîÀìîÌÌîî¬ÌÌ̬ªªª¬ª¬ª¬ªÊ̬ªªªŒˆˆˆÌÀÌÎÌÌÎ̬̪ªÀ쬪ÀÀÀÌîÀìîÌÌîî >²<""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""ÂÌ"ÂÌ"Ì",ÌÌ,ÌÌ""""ÂÌ,ÌÂ,ÂÌ"ÂÌ,ÌÌ,"""ÂÌ,ÂÌ"Ì",ÌÌ,ÌÌ""""Â,"Â""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""Ì",Ì",Ì",Ì""Ì",""""Ì"ÌÌ,Ì",Ì""Ì"""""Ì,"Ì",Ì",Ì""Ì","""Â,"","""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""Ì""Ì",Ì",ÌÌ"Ì",""""Ì"ÌÌ,Ì",ÌÂ,ÌÌ""""ÂÌ"Ì",Ì",ÌÌ"Ì",""""""","""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""Ì",Ì",ÂÌ"Ì""ÌÌ"""""Ì",,,ÌÌ,Ì",Ì""""""Ì,ÌÌ,ÂÌ"Ì""Ì","""Â,"","""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""ÂÌ"ÂÌ"","ÌÌ,Ì","""ÂÌ,,",Ì",ÂÌ,ÌÌ,"""ÌÌ"Ì",","ÌÌ,ÌÌ""""Â,"Â""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""àÝÍÌÌ̼»»«ªªš™ îîÀÌÌÌ̼»»»ªªª™™ˆîàÌÌÌ̼»»»ªªªš™‰ˆàààîÀÌÌ»»»»ªªªš™™ˆî°»»»»«ªªªš™™ˆˆààî»»»»ªªªª™™™ˆˆàî ªªš™™‰ˆˆîàî ª™™™ˆˆˆwà𘙉ˆˆˆwàîàˆˆˆˆwÞÝ ÞˆˆˆˆxwÐÝÝ݇ˆˆˆwwÐÝÝÝý pˆˆxwwgÐÝÝÝ ÐÿßpwwwwwgÝÝÝͼ» Ðÿß`wwwwwgÐÝÝÍÌ»«àþÝ `vwwwwfÝÝÌ̼» íîÝ `fwwwgfÀÌÌ̼»ªÐîîÝÝ`fvwwffÌÌ̼»ªÐíÞÝÝ ffffffËÌ»«ªÐÝÝÝݼffffff€¸»»ªšÝÝÝÍÌ ffffff€˜©ªª™ÌÌÌ̼ ªefffff€ˆ™ªš‰°ÌÌÌÌ»«ªªš™‰ˆˆð@UffffVE‡ˆ˜™™ˆËÌÌÌ»»ªªª™™ˆˆˆ@UefffUE‡ˆˆ™‰ˆ°ÌÌÌ»»«ªªš™‰ˆˆDUUffVUE‡ˆˆˆˆˆË̼»»«ªªš™™ˆˆˆDUUUUUUEp‡ˆˆˆˆˆº»»»»«ªªš™™ˆˆˆx"DTUUUUUDpwˆˆˆˆ »»»»ªªª™™™ˆˆ�x!2DDUUUUEDww‡ˆˆˆª»»«ªªš™™‰ˆøÿxw"3DDTUUUD`wwwˆˆx©ª™™©ª™™™ˆˆø�xw!"3DDDUUEDfwwwwwwð�™™™™™™™‰ˆˆÿ�xww!23DDDDDDDfwwwwww�™™™™™ˆˆˆøˆwww"23DDDDDDDfwwwwwð™™™™™€ˆˆŽxwwwf"23CDDDDDD`fvwwww�™™™™ˆèîwwwwf"23CDDDDDD`ffwwwgð€™™™‰ˆw~wwwwff"233DDDDD4fffvwwf˜™™ˆˆàwwwwgff""33CDDDDPfffffffðÿˆ™‰ˆˆˆî~wwwfff!"333CDD3ðTfffffff€ˆˆˆˆˆîfwwgfffV!"2333333@Ufffffffðÿ€ˆˆˆˆˆàî`ffffffV""33333DUfffff€ˆˆˆˆˆˆ`ffffffVE!"23333TUefffffàˆˆˆˆˆàffffffVE""233@TUUffffVˆˆˆˆˆˆî`fffffUU"""!DTUUefffàˆˆˆˆîPffffVUUD!CDTUUUffVàˆˆˆèîefffUUUD!2CDTUUUUUUpˆˆˆˆè~UffVUUUDðð"3DDDUUUUUEàˆˆî~PUUUUUUDÿ!23DDDTUUUUDàîpˆˆxíww@UUUUUEDDñ"23DDDDUUUEíîpww×Ýww@TUUUUDDD"33DDDDTUUDÐÝÞww×}wwgDUUUEDDDðÿ!"33DDDDDDDD°»»ÛÝÝp×Ý}wwgDTUUDDDDó!"33CDDDDDDD�©ª»»ËÝÝÝpÝÝ}wwg@DDDDDDô3!"33CDDDDDD�™ªº»»ÌÝÝÝÝÝ}wwgf@DDDDDDÿ?àî!"333DDDDDD™©ªº»»ÌÝÝ ÐÝÝ}wwff1DDDDDôÿ3à!"233CDDDD�™ªªº»»ÌÜÝÐÝÝwwgff1CDDDäî?3î"2333CDD3™™ªªª»»ËÌ ÐÝÝwwffff43DDDîî33à""333333€ˆ™™ªªªº»» ÝÝÝffffffE43Dîî33#!"233333ˆ˜™™©ªªªªÝÝÝff»»ÌÜÝÝÝîî>33#àî""3333ð€ˆ˜™™™ªª ÀÝÝmfº»ÌÌÝÝÝíîî333"!""33ˆˆ˜™™™©ªÀÜÝ`¦»ËÌÌÝÝÝÝ>333#!""�ˆˆˆ™™™ ÌÌ̺»ËÌÌÝÝÝÝ4333"àˆˆ˜™™°ÌÌ̺»ËÌÌÜÝÝM433"àðˆˆˆˆˆ™ ËÌÌ  º»»ÌÌUUUDD3#ˆˆˆˆ°ËÌÌ ªª»»»UUUUDD3#îðÿˆˆˆˆˆˆ°ËÌ̪ªº»ZUUUEDD3#àîÿˆˆˆˆˆ»ËÌ̘ªªªªZUUUDDD3#þw‡ˆˆˆˆ »»Ì¼™©ªªªYUUEDDD3# îîwwˆˆˆx »»»»™™ªªšYUUDDD43#ÐÝàî~ww‡ˆˆ º»»«™™©ª™DDDDDD43"Ð î~wwwwwwª»»š™™™™™DDDDDD33ÐÝ àîvwwwwww¨ªª™˜™™™™DDDD43#ÝÝ ÐÝÐînvwwwww€ªš‰˜™™™™0DD433ÐÝݽ»»»ÜÝÝÝíîfvwwwww˜™ˆˆ™™™‰ˆ3333#ÝÝݽ»»ÌÌÌÝÝÝÝÝnffwwwwg€ˆˆˆ˜™™ˆˆ33#�ÝÝÝ»»ËÌÌÌÝÝÝÝ `ffvwwwfˆˆˆˆ™‰ˆˆ�ÙÝݽ»»ËÌÌÌÝÝÝÝffffwwgfvw‡ˆˆˆˆˆ™ÚÝÝ»»»ËÌÌÌÜÝÝ Pfffffff`w‡ˆˆˆˆˆ�©ÝÝݺ»»»ÌÌÌÌUfffffff`v‡ˆˆˆˆˆU™©ÝÝ­ª»»»»@Uffffffff†ˆˆˆˆˆU™ÌÝÝ­ªªTUffffff`†ˆˆˆˆˆWE�ÉÌÜݪ TUefffffvˆˆˆˆxWE€™ÉÌÌ̪ATUUffffp‡ˆˆˆwWEDˆ™ÌÌ̬ !DTUUefffpwˆˆxwWED€ˆÉÌÌœ 2DTUUUffV@wwwwwwED4ˆ»ÌÌÌœ!CDTUUUUUU@wwwwwwDDD€¸ËÌÌÌ 2CDDUUUUUEwwwwwwDDD3°»ËÌÌœ2CDDTUUUUDwwwwwwFDD3#ˆˆˆ »»ËÌ̈!3CDDDUUUEvwwwwwfDD3#€ˆˆ™™©ªº»»»ÌŒˆ!3CDDDTUUDfwwwwgfDD33"ˆˆ˜™™ªª»»»»»ˆˆ!3CDDDDDDDfvwwwffF433"€ˆˆ™™©ªª»»»»‹ˆˆ!33DDDDDDDffwwgffF433"‡ˆ˜™™ªªª»»»»ˆˆ!33DDDDDD`ffffffV333"p‡ˆ˜™™ªªªº»»‹ˆˆ!23CDDDDD`ffffffV433"p‡ˆ˜™™ªªªª»{ˆˆx233DDDD4ffffffVE3#"v‡ˆˆ™™©ªªªzwwww"333DD4ffffffVE4#"v‡ˆˆ˜™™ªªzwwww!233333`fffffUUD3#"vwˆˆˆ™™©ªwwwww"3333PffffVUUD43"vw‡ˆˆˆfwwwww!"33#efffUUUD43#"fwwˆˆhfwwwww!""UffVUUUDD33"fvwwwf`fvwwwwPUUUUUUDD33"ffwwgfF`ffwwwg@UUUUUEDD33#"AefffffE`ffvwwfTUUUUDDD33#"AUffffVEdffffffDUUUEDDD33#"AUefffUEdffffff@TUUDDD433#"AUUffVUEeffffff@DDDDDD433#"ATUUUUUDeffffffDDDDDD333"DUUUUEDUfffffV@DDDD4333"DTUUUDDUeffffU"@DD4333#"DDUUEDDUUfffVE"333333"DDDDDDDUUeffUE$"03333#"@DDDDDDUUUUUUE4"033#"@DDDDDDTUUUUUD4"DDDDDDDUUUUED4#"CDDDDDDTUUUDD4#"3DDDD4DDUUEDD4#"03DD43DDDDDDD3#"033333CDDDDDD3#"333333DDDDD43"033333CDDDD33"3333#3CDD33#" 33#"233333""""""3333#""""33#"ó-- title: Nusan's Tentacle Effect with Explanations -- author: Nusan, TheAnarchyDice -- desc: Breakdown of Nusan's tentacle effect from the Byte Battle with Gopher (https://youtu.be/-Esj_g2PNAU) -- license: MIT License -- version: 0.1 -- script: lua sin=math.sin format=string.format --16320=0x3fc0 i.e. palette address PALETTE_ADDR=16320 --Prints current color palette, --with each line in the color with --the same ID from the palette. function print_palette() for i=0,15 do print(format('color %d',i),10,8+i*8,i) end end function TIC() cls() t=time()/512 --Sets palette to a gradient based --on the time. --Each byte represents the value for --R, G and B in an RGB color triplet, --spanning 16 colors => 3*16=48 bytes. for k=0,47 do byte_addr=PALETTE_ADDR+k --k//3 increases intensity as --palette color indices advance. --sin(k%3+t-sin(t)) both adds time --variation and ensures that all --R,G and B values differ, to avoid --grayscale. r_g_b_val=k//3*15*sin(k%3+t-sin(t)) --Uncomment to see R/G/B value. --Note: Text color is not indicative --of the actual RGB color. --print(format('%.3f',r_g_b_val),10+k%3*50,8+k//3*8,15) poke(byte_addr,r_g_b_val) end --Uncomment to see palette. --Note: Text color matches the color --with the same ID in the palette. --print_palette() for i=0,899 do --'f' is a value with several uses --and with certain prerequisites: --1. It determines the radius of the --circles that make up the tentacles. --2. It determines the color of the --circles that make up the tentacles. --3. It contributes to the x/y --positions of the circles that make --up the tentacles. --Use 1 requires that 'f'<1, as the --radius of the circle will be 0 if --'f'>=1. --For all tentacles to be have --equally sized segments of the same --colors, 'f' must have the same --value when drawing equivalent --segments of different tentacles. --As such, i//9 ensures that 'f' has --the same value for equivalent --sections of the 9 tentacles, and -- /99 scales 'f' down to the range --[0,899//9/99] (with 899//9/99<=1). f=i//9/99 --Controls how many tentacles are --drawn, and which one this loop --iteration is contributing to. tntcl_id=i%9 --'a=f*3' has been removed to improve --clarity --a=f*3 --'b' is used to compute both the x --and y position of the circle. --'tntcl_id' ensures that each --tentacle has a different value. --sin(t/4)*3*sin(t/3) creates a --non-linear dependence of 'b' to --the time, contributing to the --unusual rotating motion of the --tentacles. b=tntcl_id+sin(t/4)*3*sin(t/3) --120 centers the ring of tentacles --horizontally to 120. --sin(b)*40 provides the scaled --horizontal movement contributing --to the circular motion of the ring --of tentacles. --sin(f*3+t+tntcl_id)*50*f provides --the scaled horizontal movement of --individual segments with respect --to the tentacle base, contributing --to the illusion of tentacles --undulating all around. --*f exaggerates this motion by --by scaling the value more the --'further along' the tentacle that --a segment is. x=120+sin(f*3+t+tntcl_id)*50*f+sin(b)*40 --80 centers the ring of tentacles --vertically to 80 --40*sin(b+1.6) provides the scaled --vertical movement contributing to --the circular motion of the ring of --tentacles. Note: sin(x+1.6) is an --approximation for cos(x). --(f*80+sin(f*9+t+tntcl_id/4)*50/3)*f --provides the scaled vertical --movement of individual segments --with respect to the tentacle base, --contributing to the illusion of --tentacles undulating all around. --The '-' sign makes segments --'further along' the tentacle move --up (towards y=-INF) instead of --down (towaards y=+INF). --f*80 offsets tentacle segements --vertically in the direction of the --sign. It offsets segments 'further --along' the tentacle more than those --'closer to the base' by the --properties of 'f'. --sin(f*9+t+tntcl_id/4)*50/3 provides --scaled offset both in the same --direction as well as opposite that --of the sign. This provides the --illusion of a bobbing motion --vertically. --*f exaggerates this motion by --by scaling the value more the --'further along' the tentacle that --a segment is. y=80-(f*80+sin(f*9+t+tntcl_id/4)*50/3)*f+40*sin(b+1.6) --10*(1-f) determines the radius of --each segment, making the segments --'further along' the tentacle be --smaller by the properties of 'f'. --f*17 determines the color of each --segment, making the segments --'further along' the tentacle be --lighter by the properties of 'f' --and of the modified, gradient --color palette. --Comment to disable the drawing of --tentacles. circ(x,y,10*(1-f),f*17) end end