 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Laszlo
Joined: 14 Feb 2005 Posts: 4710 Location: Boulder, CO
|
Posted: Mon May 24, 2010 11:24 pm Post subject: |
|
|
| wolf_II wrote: | | If I had to build a tree structure to represent the numbers 0..7 initially, how would I do that? |
First, you have to decide the computer representation of an abstract tree. If it is a binary tree (each node has an optional left and a right child), you can use something similar to what I proposed:
- Trees are denoted by strings, conforming variable name conventions, like "My1stTree", but not by "1-2".
- Nodes are denoted by similar strings, or integers > 0, like "ROOT" or "a" or "1". A node "0" represents a missing node.
- Nodes have 3 associated values: the name of left and right child nodes, and a value, which can be an arbitrary AHK string.
- We build an internal AHK array, containing all the necessary information about the abstract tree.
I used the function AddNode(Tree,Node,Left,Right,Value) repeatedly to construct the data structure, e.g. with AddNode("Tree1",3,6,0,3). The tree is called "Tree1. We added a node to it called "3". It has a left child, another node, called "6", but it has no right child (0). This node also has a value, which happens to be also "3". (Dependent on what you want to do with the tree, you might also have a fourth associated value to the nodes, their parents. Sometimes you want more than two children and link them directly to each other; or store the maximum of all the node values below a given node, etc. There are endless possibilities. The extra data depends on the work you want to do efficiently on the tree.)
The internal data structure sufficient for the 4 tree traversal algorithms is very simple: | Code: | %Tree%_%Node%_L := Left
%Tree%_%Node%_R := Right
%Tree%_%Node%_V := Value | If you use array notations of AutoHotkey_L, you might be able to save a couple of characters, but the idea remains the same. Real structures could hide the implementation details, but it is not important for such simple programs. |
|
| Back to top |
|
 |
