# deckShuffle

if $ARGS[0] = 'sort':
	killvar 'deckFace'
	killvar '$deckImg'

	i = 0
	:loop1
	if i < 4:
		i += 1
		if i = 1: 
			$text = 'Spades'
		elseif i = 2: 
			$text = 'Hearts'
		elseif i = 3: 
			$text = 'Clubs'
		elseif i = 4: 
			$text = 'Diamonds'
		end
		j = 0
		:loop2
		if j < 13:
			j += 1
			deckFace[] = j
			$deckImg[] = 'images/locations/city/industrial/casino/cards/<<$text>>/<<j>>.jpg'
			jump 'loop2'
		end
		jump 'loop1'
	end
end

if $ARGS[0] = 'shuffle':
	i = 0
	:loop3
	if i < 52:
		j = rand(0,51)
		temp = deckFace[i]
		deckFace[i] = deckFace[j]
		deckFace[j] = temp
		$text = $deckImg[i]
		$deckImg[i] = $deckImg[j]
		$deckImg[j] = $text
		i += 1
		jump 'loop3'
	end
end

--- deckShuffle ---------------------------------

