new topic     » goto parent     » topic index » view thread      » older message » newer message

First, This function is broken, Any ideas why? I get the error

Syntax error - expected to see =, +=, -=, *=, /= or &=
    Shuffling_Deck() = New_Deck()
                  ^
Wich if i remove the () changes to

Syntax error - expected to see possibly 'end', not a type
  atom temp, temp_1, card_2
     ^
The only way to stop the errors is to rem out
    Shuffling_Deck() = New_Deck()

Any ides???

Also, Is this the best way to swap two elements of an sequence?


function shuffle()
  sequence Shuffling_Deck
    Shuffling_Deck() = New_Deck()
  atom temp, temp_1, card_2
    for card = 1 to 52 do
      temp = Shuffling_Deck[card]
      card_2 = rand(52)
      temp_1 = Shuffling_Deck[card_2]
      Shuffling_Deck[1] = temp_1
      Shuffling_Deck[card_2] = temp
    end for
return Shuffling_Deck



J Reeves
Grape Vine
ICQ# 13728824

_____________________________________________________________________________________
Get more from the Web.  FREE MSN Explorer download : http://explorer.msn.com

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu