:-[diceresult_rolling].

%%%%%%DRAW THE DICE%%%%%%%%%

/**
shows the result of the dice (now it works with one die and
two,three and four dices,yeah!)
**/


%%%%%%%%%ONE DIE%%%%%%%%%%%%

one_die:-
	dice_result,
	free(@dice2),
	free(@dice3),
	free(@dice4).

gui_color_one_die([Colour]):-
	one_die,
	dice_colour(@dice_circle1,Colour).

%%%%%%%%TWO DICE%%%%%%%%%%%%%
two_dice:-
	dice_result,
	free(@dice3),
	free(@dice4),
	free(@dice_circle3),
	free(@dice_circle4).

gui_color_two_dice([Colour1,Colour2]):-
	two_dice,
	dice_colour(@dice_circle1,Colour1),
	dice_colour(@dice_circle2,Colour2).


%%%%%%%THREE DICE%%%%%%%%%%

dice_result:-
	free(@dice1),
	free(@dice2),
	free(@dice3),
	free(@dice4),
	send(@playground,display,new(@dice1,box(50,50)),point(570,570)),
	send(@dice1,colour,black),
	send(@dice1,fill_pattern,white),
	send(@dice1,shadow,3),
	send(@dice1,pen,20),
	send(@playground,display,new(@dice2,box(50,50)),point(655,570)),
	send(@dice2,colour,black),
	send(@dice2,fill_pattern,white),
	send(@dice2,shadow,3),
	send(@dice2,pen,20),
	send(@playground,display,new(@dice3,box(50,50)),point(570,670)),
	send(@dice3,colour,black),
	send(@dice3,fill_pattern,white),
	send(@dice3,shadow,3),
	send(@dice3,pen,20).


dice_colour(Dice,Colour):-
	free(Dice),
	dice(Dice,X,Y),
	send(@playground,display,new(Dice,circle(40)),point(X,Y)),
	send(Dice,pen,1),
	send(Dice,fill_pattern,Colour),
	send(Dice,colour,black).

gui_color_three_dice([Colour1,Colour2,Colour3]):-
	dice_result,
	dice_colour(@dice_circle1,Colour1),
	dice_colour(@dice_circle2,Colour2),
	dice_colour(@dice_circle3,Colour3).



%%%%%%%%%%%%FOUR DICE, fourth is grey%%%%%%%%%%%%%%%%%%

additional_die:-
	dice_result,
	send(@playground,display,new(@dice4,box(50,50)),point(655,670)),
	send(@dice4,colour,black),
	send(@dice4,fill_pattern,grey),
	send(@dice4,shadow,3),
	send(@dice4,pen,20).

gui_additional_die_colour_all([Colour1,Colour2,Colour3,Colour4]):-
	additional_die,
	dice_colour(@dice_circle1,Colour1),
	dice_colour(@dice_circle2,Colour2),
	dice_colour(@dice_circle3,Colour3),
	dice_colour(@dice_circle4,Colour4).

%%%%%%%%%Remove dice from gameboard%%%%%%%%%%%% 
hide_dice:-
	free(@dice1),
	free(@dice2),
	free(@dice3),
	free(@dice4),
	free(@dice_circle1),
	free(@dice_circle2),
	free(@dice_circle3),
	free(@dice_circle4).


