Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

ActionScript 3 Problem

Name: Anonymous 2012-03-08 2:09

so yeah basically, im having this problem where i stuffed a bunch of arrays into one array, and i have to have the arrays shuffled in that one. the issue is that when i regularly call the function "sequence(combinations);" it tells me that the property is undefined when it isnt. i stuffed in a void, and it works but doesnt return anything and the program works as if combinations were never in array in the first place. help would be appreciated.







        public var i:int;
        public var l:int = combinations.length;
        public var lite:Object; //temporary storage for swapping
       
       
       
       
        public var combinations:Array = ["high_card", "one_pair", "two_pair", "three_kind", "straight", "straightkick", "straightlose", "straighttie", "flush", "flushlose", "flushtie", "fullhouse", "four_kind", "sflush", "royalflush"];
       
        public static var debug_cards:Array = ["combinations"];
       
       
   
        public var high_card:Array = [[[3, 4], [4, 5]], [[4, 4], [2, 8]], [[4, 13], [1, 4]], [[4, 4], [2, 10]], [[4, 10], [1, 4]], [[1, 6], [3, 7], [3, 9], [2, 2], [1, 12]]];
        public var one_pair:Array = [[[3, 4], [4, 4]], [[4, 4], [2, 9]], [[4, 10], [1, 4]], [[4, 4], [2, 10]], [[4, 10], [1, 4]], [[1, 6], [3, 7], [3, 9], [2, 10], [1, 11]]];
        public var two_pair:Array = [[[3, 4], [4, 4]], [[4, 4], [2, 9]], [[4, 10], [1, 4]], [[4, 4], [2, 2]], [[4, 10], [2, 3]], [[1, 6], [3, 7], [3, 10], [2, 11], [1, 11]]];
        public var three_kind:Array = [[[3, 4], [4, 3]], [[4, 4], [2, 9]], [[4, 10], [1, 4]], [[4, 4], [2, 10]], [[4, 10], [1, 4]], [[1, 6], [3, 7], [3, 9], [2, 9], [1, 2]]];
        public var straight:Array = [[[3, 4], [4, 3]], [[4, 4], [2, 10]], [[4, 10], [1, 4]], [[4, 4], [2, 10]], [[4, 10], [2, 10]], [[1, 6], [3, 7], [3, 5], [2, 9], [1, 9]]];
        public var straightkick:Array = [[[3, 4], [4, 1]], [[4, 4], [2, 3]], [[4, 10], [1, 4]], [[4, 4], [2, 10]], [[4, 4], [2, 10]], [[1, 6], [3, 7], [3, 5], [2, 4], [1, 3]]];
        public var straightlose:Array = [[[3, 4], [4, 3]], [[4, 9], [2, 9]], [[4, 10], [1, 4]], [[4, 4], [2, 10]], [[4, 4], [2, 10]], [[1, 6], [3, 7], [3, 5], [2, 9], [1, 9]]];
        public var straighttie:Array = [[[3, 4], [4, 3]], [[4, 4], [2, 3]], [[4, 10], [1, 4]], [[4, 4], [2, 10]], [[4, 4], [2, 10]], [[1, 6], [3, 7], [3, 5], [2, 9], [1, 9]]];
        public var flush:Array = [[[4, 8], [4, 6]], [[4, 4], [4, 5]], [[4, 10], [1, 4]], [[4, 4], [2, 10]], [[4, 10], [1, 4]], [[4, 7], [4, 9], [4, 11], [2, 12], [2, 13]]];
        public var flushlose:Array = [[[4, 2], [4, 3]], [[4, 4], [4, 5]], [[4, 10], [1, 4]], [[4, 4], [2, 10]], [[4, 10], [1, 4]], [[4, 7], [4, 9], [4, 11], [2, 12], [2, 13]]];
        public var flushtie:Array = [[[3, 2], [3, 3]], [[4, 2], [4, 3]], [[2, 3], [1, 2]], [[2, 2], [2, 3]], [[1, 2], [1, 3]], [[4, 7], [4, 9], [4, 11], [4, 12], [4, 13]]];
        public var fullhouse:Array = [[[4, 4], [4, 4]], [[4, 4], [2, 9]], [[4, 10], [1, 4]], [[4, 4], [2, 10]], [[4, 10], [1, 4]], [[3, 6], [4, 4], [3, 5], [2, 9], [1, 9]]];
        public var four_kind:Array = [[[4, 4], [4, 4]], [[4, 4], [2, 9]], [[4, 10], [1, 4]], [[4, 4], [2, 10]], [[4, 10], [1, 4]], [[3, 6], [4, 4], [3, 4], [2, 3], [1, 9]]];
        public var sflush:Array = [[[4, 4], [4, 5]], [[4, 3], [2, 9]], [[4, 10], [1, 4]], [[4, 4], [2, 10]], [[3, 10], [1, 4]], [[4, 2], [4, 3], [3, 7], [2, 8], [4, 1]]];
        public var royalflush:Array = [[[2, 4], [2, 3]], [[2, 4], [2, 9]], [[2, 10], [2, 4]], [[2, 4], [2, 10]], [[2, 10], [2, 11]], [[4, 10], [4, 11], [4, 12], [4, 13], [4, 1]]];
       
       
        public function seq():void {
           
        sequence.apply(null, combinations);
           
        }
       
       
       
       
        public function sequence (comb:Array):Array {
           
            for (l - 1; l > 0; l--) {
               
                i = Math.floor(Math.random() * l);
               
                lite = comb[i];
                comb[i] = comb[l];
                comb[l] = lite;
               
                trace(comb);
            }
           
           
         return comb;   
           
        }