Laszlo
Joined: 14 Feb 2005 Posts: 4710 Location: Boulder, CO
|
Posted: Tue May 25, 2010 12:02 am Post subject: Re: Greatest subsequential sum |
|
|
| tinku99 wrote: | | …translated to ahkl | AutoHotkey_L is so much different now from the original AHK, that it can be considered a new language. I deliberately avoid using it in RosettaCode, because it can confuse the reader.
| tinku99 wrote: | | I prefer the translation of c as it is (I may be biased since I may have done it initially). I can read regular expressions as fast as I can run in the ocean. Someone can post it as an alternative if they like... | With a translation you demonstrate that AHK can emulate other code. It does not use all the AHK features; it does not do justice to AHK. If you can write the algorithm in 10 lines, and a blind translation takes more than 30, it might not popularize AHK, which is our goal.
If you want a more readable script, write simple functions for the RegEx expressions. The first one keeps only the commas form the list, and the length of this is 1 less than the number of elements in the list. The second one creates the sub-list of the elements i…(i+A_Index-1). It can be easily done with a parse loop, or with a couple of StringGetPos commands finding the right positions, and a SubStr function call: | Code: | SubList(List,i,j) { ; elements [#i, #i+1, ... #i+j-1]
List := "," List ","
StringGetPos u, List, `, , L%i%
StringGetPos v, List, `, , L%j%, % u+1
Return SubStr(List,u+2,v-u-1)
} |
|
|
| Back to top |
|
 |
tinku99
Joined: 03 Aug 2007 Posts: 513 Location: Houston, TX
|
Posted: Tue May 25, 2010 5:12 am Post subject: Re: Greatest subsequential sum |
|
|
| Laszlo wrote: | | ... use all the AHK features; | I guess I think of AutoHotkey_L as a feature of AutoHotkey. IMO AutoHotkey_L allows you to write code in a way that would attract more outsiders... I guess I have a double standard. I know I hate the fact of two pythons: python2.x and 3.x, even if 3 is supposed to be better. Python 3 is a different language too. That's life...
| Laszlo wrote: | | popularize AHK, which is our goal. | 100% agreement there.
| Laszlo wrote: |
If you want a more readable script, write simple functions for the RegEx expressions... | In this case it might be better to translate the classic linear time constant-space solution from python. Its shorter, faster, and doesn't require regex. |
|
| Back to top |
|
 |
Laszlo
Joined: 14 Feb 2005 Posts: 4710 Location: Boulder, CO
|
Posted: Tue May 25, 2010 5:55 pm Post subject: |
|
|
In RosettaCode there are 4 tasks handling doubly linked lists: Definition, Element Definition, Element Insertion, and Traversal. Deletion of elements, creation of lists, finding the tail and the head of these lists are also needed, if someone really wants to use these lists. Here is a consistent set of functions: | Code: | Build(D, L) { ; Double Linked list "D": D_{Head,Tail} = number>0 id of node
Local i ; D_%number%_{P,N,V}: Prev, Next, Value, D_%Free%: next free idx
Loop Parse, L, `,
i := A_Index
,%D%_%i%_P := i-1
,%D%_%i%_N := i+1
,%D%_%i%_V := A_LoopField
%D%_%i%_N:= 0, %D%_Free := i+1
%D%_Head := 1, %D%_Tail := i
}
Head(D) {
Return %D%_Head
}
Tail(D) {
Return %D%_Tail
}
Value(D,node) {
Return %D%_%node%_V
}
Next(D,node) {
Return %D%_%node%_N
}
Prev(D,node) {
Return %D%_%node%_P
}
Traverse(D,FW=1) {
Local i, t
i := (FW:=!InStr("B.BW.Back.Backward",FW) || FW=1) ? Head(D) : Tail(D)
While i
t .= Value(D,i) " ", i := FW ? Next(D,i) : Prev(D,i)
Return t
}
AddBefore(D,n,V) {
Local i, p
%D%_Free := 1 + i := %D%_Free, %D%_%i%_V := V
If (p := Prev(D,n)) ; n != head
%D%_%p%_N := i, %D%_%n%_P := i
,%D%_%i%_P := p, %D%_%i%_N := n
Else ; add before head
%D%_Head := i, %D%_%n%_P := i
,%D%_%i%_P := 0, %D%_%i%_N := n
Return i
}
AddAfter(D,n,V) {
Local i, t
%D%_Free := 1 + i := %D%_Free, %D%_%i%_V := V
If (t := Next(D,n)) ; n != tail
%D%_%t%_P := i, %D%_%n%_N := i
,%D%_%i%_P := n, %D%_%i%_N := t
Else ; add after tail
%D%_Tail := i, %D%_%n%_N := i
,%D%_%i%_P := n, %D%_%i%_N := 0
Return i
}
Delete(D,n) {
Local p, t
p := Prev(D,n), t := Next(D,n)
If (p && t) ; in the middle
%D%_%p%_N := t, %D%_%t%_P := p
Else If (p) ; tail
%D%_Tail := p, %D%_%p%_N := 0
Else If (t) ; head
%D%_Head := t, %D%_%t%_P := 0
Else ; -> empty list
%D%_Head := 0, %D%_Tail := 0
}
; TESTS ---------------------------------------------------------------
Build("D",3)
n := AddBefore("D",Head("D"),2)
AddBefore("D",n,1)
MsgBox % Traverse("D","FW") ; 1 2 3
Build("D",3)
AddAfter("D",Head("D"),2)
n := AddAfter("D",Head("D"),1)
MsgBox % Traverse("D") ; 3 1 2
Delete("D",n)
MsgBox % Traverse("D") ; 3 2
Delete("D",Head("D"))
MsgBox % Traverse("D") ; 2
Delete("D",Tail("D"))
MsgBox % Traverse("D") ; empty
L = a,bb,1,2,x-y,$
Build("D", L)
MsgBox % Traverse("D","FW")
MsgBox % Traverse("D","Back") | When the Delete function is used millions of times, the deleted nodes could be assigned the empty string in the function, and a garbage collection routine could keep the number of defined variables in bay. |
|
| Back to top |
|
 |
Laszlo
Joined: 14 Feb 2005 Posts: 4710 Location: Boulder, CO
|
Posted: Tue May 25, 2010 6:31 pm Post subject: Re: Greatest subsequential sum |
|
|
| tinku99 wrote: | | In this case it might be better to translate the classic linear time constant-space solution from python. Its shorter, faster, and doesn't require regex. | RegEx is not required, just makes the code shorter. You are right, the classic algorithm is faster, and equally short, but the Python code is wrong (it fails at 1,-2). It also returns sometimes the longer of two equal solutions. | Code: | seq = -1,-2,3,5,6,-2,-1,4,-4,2,-1
max := sum := start := 0
Loop Parse, seq, `,
If (max < sum+=A_LoopField)
max := sum, a := start, b := A_Index
Else If sum <= 0
sum := 0, start := A_Index
RegExMatch(seq,"([^,]*,){" a "}(([^,]*,){" b-a-1 "}([^,]*))",$)
MsgBox Max = %max%`n[%$2%] | In place of the RegExMatch a second parse loop can be used for simpler, albeit longer and slower code. The end of the script will look: | Code: | ; read out the best subsequence
Loop Parse, seq, `,
s .= A_Index > a && A_Index <= b ? A_LoopField "," : ""
MsgBox % "Max = " max "`n[" SubStr(s,1,-1) "]" |
|
|
| Back to top |
|
 |
wolf_II
Joined: 18 Oct 2007 Posts: 343 Location: Saarland, Germany
|
Posted: Tue May 25, 2010 8:40 pm Post subject: |
|
|
At the time of this writing, the following task is listed on the page "Tasks not implemented in AutoHotkey":
http://rosettacode.org/wiki/Mandelbrot_set
I have tried to use GDI+ library and came up with some messy code and slow solution (but you can watch the picture growing ):
| Code: | ;~ File := "MandelBrot.gdip.bmp"
Width := Height := 400
#Include gdip.ahk
If !pToken := Gdip_Startup() {
MsgBox, 48, GDI+ Error, GDI+ failed to start.
ExitApp
}
; +E0x80000 : must be used for UpdateLayeredWindow to work
Gui, -Caption +E0x80000 +LastFound
Gui, Show,, MandelBrot
hwnd1 := WinExist()
hbm := CreateDIBSection(Width, Height)
hdc := CreateCompatibleDC()
obm := SelectObject(hdc, hbm)
G := Gdip_GraphicsFromHDC(hdc)
xx := (A_ScreenWidth - Width) // 2
yy := (A_ScreenHeight - Height) // 2
Gosub, CreateColours
Gosub, CreatePixels
;~ pBitmap := Gdip_BitmapFromScreen(xx "|" yy "|" Width "|" Height)
;~ Gdip_SaveBitmapToFile(pBitmap, File)
SelectObject(hdc, obm)
DeleteObject(hbm)
DeleteDC(hdc)
Gdip_DeleteGraphics(G)
Return
GuiClose:
GuiEscape:
Gdip_Shutdown(pToken)
ExitApp
;---------------------------------------------------------------------------
CreatePixels: ; create pixels for [-2 < x < 1] [-1.5 < y < 1.5]
;---------------------------------------------------------------------------
Max_Iteration := 64
Loop, % Height // 2 + 1 {
yi := A_Index - 1
y0 := -1.5 + yi / Height * 3 ; range -1.5 .. +1.5
Loop, %Width% {
xi := A_Index - 1
x0 := -2 + xi / Width * 3 ; range -2 .. +1
Gosub, Mandelbrot
pPen := Gdip_CreatePen(Colour, 1)
Gdip_DrawLine(G, pPen, xi, yi, xi+1, yi)
Gdip_DrawLine(G, pPen, xi, Height-yi, xi+1, Height-yi)
Gdip_DeletePen(pPen)
UpdateLayeredWindow(hwnd1, hdc, xx, yy, Width, Height)
}
}
Return
;---------------------------------------------------------------------------
Mandelbrot: ; calculate a colour for each pixel
;---------------------------------------------------------------------------
x := y := Iteration := 0
While, (x*x + y*y <= 4) And (Iteration < Max_Iteration) {
xtemp := x*x - y*y + x0
y := 2*x*y + y0
x := xtemp
Iteration++
}
Colour := Iteration = Max_Iteration ? 0xFF000000 : Colour_%Iteration%
Return
;---------------------------------------------------------------------------
CreateColours: ; borrowed from PureBasic example
;---------------------------------------------------------------------------
Loop, 64 {
i4 := (i3 := (i2 := (i1 := A_Index - 1) + 64) + 64) + 64
Colour_%i1% := RGB(4*i1 + 128, 4*i1, 0)
Colour_%i2% := RGB(64, 255, 4*i1)
Colour_%i3% := RGB(64, 255 - 4*i1, 255)
Colour_%i4% := RGB(64, 0, 255 - 4*i1)
}
Return
;---------------------------------------------------------------------------
RGB(r, g, b) { ; return 32bit color value
;---------------------------------------------------------------------------
SetFormat, Integer, Hex
r := SubStr("0" SubStr(r + 0, 3), -1)
g := SubStr("0" SubStr(g + 0, 3), -1)
b := SubStr("0" SubStr(b + 0, 3), -1)
SetFormat, Integer, D
Return, "0xFF" r g b
} |
Then I went on to create a Bitmap in memory, save that and display it, much faster, 4 times the size (800*800 pixel rather than 400*400), but you can't see the picture grow, so I added a progress bar to look at instead:
| Code: | File := "MandelBrot.bmp"
Width := Height := 800
Progress, b2 w400 fs9, %A_Space%
Gosub, CreateColours
Gosub, CreateBitmap
Progress, Off
Gui, -Caption
Gui, Margin, 0, 0
Gui, Add, Picture,, %File%
Gui, Show,, MandelBrot
Return
GuiClose:
GuiEscape:
ExitApp
;---------------------------------------------------------------------------
CreateBitmap: ; create and save a 32bit bitmap file
;---------------------------------------------------------------------------
; define header details
HeaderBMP := 14
HeaderDIB := 40
DataOffset := HeaderBMP + HeaderDIB
ImageSize := Width * Height * 4 ; 32bit
FileSize := DataOffset + ImageSize
Resolution := 3780 ; from mspaint
; create bitmap header
VarSetCapacity(IMAGE, FileSize, 0)
NumPut(Asc("B") , IMAGE, 0x00, "Char")
NumPut(Asc("M") , IMAGE, 0x01, "Char")
NumPut(FileSize , IMAGE, 0x02, "UInt")
NumPut(DataOffset , IMAGE, 0x0A, "UInt")
NumPut(HeaderDIB , IMAGE, 0x0E, "UInt")
NumPut(Width , IMAGE, 0x12, "UInt")
NumPut(Height , IMAGE, 0x16, "UInt")
NumPut(1 , IMAGE, 0x1A, "Short") ; Planes
NumPut(32 , IMAGE, 0x1C, "Short") ; Bits per Pixel
NumPut(ImageSize , IMAGE, 0x22, "UInt")
NumPut(Resolution , IMAGE, 0x26, "UInt")
NumPut(Resolution , IMAGE, 0x2A, "UInt")
; fill in Data
Gosub, CreatePixels
; save Bitmap to file
FileDelete, %File%
Handle := DllCall("CreateFile", "Str", File, "UInt", 0x40000000
, "UInt", 0, "UInt", 0, "UInt", 2, "UInt", 0, "UInt", 0)
DllCall("WriteFile", "UInt", Handle, "UInt", &IMAGE, "UInt"
, FileSize, "UInt *", Bytes, "UInt", 0)
DllCall("CloseHandle", "UInt", Handle)
Return
;---------------------------------------------------------------------------
CreatePixels: ; create pixels for [-2 < x < 1] [-1.5 < y < 1.5]
;---------------------------------------------------------------------------
Max_Iteration := 64
Loop, % Height // 2 + 1 {
yi := A_Index - 1
y0 := -1.5 + yi / Height * 3 ; range -1.5 .. +1.5
Progress, % 200*yi // Height, % "Current line: " 2*yi " / " Height
Loop, %Width% {
xi := A_Index - 1
x0 := -2 + xi / Width * 3 ; range -2 .. +1
Gosub, Mandelbrot
p1 := DataOffset + 4 * (Width * yi + xi)
NumPut(Colour, IMAGE, p1, "UInt")
p2 := DataOffset + 4 * (Width * (Height-yi) + xi)
NumPut(Colour, IMAGE, p2, "UInt")
}
}
Return
;---------------------------------------------------------------------------
Mandelbrot: ; calculate a colour for each pixel
;---------------------------------------------------------------------------
x := y := Iteration := 0
While, (x*x + y*y <= 4) And (Iteration < Max_Iteration) {
xtemp := x*x - y*y + x0
y := 2*x*y + y0
x := xtemp
Iteration++
}
Colour := Iteration = Max_Iteration ? 0x00000000 : Colour_%Iteration%
Return
;---------------------------------------------------------------------------
CreateColours: ; borrowed from PureBasic example
;---------------------------------------------------------------------------
Loop, 64 {
i4 := (i3 := (i2 := (i1 := A_Index - 1) + 64) + 64) + 64
Colour_%i1% := RGB(4*i1 + 128, 4*i1, 0)
Colour_%i2% := RGB(64, 255, 4*i1)
Colour_%i3% := RGB(64, 255 - 4*i1, 255)
Colour_%i4% := RGB(64, 0, 255 - 4*i1)
}
Return
;---------------------------------------------------------------------------
RGB(r, g, b) { ; return 32bit color value
;---------------------------------------------------------------------------
SetFormat, Integer, Hex
r := SubStr("0" SubStr(r + 0, 3), -1)
g := SubStr("0" SubStr(g + 0, 3), -1)
b := SubStr("0" SubStr(b + 0, 3), -1)
SetFormat, Integer, D
Return, "0x00" r g b
}
|
PS: I will tomorrow post a shorter version, that writes the BMP-Header in one go, it was just easier to construct this way. I have to rest now, there was a lot of waiting (for pictures) involved during development here. _________________ Wolf
Schön wär's, wenn's schön wär! |
|
| Back to top |
|
 |
