IF (Difficulty in [3,4]) or ((Difficulty=1) and (player=3)) THEN {HARD DIFFICULTY} BEGIN if game.lead=0 then {we are leading, so lets find a dominatory card if possible} begin compcard:=99; {something screwy so I know if there's no dominatory} for x:=19 downto 1 do if (dominatory(hands[player,x]) and canplay(player,x)) then compcard:=x; if compcard=99 then {no dominatory, so let's play trash} begin val:=16; for x:=1 to 19 do if (playorder[hands[player,x].num] < val) and (canplay(player,x)) then begin val:=playorder[hands[player,x].num]; if suitout[partner(player),hands[player,x].suit] then val:=val-3; {If your partner is out of that suit, play that card} compcard:=x; end; (*compcard:=1; {what to do here? play highest? or lowest? or in between?} while (not canplay(player,compcard) or (cardvalue(hands[player,compcard])<>0)) and (compcard<=19) do compcard:=compcard+1;*) end; end else begin sluff:=true; for compcard:=1 to 19 do if hands[player,compcard].suit=lead then sluff:=false; if sluff then begin suitout[player,lead]:=true; max:=eval; compcard:=20; if (max=partner(player)) and (((dominatory(trick[max])) and (not suitout[nextplay,lead])) or (lastplay) or (trick[max].suit=trump[1])) then {Your partner is taking it so points} begin for x:=1 to 19 do if (hands[player,x].num=10) and not (hands[player,x].suit in [trump[1],trump[2]]) then compcard:=x; if compcard=20 then for x:=1 to 19 do if (hands[player,x].num=5) and not (hands[player,x].suit in [trump[1],trump[2]]) then compcard:=x; if compcard=20 then repeat compcard:=compcard-1; until ((canplay(player,compcard)) and not (hands[player,compcard].suit in [trump[1],trump[2]])) or (compcard=0); if compcard=0 then begin for x:=1 to 19 do if (canplay(player,x)) and not (hands[player,x].suit in [7,8]) then compcard:=x; end; end else begin {Let's trump it!} compcard:=1; if (trick[max].suit in [trump[1],trump[2]]) and (points_there) and (max<>partner(player)) then begin {We need to beat any other trump on there} compcard:=20; repeat compcard:=compcard-1; {****} until ((hands[player,compcard].num>trick[max].num) and (hands[player,compcard].suit=trick[max].suit)) or ((hands[player,compcard].suit=trump[1]) and (trick[max].suit=trump[2])) or (compcard=1); end; if (compcard=1) and not ((hands[player,compcard].num>trick[max].num) and (hands[player,compcard].suit=trick[max].suit)) then begin compcard:=20; if ((points_left(lead)) and (not lastplay)) or (points_there) then for x:=1 to 20 do if hands[player,x].suit in [trump[1],trump[2]] then compcard:=x; trick[player]:=hands[player,compcard]; max:=eval; if (compcard=20) or (max<>player) then {Dump off trash} begin val:=16; for x:=1 to 19 do if (playorder[hands[player,x].num] < val) and not (hands[player,x].suit in [trump[1],trump[2]]) then begin val:=playorder[hands[player,x].num]; compcard:=x; end; if compcard=20 then begin for x:=1 to 19 do if (canplay(player,x)) and not (hands[player,x].suit in [7,8]) then compcard:=x; end; end; end; end; end; if not sluff then begin {find the highest card he has in the lead suit} compcard:=1; while hands[player,compcard].suit<>lead do inc(compcard); {max:=eval; {Find who is winning, based on what's been played} trick[player]:=hands[player,compcard]; max:=eval; if (lastplay) and (max=player) then begin compcard:=20; repeat compcard:=compcard-1; trick[player]:=hands[player,compcard]; max:=eval; until ((canplay(player,compcard)) and (max=player)); end else if (not dominatory(hands[player,compcard])) or (max<>player) then begin compcard:=20; {max:=0;} if (max=partner(player)) and (((dominatory(trick[max])) and (not suitout[nextplay,lead])) or (lastplay) or (trick[max].suit=trump[1])) then {Your partner is taking it so points} begin {Lets find some points to pour on} max:=0; val:=0; for x:=1 to 19 do if (cardvalue(hands[player,x])>=val) and (hands[player,x].suit=lead) and (not(hands[player,x].num in [14,15])) then begin max:=x; val:=cardvalue(hands[player,x]); end; compcard:=max; if (max=0) then rand:=true; end else max:=0; if (max=0) then {Let's play trash} begin {Search for the blank card} val:=16; for x:=1 to 19 do if (hands[player,x].suit=9) and (lead=trump[1]) then begin compcard:=x; val:=0; end; for x:=1 to 19 do if (playorder[hands[player,x].num] < val) and (hands[player,x].suit=lead) then begin val:=playorder[hands[player,x].num]; compcard:=x; end; end; end; end; end; END; {OF the else for difficulty} if not (compcard in [1..19]) or not (canplay(player,compcard)) or (rand) then {Safety to make sure its an ok card to play} repeat compcard:=trunc(random(19))+1; until canplay(player,compcard); processcard(player,compcard); if (lead=0) and (CardChoosen.suit<>9) then lead:=CardChoosen.suit; trick[player]:=CardChoosen;