Jump to content

Search the Community

Showing results for tags 'generator'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 6 results

  1. hello all, and welcome to this tool the NB-Password_generator is a small tool which allow you to create a strong passwords with this tool you can create a random passwords using : 1. capital letters 2. small letters 3. numbers 4. symbols be sure that you can check any option that you want and uncheck what you don't want to use this tool allow you to create a password from 6 letters to 150 lettersNB-Password_generator.zip at the end please accept my greetings am waiting for your commants
  2. Hello! After watching a whole day of "Journey into cryptography" at Khan Academy, I have got to know the secrets behind some sneaky things! . This is one of em', A PRNG (Pseudo Random Number Generator). Its features (atleast what I believe) are: Simple, short and crappy. Great for beginners who are baffled by the mechanics of random number generation in computers! Support for custom seeds! EIGHT DIGITS OF RANDOMNESS!!! Unlike all other PRNGs, This one is predictable 1000 possible PRNs when using @MSEC as the seed. No option for min or max, the min is 10000000 and the max is 99999999. The Unlicensed . #cs LICENSE This is free and unencumbered software released into the public domain. Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means. In jurisdictions that recognize copyright laws, the author or authors of this software dedicate any and all copyright interest in the software to the public domain. We make this dedication for the benefit of the public at large and to the detriment of our heirs and successors. We intend this dedication to be an overt act of relinquishment in perpetuity of all present and future rights to this software under copyright law. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. For more information, please refer to <http://unlicense.org/> #ce LICENSE ; #FUNCTION# ==================================================================================================================== ; Name ..........: MiddleSquareRandom ; Description ...: Pseudo-random number generator based on the infamous "Middle Sqaure" method. ; Syntax ........: MiddleSquareRandom([$iSeed = @MSEC]) ; Parameters ....: $iSeed - [optional] A seed for generation of the random number. Default is @MSEC. ; Return values .: A pseudorandom 8 digit integer. ; Author ........: John von Neumann ; Modified ......: Damon Harris (TheDcoder) - Conversion into AutoIt and simplification + further crappification. ; Remarks .......: Fun Fact - The output is based on the $iSeed passed, Same $iSeed = Same pseudo-random number. ; Related .......: Random() ; Link ..........: https://en.wikipedia.org/wiki/Middle-square_method ; Example .......: ConsoleWrite(MiddleSquareRandom() & @CRLF) ; =============================================================================================================================== Func MiddleSquareRandom($iSeed = @MSEC) Local Const $TURNS = 8 Local $sRandomNumber, $sSeed For $iTurn = 1 To $TURNS $iSeed = $iSeed * 2 $sSeed = String($iSeed) $sRandomNumber &= StringMid($sSeed, Ceiling(StringLen($iSeed) / 2), 1) Next Return Int($sRandomNumber) EndFunc Enjoy your numbers, TD . P.S NEVER USE THIS FUNCTION IN A REAL WORLD IMPLEMENTATION OF SOMETHING WHICH USES RANDOM NUMBERS!!! THIS ONE IS VERY UNSUITABLE FOR THAT PURPOSE! READ THE POSTS BELOW FOR MORE INFORMATION.
  3. Hi everyone! It's been a long time since I wrote anything in AutoIt, but I wanted to get back into it. Here's a simple UDF that generates random sword names to use in a game. Enjoy ; #FUNCTION# ==================================================================================================================== ; Name...........: _GenSword ; Description ...: Generates random RPG sword names ; Parameters ....: $Type - The type of name to generate ; $Amount - [optional] value to be used for generating more names (default: 1) ; Return values .: Success - Return Value of the name generated or an array of names generated with index[0] = number of names ; Failure - Return Value 0, @error set to 1 ; Author ........: Echibahn ; Modified.......: ; Details .......: You can select one or multiple generator types by separating the types with a semi-colon. ; When selecting the amount of names to gen, the number reflects how many of a selected type will gen. This means ; selecting multiple types will generate the amount of names per type. ; Type 1 = Single Generator #1 ; Type 2 = Single Generator #2 ; Type 3 = Double Generator #1 ; Type 4 = Double Generator #2 ; Type 5 = Double Generator #3 ; Type 6 = Triple Generator #1 ; Type 7 = Triple Generator #2 ; ; Example .......; _GenSword(1) ; _GenSword("2;4") ; _GenSword("1;5;6", 2) ; _GenSword("1;2;3;4;5;6", 10) ; =============================================================================================================================== #include-once #include <Array.au3> Global $nm1[] = ["Shadowfang","Azurewrath","Assurance","ForgetMeNot","Red Obsidian","Abyssal Shard","Aetherius","Agatha","Alpha","Amnesia","Anduril","Anger’s Tear","Apocalypse","Armageddon","Arondite","Ashrune","Betrayal","Betrayer","Blackest Heart","Blackout","Blade of a Thousand Cuts","Blade of the Grave","Blazefury","Blazeguard","Blight's Plight","Blind Justice","Blinkstrike","Bloodquench","Bloodweep","Broken Promise","Brutality","Cataclysm","Catastrophe","Celeste","Chaos","Cometfell","Convergence","Corruption","Darkheart","Darkness","Dawn","Dawn of Ruins","Dawnbreaker","Deathbringer","Deathraze","Decimation","Desolation","Despair","Destiny's Song","Devine","Devourer","Dirge","Divine Light","Doomblade","Doombringer","Draughtbane","Due Diligence","Early Retirement","Echo","Piece Maker","Eclipse","Endbringer","Epilogue","Espada","Eternal Harmony","Eternal Rest","Extinction","Faithkeeper","Fallen Champion","Fate","Final Achievement","Fleshrender","Florance","Frenzy","Fury","Ghost Reaver","Ghostwalker","Gladius","Glimmer","Godslayer","Grasscutter","Grieving Blade","Gutrender","Hatred's Bite","Heartseeker","Heartstriker","Hell's Scream","Hellfire","Hellreaver","Hollow Silence","Honor's Call","Hope's End","Infamy","Interrogator","Justice","Justifier","King's Defender","King's Legacy","Kinslayer","Klinge","Knight's Fall","Knightfall","Lament","Last Rites","Last Words","Lazarus","Life's Limit","Lifedrinker","Light's Bane","Lightbane","Lightbringer","Lightning","Limbo","Loyalty","Malice","Mangler","Massacre","Mercy","Misery's End","Morbid Doom","Morbid Will","Mournblade","Narcoleptic","Needle","Nethersbane","Night's Edge","Night's Fall","Nightbane","Nightcrackle","Nightfall","Nirvana","Oathbreaker","Oathkeeper","Oblivion","Omega","Orenmir","Peacekeeper","Perfect Storm","Persuasion","Prick","Purifier","Rage","Ragespike","Ragnarok","Reaper","Reaper's Toll","Reckoning","Reign of Misery","Remorse","Requiem","Requiem of the Lost","Retirement","Righteous Might","Rigormortis","Savagery","Scalpel","Scar","Seethe","Severance","Shadow Strike","Shadowsteel","Silence","Silencer","Silver Saber","Silverlight","Skullcrusher","Slice of Life","Soul Reaper","Soulblade","Soulrapier","Spada","Spike","Spineripper","Spiteblade","Stalker","Starshatterer","Sting","Stinger","Storm","Storm Breaker","Stormbringer","Stormcaller","Storm-Weaver","Striker","Sun Strike","Suspension","Swan Song","The Ambassador","The Black Blade","The End","The Facelifter","The Light","The Oculus","The Stake","The Untamed","The Unyielding","The Void","Thorn","Thunder","Toothpick","Tranquility","Treachery","Trinity","Tyrhung","Unending Tyranny","Unholy Might","Valkyrie","Vanquisher","Vengeance","Venom","Venomshank","Warmonger","Widow Maker","Willbreaker","Winterthorn","Wit's End","Witherbrand","Wolf","Worldbreaker","Worldslayer"]; Global $nm2[] = ["Massive","Military","Amber Infused","Ancient","Anguish","Annihilation","Antique","Arcane","Arched","Assassination","Atuned","Oathkeeper's","Bandit's","Baneful","Banished","Barbarian","Barbaric","Battleworn","Blazefury","Blood Infused","Blood-Forged","Bloodcursed","Bloodied","Bloodlord's","Bloodsurge","Bloodvenom","Bone Crushing","Bonecarvin","Brutal","Brutality","Burnished","Captain's","Cataclysm","Cataclysmic","Cold-Forged","Corroded","Corrupted","Crazed","Crying","Cursed","Curved","Dancing","Decapitating","Defiled","Demonic","Deserted","Desire's","Desolation","Destiny's","Dire","Doom","Doom's","Dragon's","Dragonbreath","Ebon","Eerie","Enchanted","Engraved","Eternal","Executing","Exiled","Extinction","Faith's","Faithful","Fancy","Fearful","Feral","Fierce","Fiery","Fire Infused","Fireguard","Firesoul","Firestorm","Flaming","Flimsy","Forsaken","Fortune's","Fragile","Frail","Frenzied","Frost","Frozen","Furious","Fusion","Ghastly","Ghost-Forged","Ghostly","Gladiator","Gladiator's","Gleaming","Glinting","Greedy","Grieving","Guard's","Guardian's","Hailstorm","Hateful","Haunted","Heartless","Hollow","Holy","Honed","Honor's","Hope's","Hopeless","Howling","Hungering","Improved","Incarnated","Infused","Inherited","Isolated","Jade Infused","Judgement","Knightly","Legionnaire's","Liar's","Lich","Lightning","Lonely","Loyal","Lustful","Lusting","Mage's","Malevolent","Malicious","Malignant","Mended","Mercenary","Misfortune's","Misty","Moonlit","Mourning","Nightmare","Ominous","Peacekeeper","Phantom","Polished","Possessed","Pride's","Prideful","Primitive","Promised","Protector's","Deluded","Proud","Recruit's","Reforged","Reincarnated","Relentless","Remorseful","Renewed","Renovated","Replica","Restored","Retribution","Ritual","Roaring","Ruby Infused","Rune-Forged","Rusty","Sailor's","Sapphire Infused","Savage","Shadow","Sharpened","Silent","Singed","Singing","Sinister","Skullforge","Skyfall","Smooth","Solitude's","Sorrow's","Soul","Soul Infused","Soul-Forged","Soulcursed","Soulless","Spectral","Spectral-Forged","Spiteful","Storm","Storm-Forged","Stormfury","Stormguard","Terror","Thirsting","Thirsty","Thunder","Thunder-Forged","Thunderfury","Thunderguard","Thundersoul","Thunderstorm","Timeworn","Tormented","Trainee's","Treachery's","Twilight","Twilight's","Twisted","Tyrannical","Undead","Unholy","Vengeance","Vengeful","Venom","Vicious","Vindication","Vindictive","Void","Volcanic","Vowed","War-Forged","Warlord's","Warp","Warped","Whistling","Wicked","Wind's","Wind-Forged","Windsong","Woeful","Wrathful","Wretched","Yearning","Zealous"]; Global $nm3[] = ["Adamantite","Bronze","Copper","Diamond","Glass","Gold","Iron","Mithril","Obsidian","Silver","Skeletal","Steel"]; Global $nm4[] = ["Blade","Broadsword","Claymore","Defender","Deflector","Doomblade","Greatsword","Guardian","Katana","Longsword","Mageblade","Protector","Quickblade","Rapier","Reaver","Sabre","Scimitar","Shortsword","Slicer","Spellblade","Swiftblade","Sword","Warblade","Skewer","Carver","Etcher","Sculptor","Razor","Crusader"]; Global $nm5[] = ["Annihilation","Betrayer","Blade","Blessed Blade","Blood Blade","Bond","Boon","Breaker","Bringer","Broadsword","Butcher","Call","Carver","Champion","Claymore","Conqueror","Crusader","Cry","Cunning","Dark Blade","Dawn","Defender","Defiler","Deflector","Destroyer","Doomblade","Edge","Ender","Etcher","Executioner","Favor","Ferocity","Foe","Gift","Glory","Greatsword","Guardian","Heirloom","Hope","Incarnation","Jaws","Katana","Last Hope","Last Stand","Legacy","Longblade","Longsword","Mageblade","Memory","Might","Oath","Pact","Pledge","Promise","Protector","Quickblade","Rapier","Ravager","Razor","Reach","Reaper","Reaver","Runed Blade","Saber","Sabre","Savagery","Scimitar","Sculptor","Secret","Shortsword","Skewer","Slayer","Slicer","Soul","Spellblade","Spine","Swiftblade","Sword","Terror","Token","Tribute","Vengeance","Voice","Warblade","Warglaive","Whisper","Wit"]; Global $nm6[] = ["of Agony","of Ancient Power","of Anguish","of Ashes","of Assassins","of Black Magic","of Blessed Fortune","of Blessings","of Blight","of Blood","of Bloodlust","of Broken Bones","of Broken Dreams","of Broken Families","of Burdens","of Chaos","of Closing Eyes","of Conquered Worlds","of Corruption","of Cruelty","of Cunning","of Dark Magic","of Dark Souls","of Darkness","of Decay","of Deception","of Degradation","of Delusions","of Denial","of Desecration","of Diligence","of Dismay","of Dragonsouls","of Due Diligence","of Echoes","of Ended Dreams","of Ending Hope","of Ending Misery","of Eternal Bloodlust","of Eternal Damnation","of Eternal Glory","of Eternal Justice","of Eternal Rest","of Eternal Sorrow","of Eternal Struggles","of Eternity","of Executions","of Faded Memories","of Fallen Souls","of Fools","of Frost","of Frozen Hells","of Fury","of Giants","of Giantslaying","of Grace","of Grieving Widows","of Hate","of Hatred","of Hell's Games","of Hellish Torment","of Heroes","of Holy Might","of Honor","of Hope","of Horrid Dreams","of Horrors","of Illuminated Dreams","of Illumination","of Immortality","of Inception","of Infinite Trials","of Insanity","of Invocation","of Justice","of Light's Hope","of Lost Comrades","of Lost Hope","of Lost Voices","of Lost Worlds","of Magic","of Mercy","of Misery","of Mountains","of Mourning","of Mystery","of Necromancy","of Nightmares","of Oblivion","of Perdition","of Phantoms","of Power","of Pride","of Pride's Fall","of Putrefaction","of Reckoning","of Redemption","of Regret","of Riddles","of Secrecy","of Secrets","of Shadow Strikes","of Shadows","of Shifting Sands","of Shifting Worlds","of Silence","of Slaughter","of Souls","of Stealth","of Storms","of Subtlety","of Suffering","of Suffering's End","of Summoning","of Terror","of Thunder","of Time-Lost Memories","of Timeless Battles","of Titans","of Torment","of Traitors","of Trembling Hands","of Trials","of Truth","of Twilight's End","of Twisted Visions","of Unholy Blight","of Unholy Might","of Vengeance","of Visions","of Wasted Time","of Widows","of Wizardry","of Woe","of Wraiths","of Zeal","of the Ancients","of the Banished","of the Basilisk","of the Beast","of the Blessed","of the Breaking Storm","of the Brotherhood","of the Burning Sun","of the Caged Mind","of the Cataclysm","of the Champion","of the Claw","of the Corrupted","of the Covenant","of the Crown","of the Damned","of the Daywalker","of the Dead","of the Depth","of the Dreadlord","of the Earth","of the East","of the Emperor","of the Empty Void","of the End","of the Enigma","of the Fallen","of the Falling Sky","of the Flame","of the Forest","of the Forgotten","of the Forsaken","of the Gladiator","of the Harvest","of the Immortal","of the Incoming Storm","of the Insane","of the King","of the Lasting Night","of the Leviathan","of the Light","of the Lion","of the Lionheart","of the Lone Victor","of the Lone Wolf","of the Lost","of the Moon","of the Moonwalker","of the Night Sky","of the Night","of the Nightstalker","of the North","of the Occult","of the Oracle","of the Phoenix","of the Plague","of the Prince","of the Protector","of the Queen","of the Serpent","of the Setting Sun","of the Shadows","of the Sky","of the South","of the Stars","of the Storm","of the Summoner","of the Sun","of the Sunwalker","of the Talon","of the Undying","of the Victor","of the Void","of the West","of the Whispers","of the Wicked","of the Wind","of the Wolf","of the World","of the Wretched"]; Global $nm7[] = ["Aetherius","Agatha","Alpha","Amnesia","Anduril","Apocalypse","Armageddon","Arondite","Ashrune","Betrayal","Betrayer","Blackout","Blazefury","Blazeguard","Blinkstrike","Bloodquench","Bloodweep","Brutality","Celeste","Chaos","Cometfell","Convergence","Darkheart","Dawn","Dawnbreaker","Deathbringer","Deathraze","Decimation","Desolation","Destiny's Song","Dirge","Doomblade","Doombringer","Draughtbane","Due Diligence","Echo","Eclipse","Endbringer","Epilogue","Espada","Extinction","Faithkeeper","Fate","Fleshrender","Florance","Frenzy","Fury","Ghost Reaver","Ghostwalker","Gladius","Glimmer","Godslayer","Grasscutter","Gutrender","Hatred's Bite","Heartseeker","Heartstriker","Hell's Scream","Hellfire","Piece Maker","Hellreaver","Honor's Call","Hope's End","Infamy","Interrogator","Justifier","Kinslayer","Klinge","Knightfall","Lament","Lazarus","Lifedrinker","Light's Bane","Lightbane","Lightbringer","Lightning","Limbo","Loyalty","Malice","Mangler","Massacre","Mercy","Misery","Mournblade","Narcoleptic","Needle","Nethersbane","Night's Edge","Night's Fall","Nightbane","Nightcrackle","Nightfall","Nirvana","Oathbreaker","Oathkeeper","Oblivion","Omega","Orenmir","Peacekeeper","Persuasion","Prick","Purifier","Rage","Ragespike","Ragnarok","Reckoning","Reign","Remorse","Requiem","Retirement","Rigormortis","Savagery","Scalpel","Scar","Seethe","Severance","Shadow Strike","Shadowsteel","Silence","Silencer","Silver Saber","Silverlight","Skullcrusher","Slice of Life","Soul Reaper","Soulblade","Soulrapier","Spada","Spike","Spineripper","Spiteblade","Stalker","Starshatterer","Sting","Stinger","Storm","Storm Breaker","Stormbringer","Stormcaller","Story-Weaver","Striker","Sun Strike","Suspension","Swan Song","The Ambassador","The Black Blade","The End","The Facelifter","The Light","The Oculus","The Stake","The Untamed","The Unyielding","The Void","Thorn","Thunder","Toothpick","Tranquility","Treachery","Trinity","Tyrhung","Unending Tyranny","Unholy Might","Valkyrie","Vanquisher","Vengeance","Venom","Venomshank","Warmonger","Widow Maker","Willbreaker","Winterthorn","Wit's End","Witherbrand","Wolf","Worldbreaker","Worldslayer"]; MsgBox(0, "Name Gen", _GenSword(4)) $Gen = _GenSword("1;2;3;4;5;6;7", 3) _ArrayDisplay($Gen) Func _GenSword($Type, $Amount = 1) If StringInStr($Type, ";") Then;Run multiple $String = StringSplit($Type, ";") Local $Size = $String[0] * $Amount Dim $Name[$Size+1] $x = 1 $z = 1 $Name[0] = $Size While $x <= $String[0] $String[$x] = Int($String[$x]) Switch $String[$x] Case 1 For $i = 1 To $Amount $r1 = Floor(Random(0, UBound($nm1))) $Name[$z] = $nm1[$r1] If ($z + 1) <= $Size Then $z += 1 Next Case 2 For $i = 1 To $Amount $r7 = Floor(Random(0, UBound($nm7))) $Name[$z] = $nm7[$r7] If ($z + 1) <= $Size Then $z += 1 Next Case 3 For $i = 1 To $Amount $r2 = Floor(Random(0, UBound($nm2))) $r4 = Floor(Random(0, UBound($nm4))) $Name[$z] = $nm2[$r2] & " " & $nm4[$r4] If ($z + 1) <= $Size Then $z += 1 Next Case 4 For $i = 1 To $Amount $r1 = Floor(Random(0, UBound($nm1))) $r6 = Floor(Random(0, UBound($nm6))) $Name[$z] = $nm1[$r1] & " " & $nm6[$r6] If ($z + 1) <= $Size Then $z += 1 Next Case 5 For $i = 1 To $Amount $r3 = Floor(Random(0, UBound($nm3))) $r5 = Floor(Random(0, UBound($nm5))) $Name[$z] = $nm3[$r3] & " " & $nm5[$r5] If ($z + 1) <= $Size Then $z += 1 Next Case 6 For $i = 1 To $Amount $r2 = Floor(Random(0, UBound($nm2))) $r3 = Floor(Random(0, UBound($nm3))) $r4 = Floor(Random(0, UBound($nm4))) $Name[$z] = $nm2[$r2] & " " & $nm3[$r3] & " " & $nm4[$r4] If ($z + 1) <= $Size Then $z += 1 Next Case 7 For $i = 1 To $Amount $r7 = Floor(Random(0, UBound($nm7))) $r5 = Floor(Random(0, UBound($nm5))) $r6 = Floor(Random(0, UBound($nm6))) $Name[$z] = $nm7[$r7] & " " & $nm5[$r5] & " " & $nm6[$r6] If ($z + 1) <= $Size Then $z += 1 Next EndSwitch $x += 1 WEnd Return $Name ElseIf IsInt($Type) And $Type >= 1 And $Type <= 6 Then;Run Single Local $Name = "" Switch $Type Case 1 For $i = 1 To $Amount $r1 = Floor(Random(0, UBound($nm1))) $Name = $Name & $nm1[$r1] & @CRLF Next Case 2 For $i = 1 To $Amount $r7 = Floor(Random(0, UBound($nm1))) $Name = $Name & $nm7[$r7] & @CRLF Next Case 3 For $i = 1 To $Amount $r2 = Floor(Random(0, UBound($nm2))) $r4 = Floor(Random(0, UBound($nm4))) $Name = $Name & $nm2[$r2] & " " & $nm4[$r4] & @CRLF Next Case 4 For $i = 1 To $Amount $r1 = Floor(Random(0, UBound($nm1))) $r6 = Floor(Random(0, UBound($nm6))) $Name = $Name & $nm1[$r1] & " " & $nm6[$r6] & @CRLF Next Case 5 For $i = 1 To $Amount $r3 = Floor(Random(0, UBound($nm3))) $r5 = Floor(Random(0, UBound($nm5))) $Name = $Name & $nm3[$r3] & " " & $nm5[$r5] & @CRLF Next Case 6 For $i = 1 To $Amount $r2 = Floor(Random(0, UBound($nm2))) $r3 = Floor(Random(0, UBound($nm3))) $r4 = Floor(Random(0, UBound($nm4))) $Name = $Name & $nm2[$r2] & " " & $nm3[$r3] & " " & $nm4[$r4] & @CRLF Next Case 7 For $i = 1 To $Amount $r7 = Floor(Random(0, UBound($nm7))) $r5 = Floor(Random(0, UBound($nm5))) $r6 = Floor(Random(0, UBound($nm6))) $Name = $Name & $nm7[$r7] & " " & $nm5[$r5] & " " & $nm6[$r6] & @CRLF Next EndSwitch Return $Name Else SetError(1) Return 0 EndIf EndFunc
  4. This script is used to create and display Latin Squares and to use them to create a secure password. You would use this to create a password, as an example, by inputting the name of the site you need the password for and pressing the GeneratePW button. The resulting password will be displayed in the red box to the right of the input. The password generator uses up to 6 characters of whatever is typed into the input (n) to create a password whose length is n*2. So, for example, if you were to go to autoitscript.com and you needed a password for it, you would type in autoitscript and generate the password. Because the password generator only uses the first 6 characters, autoit in this case, it would output a 12 character password for you. Each Latin Square you generate can be used to create 26 different passwords for the same 6 character string by selecting a different starting row for each. Each square can also generate several hundred different passwords for the same character string by selecting a different number of characters to use and a different starting row for each of those. If you also throw in that you can add either a random punctuation character or a random 1 digit number, or both, the combinations for just one square are probably a lot more than you could ever need in a lifetime even if you had to change a password every week. Plus, you can use this script to generate new squares whenever you'd like. Each time you generate a new Latin Square the square is saved to a text file called *.pwf, the filename is determined by generating the password for Autoit using that square and the first row as the starting row. When you generate a new latin square, there is no control over it's generation, it's random as to what letters are placed where with no row or column having more than one instance of every letter. When you choose the case of the letters, by using the combobox, the mixed mode will always change the case of the letters to be the same every time. I originally had it so that the case was chosen randomly, but that made it virtually impossible to retrieve a password that was previously created. The way this password generator works is by finding the first letter, of the string you typed in, in the starting row you've selected. It will then search the column that that letter was found in to find the second letter, then searches the row that letter was found in, and so on until it reaches the end of your string or the number of characters you've selected in the combo box. Once it has found the last letter in the search, it repeats the search using the position of that last found letter, and searches either the row or column that the letter is found in. It chooses the search direction based upon the last direction it searched in to find that last character. If it searched a row to find it, it will search the column to find the first letter in your string the second round. Depending upon the direction of the search from the last character of your string to the first character of your string (L->R/R->L/Up/Down) the 2 characters immediately adjacent to the character, and in the direction searched, are chosen for the password string. Alternating between the rows and columns it will continue adding 2 characters for every character in your string. Searching for the string "autoit" in the square below gives you the resulting password of "XMRUQMOUHPKV" when starting the search from the first row. There is an option to select the case of the letters used to generate the password, the default is a mix of upper and lower case letters, there is also a setting for all lower and all upper case letters as well. The picture below shows how the password is found, the red line is the initial search, and the green line is the password generating search. The purple circles show where the letters are that are used to create the password. The case of the letters in the input string doesn’t matter as the searches aren't case sensitive. After the password is generated and you see it in the red square, it is also copied to the clipboard so that you can paste it into whatever you're working with that needed that password. There is a checkbox that allows you to add a random punctuation character and/or a number to the password generated for any sites that require it. There are also checkboxes to save, and retrieve saved, passwords. The passwords are saved to a file called "Lsquare.dll", I used this file name only because it helps obscure your password list a tiny bit. This file is automatically encrypted and decrypted using AES 256 encryption whenever it's needed for added security from prying eyes. The file Lsquare.dll is actually an INI file the format of the ini file information is as follows: section name = input string key = File name of the pwf file, a space then the starting row # another space and then case used ("M" for mixed, "L" for all lower, "U" for all upper), another space and any punctuation and/or numerical characters added value = the checkbox indicator for what extra characters were added: "+" = both boxes checked, "S" = punctuation box checked, "N" = number box checked, "0" = no boxes checked The actual password is never put into the ini file, just the way it was generated, for protection. Plus the ini file is encrypted for even more protection from prying eyes. If you don't have the pwf file used to generate the password none of this information is going to get the password. So, even if you hack the program and get the keys used to encrypt the ini file, it's useless without the correct pwf file. The "Load" button will allow you to load another password file, there is a verification process to check that the file being loaded is actually a password file or not. After you have loaded a new password file, if you close the program, the next time you reopen it, the last selected pwf will be reloaded, otherwise the last pwf generated will be loaded. If you are running the program for the first time, a new password file will be created and loaded into the listview. You will need to download Melba23's to use this. I used it to show/hide the square if you wanted to. If you would rather not download that, you can comment out or delete all lines that contain any functions that reference _GUIExtender_. The script will work without using the UDF, but you lose the ability to hide the listview. This script is heavily commented so that if you're wondering how it all works it should be in there. Also take note that the time needed to generate a new square varies widely, anywhere from a few seconds to over several minutes. The process can get quite complicated as it generates the lines further into the square, and you may see it pausing for a while at some of the lines in the 20's. I put some consolewrite code in that let me follow the progress of the process, and also tells me how many times the line had to be reset before it could come up with a valid line. I've seen the number of attempts at over 3,000 in some cases for just one line. This script will generate any number of reasonably secure passwords, but it's only as secure as the computer you're using it on and whether or not anyone can access the script, the INI file, and the Latin square file used to generate the password. If you lose the *.pwf file used you won't be able to retrieve the password. If you lose access to the ini file, but still have the *.pwf files, you may be able to recreate the password but it will be very tough to do so because of the numerous factors that determine how the password is generated. As always, if there are any bugs, or you're not sure how something works, or a modification is politely asked for, please feel free to leave a comment. You can create a password using more than 6 characters of your passphrase by looking at the comments at lines 560 and 561, just remember, the password generated is twice as many characters as the passphrase used. LatinSquare.au3 download link EDIT:Changed download link
  5. I've been looking around for implementations of noise generators for autoit, but as of yet have had no luck More particularly, I'm looking for an x octave noise generator, but I haven't found any for autoit. Has anyone seen any x octave or perlin noise generators for autoit?
  6. This is my maze generator. It creates a maze useing the Recursive backtracker witch i found here: http://en.wikipedia.org/wiki/Maze_generation_algorithm#Recursive_backtracker It'll save the finished maze in the a folder with the name Mazes in @scriptdir as Maze (Seed).bmp where Seed is the seed of the maze and size is the size. It usees the Bitmap Libray by evelertoaster find it here: Thanks to MvGulik for cleaning the code. Here's a picture of a finished 25*25 maze: The green dot is the start and the red dot is the end. It can also solve the maze. Here's the solution for the above 25*25 maze. So here's the code: ;~ #AutoIt3Wrapper_Au3Check_Stop_OnWarning=y ;~ #AutoIt3Wrapper_AU3Check_Parameters=-q -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 ;Thanks to MvGulik (http://www.autoitscript.com/forum/user/14111-mvgulik/) for cleaning up the code. And for RND_SeedTimed function #region Decleres and includes ;Add the needed includes #include <Array.au3> #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include "BMP3.au3" ; Downloaded from http://www.autoitscript.com/forum/topic/27362-bitmap-library/ #endregion Decleres and includes #Region ### START Koda GUI section ### Form=*** $Gui = GUICreate("Maze Generator", 673, 728, 299, 77) $GenerateButton = GUICtrlCreateButton("Generate!", 528, 8, 137, 49) GUICtrlSetFont(-1, 17, 400, 0, "MS Sans Serif") $SizeXLabel = GUICtrlCreateLabel("X:", 8, 24, 19, 24) GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif") $SizeYLabel = GUICtrlCreateLabel("Y:", 112, 24, 19, 24) GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif") $SolveCheck = GUICtrlCreateCheckbox("Solve maze?", 384, 24, 137, 20) GUICtrlSetFont(-1, 15, 400, 0, "MS Sans Serif") $MazeYInput = GUICtrlCreateInput("", 136, 24, 57, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_NUMBER)) $MazeXInput = GUICtrlCreateInput("", 32, 24, 57, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_NUMBER)) $SizeLabel = GUICtrlCreateLabel("Size:", 80, 0, 39, 24) GUICtrlSetFont(-1, 13, 400, 0, "MS Sans Serif") $SeedLabel = GUICtrlCreateLabel("Seed:", 216, 24, 46, 24) GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif") $SeedInput = GUICtrlCreateInput("", 264, 24, 97, 21) GUICtrlSetLimit(-1, 10) GUICtrlSetTip(-1, "Leave blank for a random seed.") $MazeTempPic = GUICtrlCreateGraphic(5,72, 663, 651) GUICtrlSetBkColor(-1, 0x000000) $MazeShowPic = GUICtrlCreatePic("", 5, 72, 663, 651) ;this is where the maze will be shown GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $GenerateButton Generate(Int(GUICtrlRead($MazeXInput)), Int(GUICtrlRead($MazeYInput)), GUICtrlRead($SeedInput), Int(GUICtrlRead($SolveCheck))) EndSwitch WEnd Func Generate($iMazeX, $iMazeY, $sSeed, $iSolve) ProgressOn("Generating maze", "Generating maze. Please Wait", "", -1, -1 , 16) $iSeed = UseSeed($sSeed) If $sSeed = "" Then $sSeed = String($iSeed) ProgressSet(1, "1 Percent.") Local $sBaseName = 'MazesMaze [' & String($iMazeX) & ', ' & String($iMazeY) & '] (' & $sSeed & ')' ; Now saves mazes in a separate folder DirCreate(@ScriptDir&"Mazes") Local $aiSize[2] = [$iMazeX, $iMazeY] ;$aiSize[0] Equals Number of Rows in each colum and $aiSize[1] equals number of Colums Local $aCells = _;This is where the maze will be stored ; It will store witch walls are intact Generate_Maze($aiSize, $iSolve) ; 25.5% of progress or 51% if not being solved Draw_Maze_Image($aiSize, $aCells, $sBaseName, $iSolve) ; 24.5% of progress or 48% if not being so)ved ;Show image if maze should not be solved If $iSolve = 49 Then GUICtrlSetImage($MazeShowPic, @ScriptDir & "" & $sBaseName & ".bmp") If $iSolve <> 49 Then Local $aCurrentPath = Solve_Maze($aiSize, $aCells) ; 25.5% of progress Solve_Maze_ImgDraw($aiSize, $aCurrentPath, $sBaseName) ; 23.5% of progress GUICtrlSetImage($MazeShowPic, @ScriptDir & "" & $sBaseName & "_Solved.bmp") EndIf ProgressOff() EndFunc Func Generate_Maze(Const ByRef $aiSize, ByRef $iSolve) Local Const $iTotalCells = $aiSize[0] * $aiSize[1] Local $iMoveToCell ; What cell to move to Local $aCellstack[$iTotalCells][2];This stores with sequnce the cell got generated in. used for backtracing. First dimension is Row. Second is Colum Local $iCurrentCellStackNumber = 0 ; Current subscript number to write to in $aCellstack Local $aCurrentCellStack[2] ; USed as a temp storage of a bit of cellstack. First dimension is Row. Second is Colum Local $iUnvisitedCells = $iTotalCells ; Number of cell that are unvisited Local $sNeighbours = '' Local $sNeighbourOk Local $iRndDirection Local $aCurrentCellRowColum $iSolve -= 1 If $iSolve = 3 Then $iSolve = 25.5 ;; setup cell array. Local $aCells[$iTotalCells];This is where the maze will be stored ; It will store witch walls are intact Local $iCurrentCell = Random(0, $iTotalCells - 1, 1) ;; set random start point/cell ;Make all walls be intact by filling the cells array with 1111 array_filler($aCells, '1111') Local $aVisitedCells[$iTotalCells] array_filler($aVisitedCells, False) While 1 ;Mark as visited and add to the cell stack $aCurrentCellRowColum = AddToCellStack($iCurrentCell, $iCurrentCellStackNumber, $aCellstack, $aiSize) ;; $iCurrentCell not used in function. ;Check to see if it sould stop createing the maze If $iUnvisitedCells <> 0 Then ;Check to see if the current cell has any neighbours there are unvisited $sNeighbours = _Neighbours($aCurrentCellRowColum, $iCurrentCell, $aVisitedCells, $aiSize) If $sNeighbours <> "0000" Then ;Choose a random unvisited Neighbour Do $iRndDirection = Random(0, 3, 1) $sNeighbourOk = StringMid($sNeighbours, $iRndDirection + 1, 1) Until $sNeighbourOk = "1" Switch $iRndDirection ;Witch side to move to Case 0 ; Move Up $iMoveToCell = $iCurrentCell - $aiSize[1] Case 1 ; Move Right $iMoveToCell = $iCurrentCell + 1 Case 2 ; Move Down $iMoveToCell = $iCurrentCell + $aiSize[1] Case 3 ; Move Left $iMoveToCell = $iCurrentCell - 1 EndSwitch BustWall($iCurrentCell, $iMoveToCell, $iRndDirection, $aCells) $iCurrentCell = $iMoveToCell ;Make the current cell visited $aVisitedCells[$iCurrentCell] = True $iUnvisitedCells -= 1 Else $aCurrentCellStack[0] = $aCellstack[$iCurrentCellStackNumber - 2][0] ; Get row of last item in cellstack $aCurrentCellStack[1] = $aCellstack[$iCurrentCellStackNumber - 2][1] ; Get colum of last item in cellstack $iCurrentCell = _GetCellPos($aiSize, $aCurrentCellStack) ; Combine row and colum to get pos $iCurrentCellStackNumber -= 2 ; This will ensure that the used cell from the cellstack will be overwritten EndIf Else ExitLoop EndIf ;Update the progress ProgressSet(Int(Map($iUnvisitedCells, $iTotalCells, 0, 0, 25.5) + 1 + $iSolve), String(Int(Map($iUnvisitedCells, $iTotalCells, 0, 0, 25.5) + 1 + $iSolve))&" Percent.") WEnd ProgressSet(Int(25.5 + $iSolve), String(Int(25.5 + $iSolve))&" Percent.") ; Update progress Return $aCells EndFunc ;==>Generate_Maze Func Draw_Maze_Image(Const ByRef $aiSize, ByRef Const $aCells, ByRef Const $sFilename, ByRef $iSolve) Local Const $iTotalCells = $aiSize[0] * $aiSize[1] Local $aImageRowColum Local $tBMP = _BMPCreate($aiSize[1] * 9, $aiSize[0] * 9) ;Define the size of the maze (in bmp) If $iSolve = 25.5 Then $iSolve = 25.5 + 23.5 ;Draw the maze with no walls For $i = 0 To $iTotalCells - 1 $aImageRowColum = _GetCellPos($aiSize, $i) Draw3By3($tBMP, $aImageRowColum[0] * 9, $aImageRowColum[1] * 9) Draw3By3($tBMP, 6 + $aImageRowColum[0] * 9, $aImageRowColum[1] * 9) Draw3By3($tBMP, $aImageRowColum[0] * 9, 6 + $aImageRowColum[1] * 9) Draw3By3($tBMP, 6 + $aImageRowColum[0] * 9, 6 + $aImageRowColum[1] * 9) ProgressSet(Int(Map($i, 0, $iTotalCells-1, 0, 10) + 26.5 + $iSolve), String(Int(Map($i, 0, $iTotalCells-1, 0, 10) + 26.5 + $iSolve))&" Percent."); Update progress Next ;Then Draw the wall on the cells For $i = 0 To $iTotalCells - 1 $aImageRowColum = _GetCellPos($aiSize, $i) If StringMid($aCells[$i], 1, 1) = "1" Then Draw3By3($tBMP, 3 + $aImageRowColum[1] * 9, $aImageRowColum[0] * 9) EndIf If StringMid($aCells[$i], 2, 1) = "1" Then Draw3By3($tBMP, 6 + $aImageRowColum[1] * 9, 3 + $aImageRowColum[0] * 9) EndIf If StringMid($aCells[$i], 3, 1) = "1" Then Draw3By3($tBMP, 3 + $aImageRowColum[1] * 9, 6 + $aImageRowColum[0] * 9) EndIf If StringMid($aCells[$i], 4, 1) = "1" Then Draw3By3($tBMP, $aImageRowColum[1] * 9, 3 + $aImageRowColum[0] * 9) EndIf ProgressSet(Int(Map($i, 0, $iTotalCells-1, 0, 10) + 36.5 + $iSolve), String(Int(Map($i, 0, $iTotalCells-1, 0, 10) + 36.5 + $iSolve))&" Percent."); Update progress Next ;Draw start and exit. ;Start will be green and exit will be red Draw3By3($tBMP, 3, 3, '00FF00') ; Draw a green cube in the first cell(Top Left Corner) $aImageRowColum = _GetCellPos($aiSize, $iTotalCells - 1);Get row and colum of the last cell in the maze Draw3By3($tBMP, 3 + + $aImageRowColum[1] * 9, 3 + $aImageRowColum[0] * 9, 'FF0000') ; Draw a red cube in the last cell (Buttom right corner) ;And finaly save the bmp _BMPWrite($tBMP, @ScriptDir & "" & $sFilename & ".bmp") ProgressSet(Int(51 + $iSolve), String(Int(51 + $iSolve))&" Percent.") ; Update progress EndFunc ;==>Draw_Maze_Image Func Solve_Maze(Const ByRef $aiSize, ByRef $aCells) Local Const $iTotalCells = $aiSize[0] * $aiSize[1] Local $aCurrentPath[$iTotalCells+1000] ; Will store the current solved path Local $aSolveVisitedCells[$iTotalCells] ;This will store if the solver has been to a cell yet or not Local $iCurrentPathSubscriptNumber = -1 ; Current subscript number to write to in $aCurrentPath Local $iCurrentCell = 0 AddToCurrentPath($iCurrentCell, $iCurrentPathSubscriptNumber, $aCurrentPath) ; Add the cell the the path $aSolveVisitedCells[$iCurrentCell] = 1;Mark cell as visited ;Loop until the path has been found Local $CanGoOrNot Local $aYX[2] ; Store Y and X in an array ; used in solveing the maze While 1 ;Find a direction to go For $iDirection = 0 To 3 ;;If $iDirection = 4 Then ExitLoop $aYX = _GetCellPos($aiSize, $iCurrentCell); Convert it to rows and colums $CanGoOrNot = CanGo($aYX[0], $aYX[1], $iDirection, $aCells, $aSolveVisitedCells, $aiSize) ; Check if it can go there If $CanGoOrNot = 1 Then ExitLoop Next If $iDirection <> 4 Then Switch $iDirection Case 0 ; Up $iCurrentCell -= $aiSize[0] Case 1 ; Right $iCurrentCell += 1 Case 2 ; Down $iCurrentCell += $aiSize[0] Case 3 ; Left $iCurrentCell -= 1 EndSwitch AddToCurrentPath($iCurrentCell, $iCurrentPathSubscriptNumber, $aCurrentPath) ; Add the cell the the path $aSolveVisitedCells[$iCurrentCell] = True;Mark cell as visited Else If $iCurrentPathSubscriptNumber > 0 Then $iCurrentCell = $aCurrentPath[$iCurrentPathSubscriptNumber - 1] $iCurrentPathSubscriptNumber -= 1 ;Else ; $iCurrentPathSubscriptNumber -= 1 EndIf EndIf If $iCurrentCell = $iTotalCells - 1 Then ExitLoop WEnd ProgressSet(Int(76.5), "75 Percent"); Update progress Return $aCurrentPath EndFunc ;==>Solve_Maze Func Solve_Maze_ImgDraw(Const ByRef $aiSize, ByRef $aCurrentPath, Const ByRef $sFilename) Local Const $iTotalCells = $aiSize[0] * $aiSize[1] ;This function will use functions from the Drawing Functions region ;Open The Generated maze as a bmp handle Local $tBMP = _BMPOpen(@ScriptDir & "" & $sFilename & ".bmp") Local $aCurrentRowAndColum ;Go thoug all the cells one by one For $i = 0 To UBound($aCurrentPath) - 1 If $aCurrentPath[$i] = $iTotalCells - 1 Then ExitLoop If $aCurrentPath[$i] <> "" Then $aCurrentRowAndColum = _GetCellPos($aiSize, $aCurrentPath[$i]) Draw3By3($tBMP, 9 * $aCurrentRowAndColum[1] + 3, 9 * $aCurrentRowAndColum[0] + 3, 'FFFF00') If $aCurrentPath[$i] - $aiSize[0] = $aCurrentPath[$i + 1] Then ; Up Draw3By3($tBMP, 9 * $aCurrentRowAndColum[1] + 3, 9 * $aCurrentRowAndColum[0], 'FFFF00') Draw3By3($tBMP, 9 * $aCurrentRowAndColum[1] + 3, 9 * $aCurrentRowAndColum[0] - 3, 'FFFF00') ElseIf $aCurrentPath[$i] + 1 = $aCurrentPath[$i + 1] Then ;Right Draw3By3($tBMP, 9 * $aCurrentRowAndColum[1] + 6, 9 * $aCurrentRowAndColum[0] + 3, 'FFFF00') Draw3By3($tBMP, 9 * $aCurrentRowAndColum[1] + 9, 9 * $aCurrentRowAndColum[0] + 3, 'FFFF00') ElseIf $aCurrentPath[$i] + $aiSize[0] = $aCurrentPath[$i + 1] Then ; Down Draw3By3($tBMP, 9 * $aCurrentRowAndColum[1] + 3, 9 * $aCurrentRowAndColum[0] + 6, 'FFFF00') Draw3By3($tBMP, 9 * $aCurrentRowAndColum[1] + 3, 9 * $aCurrentRowAndColum[0] + 9, 'FFFF00') ElseIf $aCurrentPath[$i] - 1 = $aCurrentPath[$i + 1] Then ;LEft Draw3By3($tBMP, 9 * $aCurrentRowAndColum[1], 9 * $aCurrentRowAndColum[0] + 3, 'FFFF00') Draw3By3($tBMP, 9 * $aCurrentRowAndColum[1] - 3, 9 * $aCurrentRowAndColum[0] + 3, 'FFFF00') EndIf EndIf ProgressSet(Int(Map($i, 0, UBound($aCurrentPath) - 1, 0, 22.5) + 76.5), String(Int(Map($i, 0, UBound($aCurrentPath) - 1, 0, 22.5) + 76.5))&" Percent") ; Update progress Next ;reDraw start and exit. ;Start will be green and exit will be red Draw3By3($tBMP, 3, 3, '00FF00') ; Draw a green cube in the first cell(Top Left Corner) Local $aImageRowColum = _GetCellPos($aiSize, $iTotalCells - 1);Get row and colum of the last cell in the maze Draw3By3($tBMP, 3 + + $aImageRowColum[1] * 9, 3 + $aImageRowColum[0] * 9, 'FF0000') ; Draw a red cube in the last cell (Buttom right corner) ;And finaly save th bmp as Maze.bmp _BMPWrite($tBMP, @ScriptDir & "" & $sFilename & "_Solved.bmp") ProgressSet(100, "100 Percent") ; Update progress EndFunc ;==>Solve_Maze_ImgDraw #region Maze generation functions Func BustWall($Cell1, $Cell2, $iDirection, ByRef $aCells) ; This function will remove the walls in two adjacent cells. Direction is from first cell to second. Direction can be from 0 - 3. 0 = Up, 1 = Right, 2 = Down, 3 = Left $aCells[$Cell1] = StringReplace($aCells[$Cell1], $iDirection + 1, "0", 1, 2) ; Bust the wall between cell1 and cell2 in cell1 FlipDirection_br($iDirection) $aCells[$Cell2] = StringReplace($aCells[$Cell2], $iDirection + 1, "0", 1, 2) ; Bust the wall between cell1 and cell2 in cell2 EndFunc ;==>BustWall Func AddToCellStack($iCurrentCell, ByRef $iCurrentCellStackNumber, ByRef $aCellstack, Const ByRef $aiSize); This function will add the $Cell to the $aCellstack at the subscript of $CurretCellStackNumber ;Convert to Rows and colums Local $aCurrentCellRowColum = _GetCellPos($aiSize, $iCurrentCell) ;Add cell to the cell stack $aCellstack[$iCurrentCellStackNumber][0] = $aCurrentCellRowColum[0] $aCellstack[$iCurrentCellStackNumber][1] = $aCurrentCellRowColum[1] ;Add one to $iCurrentCellStackNumber $iCurrentCellStackNumber += 1 Return $aCurrentCellRowColum EndFunc ;==>AddToCellStack Func _Neighbours(Const ByRef $aCurrentCellRowColum, $Cell, ByRef Const $aVisitedCells, Const ByRef $aiSize) ; Check for Neighbours and store them in a string an 1 means that the neighbour has not been visited and an 0 means the neighbour has been visited it also checks for the edge of the maze. Local $NeighbourRowColum, $sNeighbours = '' Local Const $iTotalCells = $aiSize[0] * $aiSize[1] ;Check Clockwise ;Check Above cell If ($Cell - $aiSize[1] >= 0) And ($aVisitedCells[$Cell - $aiSize[1]] = False) Then $sNeighbours &= "1" Else $sNeighbours &= "0" EndIf ;Check Right Cell $NeighbourRowColum = _GetCellPos($aiSize, $Cell + 1) If ($aCurrentCellRowColum[0] >= $NeighbourRowColum[0]) And ($Cell + 1 < $iTotalCells) And ($aVisitedCells[$Cell + 1] = False) Then $sNeighbours &= "1" Else $sNeighbours &= "0" EndIf ;Check Buttom Cell If ($Cell + $aiSize[1] < $iTotalCells) And ($aVisitedCells[$Cell + $aiSize[1]] = False) Then $sNeighbours &= "1" Else $sNeighbours &= "0" EndIf ;Check Left Cell $NeighbourRowColum = _GetCellPos($aiSize, $Cell - 1) If ($aCurrentCellRowColum[0] <= $NeighbourRowColum[0]) And ($Cell - 1 >= 0) And ($aVisitedCells[$Cell - 1] = False) Then $sNeighbours &= "1" Else $sNeighbours &= "0" EndIf Return $sNeighbours EndFunc ;==>_Neighbours #endregion Maze generation functions #region Drawing Functions Func Draw3By3(ByRef $tBMP, $x, $y, $Colur = '000000') ; This function will draw a 3*3 Cube at a given x and y on the $tBMP _PixelWrite($tBMP, $x, $y, $Colur) _PixelWrite($tBMP, $x + 1, $y, $Colur) _PixelWrite($tBMP, $x + 2, $y, $Colur) _PixelWrite($tBMP, $x, $y + 1, $Colur) _PixelWrite($tBMP, $x + 1, $y + 1, $Colur) _PixelWrite($tBMP, $x + 2, $y + 1, $Colur) _PixelWrite($tBMP, $x, $y + 2, $Colur) _PixelWrite($tBMP, $x + 1, $y + 2, $Colur) _PixelWrite($tBMP, $x + 2, $y + 2, $Colur) EndFunc ;==>Draw3By3 #endregion Drawing Functions #region Maze solveing Functions Func CanGo($y, $x, ByRef Const $iDirection, ByRef Const $aCells, ByRef Const $aSolveVisitedCells, Const ByRef $aiSize);Returns 1 if the direction can the traveled and if not it will return 0. $Y = Row, $x = Colum, $iDirection = Direction Local $aYX[2] = [$y, $x] If StringMid($aCells[_GetCellPos($aiSize, $aYX)], $iDirection + 1, 1) = "0" Then Switch $iDirection Case 0 ; Up $aYX[0] -= 1 Case 1 ; Right $aYX[1] += 1 Case 2 ; Down $aYX[0] += 1 Case 3 ; Left $aYX[1] -= 1 EndSwitch If ($aSolveVisitedCells[_GetCellPos($aiSize, $aYX)] <> True) Then Return 1 ; IF cell has not been seen before by the solver EndIf Return 0 EndFunc ;==>CanGo Func AddToCurrentPath(ByRef Const $Cell, ByRef $iCurrentPathSubscriptNumber, ByRef $aCurrentPath) $iCurrentPathSubscriptNumber += 1 $aCurrentPath[$iCurrentPathSubscriptNumber] = $Cell EndFunc ;==>AddToCurrentPath #endregion Maze solveing Functions #region Seed Functions Func UseSeed($sRawSeed) Local Const $INT31u = Int('0x0080000000') ;; (2^31), int64. (2147483648) Local Const $INT32u = Int('0x0100000000') ;; (2^32), int64. (4294967296) If $sRawSeed = "" Then Return SetError(0, 1, RND_SeedTimed()) If StringLen($sRawSeed) > 10 Then Return SetError(1, 0, -1) $s = StringSplit($sRawSeed, "") $iSeed = 0 For $i = 1 To $s[0] $iSeed += (Asc($s[$i])*31^($s[0]-$i)) Next $iSeed = Int(Mod(Int($iSeed), $INT32u) - ($INT31u), 1) SRandom($iSeed) Return SetError(0, 0, $iSeed) EndFunc Func RND_SeedTimed($iSeed = Default) ;; Set seed base on current timer value. Returns used seed value. Local Const $INT31u = Int('0x0080000000') ;; (2^31), int64. (2147483648) Local Const $INT32u = Int('0x0100000000') ;; (2^32), int64. (4294967296) If Not IsNumber($iSeed) Then $iSeed = Int(Mod(Int(TimerInit()), $INT32u) - ($INT31u), 1) ;; wraps to [-2^31 and 2^31-1]. (has value shift) EndIf SRandom($iSeed) Return SetError(@error, @extended, $iSeed) EndFunc ;==>RND_SeedTimed #endregion Seed Functions #region Global Functions Func _GetCellPos(Const ByRef $aiSize, $vFind) ; This function will make a row and a colum into a Pos to be used with $aCells or $aCellstack, Or it will Make a Pos into an array with row and colum If IsArray($vFind) Then Local $CellPos = $vFind[0] * $aiSize[1] + $vFind[1] Return $CellPos Else Local $aCellRowColum[2] ; Will be used in the _GetCellPos function to temp.. store an array $aCellRowColum[0] = Int($vFind / $aiSize[1]) $aCellRowColum[1] = $vFind - ($aCellRowColum[0] * $aiSize[1]) Return $aCellRowColum EndIf EndFunc ;==>_GetCellPos Func FlipDirection_br(ByRef $iDirection) ; Flips the direction If $iDirection > 1 Then $iDirection -= 2 Else $iDirection += 2 EndIf EndFunc ;==>FlipDirection_br Func FlipDirection($iDirection) ; Flips the direction If $iDirection > 1 Then Return $iDirection - 2 Return $iDirection + 2 EndFunc ;==>FlipDirection Func array_filler(ByRef $aArray, $vFiller) ; Fills $aArray with $vFiller For $i = 0 To UBound($aArray) - 1 $aArray[$i] = $vFiller Next EndFunc ;==>array_filler Func Map($iValue, $iFromLow, $iFromHigh, $iToLow, $iToHigh) Return ($iValue - $iFromLow) * ($iToHigh - $iToLow) / ($iFromHigh - $iFromLow) + $iTolow EndFunc #endregion Global Functions Also be VERY carefull when generating very big mazes, my computer crashed when i was trying to generate a 500*500 maze. -FIXED Please post comments and/or any bug or problems. Sorry for any bad spelling that there may be.
×
×
  • Create New...