Strona 1 z 1

teraz !

: 11 wrz 2003, o 18:23
autor: michalm
teraz pisze poprawke...i czekam na kartke z rozwiazaniem :D pozdro! :grin: :grin: :grin:

: 11 wrz 2003, o 18:30
autor: sierak
To fajną macie szkołe jak Wam net dają podczas egzaminu ...

: 11 wrz 2003, o 18:34
autor: zgubek
A ja siedze tuz za jego plecami :-D :-D :-D :-D

: 11 wrz 2003, o 18:38
autor: michalm
ale cicho :0

: 11 wrz 2003, o 18:48
autor: qomo
powodzenie trzymam kciuki!!!!!!!!! nie dziekowac..

: 11 wrz 2003, o 18:56
autor: zgubek
Wszystko sie zaliczy... :oko:

: 11 wrz 2003, o 18:56
autor: qomo
hyhy :oko: nom 3ymac sie

: 11 wrz 2003, o 19:01
autor: michalm
dawaj 3 pyt !!!!!!!! :zakrecony:

: 11 wrz 2003, o 19:01
autor: arts
fajna macie rozrywke podczas poprawki ....

: 11 wrz 2003, o 19:03
autor: qomo
no nie? widac ze sie chlopaki stresuja..... :-D

: 11 wrz 2003, o 19:05
autor: zgubek
Masz!!Szybko spisuj :-D

unit main;

interface

uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ExtCtrls, StdCtrls;