Laszlo
Joined: 14 Feb 2005 Posts: 4710 Location: Boulder, CO
|
Posted: Tue May 25, 2010 8:50 pm Post subject: |
|
|
| Beautiful! Both Mandelbrot scripts work, as expected (Win7-x64). |
|
| Back to top |
|
 |
wolf_II
Joined: 18 Oct 2007 Posts: 343 Location: Saarland, Germany
|
Posted: Tue May 25, 2010 9:00 pm Post subject: |
|
|
Thank you!! Mind you, the colours used are "borrowed", and I did not try to "Laszlofy" the RGB-routine. Can this be done easier? _________________ Wolf
Schön wär's, wenn's schön wär! |
|
| Back to top |
|
 |
wolf_II
Joined: 18 Oct 2007 Posts: 343 Location: Saarland, Germany
|
Posted: Tue May 25, 2010 9:50 pm Post subject: |
|
|
for BMP:
| Code: | ;---------------------------------------------------------------------------
RGB(r, g, b) { ; return 24bit color value
;---------------------------------------------------------------------------
Return, (r&0xFF)<<16 | g<<8 | b
}
|
for GDI+:
| Code: | ;---------------------------------------------------------------------------
RGB(r, g, b) { ; return 32bit color value
;---------------------------------------------------------------------------
Return, 0xFF<<24 | (r&0xFF)<<16 | g<<8 | b
}
|
_________________ Wolf
Schön wär's, wenn's schön wär! |
|
| Back to top |
|
 |
