Jump to content

all numbers, having 4 digits, no duplicate digits, in one .txt


Eller
 Share

Recommended Posts

Sure there will be formulas to calculate the number of possibilities. One digit 0 to 9 gives ten opts.

Two digits make 10 x 10 minus 9 (one digits).

I think with 4 digits, that would be (10X10-9) x (10X10-9) X (10X10-9), but I'd like to make a script to automate the generation of these numbers.

I tried to write both in autoit (old version) and autoit 3, but being no programmer att all my knowledge fails me.

Anyone who can help?

getAU.au

Link to comment
Share on other sites

Are you trying to make a text file running from 0000 to 9999? That's fairly simple, could be easiest using stringformat, and there's only 10000 possible combinations if you're using those sets of numbers.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

  • Moderators

Eller,

And just why do you want a file containing these 4-digit numbers?

M23

P.S. And just to be absolutely clear - this is the Mod team determining the legality of the thread, so everyone else please keep out.

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Melba23

After seniorweb-forum died here in NL, I was asked to run a small forum for pensionados. Nothing scientific, most of it a "cosy corner"

One of the "games" we play is MasterMind. (eller.forum2go.nl)

 

Using your brain to determin a fixed number of 4 digits at random, in which no duplcate digits are allowed.

Playing the game, I asked formerly assistence on your forum and got answers from i.e. Jos and a few more. (december 2011 that was)

=============

Those days the text under your avatar was: "I'm old, What is your excuse?"

I was born july 1938... 

=============

Jos gave me a tiny script in which the line "WriteConsole" ...... and explained that SciTE was needed to display the list.

I do not succeed in displaying the list and I'm looking for another aproach to do the trick.

 

Needed? No, not realy, but I was curious how much options there were.

I have a small script that write to file (FileAppend) which shows all the possibilties from 4 given digits.
Maybe, from there, I can show the possibilities for each set of 4 digits.

I also provided "my" players with a small utility to analayse the guesses and publish the score in format:
= (not used) 0 (used, wrong place) and X,  correctly placed. 

I also got a script to run MasterMind alone, on your own computer, but I can read and read over again every line, in order to construct my own script, but knowledge of the script besides the fact that my only English gained at school is not enough....

I will look up the formerly received information, cause I saw it is still there. May be "I'll see the light"

 

!motiv.docx

Edited by Eller
reviewed older post (2011) from Melba23
Link to comment
Share on other sites

  • Moderators

Eller,

So 7 years on you are still looking to list these numbers? Fine - carry on.

M23

Edited by Melba23
Added link

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

I think you could use 4 "For" loops, in the 4th loop you do the calculation.

For $i = 0 To 9
    For $u = 0 To 9
        For $j = 0 To 9
            For $k = 0 To 9
            consolewrite($i*$u*$j*$k&@CRLF)
            Next
        Next
    Next
Next

I already did this, but for 3 numbers, also removed duplicates and all that.

Not at home atm so when i get, i post.

EDIT: Code was deleted, but was this basically, just need to clean the results, gives you all combinations of multiplication between those numbers 0 - 9

Edited by careca
Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Link to comment
Share on other sites

you want something that will blow you last synapses ?

$Numbrs = StringSplit("0,1,2,3,4,5,6,7,8,9", ",")
Combi("", ???)

Func Combi($Str, $MaxLen)
    if StringLen($Str) = $MaxLen Then
      FileWriteLine("Test.txt", "Tracking Number = " & $Str)
      Return
    EndIf
      For $i = 1 to $Numbrs[0]
         Combi($Str & $Numbrs[$i], $MaxLen)
      Next
EndFunc

It will work with whatever ??? is 4 or 6 or 10 or 999.

Link to comment
Share on other sites

Or you could do what I suggested and use StringFormat.

For $Loop = 0 To 9999
    ConsoleWrite(StringFormat("%04i", $Loop) & @CRLF)
Next

One loop, nice and fast. Change the ConsoleWrite to one of the FileWrite functions and you've got a file.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

@Eller,

I've been doing similar thing as what you've been doing right now maybe this thread will help you especially when VIP and Subz ideas inserted to that thread. Also, those experts suggested on that thread might give you a right path.;) I've been there and my program is now working and solved. Thanks to them:).

 

KS15

 

Programming is "To make it so simple that there are obviously no deficiencies" or "To make it so complicated that there are no obvious deficiencies" by C.A.R. Hoare.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...