type
TPolowanie = class(TForm)
Panel1: TPanel;
pbox: TPaintBox;
Button1: TButton;
edM: TEdit;
Label1: TLabel;
Label2: TLabel;
edN: TEdit;
Label3: TLabel;
edZ: TEdit;
objTimer: TTimer;
Button2: TButton;
labStats: TLabel;
Shape1: TShape;
Shape2: TShape;
Shape3: TShape;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
procedure Button1Click(Sender: TObject);
procedure pboxPaint(Sender: TObject);
procedure objTimerTimer(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
procedure Poluj;
procedure Action;
procedure Stats;
{ Public declarations }
end;

type tMysl = object
public
x,y,dx,dy : integer;
load,stun : integer;
scr : integer;
lock : integer;
public
constructor Init;
procedure Action;
procedure Draw(box : TPaintBox);
end;

type tZwierz = object
public
x,y,dx,dy : integer;
attack,live : integer;
public
procedure Init;
procedure Action;
procedure Draw(box : TPaintBox);
end;

type tNagon = object
public
x,y,dx,dy : integer;
lock_ : integer;
public
procedure Init;
procedure Action;
procedure Draw(box : TPaintBox);
end;


var
Polowanie: TPolowanie;
czas :integer; { zegar gry }

Mysl : array [1..500] of tMysl;
cntM : integer; { ilosc osob }

Zwierz : array[1..500] of tZwierz;
cntZ : integer;

nagon :array [1..500] of tNagon; { nagonka }
cntN :integer;

gStop : boolean; { koniec polowania }

statsShoot, statsShootHit : integer;
statsMeel, statsStuns : integer;
lock : integer;


implementation


uses UnitNajlepsi;

{$R *.DFM}

constructor tMysl.Init;
begin
x:=random(400); y:=random(400);
dx:=0; dy:=0;
load:=10; stun:=0; scr:=0;
lock:=-1;
end;

procedure tMysl.Action;
var celx,cely,i,j :integer;
begin
if (load<40) then inc(load);
if (stun>0) then begin dx:=0; dy:=0; dec(stun); end; { jest ogluszony }
if (stun>30) then stun:=30; { limit ogluszenia }

if (stun=0) then begin { ruch }
x:=x+dx;
y:=y+dy;
end;

{ granice terenu }
if (x<5) then begin x:=5; dx:=0; end;
if (y<5) then begin y:=5; dy:=0; end;
if (x>395) then begin x:=395; dx:=0; end;
if (y>395) then begin y:=395; dy:=0; end;

if zwierz[lock].live = 0 then lock:=random(cntZ)+1; { nowy cel, stary nie zyje }

for j:=1 to cntZ do begin { jezeli zwierz w zasiegu wzroku - moze go wybierz na cel }
celx:=zwierz[j].x; cely:=zwierz[j].y;
if (sqrt( sqr(celx-x)+sqr(cely-y) )<50) then { jezeli blisko }
if (random(10)=0) then lock:=j; { i wylosowal - bierze na cel }
end;

celx:=zwierz[lock].x; cely:=zwierz[lock].y;
if (celx<x) then dec(dx); if (celx>x) then inc(dx);
if (cely<y) then dec(dy); if (cely>y) then inc(dy);
if (dx<-4) then dx:=-4; if (dx>+4) then dx:=+4;
if (dy<-4) then dy:=-4; if (dy>+4) then dy:=+4;

if zwierz[lock].live > 0 then
if (sqrt( sqr(celx-x)+sqr(cely-y) )<30) then { w zasigu }
begin
if (load >= 2) and (stun<=0) then { fire ! }
begin
inc(statsShoot);
load:=0;
if (random(2)=0) then { trafiony ! }
begin
inc(statsShootHit);
dec(zwierz[lock].live, 36);
if (zwierz[lock].live <= 0) then begin
zwierz[lock].live:=0;
inc(scr);
end;
if (random(100)>70) then zwierz[lock].attack := random(30) + 30; { kontr atakuje }
end;
end; { fire }
end; { w zasiegu }


if zwierz[lock].live > 0 then
if (sqrt( sqr(celx-x)+sqr(cely-y) )<10) then { walka wrecz }
begin
if (stun<=0) and (random(5)=0) then { attack, trafiony }
begin
inc(statsMeel);
dec(zwierz[lock].live, 50);
if zwierz[lock].live<0 then zwierz[lock].live:=0; { zabity zwierz }
if (zwierz[lock].live <= 0) then begin
zwierz[lock].live:=0;
inc(scr);
end;
end;
if (random(10)<6) then begin { mysliwy odkopniety przez zwierza }
inc(statsStuns);
x := x+random(7)-3;
y := y+random(7)-3;
dx:=0; dy:=0; load:=1;
if (stun<3) then stun:=10+random(30); { ogluszony mocno }
inc(stun, 5+random(5)); { ogluszony }
zwierz[lock].dx := zwierz[lock].dx div 2;
zwierz[lock].dy := zwierz[lock].dy div 2;
inc(zwierz[lock].attack , random(8) + 6); { zwierz bardziej agresywny }
end;
end; { wlaka wrecz }
end;


procedure tMysl.Draw(box : TPaintBox);
begin
box.Canvas.Pen.Color := RGB(255,0,0);
box.Canvas.Brush.Color := RGB(255,0,0);
if (stun>0) then box.Canvas.Brush.Color := RGB(64,0,0); { ogluszony }
box.Canvas.Ellipse(x-3, y-3, x+3, y+3);
if (load=0) then begin { wlasnie strzela}
box.Canvas.Pen.Color := RGB(255,255,190);
box.Canvas.MoveTo(x,y);
box.Canvas.LineTo(zwierz[lock].x, zwierz[lock].y);
end;
end;

{ ==================== }

procedure tZwierz.Init;
begin
x:=random(400); y:=random(400);
dx:=0; dy:=0;
attack:=0; live:=100;
end;

procedure tZwierz.Action;
var tx,ty,ddx,ddy,j,maxd : integer;
begin
if (live<=0) then exit; { nie zyje }

x:=x+dx; y:=y+dy;
if (x< 5) then begin x:= 5; dx:=0; end;
if (y< 5) then begin y:= 5; dy:=0; end;
if (x>395) then begin x:=395; dx:=0; end;
if (y>395) then begin y:=395; dy:=0; end;

ddx:=0; ddy:=0; { gdzie zmienic kierunek }
for j:=1 to cntM do begin
tx:=mysl[j].x; ty:=mysl[j].y;
if sqrt( sqr(x-tx) + sqr(y-ty)) < 50 then begin
tx:=mysl[j].x; ty:=mysl[j].y;
if (x<tx) then dec(ddx); if (x>tx) then inc(ddx);
if (y<ty) then dec(ddy); if (y>ty) then inc(ddy);
end;
end;

for j:=1 to cntN do begin
tx:=nagon[j].x; ty:=nagon[j].y;
if sqrt( sqr(x-tx) + sqr(y-ty)) < 50 then begin
tx:=mysl[j].x; ty:=mysl[j].y;
if (x<tx) then dec(ddx); if (x>tx) then inc(ddx);
if (y<ty) then dec(ddy); if (y>ty) then inc(ddy);
end;
end;

if (abs(dx)<3) and (random(3)=0) then dx:=random(3)-1;
if (abs(dy)<3) and (random(3)=0) then dy:=random(3)-1;

if (attack>0) then
begin { atak }
ddx:=-ddx; ddy:=-ddy; dec(attack);
end;

if (random(100)>95) then attack := random(10) + 20;

if (ddx<0) then dec(dx); if (ddx>0) then inc(dx);
if (ddy<0) then dec(dy); if (ddy>0) then inc(dy);

maxd:=4;
if (dx<-maxd) then dx:=-maxd; if (dx>+maxd) then dx:=+maxd;
if (dy<-maxd) then dy:=-maxd; if (dy>+maxd) then dy:=+maxd;
end;

procedure tZwierz.Draw(box : TPaintBox);
begin
box.Canvas.Pen.Color := RGB(0, 100+round(live*1.3), 0);
box.Canvas.Brush.Color := RGB(0, 100+round(live*1.3), 0);
if live=0 then box.Canvas.Brush.Color := RGB(0,50,0);
box.Canvas.Ellipse(x-3, y-3, x+3, y+3);
end;



{ ==================== }

procedure tNagon.Init;
begin
x:=random(400); y:=random(400);
dx:=0; dy:=0;
end;

procedure tNagon.Action;
var celx_,cely_,i,j :integer;
begin
{ ruch }
x:=x+dx;
y:=y+dy;
{ granice terenu }
if (x<5) then begin x:=5; dx:=0; end;
if (y<5) then begin y:=5; dy:=0; end;
if (x>395) then begin x:=395; dx:=0; end;
if (y>395) then begin y:=395; dy:=0; end;

if zwierz[lock_].live = 0 then lock_:=random(cntZ)+1; { nowy cel, stary nie zyje }

for j:=1 to cntZ do begin { jezeli zwierz w zasiegu wzroku - moze go wybierz na cel }
celx_:=zwierz[j].x; cely_:=zwierz[j].y;
if (sqrt( sqr(celx_-x)+sqr(cely_-y) )<10) then { jezeli blisko }
if (random(10)=0) then lock_:=j; { i wylosowal - bierze na cel }
end;

celx_:=zwierz[lock_].x; cely_:=zwierz[lock_].y;
if (celx_<x) then dec(dx); if (celx_>x) then inc(dx);
if (cely_<y) then dec(dy); if (cely_>y) then inc(dy);
if (dx<-3) then dx:=-3; if (dx>+3) then dx:=+3;
if (dy<-3) then dy:=-3; if (dy>+3) then dy:=+3;

end;

procedure tNagon.Draw(box : TPaintBox);
begin
box.Canvas.Pen.Color := RGB(165,165,0);
box.Canvas.Brush.Color := RGB(165,165,0);
box.Canvas.Ellipse(x-2, y-2, x+3, y+3);
end;

{ ==================== }


procedure TPolowanie.Poluj;
var
oldClock,i : integer;
s,ss : string;
left : integer;


begin
oldClock := czas;
while not gStop do
begin
pbox.rePaint;
Action;
while (oldClock >= czas) do application.processmessages; { czekamy }
oldClock := czas;
Stats;
left:=0;
for i:=1 to cntZ do if zwierz.live>0 then inc(left);
if (left=0) then break; { koniec }
end;

frmBest.memBest.Clear;
for i:=1 to cntM do begin
str(i,ss); s:='Mysliwy #'+ss+' ';
str(Mysl.scr,ss); s:= s + ' - '+ss+' upolowanych zwierzat'+#13;
frmBest.memBest.Lines.Add(s);
end;
frmBest.show;
end;

procedure TPolowanie.Action;
var i,x,y,j, ddx,ddy,maxd : integer;
begin
for i:=1 to cntZ do zwierz.Action;
for i:=1 to cntM do mysl.Action;
for i:=1 to cntN do nagon.Action;
end;

procedure TPolowanie.Button1Click(Sender: TObject);
var i : integer;
begin
gStop:=false;
statsShoot:=0; statsShootHit:=0;
statsMeel:=0; statsStuns:=0;

cntM := StrToInt(edM.text);
Mysl[1].Init;
for i:=1 to cntM do Mysl.Init;

cntZ := StrToInt(edZ.text);
for i:=1 to cntZ do Zwierz.Init;

cntN := StrToInt(edN.text);
for i:=1 to cntN do Nagon.Init;
Poluj;
end;


procedure TPolowanie.Stats;
var s,ss :string;
Begin
s:='';
s:=s+ 'Ludzie: '+ #10#13;
str(statsShoot,ss); s:=s + 'Strzaly - '+ss + #10#13;
str(statsShootHit,ss); s:=s + 'Trafienia - '+ss + #10#13;
str(statsMeel,ss); s:=s + 'Z bliska - '+ss + #10#13;

s:=s+#10#13 + 'Zwierzeta: '+ #10#13;
str(statsStuns,ss); s:=s + 'Ogluszenia - '+ss + #10#13;
labStats.Caption := s;
end;

procedure TPolowanie.pboxPaint(Sender: TObject);
var i,x,y:integer;
begin
for i:=1 to cntM do mysl.Draw(pbox);
for i:=1 to cntZ do zwierz.Draw(pbox);
for i:=1 to cntN do nagon[i].Draw(pbox);
end;

procedure TPolowanie.objTimerTimer(Sender: TObject);
begin
inc(czas);
end;

procedure TPolowanie.Button2Click(Sender: TObject);
begin
gStop := true;
end;

procedure TPolowanie.FormCreate(Sender: TObject);
begin
caption := caption;
end;

end.

: 11 wrz 2003, o 19:09
autor: qomo
Wy mnie rozpierdalacie:-)