Laszlo
Joined: 14 Feb 2005 Posts: 4710 Location: Boulder, CO
|
Posted: Tue May 25, 2010 10:46 pm Post subject: |
|
|
| wolf_II wrote: | | Can this be done easier? | They look pretty and simple. Replacing 0xFF<<24 with 0xFF000000 would just make the code longer. |
|
| Back to top |
|
 |
tinku99
Joined: 03 Aug 2007 Posts: 513 Location: Houston, TX
|
Posted: Tue May 25, 2010 11:36 pm Post subject: Re: Greatest subsequential sum |
|
|
| Laszlo wrote: | | tinku99 wrote: | | In this case it might be better to translate the classic linear time constant-space solution from python. Its shorter, faster, and doesn't require regex. | RegEx is not required, just makes the code shorter. You are right, the classic algorithm is faster, and equally short, but the Python code is wrong (it fails at 1,-2). It also returns sometimes the longer of two equal solutions. | Code: | seq = -1,-2,3,5,6,-2,-1,4,-4,2,-1
max := sum := start := 0
Loop Parse, seq, `,
If (max < sum+=A_LoopField)
max := sum, a := start, b := A_Index
Else If sum <= 0
sum := 0, start := A_Index
RegExMatch(seq,"([^,]*,){" a "}(([^,]*,){" b-a-1 "}([^,]*))",$)
MsgBox Max = %max%`n[%$2%] | In place of the RegExMatch a second parse loop can be used for simpler, albeit longer and slower code. The end of the script will look: | Code: | ; read out the best subsequence
Loop Parse, seq, `,
s .= A_Index > a && A_Index <= b ? A_LoopField "," : ""
MsgBox % "Max = " max "`n[" SubStr(s,1,-1) "]" |
|
Nice. I will post your vanilla ahk example. But just for kicks I translated to ahkl: | Code: | seq := object()
seq._insert(1, -1,-2,3,5,6,-2,-1,4,-4,2,-1)
max := sum := start := 0
Loop % seq._maxindex()
If (max < sum+= seq[A_Index])
max := sum, a := start, b := A_Index ; a = subseqstart, b = subseqstop
Else If sum <= 0
sum := 0, start := A_Index
; read out the best subsequence
Loop % seq._maxindex()
s .= A_Index > a && A_Index <= b ? seq[A_Index] "," : ""
MsgBox % "Max = " max "`n[" SubStr(s,1,-1) "]" |
|
|
| Back to top |
|
 |
