:- consult(main).

test :-
	init,
	
	% Yellow
	phaseGhosts,
	
	event(yellow,nextPhase,_),
	write_ln('Yellow: ask player to choose field'),
	event(yellow,placeGhost,[(8,-3)]),
	
	ghostField((8,-3),1,yellow),
	write_ln('Yellow: ghost placed!'),
	
	event(yellow,nextPhase,_),
	write_ln('Yellow: move taoist'),
	event(yellow,move,[3]),
	taoist(yellow,_,_,_,_,3),
	write_ln('Yellow: taoist moved!'),
	
	event(yellow,nextPhase,_),
	write_ln('Yellow: whats next'),
	event(yellow,doNext,[3]),
	write_ln('Yellow: village works maybe'),
	event(yellow,village,[[0,1,0,0,0]]),
	write_ln('Yellow: village seems to work!'),
	taoist(yellow,_,[1,1,1,0,0],_,_,_),
	write_ln('Yellow: village works'),

	event(yellow,nextPhase,_),
	write_ln('Yellow: addBuddha?'),
	currentEvent(none),
	write_ln('Yellow: no'),

	% Red
	currentPlayer(red),
	write_ln('Red: next player worked'),
	
	haunter((8,-3),0),
	write_ln('Red: haunter did not move'),
	
	event(red,nextPhase,_),
	write_ln('Red: addGhost'),
	event(red,placeGhost,[(3,-1)]),
	write_ln('Red: placeGhost'),
	ghostField((3,-1),17,blue),
	write_ln('Red: ghost placed!'),
	
	event(red,nextPhase,_),
	write_ln('Red: move taoist'),
	event(red,move,[3]),
	taoist(red,_,_,_,_,3),
	write_ln('Red: taoist moved!'),
	
	event(red,nextPhase,_),
	write_ln('Red: whats next'),	
	event(red,doNext,[(3,-1)]),
	write_ln('Red: fight!'),
		
	event(red,ghostSelect,[(3,-1)]),
	write_ln('Red: attack imba blue ghost'),
	currentEvent(ghostSelect),
	write_ln('Red: noe'),

	event(red,nextPhase,_),
	write_ln('Red: place Buddha? - No'),

	% Green
	currentPlayer(green),
	write_ln('Green: ITS YOUR TURN!'),
	
	haunter((8,-3),0),
	write_ln('Green: haunter did not move'),
	
	event(green,nextPhase,_),
	write_ln('Green: addGhost'),
	currentEvent(placeGhostRound),
	event(green,placeGhost,[(3,3)]),
	ghostField((3,3),26,green),
	write_ln('Green: ghostPlaced'),
	currentEvent(placeGhost),
	write_ln('Green: place additional ghost'),
	event(green,placeGhost,[(2,3)]),
	ghostField((2,3),54,green),
	write_ln('Green: ghost placed'),
	village(2,_,_,haunted,_),
	write_ln('Green: vilalge haunted'),
	
	event(green,nextPhase,_),
	event(green,move,[3]),
	taoist(green,_,_,_,_,3),
	write_ln('Green: moved'),
	
	event(green,nextPhase,_),
	write_ln('Green: whats next'),
	event(green,doNext,[(3,3)]),
	write_ln('Green: fight!'),
	event(green,ghostSelect,[(3,-1)]),
	write_ln('Green: kick blue ass'),
	ghostField((3,-1),0,blue),
	write_ln('Green: blue ass kicked'),
	taoist(green,_,_,3,_,_),
	write_ln('Green: lost qi'),
	currentEvent(ghostSelect),
	write_ln('Green: attack another ghost'),

	event(green,ghostSelect,[(3,3)]),
	write_ln('Green: attack green ghost'),
	ghostField((3,3),26,green),
	write_ln('Green: ghost still there'),
	currentEvent(chooseMarkers),
	write_ln('Green: choose Markers'),
	event(green,chooseMarkers,[0,[0,0,0,0,0]]),
	write_ln('Green: use green tao marker'),
	ghostField((3,3),0,green),
	write_ln('Green: ghost defeated'),
	taoist(green,_,[0,0,0,0,0],_,_,_),
	write_ln('Green: tao marker used'),
	currentEvent(none),
	write_ln('Green: ghosts are dead'),

	event(green,nextPhase,_),
	write_ln('Green: place buddha? - No'),

	% Blue
	currentPlayer(blue),
	write_ln('Blue: ITS YOUR TURN!'),
	
	haunter((8,-3),0),
	write_ln('Blue: haunter did not move'),

	event(blue,nextPhase,_),
	write_ln('Blue: addGhost'),
	currentEvent(placeGhostRound),
	event(blue,placeGhost,[(7,1)]),	
	ghostField((7,1),43,red),
	write_ln('Blue: ghostPlaced'),
	currentEvent(none),

	event(blue,nextPhase,_),
	write_ln('Blue: move!'),
	
	event(blue,move,[8]),
	write_ln('Blue: moved!'),
	currentEvent(none),

	event(blue,nextPhase,_),
	write_ln('Blue: whats next'),
	event(blue,doNext,[8]),
	write_ln('Blue: village'),
	currentEvent(village),
	write_ln('Blue: ok'),
	event(blue,village,[[0,0,0,0,1]]),
	write_ln('Blue: gimme black tao markers'),
	currentEvent(placeGhost),
	write_ln('Blue: placeGhost'),
	taoist(blue,_,[0,0,0,1,1],5,_,_),
	write_ln('Blue: markers added'),
	event(blue,placeGhost,[(9,-3)]),
	write_ln('Blue: place Ghost'),
	haunter((9,-3),0),
	write_ln('Blue: new haunter placed'),
       	
	event(blue,nextPhase,_),
	write_ln('Blue: place buddha? - No'),
	
	% Yellow
	currentPlayer(yellow),
	write_ln('Yellow: ITS YOUR TURN!'),

	haunter((8,-3),1),
	haunter((9,-3),1),	
	write_ln('Yellow: Haunter moved, yeah!'),
	
	event(yellow,nextPhase,_),
	write_ln('Yellow: addGhost'),
	event(yellow,placeGhost,[(7,-3)]),
	write_ln('Yellow: ghost placed'),
	currentEvent(placeGhost),
	write_ln('Yellow: place another ghost'),
	event(yellow,placeGhost,[(4,1)]),
	write_ln('Yellow: ghost placed'),
	ghostField((4,1),44,red),
	write_ln('Yellow: true'),
	currentEvent(none),
	
	event(yellow,nextPhase,_),
	event(yellow,move,[6]),
	write_ln('Yellow: moved'),
	
	event(yellow,nextPhase,_),
	write_ln('Yellow: whats next?'),
	event(yellow,doNext,[6]),
	write_ln('Yellow: village help!'),	
	currentEvent(none),
	buddha(_,yellow),
	write_ln('Yellow: buddha is yours'),
	
	event(yellow,nextPhase,_),
	write_ln('Yellow: placeBuddha? - No'),
	
	% Red
	write_ln('Red: roll cursedie'),
	taoist(red,_,[0,0,0,0,0],_,_,_),
	write_ln('Red: ha ha'),
	
	event(red,nextPhase,_),
	write_ln('Red: placeGhost'),
	event(red,placeGhost,[(3,-1)]),
	write_ln('Red: ghost placed'),
	
	event(red,nextPhase,_),
	event(red,move,[3]),
	write_ln('Red: moved'),
	
	event(red,nextPhase,_),
	write_ln('Red: whats next'),	
	event(red,doNext,[(3,-1)]),
	write_ln('Red: attaaaaack!'),
	currentEvent(ghostSelect),
	write_ln('Red: Select ghost to attack'),
	event(red,ghostSelect,[(3,-1)]),
	write_ln('Red: done'),
	currentEvent(ghostSelect),
	ghostField((3,-1),2,blue),
	write_ln('Red: pick another one'),
	
	event(red,nextPhase,_),
	write_ln('Red: placeBuddha? - No').
	
init :-
	assert(cards([1,17,26,54,43,8,4,44,2,50])),
	placeBuddha(1,6),
	placeBuddha(2,6).


query(_,_).
broadcasting(_).