: 11 wrz 2003, o 19:11
autor: zgubek
Wklej ten kod do kompilatora delphie'go i zobaczysz jaki fajny programik mamy heheheh...

: 11 wrz 2003, o 19:11
autor: osman14
qomo pisze:Wy mnie rozpierdalacie:-)


:)2 heheheheh :-D

: 11 wrz 2003, o 19:16
autor: sierak
Delphi suxx

: 11 wrz 2003, o 20:43
autor: Thaurin
:D:D:D
To sie nazywa OFFTopic :D
Czego jak czego ale tego bym sie nigdy nie spodziewal na tym forum... rozwaliliscie mnie :)2 :)2 :)2

: 11 wrz 2003, o 20:44
autor: qomo
normalnie gratulacje: daje wam 5+ hyhy zgubek a mozesz mo takie cos na emaila wrzucic bo ja nie bardzo qumam takie sprawy:-) a i wez sobie w koncu gg skoluj....boshe:-)

: 11 wrz 2003, o 21:21
autor: michalm
zgubek gg ma tylko nie ma stalego lacza :-(

: 11 wrz 2003, o 22:08
autor: pirat
RESPECT chłopaki ;) jesteście zajebiści hehehe

u mnie macie 5 z logiki ;)

: 11 wrz 2003, o 22:11
autor: arts
teraz mnie zgubek rozbroiles .... :0