wolf_II
Joined: 18 Oct 2007 Posts: 343 Location: Saarland, Germany
|
Posted: Wed May 26, 2010 3:50 am Post subject: |
|
|
I have decided to post the following BMP-variation to RosettaCode.org:
I leave the BMP header in its current form, it looks clean, it self-adjusts to variable widths and heights, it costs no time to run (nearly), and it is a pain to write the variation I had in mind.
I also noticed that the colours No. 64..255 are not being used with Max_Iteration = 64, so I changed those to 256. Which slows down the calculation of 800*800 pixels quite considerably, which made me decide to also change the size to 400 for the final code.
You can see the result here. _________________ Wolf
Schön wär's, wenn's schön wär! |
|
| Back to top |
|
 |
wolf_II
Joined: 18 Oct 2007 Posts: 343 Location: Saarland, Germany
|
Posted: Wed May 26, 2010 6:32 am Post subject: |
|
|
I thought I could apply my freshly acquainted knowledge of trees here, but it turns out, I only managed to do it with plain arrays.
At the time of this writing, the following task is listed on the page "Tasks not implemented in AutoHotkey":
http://rosettacode.org/wiki/Top_rank_per_group
| Code: | Departments = D050, D101, D190, D202
StringSplit, Department_, Departments, `,, %A_Space%
; Employee Name, Employee ID, Salary, Department
Add_Employee("Tyler Bennett ", "E10297", 32000, "D101")
Add_Employee("John Rappl ", "E21437", 47000, "D050")
Add_Employee("George Woltman ", "E00127", 53500, "D101")
Add_Employee("Adam Smith ", "E63535", 18000, "D202")
Add_Employee("Claire Buckman ", "E39876", 27800, "D202")
Add_Employee("David McClellan", "E04242", 41500, "D101")
Add_Employee("Rich Holcomb ", "E01234", 49500, "D202")
Add_Employee("Nathan Adams ", "E41298", 21900, "D050")
Add_Employee("Richard Potter ", "E43128", 15900, "D101")
Add_Employee("David Motsinger", "E27002", 19250, "D202")
Add_Employee("Tim Sampair ", "E03033", 27000, "D101")
Add_Employee("Kim Arlich ", "E10001", 57000, "D190")
Add_Employee("Timothy Grove ", "E16398", 29900, "D190")
; display top 3 ranks for each department
Loop, %Department_0% ; all departments
MsgBox,, % "Department: " Department_%A_Index%
, % TopRank(3, Department_%A_Index%)
;---------------------------------------------------------------------------
TopRank(N, Department) { ; find the top N salaries in each deptment
;---------------------------------------------------------------------------
local Collection := Msg := ""
Loop, %m% ; all employees
If (Employee_%A_Index%_Dept = Department)
; collect all the salaries being paid in this department
Collection .= (Collection ? "," : "") Employee_%A_Index%_Salary
Sort, Collection, ND,R
StringSplit, Collection, Collection, `,
Loop, % (N < Collection0) ? N : Collection0 {
Salary := Collection%A_Index%
Loop, %m% ; find the respective employee
If (Employee_%A_Index%_Salary = Salary)
; and put out his/her details
Msg .= Employee_%A_Index%_Name "`t"
. Employee_%A_Index%_ID "`t"
. Employee_%A_Index%_Salary "`t"
. Employee_%A_Index%_Dept "`t`n"
}
Return, Msg
}
;---------------------------------------------------------------------------
Add_Employee(Name, ID, Salary, Department) {
;---------------------------------------------------------------------------
global
m++
Employee_%m%_Name := Name
Employee_%m%_ID := ID
Employee_%m%_Salary := Salary
Employee_%m%_Dept := Department
} |
The message boxes show:
| Code: |
Department: D050
---------------------------
John Rappl E21437 47000 D050
Nathan Adams E41298 21900 D050
Department: D101
---------------------------
George Woltman E00127 53500 D101
David McClellan E04242 41500 D101
Tyler Bennett E10297 32000 D101
Department: D190
---------------------------
Kim Arlich E10001 57000 D190
Timothy Grove E16398 29900 D190
Department: D202
---------------------------
Rich Holcomb E01234 49500 D202
Claire Buckman E39876 27800 D202
David Motsinger E27002 19250 D202
|
_________________ Wolf
Schön wär's, wenn's schön wär! |
|
| Back to top |
|
 |
