User:Pee/Sandbox: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
No edit summary
(This section of the alias page is very badly worded and potentially inaccurate, I'm attempting to make it more readable.)
 
(13 intermediate revisions by the same user not shown)
Line 1: Line 1:
</noinclude>{{#switch:{{{1}}}
== Advanced uses ==
|aa = Afar
Ignoring the limitation that there can only be a predefined maximum number of aliases, the <code>alias</code> command alone makes the console [[Wikipedia:Turing completeness|Turing-complete]]. In other words, it is able to simulate any computer calculation, meaning a command can be run based on an arbitrarily complex way that aliased commands were invoked. For example, an alias can run another command if the amount of times the alias was invoked previously was prime. There are many uses that are more practical.
|ab = Abkhazian
 
|abs = Ambonese Malay
If the limit of a predefined maximum number of aliases is not ignored, the console is only able to simulate a [[Wikipedia:Finite-state machine|finite-state machine]]. However, due to how the <code>alias</code> command can simulate a finite-state machine, it negates the typical drawback of mathematical operations requiring extremely large quantities of states. This is because unlike a traditional finite-state machine, the results of inputs (contents of aliases) are not changed by default upon a transition. The following example helps illustrate this:
|ace = Achinese
{{CodeBlock|<!--
|ady = Adyghe
      -->{{stx|type|alias}} state_A "{{stx|type|alias}} {{stx|func|input_1}} state_B; {{stx|type|alias}} {{stx|func|input_2}} state_C; {{stx|type|alias}} {{stx|func|input_3}} state_D"<nowiki>
|ady-cyrl = Adyghe (Cyrillic)
</nowiki>{{stx|type|alias}} state_B  {{stx|type|alias}} {{stx|func|input_3}} state_B<!--
|aeb = Tunisian Arabic
-->}}
|aeb-arab = Tunisian Arabic (Arabic)
 
|aeb-latn = Tunisian Arabic (Latin)
Here, after state A is activated, followed by input 1 firing, the functions of inputs 1 and 2 persist after state B becomes the current state. This attribute of inputs that may be defined independent of each other creates the possibility of encoding values in binary.
|af = Afrikaans
 
|ak = Akan
Compare the Source engine's ability to store a 32-bit value with 32 independent binary values to a traditional finite-state machine's requirement of 2<sup>32</sup> states to store an equivalent value.
|aln = Gheg Albanian
|als = Swiss German
|alt = Southern Altai
|am = Amharic
|ami = Amis
|an = Aragonese
|ang = Old English
|anp = Angika
|ar = Arabic
|arc = Imperial Aramaic
|arn = Mapudungun
|arq = Algerian Arabic
|ary = Moroccan Arabic
|arz = Egyptian Arabic
|as = Assamese
|ase = American Sign Language
|ast = Asturian
|atj = Atikamekw
|av = Avaric
|avk = Kotava
|awa = Awadhi
|ay = Aymara
|az = Azerbaijani
|azb = South Azerbaijani
|ba = Bashkir
|ban = Balinese
|ban-bali = Balinese (Balinese)
|bar = Bavarian
|bat-smg = Samogitian
|bbc = Batak Toba
|bbc-latn = Batak Toba (Latin)
|bcc = Southern Balochi
|bci = Baoulé
|bcl = Central Bikol
|be = Belarusian
|be-tarask = Belarusian (Taraškievica)
|be-x-old = Belarusian (Taraškievica)
|bg = Bulgarian
|bgn = Western Balochi
|bh = Bihari languages
|bho = Bhojpuri
|bi = Bislama
|bjn = Banjar
|blk = Pa'o Karen
|bm = Bambara
|bn = Bengali
|bo = Tibetan
|bpy = Bishnupriya
|bqi = Bakhtiari
|br = Breton
|brh = Brahui
|bs = Bosnian
|btm = Batak Mandailing
|bto = Rinconada Bikol
|bug = Buginese
|bxr = Russia Buriat
|ca = Catalan
|cbk-zam = Chavacano
|cdo = Min Dong Chinese
|ce = Chechen
|ceb = Cebuano
|ch = Chamorro
|cho = Choctaw
|chr = Cherokee
|chy = Cheyenne
|ckb = Central Kurdish
|co = Corsican
|cps = Capiznon
|cr = Cree
|crh = Crimean Tatar
|crh-cyrl = Crimean Tatar (Cyrillic)
|crh-latn = Crimean Tatar (Latin)
|cs = Czech
|csb = Kashubian
|cu = Church Slavic
|cv = Chuvash
|cy = Welsh
|da = Danish
|dag = Dagbani
|de = German
|de-at = Austria German (FIX)
|de-ch = Swiss High German
|de-formal = German (formal)
|din = Dinka
|diq = Dimli (individual language)
|dsb = Lower Sorbian
|dtp = Kadazan Dusun
|dty = Dotyali
|dv = Dhivehi
|dz = Dzongkha
|ee = Ewe
|egl = Emilian
|el = Greek
|eml = Emilian
|en = English
|en-ca = Canadian English
|en-gb = British English
|eo = Esperanto
|es = Spanish
|es-419 = Latin American Spanish
|es-formal = Spanish (formal)
|et = Estonian
|eu = Basque
|ext = Extremaduran
|fa = Persian
|fat = Fanti
|ff = Fulah
|fi = Finnish
|fit = Tornedalen Finnish
|fiu-vro = Võro
|fj = Fijian
|fo = Faroese
|fon = Fon
|fr = French
|frc = Cajun French
|frp = Arpitan
|frr = Northern Frisian
|fur = Friulian
|fy = Western Frisian
|ga = Irish
|gaa = Ga
|gag = Gagauz
|gan = Gan Chinese
|gan-hans = Gan Chinese (Simplified)
|gan-hant = Gan Chinese (Traditional)
|gcr = Guianese Creole French
|gd = Scottish Gaelic
|gl = Galician
|gld = Nanai
|glk = Gilaki
|gn = Guarani
|gom = Goan Konkani
|gom-deva = Goan Konkani (Devanagari)
|gom-latn = Goan Konkani (Latin)
|gor = Gorontalo
|got = Gothic
|gpe = Ghanaian Pidgin English
|grc = Ancient Greek
|gsw = Swiss German
|gu = Gujarati
|guc = Wayuu
|gur = Farefare
|guw = Gun
|gv = Manx
|ha = Hausa
|hak = Hakka Chinese
|haw = Hawaiian
|he = Hebrew
|hi = Hindi
|hif = Fiji Hindi
|hif-latn = Fiji Hindi (Latin)
|hil = Hiligaynon
|ho = Hiri Motu
|hr = Croatian
|hrx = Hunsrik
|hsb = Upper Sorbian
|hsn = Xiang Chinese
|ht = Haitian
|hu = Hungarian
|hu-formal = Hungarian (formal)
|hy = Armenian
|hyw = Western Armenian
|hz = Herero
|ia = Interlingua (International Auxiliary Language Association)
|id = Indonesian
|ie = Interlingue
|ig = Igbo
|ii = Sichuan Yi
|ik = Inupiaq
|ike-cans = Eastern Canadian Inuktitut (Unified Canadian Aboriginal Syllabics)
|ike-latn = Eastern Canadian Inuktitut (Latin)
|ilo = Iloko
|inh = Ingush
|io = Ido
|is = Icelandic
|it = Italian
|iu = Inuktitut
|ja = Japanese
|jam = Jamaican Creole English
|jbo = Lojban
|jut = Jutish
|jv = Javanese
|ka = Georgian
|kaa = Kara-Kalpak
|kab = Kabyle
|kbd = Kabardian
|kbd-cyrl = Kabardian (Cyrillic)
|kbp = Kabiyè
|kcg = Tyap
|kea = Kabuverdianu
|kg = Kongo
|khw = Khowar
|ki = Kikuyu
|kiu = Kirmanjki (individual language)
|kj = Kuanyama
|kjp = Pwo Eastern Karen
|kk = Kazakh
|kk-arab = Kazakh (Arabic)
|kk-cn = China Kazakh (FIX)
|kk-cyrl = Kazakh (Cyrillic)
|kk-kz = Kazakhstan Kazakh (FIX)
|kk-latn = Kazakh (Latin)
|kk-tr = Türkiye Kazakh (FIX)
|kl = Kalaallisut
|km = Khmer
|kn = Kannada
|ko = Korean
|ko-kp = Democratic People's Republic of Korea Korean (FIX)
|koi = Komi-Permyak
|kr = Kanuri
|krc = Karachay-Balkar
|kri = Krio
|krj = Kinaray-A
|krl = Karelian
|ks = Kashmiri
|ks-arab = Kashmiri (Arabic)
|ks-deva = Kashmiri (Devanagari)
|ksh = Kölsch
|ksw = S'gaw Karen
|ku = Kurdish
|ku-arab = Kurdish (Arabic)
|ku-latn = Kurdish (Latin)
|kum = Kumyk
|kv = Komi
|kw = Cornish
|ky = Kirghiz
|la = Latin
|lad = Ladino
|lb = Luxembourgish
|lbe = Lak
|lez = Lezghian
|lfn = Lingua Franca Nova
|lg = Ganda
|li = Limburgan
|lij = Ligurian
|liv = Liv
|lki = Laki
|lld = Ladin
|lmo = Lombard
|ln = Lingala
|lo = Lao
|loz = Lozi
|lrc = Northern Luri
|lt = Lithuanian
|ltg = Latgalian
|lus = Lushai
|luz = Southern Luri
|lv = Latvian
|lzh = Literary Chinese
|lzz = Laz
|mad = Madurese
|mai = Maithili
|map-bms = Banyumasan dialect
|mdf = Moksha
|mg = Malagasy
|mh = Marshallese
|mhr = Eastern Mari
|mi = Maori
|min = Minangkabau
|mk = Macedonian
|ml = Malayalam
|mn = Mongolian
|mni = Manipuri
|mnw = Mon
|mo = Moldova Romanian (FIX)
|mos = Mossi
|mr = Marathi
|mrh = Mara Chin
|mrj = Western Mari
|ms = Malay
|ms-arab = Malay (Arabic)
|mt = Maltese
|mus = Creek
|mwl = Mirandese
|my = Burmese
|myv = Erzya
|mzn = Mazanderani
|na = Nauru
|nah = Nahuatl languages
|nan = Min Nan Chinese
|nap = Neapolitan
|nb = Norwegian Bokmål
|nds = Low German
|nds-nl = Netherlands Low German (FIX)
|ne = Nepali
|new = Newari
|ng = Ndonga
|nia = Nias
|niu = Niuean
|nl = Dutch
|nl-informal = Dutch (informal)
|nmz = Nawdm
|nn = Norwegian Nynorsk
|no = Norwegian
|nod = Northern Thai
|nov = Novial
|nqo = N'Ko
|nrm = Jèrriais
|nso = Pedi
|nv = Navajo
|ny = Nyanja
|nyn = Nyankole
|nys = Nyungar
|oc = Occitan (post 1500)
|ojb = Northwestern Ojibwa
|olo = Livvi
|om = Oromo
|or = Odia
|os = Ossetian
|pa = Panjabi
|pag = Pangasinan
|pam = Pampanga
|pap = Papiamento
|pcd = Picard
|pcm = Nigerian Pidgin
|pdc = Pennsylvania German
|pdt = Plautdietsch
|pfl = Pfaelzisch
|pi = Pali
|pih = Pitcairn-Norfolk
|pl = Polish
|pms = Piemontese
|pnb = Western Panjabi
|pnt = Pontic
|prg = Prussian
|ps = Pushto
|pt = Portuguese
|pt-br = Brazilian Portuguese
|pwn = Paiwan
|qu = Quechua
|qug = Chimborazo Highland Quichua
|rgn = Romagnol
|rif = Tarifit
|rm = Romansh
|rmc = Carpathian Romani
|rmy = Vlax Romani
|rn = Rundi
|ro = Romanian
|roa-rup = Macedo-Romanian
|roa-tara = Tarantino dialect
|rsk = Ruthenian
|ru = Russian
|rue = Rusyn
|rup = Macedo-Romanian
|ruq = Megleno Romanian
|ruq-cyrl = Megleno Romanian (Cyrillic)
|ruq-latn = Megleno Romanian (Latin)
|rw = Kinyarwanda
|ryu = Central Okinawan
|sa = Sanskrit
|sah = Yakut
|sat = Santali
|sc = Sardinian
|scn = Sicilian
|sco = Scots
|sd = Sindhi
|sdc = Sassarese Sardinian
|sdh = Southern Kurdish
|se = Northern Sami
|se-fi = Finland Northern Sami (FIX)
|se-no = Norway Northern Sami (FIX)
|se-se = Sweden Northern Sami (FIX)
|sei = Seri
|ses = Koyraboro Senni Songhai
|sg = Sango
|sgs = Samogitian
|sh = Serbo-Croatian
|shi = Tachelhit
|shi-latn = Tachelhit (Latin)
|shi-tfng = Tachelhit (Tifinagh)
|shn = Shan
|shy = Tachawit
|shy-latn = Tachawit (Latin)
|si = Sinhala
|simple = Simple English
|sjd = Kildin Sami
|sje = Pite Sami
|sk = Slovak
|skr = Saraiki
|skr-arab = Saraiki (Arabic)
|sl = Slovenian
|sli = Lower Silesian
|sm = Samoan
|sma = Southern Sami
|smn = Inari Sami
|sms = Skolt Sami
|sn = Shona
|so = Somali
|sq = Albanian
|sr = Serbian
|sr-ec = Serbian in Cyrillic script
|sr-el = Serbian in Latin script
|srn = Sranan Tongo
|sro = Campidanese Sardinian
|ss = Swati
|st = Southern Sotho
|stq = Saterfriesisch
|sty = Siberian Tatar
|su = Sundanese
|sv = Swedish
|sw = Swahili
|syl = Sylheti
|szl = Silesian
|szy = Sakizaya
|ta = Tamil
|tay = Atayal
|tcy = Tulu
|tdd = Tai Nüa
|te = Telugu
|tet = Tetum
|tg = Tajik
|tg-cyrl = Tajik in Cyrillic script
|tg-latn = Tajik (Latin)
|th = Thai
|ti = Tigrinya
|tk = Turkmen
|tl = Tagalog
|tly = Talysh
|tly-cyrl = Talysh (Cyrillic)
|tn = Tswana
|to = Tonga (Tonga Islands)
|tpi = Tok Pisin
|tr = Turkish
|tru = Turoyo
|trv = Sediq
|ts = Tsonga
|tt = Tatar
|tt-cyrl = Tatar (Cyrillic)
|tt-latn = Tatar (Latin)
|tum = Tumbuka
|tw = Twi
|ty = Tahitian
|tyv = Tuvinian
|tzm = Central Atlas Tamazight
|udm = Udmurt
|ug = Uighur
|ug-arab = Uighur (Arabic)
|ug-latn = Uighur (Latin)
|uk = Ukrainian
|ur = Urdu
|uz = Uzbek
|uz-cyrl = Uzbek in Cyrillic script
|uz-latn = Uzbek in Latin script
|ve = Venda
|vec = Venetian
|vep = Veps
|vi = Vietnamese
|vls = Vlaams
|vmf = Mainfränkisch
|vmw = Makhuwa
|vo = Volapük
|vot = Votic
|vro = Võro
|wa = Walloon
|war = Waray (Philippines)
|wls = Wallisian
|wo = Wolof
|wuu = Wu Chinese
|xal = Kalmyk
|xh = Xhosa
|xmf = Mingrelian
|xsy = Saisiyat
|yi = Yiddish
|yo = Yoruba
|yrl = Nhengatu
|yue = Yue Chinese
|za = Zhuang
|zea = Zeeuws
|zgh = Standard Moroccan Tamazight
|zh = Chinese
|zh-classical = Literary Chinese
|zh-cn = PRC Mainland Chinese
|zh-hans = simplified Chinese
|zh-hant = traditional Chinese
|zh-hk = Hong Kong Chinese
|zh-min-nan = Min Nan Chinese
|zh-mo = Macao Chinese
|zh-my = Malaysian Chinese
|zh-sg = Singapore Chinese
|zh-tw = Taiwan Chinese
|zh-yue = Yue Chinese
|zu = Zulu
}}

Latest revision as of 17:45, 29 August 2025

Advanced uses

Ignoring the limitation that there can only be a predefined maximum number of aliases, the alias command alone makes the console Turing-complete. In other words, it is able to simulate any computer calculation, meaning a command can be run based on an arbitrarily complex way that aliased commands were invoked. For example, an alias can run another command if the amount of times the alias was invoked previously was prime. There are many uses that are more practical.

If the limit of a predefined maximum number of aliases is not ignored, the console is only able to simulate a finite-state machine. However, due to how the alias command can simulate a finite-state machine, it negates the typical drawback of mathematical operations requiring extremely large quantities of states. This is because unlike a traditional finite-state machine, the results of inputs (contents of aliases) are not changed by default upon a transition. The following example helps illustrate this:

alias state_A "alias input_1 state_B; alias input_2 state_C; alias input_3 state_D" alias state_B alias input_3 state_B

Here, after state A is activated, followed by input 1 firing, the functions of inputs 1 and 2 persist after state B becomes the current state. This attribute of inputs that may be defined independent of each other creates the possibility of encoding values in binary.

Compare the Source engine's ability to store a 32-bit value with 32 independent binary values to a traditional finite-state machine's requirement of 232 states to store an equivalent value.