function preparePlayers()
	local players={}
	local positions={}
	positions[1]="bottom"
	positions[2]="left"
	positions[3]="top"
	positions[4]="right"
	local i=0
	for i=1,4 do
		players[i]={}
		local avatarProperties=loadPropertiesFile("images/avatars/"..USERPREF["avatarPlayer"..i].."/avatar.properties")
		
		if i==1 and USERPREF["usePersonalName"]==true then --special case for player 1, who can use his name
			players[1]["name"]=USERPREF["name"]
		else
			players[i]["name"]=avatarProperties["name"]
		end
		players[i]["state"]="not_playing" --"in_game", "passed", "has_hand", "finished", "not_playing"
		players[i]["rank"]="neutral" --"president", "vice president", "vice asshole", "asshole"
		players[i]["hand"]={} --will hold a list of cards
		players[i]["avatar"]=loadAvatarImage(USERPREF["avatarPlayer"..i])
		players[i]["position"]=positions[i] --"top", "bottom", "left", "right"
		
		
		
		
		if i==1 and USERPREF["usePersonalColor"]==true then
			players[1]["colorOut"]=USERPREF["colorOut"]
			players[1]["colorIn"]=USERPREF["colorIn"]
		else
			players[i]["colorOut"]=avatarProperties["colorOut"]
			players[i]["colorIn"]=avatarProperties["colorIn"]
		end
		
		--buffering name as it takes too long
		--players[i]["nameImage"]=Image.createEmpty(200, 100)--hope it's enough
		--printU(players[i]["nameImage"], 25, 25, players[i].name, players[i]["colorIn"], true, CARPETPREF["namesFontName"], CARPETPREF["namesFontW"], CARPETPREF["namesFontH"], CARPETPREF["namesFontSpacing"], players[i]["colorOut"])
		
		
		avatarProperties=nil
	end
	positions=nil
	return players
end

-- returns the deck containing all the cards available
function prepareMainDeck()
	local mainDeck={} --table of cards
	local colors={"clubs", "hearts", "spades", "diamonds"}
	local trumpColor="trump"
	
	-- correspondance value/power like 1 is stronger than 9 so we need this
	-- 1=weakest
	local orderingMatch={}
	orderingMatch[1]=ACE --15 --1
	orderingMatch[2]=TWO --16 --2 
	orderingMatch[3]=3 --3
	orderingMatch[4]=4 --4
	orderingMatch[5]=5 --5
 	orderingMatch[6]=6 --6
	orderingMatch[7]=7 --7
	orderingMatch[8]=8 --8
	orderingMatch[9]=9 --9
 	orderingMatch[10]=10 --10
	orderingMatch[11]=11 --jack=valet
	orderingMatch[12]=12 --knight=cavalier
	orderingMatch[13]=13 --queen=dame
	orderingMatch[14]=14 --king=roi
	orderingMatch[15]=TRUMP --17 --trump=atout
	
	local i=0
	local j=0
	local k=0
	local l=0
	local cardNumber=1;--iterates through all the cards
	for i=1,2 do --there are 2 decks in this game, for a total of 118 cards
		for j=1,4 do --for each color
			local color=colors[j]
			
			for k=1,14 do --for each type of card, except trumps
				local card={}
				card["value"]=k
				card["color"]=color
				card["position"]={}
				
				--TODO: after the tests, put 0 or -1 in there
				card["position"]["x"]=100
				card["position"]["y"]=100
				
				--verticalmain by default (in the hand of the player), other values is "horizontal" and "verticalsub"
				card["orientation"]="verticalmain" 
				card["visible"]=true --it's face up
				card["greyed"]=false --it is grey when it's on the table with other cards on top of it
				card["power"]=orderingMatch[k]
				card["selected"]=false
				card["mustbedrawn"]=true --tells if the card must be drawn or not
				
				mainDeck[cardNumber]=card --put the card in the deck
				cardNumber=cardNumber+1
			end
		end
		
		--speacial case: trump cards are only 3 per deck, no color (special trump color in fact)
		for l=1,3 do
			local card={}
			card["value"]=15
			card["color"]=trumpColor
			card["position"]={}
			
			--TODO: after the tests, put 0 or -1 in there
			card["position"]["x"]=100
			card["position"]["y"]=100
				
			card["orientation"]="verticalmain" --no value as it's determined by the player's position 
			card["visible"]=true --it's face up
			card["greyed"]=false --it is grey when it's on the table with other cards on top of it
			card["power"]=orderingMatch[15]
			card["selected"]=false
			card["mustbedrawn"]=true
			
			mainDeck[cardNumber]=card --put the card in the deck
			cardNumber=cardNumber+1
		end
	end
	
	colors=nil
	trumpColor=nil

	orderingMatch=nil
	return mainDeck
end

function prepareIngameCursor()
	local cur={}
	cur["image"]=loadCursorImage(USERPREF["cursor"])
	cur["available"]=false
	cur["position"]={}
	cur.position["x"]=100
	cur.position["y"]=100
	cur["indice"]=1 --number of the pointed card, typically
	return cur
end






