: 11 wrz 2003, o 23:05
autor: Poli
niemam pytan :) Polacy to zawsze cos wymysla kurna powinniecie za to zostac oprucz oceny wyroznieni jakims dyplomem :) a tak pozatym to moze jutro ktos wrzuci na forum przepis na sernik po wiedensku :-D :-D :-D :-D

: 11 wrz 2003, o 23:17
autor: qomo
ja sie babci spytam jak szarlotke zrobic to wam powiem:-) a pozatym to :)2 hyhy no wreszciem troszkem luuuzu

: 11 wrz 2003, o 23:28
autor: mmike
Czegos takie nigdy nie widzialem...
Brawo za pomyslowosc! I zycze powodzenia na kolejnych egzaminach :D

: 11 wrz 2003, o 23:29
autor: pirat
A magistra też tak będziecie bronić? ;)

: 12 wrz 2003, o 11:01
autor: Poli
chlopaki jak tak dobrze wam idzie :)2 to moze zglosimy wasza kandydature na prezydenta :)

: 12 wrz 2003, o 12:22
autor: cyberpooh
ROTFL !!!
:)2 :)2 :)2 :)2 :)2 :)2 :)2

: 12 wrz 2003, o 19:30
autor: michalm
wyniki z egzaminu :

w dniu 11.09.2003
Grupa Numer albumu Punkty Ocena
__________________________________________________________________________

Z204 1561 46/90 3(dst)
Z204 1792 58/90 3,5(dst+)
Z204 1609 49/90 3(dst)
Z204 1633 38/90 2(ndst)

moj to 1561 :grin: :grin: :grin: :grin:

: 12 wrz 2003, o 19:35
autor: marog
pirat pisze:A magistra też tak będziecie bronić? ;)
moze lepiej niech nie bronia bo sie forum zapcha :)

: 12 wrz 2003, o 22:15
autor: pirat
Gratuluje
michalm pisze:moj to 1561 :grin: :grin: :grin: :grin:

a Zgubka?

: 13 wrz 2003, o 18:18
autor: zgubek
Ja juz mialem cwiczenia zaliczone w czerwcu hehehe...nie ma jak to madra glowka :grin: :grin: