Class TF4 (unit T_F4)

Inherits from

TGraphicControl

Constructors


constructor Create(AOwner:TComponent);

Constructor


Functions

procedure Click;

Protected declarations

destructor Destroy;


procedure newGame;

Canvas.

FUNCTION CheckForWinner(K:TCOLOR):BOOLEAN;


procedure ClearGrid;


Procedure CPUMove;

W IS THE COLOR TO SEARCH

procedure DrawBlock(X,Y: Integer;P:TCOLOR);


Function Find1(W,OTHER,OUR:TCOLOR):Integer;

W IS THE COLOR TO SEARCH

Function Find2(W,OTHER,OUR:TCOLOR):Integer;


Function Find3(W:TCOLOR):Integer;


FUNCTION FindFirstFree(X:INTEGER):INTEGER;


procedure fSetBackColor(C:TColor);


procedure fSetBitmap(Value: TBitmap);


procedure fSetBlockType(B:TBlockType);

Properties - write-methodes

procedure fSetDrawLines(B:Boolean);


procedure fSetLineColor(C:TColor);


procedure fSetP1Color(C:TColor);

procedure SetSampleBlocks;

procedure fSetP2Color(C:TColor);


FUNCTION MAYWIN(M:INTEGER;C:TCOLOR):BOOLEAN;


FUNCTION NEXTPLAYER:INTEGER;


procedure Paint;

Paint - methode

FUNCTION PositionStatus(X,Y:INTEGER;K:TCOLOR):INTEGER;


Function RandomPosition:Integer;


Procedure SetBlockAt(X,Y:integer;P:TCOLOR);


Properties

property BackBitmap : TBitmap


property BackColor : TColor


property BlockType : TBlockType

Added properties

property CPULevel : TCpuIntelligence


property DrawLines : Boolean


property LineColor : TColor


property Player1HIColor : TColor


property Player1Kind : TPlayerkind


property Player1LOColor : TColor


property Player2HIColor : TColor


property Player2Kind : TPlayerkind


property Player2LOColor : TColor


property WhoIsOnTurn : INTEGER

Public declarations

Events

event OnFalseMove : TNotifyevent


event OnWinGame : TWinGameEvent


Variables

fBackColor : TColor;


fBitmap : TBitmap;


fBlockType : TBlockType;

Added properties

fDrawLines : Boolean;


fGrid : TForza4grid;


fLev : TCpuIntelligence;


fLineColor : TColor;


fOnfalseMove : TNotifyEvent;


fOnWinGame : TWinGameEvent;


fPlaying : Boolean;


fWhosOnTurn : Integer;


HI1 : TCOLOR;


HI2 : TCOLOR;


PLAYER : ARRAY[1..2] OF TPLAYER;



Constructors


constructor Create(AOwner:TComponent);

Constructor


Functions


procedure Click;

Protected declarations


destructor Destroy;


procedure newGame;

Canvas.Draw(0,0,fBitmap);


FUNCTION CheckForWinner(K:TCOLOR):BOOLEAN;


procedure ClearGrid;


Procedure CPUMove;

W IS THE COLOR TO SEARCH


procedure DrawBlock(X,Y: Integer;P:TCOLOR);


Function Find1(W,OTHER,OUR:TCOLOR):Integer;

W IS THE COLOR TO SEARCH


Function Find2(W,OTHER,OUR:TCOLOR):Integer;


Function Find3(W:TCOLOR):Integer;


FUNCTION FindFirstFree(X:INTEGER):INTEGER;


procedure fSetBackColor(C:TColor);


procedure fSetBitmap(Value: TBitmap);


procedure fSetBlockType(B:TBlockType);

Properties - write-methodes


procedure fSetDrawLines(B:Boolean);


procedure fSetLineColor(C:TColor);


procedure fSetP1Color(C:TColor);

procedure SetSampleBlocks;


procedure fSetP2Color(C:TColor);


FUNCTION MAYWIN(M:INTEGER;C:TCOLOR):BOOLEAN;


FUNCTION NEXTPLAYER:INTEGER;


procedure Paint;

Paint - methode


FUNCTION PositionStatus(X,Y:INTEGER;K:TCOLOR):INTEGER;


Function RandomPosition:Integer;


Procedure SetBlockAt(X,Y:integer;P:TCOLOR);


Properties


property BackBitmap : TBitmap


property BackColor : TColor


property BlockType : TBlockType

Added properties


property CPULevel : TCpuIntelligence


property DrawLines : Boolean


property LineColor : TColor


property Player1HIColor : TColor


property Player1Kind : TPlayerkind


property Player1LOColor : TColor


property Player2HIColor : TColor


property Player2Kind : TPlayerkind


property Player2LOColor : TColor


property WhoIsOnTurn : INTEGER

Public declarations


Events


event OnFalseMove : TNotifyevent


event OnWinGame : TWinGameEvent


Variables


fBackColor : TColor;


fBitmap : TBitmap;


fBlockType : TBlockType;

Added properties


fDrawLines : Boolean;


fGrid : TForza4grid;


fLev : TCpuIntelligence;


fLineColor : TColor;


fOnfalseMove : TNotifyEvent;


fOnWinGame : TWinGameEvent;


fPlaying : Boolean;


fWhosOnTurn : Integer;


HI1 : TCOLOR;


HI2 : TCOLOR;


PLAYER : ARRAY[1..2] OF TPLAYER;