Thread Rating:
		
			
				- 0 Votes - 0 Average
- 1
- 2
- 3
- 4
- 5
 
 
	
		
			| 
					Rank out of Tags
				 | 
		
			| Author | Message | 
		
	
	
		
	
		| RanXerox  Master
 
   
   Posts: 550
 Likes Given: 1
 Likes Received: 12 in 9 posts
 Joined: Dec 2010
 Reputation: 19
 
 
 
 ![]() 
 | 
			| RE: Rank out of Tags 
 
				Use a LIST structure to store the data... not a set of VARs.  Then sort the list however you want to before the dialog that displays it. 
Here is an example function to sort a poker card hand that is stored in a LIST structure:
 
Code:
 [FUNCTION f_Poker_SortCards]//"
 // Usage: f_Poker_SortCards CardArray
 //
 // Sorts an existing LIST object named CardArray, which is assumed to contain
 // CardSymbols.  The sort order has highest ranked cards (Ace) first (suit is
 // ignored.)
 //"
 IF (<ARGV>==0)
 f_pokerlog 1,"Poker_SortCards: needs a CardArray"
 RETURN 1
 ENDIF
 LOCAL.Input=<ARGS>
 LOCAL.InputSize=<LIST.<LOCAL.Input>.COUNT>
 IF (<LOCAL.InputSize> < 2)
 f_pokerlog 1,"Poker_SortCards: CardArray <LOCAL.Input> is too small to sort"
 RETURN 1
 ENDIF
 LOCAL.Swapped=1
 WHILE (<dLOCAL.Swapped>==1)
 LOCAL.Swapped=0
 FOR LoopNumber 1 <EVAL <LOCAL.InputSize>-1>
 IF (<LOCAL.LoopNumber>)
 LOCAL.CardA="<STRSUB 1 2 <LIST.<LOCAL.Input>.<EVAL <LOCAL.LoopNumber>-1>>>"
 LOCAL.CardB="<STRSUB 1 2 <LIST.<LOCAL.Input>.<dLOCAL.LoopNumber>>>"
 IF (<f_Poker_RankCards <LOCAL.CardA>,<LOCAL.CardB>>==-1) //CardA ranks lower than CardB
 LIST.<LOCAL.Input>.<EVAL <LOCAL.LoopNumber>-1>=<LOCAL.CardB>
 LIST.<LOCAL.Input>.<dLOCAL.LoopNumber>=<LOCAL.CardA>
 LOCAL.Swapped=1
 ENDIF
 ENDIF
 ENDFOR
 LOCAL.InputSize=<EVAL <LOCAL.InputSize>-1>
 ENDWHILE
 |  | 
	| 11-06-2013 10:16 AM |  | 
	
	| ![[+]](images/collapse_collapsed.gif)  
 | 
	 
	
	
		
	
	
		
 
 
	 
	
	
	
| Messages In This Thread | 
| RE: Rank out of Tags -  RanXerox - 11-06-2013 10:16 AM | 
	
	
	
	
		
		
	
	
	
User(s) browsing this thread: 1 Guest(s)