Name: Anonymous 2012-03-08 2:26


public var combinations:Array = ["high_card", "one_pair"...


Is this supposed to be an array of the arrays you define below? Because now it is just an array of strings.

Name: Anonymous 2012-03-08 2:30

yes it is, supposed to be an array of arrays. so do i do it like this?

combos = new Array();
combos["royal_flush"] = "[1,2]3[213 etc";
combos["straight"] = "[1,2]3[213 etc";
combos["kickers"] = "[1,2]3[213 etc";

like that right?

Name: Anonymous 2012-03-08 2:39

Do


public var combinations:Array = [high_card, one_pair, two_pair ...


No "s around the names.

In that case, you would have to assign a number to each card combo, so combinations[0] would be high_card

If you wanted to have each combo index by a string, do


combos = new Object();
combos["royal_flush"] = royal_flush;
combos["straight"]    = straight;
...

Name: Anonymous 2012-03-08 2:39

Lisp:

(high_card ((3 4) (4 5)) ((4 4) (2 8)) ((4 13) (1 4)) ((4 4) (2 10)) ((4 10) (1 4)) ((1 6) (3 7) (3 9) (2 2) (1 12)))
(one_pair ((3 4) (4 4)) ((4 4) (2 9)) ((4 10) (1 4)) ((4 4) (2 10)) ((4 10) (1 4)) ((1 6) (3 7) (3 9) (2 10) (1 11)))
(two_pair ((3 4) (4 4)) ((4 4) (2 9)) ((4 10) (1 4)) ((4 4) (2 2)) ((4 10) (2 3)) ((1 6) (3 7) (3 10) (2 11) (1 11)))
(three_kind ((3 4) (4 3)) ((4 4) (2 9)) ((4 10) (1 4)) ((4 4) (2 10)) ((4 10) (1 4)) ((1 6) (3 7) (3 9) (2 9) (1 2)))
(straight ((3 4) (4 3)) ((4 4) (2 10)) ((4 10) (1 4)) ((4 4) (2 10)) ((4 10) (2 10)) ((1 6) (3 7) (3 5) (2 9) (1 9)))
(straightkick ((3 4) (4 1)) ((4 4) (2 3)) ((4 10) (1 4)) ((4 4) (2 10)) ((4 4) (2 10)) ((1 6) (3 7) (3 5) (2 4) (1 3)))
(straightlose ((3 4) (4 3)) ((4 9) (2 9)) ((4 10) (1 4)) ((4 4) (2 10)) ((4 4) (2 10)) ((1 6) (3 7) (3 5) (2 9) (1 9)))
(straighttie ((3 4) (4 3)) ((4 4) (2 3)) ((4 10) (1 4)) ((4 4) (2 10)) ((4 4) (2 10)) ((1 6) (3 7) (3 5) (2 9) (1 9)))


JavaScript:

        public var high_card:Array = [[[3, 4], [4, 5]], [[4, 4], [2, 8]], [[4, 13], [1, 4]], [[4, 4], [2, 10]], [[4, 10], [1, 4]], [[1, 6], [3, 7], [3, 9], [2, 2], [1, 12]]];
        public var one_pair:Array = [[[3, 4], [4, 4]], [[4, 4], [2, 9]], [[4, 10], [1, 4]], [[4, 4], [2, 10]], [[4, 10], [1, 4]], [[1, 6], [3, 7], [3, 9], [2, 10], [1, 11]]];
        public var two_pair:Array = [[[3, 4], [4, 4]], [[4, 4], [2, 9]], [[4, 10], [1, 4]], [[4, 4], [2, 2]], [[4, 10], [2, 3]], [[1, 6], [3, 7], [3, 10], [2, 11], [1, 11]]];
        public var three_kind:Array = [[[3, 4], [4, 3]], [[4, 4], [2, 9]], [[4, 10], [1, 4]], [[4, 4], [2, 10]], [[4, 10], [1, 4]], [[1, 6], [3, 7], [3, 9], [2, 9], [1, 2]]];
        public var straight:Array = [[[3, 4], [4, 3]], [[4, 4], [2, 10]], [[4, 10], [1, 4]], [[4, 4], [2, 10]], [[4, 10], [2, 10]], [[1, 6], [3, 7], [3, 5], [2, 9], [1, 9]]];
        public var straightkick:Array = [[[3, 4], [4, 1]], [[4, 4], [2, 3]], [[4, 10], [1, 4]], [[4, 4], [2, 10]], [[4, 4], [2, 10]], [[1, 6], [3, 7], [3, 5], [2, 4], [1, 3]]];
        public var straightlose:Array = [[[3, 4], [4, 3]], [[4, 9], [2, 9]], [[4, 10], [1, 4]], [[4, 4], [2, 10]], [[4, 4], [2, 10]], [[1, 6], [3, 7], [3, 5], [2, 9], [1, 9]]];
        public var straighttie:Array = [[[3, 4], [4, 3]], [[4, 4], [2, 3]], [[4, 10], [1, 4]], [[4, 4], [2, 10]], [[4, 4], [2, 10]], [[1, 6], [3, 7], [3, 5], [2, 9], [1, 9]]];

Name: Anonymous 2012-03-08 2:43

Normal Language:

[RoyalFlush=RoyalFlush; Straight=Straight]


JavaScript:

combos = new Object();
combos["royal_flush"] = royal_flush;
combos["straight"]    = straight;

Name: Anonymous 2012-03-08 2:56

Error access of undefined property combinations, royalflush, sflush etc...i dont know what to do. its all fully defined and i even tried declaring it in the beginning.

public class PokerCombinations
   
    {
       
        public var i:int;
        public var l:int = combinations.length;
        public var lite:Object; //temporary storage for swapping
       
       
       
        public var combinations:Array = new Array ();
        combinations.push(high_card, one_pair, two_pair, three_kind, straight, straightkick, straightlose, straighttie, flush, flushlose, flushtie, fullhouse, four_kind, sflush, royalflush);
       
       
       
        public static var debug_cards:Array = [combinations];
       
       
       
       
       
   
        public var high_card:Array = [[[3, 4], [4, 5]], [[4, 4], [2, 8]], [[4, 13], [1, 4]], [[4, 4], [2, 10]], [[4, 10], [1, 4]], [[1, 6], [3, 7], [3, 9], [2, 2], [1, 12]]];
        public var one_pair:Array = [[[3, 4], [4, 4]], [[4, 4], [2, 9]], [[4, 10], [1, 4]], [[4, 4], [2, 10]], [[4, 10], [1, 4]], [[1, 6], [3, 7], [3, 9], [2, 10], [1, 11]]];
        public var two_pair:Array = [[[3, 4], [4, 4]], [[4, 4], [2, 9]], [[4, 10], [1, 4]], [[4, 4], [2, 2]], [[4, 10], [2, 3]], [[1, 6], [3, 7], [3, 10], [2, 11], [1, 11]]];
        public var three_kind:Array = [[[3, 4], [4, 3]], [[4, 4], [2, 9]], [[4, 10], [1, 4]], [[4, 4], [2, 10]], [[4, 10], [1, 4]], [[1, 6], [3, 7], [3, 9], [2, 9], [1, 2]]];
        public var straight:Array = [[[3, 4], [4, 3]], [[4, 4], [2, 10]], [[4, 10], [1, 4]], [[4, 4], [2, 10]], [[4, 10], [2, 10]], [[1, 6], [3, 7], [3, 5], [2, 9], [1, 9]]];
        public var straightkick:Array = [[[3, 4], [4, 1]], [[4, 4], [2, 3]], [[4, 10], [1, 4]], [[4, 4], [2, 10]], [[4, 4], [2, 10]], [[1, 6], [3, 7], [3, 5], [2, 4], [1, 3]]];
        public var straightlose:Array = [[[3, 4], [4, 3]], [[4, 9], [2, 9]], [[4, 10], [1, 4]], [[4, 4], [2, 10]], [[4, 4], [2, 10]], [[1, 6], [3, 7], [3, 5], [2, 9], [1, 9]]];
        public var straighttie:Array = [[[3, 4], [4, 3]], [[4, 4], [2, 3]], [[4, 10], [1, 4]], [[4, 4], [2, 10]], [[4, 4], [2, 10]], [[1, 6], [3, 7], [3, 5], [2, 9], [1, 9]]];
        public var flush:Array = [[[4, 8], [4, 6]], [[4, 4], [4, 5]], [[4, 10], [1, 4]], [[4, 4], [2, 10]], [[4, 10], [1, 4]], [[4, 7], [4, 9], [4, 11], [2, 12], [2, 13]]];
        public var flushlose:Array = [[[4, 2], [4, 3]], [[4, 4], [4, 5]], [[4, 10], [1, 4]], [[4, 4], [2, 10]], [[4, 10], [1, 4]], [[4, 7], [4, 9], [4, 11], [2, 12], [2, 13]]];
        public var flushtie:Array = [[[3, 2], [3, 3]], [[4, 2], [4, 3]], [[2, 3], [1, 2]], [[2, 2], [2, 3]], [[1, 2], [1, 3]], [[4, 7], [4, 9], [4, 11], [4, 12], [4, 13]]];
        public var fullhouse:Array = [[[4, 4], [4, 4]], [[4, 4], [2, 9]], [[4, 10], [1, 4]], [[4, 4], [2, 10]], [[4, 10], [1, 4]], [[3, 6], [4, 4], [3, 5], [2, 9], [1, 9]]];
        public var four_kind:Array = [[[4, 4], [4, 4]], [[4, 4], [2, 9]], [[4, 10], [1, 4]], [[4, 4], [2, 10]], [[4, 10], [1, 4]], [[3, 6], [4, 4], [3, 4], [2, 3], [1, 9]]];
        public var sflush:Array = [[[4, 4], [4, 5]], [[4, 3], [2, 9]], [[4, 10], [1, 4]], [[4, 4], [2, 10]], [[3, 10], [1, 4]], [[4, 2], [4, 3], [3, 7], [2, 8], [4, 1]]];
        public var royalflush:Array = [[[2, 4], [2, 3]], [[2, 4], [2, 9]], [[2, 10], [2, 4]], [[2, 4], [2, 10]], [[2, 10], [2, 11]], [[4, 10], [4, 11], [4, 12], [4, 13], [4, 1]]];
       
       
        public var combos:Object = new Object();
        combos["royalflush"] = royalflush;
        combos["sflush"] = sflush;
        combos["four_kind"] = four_kind;
        combos["fullhouse"] = fullhouse;
        combos["flushtie"] = flushtie;
        combos["flushlose"] = flushlose;
        combos["flush"] = flush;
        combos["straighttie"] = straighttie;
        combos["straightlose"] = straightlose;
        combos["straightkick"] = straightkick;
        combos["straight"] = straight;
        combos["three_kind"] = three_kind;
        combos["two_pair"] = two_pair;
        combos["one_pair"] = one_pair;
        combos["high_card"] = high_card;
       
       
       
       
        public function seq():void {
           
        sequence.apply(null, combinations);
           
        }
       
       
       
       
        public function sequence (comb:Array):Array {
           
            for (l - 1; l > 0; l--) {
               
                i = Math.floor(Math.random() * l);
               
                lite = comb[i];
                comb[i] = comb[l];
                comb[l] = lite;
               
                trace(comb);
            }
           
           
         return comb;   
           
        }

Name: Anonymous 2012-03-08 2:58

Normal Language:
>hearts + clubs
Error: types do not support addition


Javascript:
>hearts + clubs
-Infinity

Name: Anonymous 2012-03-08 3:00

im not adding anything.

Name: Anonymous 2012-03-08 3:08

so yeah can anyone care to help?

Error access of undefined property combinations, royalflush, sflush etc...i dont know what to do. its all fully defined and i even tried declaring it in the beginning.

public class PokerCombinations
  
    {
      
        public var i:int;
        public var l:int = combinations.length;
        public var lite:Object; //temporary storage for swapping
      
      
      
        public var combinations:Array = new Array ();
        combinations.push(high_card, one_pair, two_pair, three_kind, straight, straightkick, straightlose, straighttie, flush, flushlose, flushtie, fullhouse, four_kind, sflush, royalflush);
      
      
      
        public static var debug_cards:Array = [combinations];
      
      
      
      
      
  
        public var high_card:Array = [[[3, 4], [4, 5]], [[4, 4], [2, 8]], [[4, 13], [1, 4]], [[4, 4], [2, 10]], [[4, 10], [1, 4]], [[1, 6], [3, 7], [3, 9], [2, 2], [1, 12]]];
        public var one_pair:Array = [[[3, 4], [4, 4]], [[4, 4], [2, 9]], [[4, 10], [1, 4]], [[4, 4], [2, 10]], [[4, 10], [1, 4]], [[1, 6], [3, 7], [3, 9], [2, 10], [1, 11]]];
        public var two_pair:Array = [[[3, 4], [4, 4]], [[4, 4], [2, 9]], [[4, 10], [1, 4]], [[4, 4], [2, 2]], [[4, 10], [2, 3]], [[1, 6], [3, 7], [3, 10], [2, 11], [1, 11]]];
        public var three_kind:Array = [[[3, 4], [4, 3]], [[4, 4], [2, 9]], [[4, 10], [1, 4]], [[4, 4], [2, 10]], [[4, 10], [1, 4]], [[1, 6], [3, 7], [3, 9], [2, 9], [1, 2]]];
        public var straight:Array = [[[3, 4], [4, 3]], [[4, 4], [2, 10]], [[4, 10], [1, 4]], [[4, 4], [2, 10]], [[4, 10], [2, 10]], [[1, 6], [3, 7], [3, 5], [2, 9], [1, 9]]];
        public var straightkick:Array = [[[3, 4], [4, 1]], [[4, 4], [2, 3]], [[4, 10], [1, 4]], [[4, 4], [2, 10]], [[4, 4], [2, 10]], [[1, 6], [3, 7], [3, 5], [2, 4], [1, 3]]];
        public var straightlose:Array = [[[3, 4], [4, 3]], [[4, 9], [2, 9]], [[4, 10], [1, 4]], [[4, 4], [2, 10]], [[4, 4], [2, 10]], [[1, 6], [3, 7], [3, 5], [2, 9], [1, 9]]];
        public var straighttie:Array = [[[3, 4], [4, 3]], [[4, 4], [2, 3]], [[4, 10], [1, 4]], [[4, 4], [2, 10]], [[4, 4], [2, 10]], [[1, 6], [3, 7], [3, 5], [2, 9], [1, 9]]];
        public var flush:Array = [[[4, 8], [4, 6]], [[4, 4], [4, 5]], [[4, 10], [1, 4]], [[4, 4], [2, 10]], [[4, 10], [1, 4]], [[4, 7], [4, 9], [4, 11], [2, 12], [2, 13]]];
        public var flushlose:Array = [[[4, 2], [4, 3]], [[4, 4], [4, 5]], [[4, 10], [1, 4]], [[4, 4], [2, 10]], [[4, 10], [1, 4]], [[4, 7], [4, 9], [4, 11], [2, 12], [2, 13]]];
        public var flushtie:Array = [[[3, 2], [3, 3]], [[4, 2], [4, 3]], [[2, 3], [1, 2]], [[2, 2], [2, 3]], [[1, 2], [1, 3]], [[4, 7], [4, 9], [4, 11], [4, 12], [4, 13]]];
        public var fullhouse:Array = [[[4, 4], [4, 4]], [[4, 4], [2, 9]], [[4, 10], [1, 4]], [[4, 4], [2, 10]], [[4, 10], [1, 4]], [[3, 6], [4, 4], [3, 5], [2, 9], [1, 9]]];
        public var four_kind:Array = [[[4, 4], [4, 4]], [[4, 4], [2, 9]], [[4, 10], [1, 4]], [[4, 4], [2, 10]], [[4, 10], [1, 4]], [[3, 6], [4, 4], [3, 4], [2, 3], [1, 9]]];
        public var sflush:Array = [[[4, 4], [4, 5]], [[4, 3], [2, 9]], [[4, 10], [1, 4]], [[4, 4], [2, 10]], [[3, 10], [1, 4]], [[4, 2], [4, 3], [3, 7], [2, 8], [4, 1]]];
        public var royalflush:Array = [[[2, 4], [2, 3]], [[2, 4], [2, 9]], [[2, 10], [2, 4]], [[2, 4], [2, 10]], [[2, 10], [2, 11]], [[4, 10], [4, 11], [4, 12], [4, 13], [4, 1]]];
      
      
        public var combos:Object = new Object();
        combos["royalflush"] = royalflush;
        combos["sflush"] = sflush;
        combos["four_kind"] = four_kind;
        combos["fullhouse"] = fullhouse;
        combos["flushtie"] = flushtie;
        combos["flushlose"] = flushlose;
        combos["flush"] = flush;
        combos["straighttie"] = straighttie;
        combos["straightlose"] = straightlose;
        combos["straightkick"] = straightkick;
        combos["straight"] = straight;
        combos["three_kind"] = three_kind;
        combos["two_pair"] = two_pair;
        combos["one_pair"] = one_pair;
        combos["high_card"] = high_card;
      
      
      
      
        public function seq():void {
          
        sequence.apply(null, combinations);
          
        }
      
      
      
      
        public function sequence (comb:Array):Array {
          
            for (l - 1; l > 0; l--) {
              
                i = Math.floor(Math.random() * l);
              
                lite = comb[i];
                comb[i] = comb[l];
                comb[l] = lite;
              
                trace(comb);
            }
          
          
         return comb;  
          
        }

Name: Anonymous 2012-03-08 3:11

Whoa whoa whoa, you need do are your assigning inside the class construction method.

I got this to compile fully:

http://pastebin.com/PyiL0cQH

Name: Anonymous 2012-03-08 3:17

Name: Anonymous 2012-03-08 3:20

i need the array of hands to be shuffled before being invoked in the debug_cards array:

     
        public class PokerCombinations
        {
                public var i:int;
                public var l:int = combinations.length;
                public var lite:Object; //temporary storage for swapping
                public var combos:Object;
              
                public var combinations:Array;
                public static var debug_cards:Array;
              
                public var high_card:Array;
                public var one_pair:Array;
                public var two_pair:Array;
                public var three_kind:Array;
                public var straight:Array;
                public var straightkick:Array;
                public var straightlose:Array;
                public var straighttie:Array;
                public var flush:Array;
                public var flushlose:Array;
                public var flushtie:Array;
                public var fullhouse:Array;
                public var four_kind:Array;
                public var sflush:Array;
                public var royalflush:Array;
              
                public function PokerCombinations()
                {
                        high_card = [[[3, 4], [4, 5]], [[4, 4], [2, 8]], [[4, 13], [1, 4]], [[4, 4], [2, 10]], [[4, 10], [1, 4]], [[1, 6], [3, 7], [3, 9], [2, 2], [1, 12]]];
                        one_pair = [[[3, 4], [4, 4]], [[4, 4], [2, 9]], [[4, 10], [1, 4]], [[4, 4], [2, 10]], [[4, 10], [1, 4]], [[1, 6], [3, 7], [3, 9], [2, 10], [1, 11]]];
                        two_pair = [[[3, 4], [4, 4]], [[4, 4], [2, 9]], [[4, 10], [1, 4]], [[4, 4], [2, 2]], [[4, 10], [2, 3]], [[1, 6], [3, 7], [3, 10], [2, 11], [1, 11]]];
                        three_kind = [[[3, 4], [4, 3]], [[4, 4], [2, 9]], [[4, 10], [1, 4]], [[4, 4], [2, 10]], [[4, 10], [1, 4]], [[1, 6], [3, 7], [3, 9], [2, 9], [1, 2]]];
                        straight = [[[3, 4], [4, 3]], [[4, 4], [2, 10]], [[4, 10], [1, 4]], [[4, 4], [2, 10]], [[4, 10], [2, 10]], [[1, 6], [3, 7], [3, 5], [2, 9], [1, 9]]];
                        straightkick = [[[3, 4], [4, 1]], [[4, 4], [2, 3]], [[4, 10], [1, 4]], [[4, 4], [2, 10]], [[4, 4], [2, 10]], [[1, 6], [3, 7], [3, 5], [2, 4], [1, 3]]];
                        straightlose = [[[3, 4], [4, 3]], [[4, 9], [2, 9]], [[4, 10], [1, 4]], [[4, 4], [2, 10]], [[4, 4], [2, 10]], [[1, 6], [3, 7], [3, 5], [2, 9], [1, 9]]];
                        straighttie = [[[3, 4], [4, 3]], [[4, 4], [2, 3]], [[4, 10], [1, 4]], [[4, 4], [2, 10]], [[4, 4], [2, 10]], [[1, 6], [3, 7], [3, 5], [2, 9], [1, 9]]];
                        flush = [[[4, 8], [4, 6]], [[4, 4], [4, 5]], [[4, 10], [1, 4]], [[4, 4], [2, 10]], [[4, 10], [1, 4]], [[4, 7], [4, 9], [4, 11], [2, 12], [2, 13]]];
                        flushlose = [[[4, 2], [4, 3]], [[4, 4], [4, 5]], [[4, 10], [1, 4]], [[4, 4], [2, 10]], [[4, 10], [1, 4]], [[4, 7], [4, 9], [4, 11], [2, 12], [2, 13]]];
                        flushtie = [[[3, 2], [3, 3]], [[4, 2], [4, 3]], [[2, 3], [1, 2]], [[2, 2], [2, 3]], [[1, 2], [1, 3]], [[4, 7], [4, 9], [4, 11], [4, 12], [4, 13]]];
                        fullhouse = [[[4, 4], [4, 4]], [[4, 4], [2, 9]], [[4, 10], [1, 4]], [[4, 4], [2, 10]], [[4, 10], [1, 4]], [[3, 6], [4, 4], [3, 5], [2, 9], [1, 9]]];
                        four_kind = [[[4, 4], [4, 4]], [[4, 4], [2, 9]], [[4, 10], [1, 4]], [[4, 4], [2, 10]], [[4, 10], [1, 4]], [[3, 6], [4, 4], [3, 4], [2, 3], [1, 9]]];
                        sflush = [[[4, 4], [4, 5]], [[4, 3], [2, 9]], [[4, 10], [1, 4]], [[4, 4], [2, 10]], [[3, 10], [1, 4]], [[4, 2], [4, 3], [3, 7], [2, 8], [4, 1]]];
                        royalflush = [[[2, 4], [2, 3]], [[2, 4], [2, 9]], [[2, 10], [2, 4]], [[2, 4], [2, 10]], [[2, 10], [2, 11]], [[4, 10], [4, 11], [4, 12], [4, 13], [4, 1]]];
                      
              
                        combinations.push(high_card, one_pair, two_pair, three_kind, straight, straightkick, straightlose, straighttie, flush, flushlose, flushtie, fullhouse, four_kind, sflush, royalflush);
                        sequence(combinations);
                        debug_cards = combinations;
                      
                        combos = new Object();
                        combos["royalflush"] = royalflush;
                        combos["sflush"] = sflush;
                        combos["four_kind"] = four_kind;
                        combos["fullhouse"] = fullhouse;
                        combos["flushtie"] = flushtie;
                        combos["flushlose"] = flushlose;
                        combos["flush"] = flush;
                        combos["straighttie"] = straighttie;
                        combos["straightlose"] = straightlose;
                        combos["straightkick"] = straightkick;
                        combos["straight"] = straight;
                        combos["three_kind"] = three_kind;
                        combos["two_pair"] = two_pair;
                        combos["one_pair"] = one_pair;
                        combos["high_card"] = high_card;
                      
                        trace("Hello");
                       
                       
                }
       
       
        public function sequence (comb:Array):Array {
           
            for (l - 1; l > 0; l--) {
               
                i = Math.floor(Math.random() * l);
               
                lite = comb[i];
                comb[i] = comb[l];
                comb[l] = lite;
               
                trace(comb);
            }
           
           
         return comb;   
           
        }
       
       
       
       
        //its not working

Name: Anonymous 2012-03-08 3:43

any help?

Name: Anonymous 2012-03-08 3:48

/prog/, please do for OP his Java homework and help him achieve high grades.

Name: Anonymous 2012-03-08 3:50

Here

I've compiled and tested this, it swaps two random locations in your array. That's it for me, the rest you should figure out yourself. Look over this code; Remove the trace() stuff if you want, it's just there for debugging.

http://pastebin.com/y2JfevDv

Name: Anonymous 2012-03-08 3:58

no! i need to randomize the ENTIRE array. thats what i originally intended with this function.

public function sequence (comb:Array):Array {
          
            for (l - 1; l > 0; l--) {
              
                i = Math.floor(Math.random() * l);
              
                lite = comb[i];
                comb[i] = comb[l];
                comb[l] = lite;
              
                trace("comb");
            }
          
          
         return comb;  
          
        }

Name: Anonymous 2012-03-08 3:59

and its not for homework, its for my casino game.

Name: Anonymous 2012-03-08 4:04

and you missed the type for shuffle

Name: Anonymous 2012-03-08 4:05

nope doesnt work. thank you all.

Name: Anonymous 2012-03-08 5:40

bump is anyone willing to assist?

Name: Anonymous 2012-03-08 6:33

>>21
Please don't fucking bump every hour. I'm afraid it seems futile to fix so much code for you because you'll just run into another issue you can't solve right after.

Start smaller, and read about stuff before you slap together massive things like this and then wonder why they don't work.

How about you forget about this stuff above for now, and see if you can find any algorithms for randomly reordering an array's indices. Then write function shuffle(arr:Array):void that does that on some arbitrary array arr. Then go back and try to apply it to your project above.

Don't change these.
Name: Email:
Entire Thread Thread List