tomoe_uehara
Joined: 05 Sep 2009 Posts: 1591 Location: Somewhere near you
|
Posted: Fri May 28, 2010 8:11 pm Post subject: |
|
|
@ wolf_II : The Rosetta rank script doesn't show anything anymore..
| Rosetta Rank wrote: | Sample output on 16 May 2010:
1. 397- Tcl
2. 364- Python
3. 350- Ruby
4. 331- J
5. 324- C
6. 319- OCaml
7. 318- Haskell
8. 300- Perl
9. 287- Common Lisp
10. 270- AutoHotkey
11. 270- Java
12. 268- Oz
13. 266- Ada
14. 257- D
15. 249- R
16. 247- E
17. 243- C++
18. 237- JavaScript
19. 223- ALGOL 68
20. 222- PureBasic
... |
Today we're 10th! Gone up by 3 points from the last month.. _________________
The quick onyx goblin jumps over the lazy dwarf |
|
| Back to top |
|
 |
wolf_II
Joined: 18 Oct 2007 Posts: 343 Location: Saarland, Germany
|
Posted: Fri May 28, 2010 9:14 pm Post subject: |
|
|
| tomoe_uehara wrote: | | @ wolf_II : The Rosetta rank script doesn't show anything anymore.. |
Strange, it still works for me. _________________ Wolf
Schön wär's, wenn's schön wär! |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|