d2jsp
Log InRegister
d2jsp Forums > Off-Topic > International > Magyar > Mekprogramozzuk Topic
Prev13233343536249Next
Add Reply New Topic New Poll
Member
Posts: 35,964
Joined: Dec 27 2007
Gold: 0.00
Jan 27 2014 06:30am


hálistennek nem nézték meg a kódot, csak a működését, úgyhogy 100%-ot kaptam rá :D
Member
Posts: 14,235
Joined: Apr 20 2007
Gold: 15.00
Jan 27 2014 01:05pm
Quote (xGurke @ Jan 27 2014 12:30pm)
https://fbcdn-sphotos-f-a.akamaihd.net/hphotos-ak-prn1/1560673_503895403056388_1945705735_n.jpg

hálistennek nem nézték meg a kódot, csak a működését, úgyhogy 100%-ot kaptam rá :D


de mi meg akarjuk nézni a kódot is :evil:
Member
Posts: 35,964
Joined: Dec 27 2007
Gold: 0.00
Jan 27 2014 01:43pm
main.cpp

Code
#include "Bugs.h"

int main()
{
// Térképes + Egyéb Dolgok
Open(1000,500);
DrawMap();
InitMap();
int TamadoCounter = 5;
int MenekuloCounter = 505;
int Halottak1 = 0;
int Halottak2 = 0;

// Vectorok
vector <Bugs> Tamado;
vector <Bugs> Menekulo;
vector <Food> Kaja;

// Kaják csinálása
Food *Foood = new Food();
Foood->PlaceFood();
Foood->PlaceFoodOnMap();

Food *Fooood = new Food();
Fooood->PlaceFood();
Fooood->PlaceFoodOnMap();

Food *Foooood = new Food();
Foooood->PlaceFood();
Foooood->PlaceFoodOnMap();

Food *Fooooood = new Food();
Fooooood->PlaceFood();
Fooooood->PlaceFoodOnMap();

Food *Foooooood = new Food();
Foooooood->PlaceFood();
Foooooood->PlaceFoodOnMap();

Kaja.push_back(*Foood);
Kaja.push_back(*Fooood);
Kaja.push_back(*Foooood);
Kaja.push_back(*Fooooood);
Kaja.push_back(*Foooooood);

// Támadó Bogarak Csinálása
Bugs *Buggy1 = new Bugs("One",TamadoCounter);
Buggy1->PlaceBug();
Buggy1->PlaceBugOnMap();
TamadoCounter++;
Bugs *Buggy2 = new Bugs("One",TamadoCounter);
Buggy2->PlaceBug();
Buggy2->PlaceBugOnMap();
TamadoCounter++;
Bugs *Buggy3 = new Bugs("One",TamadoCounter);
Buggy3->PlaceBug();
Buggy3->PlaceBugOnMap();
TamadoCounter++;
Bugs *Buggy4 = new Bugs("One",TamadoCounter);
Buggy4->PlaceBug();
Buggy4->PlaceBugOnMap();
TamadoCounter++;
Bugs *Buggy5 = new Bugs("One",TamadoCounter);
Buggy5->PlaceBug();
Buggy5->PlaceBugOnMap();

Tamado.push_back(*Buggy1);
Tamado.push_back(*Buggy2);
Tamado.push_back(*Buggy3);
Tamado.push_back(*Buggy4);
Tamado.push_back(*Buggy5);

// Menekülõ Bogarak Csinálása
Bugs *Buggyy1 = new Bugs("Two",MenekuloCounter);
Buggyy1->PlaceBug();
Buggyy1->PlaceBugOnMap();
MenekuloCounter++;
Bugs *Buggyy2 = new Bugs("Two",MenekuloCounter);
Buggyy2->PlaceBug();
Buggyy2->PlaceBugOnMap();
MenekuloCounter++;
Bugs *Buggyy3 = new Bugs("Two",MenekuloCounter);
Buggyy3->PlaceBug();
Buggyy3->PlaceBugOnMap();
MenekuloCounter++;
Bugs *Buggyy4 = new Bugs("Two",MenekuloCounter);
Buggyy4->PlaceBug();
Buggyy4->PlaceBugOnMap();
MenekuloCounter++;
Bugs *Buggyy5 = new Bugs("Two",MenekuloCounter);
Buggyy5->PlaceBug();
Buggyy5->PlaceBugOnMap();

Menekulo.push_back(*Buggyy1);
Menekulo.push_back(*Buggyy2);
Menekulo.push_back(*Buggyy3);
Menekulo.push_back(*Buggyy4);
Menekulo.push_back(*Buggyy5);

WriteLocation(710, 190,Halottak1);
WriteLocation(710, 360,Halottak2);
Refresh();
event ev;
gin.timer(50);
while(gin >> ev) {
if(ev.type==ev_timer){
ClearLeft();

for (unsigned int i = 0; i < Tamado.size(); i++)
{
if (Tamado[i].Health <= 0)
{
TamadoCounter++;
Mappino[Tamado[i].Location.y][Tamado[i].Location.x] = 0;
Tamado.erase(Tamado.begin()+i);
Bugs *NewTamado = new Bugs("One",TamadoCounter);
NewTamado->PlaceBug();
NewTamado->PlaceBugOnMap();
Tamado.push_back(*NewTamado);
Halottak1++;
WriteLocation(710, 190,Halottak1);
}
else
{
Tamado[i].MoveWithBrain();
Tamado[i].WriteLocation(710,65+i*20);
Tamado[i].PlaceBugOnMap();
Tamado[i].StampBug();
}
}

for (unsigned int i = 0; i < Menekulo.size(); i++)
{
if ((Menekulo[i].Health <= 0) || (Mappino[Menekulo[i].Location.y][Menekulo[i].Location.x] == 0))
{
MenekuloCounter++;
Mappino[Menekulo[i].Location.y][Menekulo[i].Location.x] = 0;
Menekulo.erase(Menekulo.begin()+i);
Bugs *NewMenekulo = new Bugs("Two",MenekuloCounter);
NewMenekulo->PlaceBug();
NewMenekulo->PlaceBugOnMap();
Menekulo.push_back(*NewMenekulo);
Halottak2++;
WriteLocation(710, 360,Halottak2);
}
else
{
Menekulo[i].MoveWithBrain();
Menekulo[i].WriteLocation(710,245+i*20);
Menekulo[i].PlaceBugOnMap();
Menekulo[i].StampBug();
}

}

for (unsigned int i = 0; i < Kaja.size(); i++)
{
if ((Kaja[i].Location.x == 0) && (Kaja[i].Location.y == 0))
{
Kaja.erase(Kaja.begin()+i);
Food *NewFood = new Food();
NewFood->PlaceFood();
NewFood->PlaceFoodOnMap();
Kaja.push_back(*NewFood);
}

Kaja[i].StampFood();
Kaja[i].WriteLocation(710,415+i*20);
}

Refresh();
}
}
return 0;
}
Member
Posts: 35,964
Joined: Dec 27 2007
Gold: 0.00
Jan 27 2014 01:44pm
bugs.h

Code
#include "Food.h"
#include <vector>

class Bugs{
public:
string Type;
string Orientation;
Coord Location;
int ID;
int Health;
int See;

Bugs(string t,int i)
{
Type = t;
ID = i;
Orientation = "N";
Health = 500;
See = 100;
}

Bugs(string t, string o, int x, int y, int i)
{
Type = t;
Orientation = o;
Location.x = x;
Location.y = y;
ID = i;
Health = 500;
See = 100;
}

void PlaceBug()
{
int tempx = rand() % 660 + 20;
int tempy = rand() % 460 + 20;
while (AnythingNearby(tempx,tempy))
{
tempx = rand() % 640 + 30;
tempy = rand() % 440 + 30;
}
Location.x = tempx;
Location.y = tempy;
}

void RotateLeft()
{
if (Orientation == "N"){Orientation = "WN";}
else if (Orientation == "NE"){Orientation = "N";}
else if (Orientation == "E"){Orientation = "NE";}
else if (Orientation == "ES"){Orientation = "E";}
else if (Orientation == "S"){Orientation = "ES";}
else if (Orientation == "SW"){Orientation = "S";}
else if (Orientation == "W"){Orientation = "SW";}
else if (Orientation == "WN"){Orientation = "W";}
}
void RotateRight()
{
if (Orientation == "N"){Orientation = "NE";}
else if (Orientation == "NE"){Orientation = "E";}
else if (Orientation == "E"){Orientation = "ES";}
else if (Orientation == "ES"){Orientation = "S";}
else if (Orientation == "S"){Orientation = "SW";}
else if (Orientation == "SW"){Orientation = "W";}
else if (Orientation == "W"){Orientation = "WN";}
else if (Orientation == "WN"){Orientation = "N";}
}

void StampBug()
{
if (Type == "One"){
if (Orientation == "N"){Stamp(Ret1N(),Location.x-22,Location.y-22);}
else if (Orientation == "NE"){Stamp(Ret1NE(),Location.x-22,Location.y-22);}
else if (Orientation == "E"){Stamp(Ret1E(),Location.x-22,Location.y-22);}
else if (Orientation == "ES"){Stamp(Ret1ES(),Location.x-22,Location.y-22);}
else if (Orientation == "S"){Stamp(Ret1S(),Location.x-22,Location.y-22);}
else if (Orientation == "SW"){Stamp(Ret1SW(),Location.x-22,Location.y-22);}
else if (Orientation == "W"){Stamp(Ret1W(),Location.x-22,Location.y-22);}
else if (Orientation == "WN"){Stamp(Ret1WN(),Location.x-22,Location.y-22);}}
else{
if (Orientation == "N"){Stamp(Ret2N(),Location.x-22,Location.y-22);}
else if (Orientation == "NE"){Stamp(Ret2NE(),Location.x-22,Location.y-22);}
else if (Orientation == "E"){Stamp(Ret2E(),Location.x-22,Location.y-22);}
else if (Orientation == "ES"){Stamp(Ret2ES(),Location.x-22,Location.y-22);}
else if (Orientation == "S"){Stamp(Ret2S(),Location.x-22,Location.y-22);}
else if (Orientation == "SW"){Stamp(Ret2SW(),Location.x-22,Location.y-22);}
else if (Orientation == "W"){Stamp(Ret2W(),Location.x-22,Location.y-22);}
else if (Orientation == "WN"){Stamp(Ret2WN(),Location.x-22,Location.y-22);}
}
}

void PlaceBugOnMap()
{
PlaceToMap(ID,Location.x,Location.y);
}

void RemoveBugFromMap()
{
RemoveFromMap(Location.x,Location.y);
}

void Step()
{
RemoveBugFromMap();
if (Orientation == "N"){Location.y-=1;}
else if (Orientation == "NE"){Location.x+=1; Location.y-=1;}
else if (Orientation == "E"){Location.x+=1;}
else if (Orientation == "ES"){Location.x+=1; Location.y+=1;}
else if (Orientation == "S"){Location.y+=1;}
else if (Orientation == "SW"){Location.x-=1; Location.y+=1;}
else if (Orientation == "W"){Location.x-=1;}
else if (Orientation == "WN"){Location.x-=1; Location.y-=1;}
PlaceBugOnMap();
Health--;
}

void RandomMove()
{
int temp = rand() % 100 + 1;
if (temp <= 10){
RotateLeft();
}
if (temp >=90){
RotateRight();
}
Step();
}

void MoveAway(int x, int y)
{
if (x > Location.x)
{
if (y > Location.y)
{
Orientation = "WN";
}
else if (y < Location.y)
{
Orientation = "SW";
}
else
{
Orientation = "W";
}
}
else if (x < Location.x)
{
if (y > Location.y)
{
Orientation = "NE";
}
else if (y < Location.y)
{
Orientation = "ES";
}
else
{
Orientation = "E";
}
}
else
{
if (y > Location.y)
{
Orientation = "N";
}
else if (y < Location.y)
{
Orientation = "S";
}
}
Step();
}

void MoveTowards(int x, int y)
{
if (x > Location.x)
{
if (y > Location.y)
{
Orientation = "ES";
}
else if (y < Location.y)
{
Orientation = "NE";
}
else
{
Orientation = "E";
}
}
else if (x < Location.x)
{
if (y > Location.y)
{
Orientation = "SW";
}
else if (y < Location.y)
{
Orientation = "WN";
}
else
{
Orientation = "W";
}
}
else
{
if (y > Location.y)
{
Orientation = "S";
}
else if (y < Location.y)
{
Orientation = "N";
}
}
Step();
}

Coord SenseClosestFood()
{
Coord Temp;
Temp.x = 1500;
Temp.y = 1500;
int dist = See;
int where = 0;
vector <Coord> TempV;
for (int i = 0; i < 500; i++)
{
for (int j = 0; j < 700; j++)
{
if ((Mappino[i][j] == 2) && (Distance(Location.x,Location.y,j,i) < See) && (Distance(Location.x,Location.y,j,i) > 20))
{
Temp.x = j;
Temp.y = i;
TempV.push_back(Temp);
}
else if ((Mappino[i][j] == 2) && (Distance(Location.x,Location.y,j,i) <= 20))
{
Health += 300;
Mappino[i][j] = 0;
}
}
}
if (TempV.size() == 0)
{
return Temp;
}
else if (TempV.size() == 1)
{
return TempV[0];
}
else
{
for (unsigned int i = 0; i < TempV.size(); i++)
{
if (Distance(Location.x,Location.y,TempV[i].x,TempV[i].y) < dist)
{
dist = Distance(Location.x,Location.y,TempV[i].x,TempV[i].y);
where = i;
}
}
return TempV[where];
}
}

Coord SenseClosestObstacle()
{
Coord Temp;
Temp.x = 1500;
Temp.y = 1500;
int dist = See;
int where = 0;
vector <Coord> TempV;
for (int i = 0; i < 500; i++)
{
for (int j = 0; j < 700; j++)
{
if ((Mappino[i][j] == 1) && (Distance(Location.x,Location.y,j,i) < See))
{
Temp.x = j;
Temp.y = i;
TempV.push_back(Temp);
}
}
}
if (TempV.size() == 0)
{
return Temp;
}
else if (TempV.size() == 1)
{
return TempV[0];
}
else
{
for (unsigned int i = 0; i < TempV.size(); i++)
{
if (Distance(Location.x,Location.y,TempV[i].x,TempV[i].y) < dist)
{
dist = Distance(Location.x,Location.y,TempV[i].x,TempV[i].y);
where = i;
}
}
return TempV[where];
}
}

Coord SenseClosestOne()
{
Coord Temp;
Temp.x = 1500;
Temp.y = 1500;
int dist = See;
int where = 0;
vector <Coord> TempV;
for (int i = 0; i < 500; i++)
{
for (int j = 0; j < 700; j++)
{
if ((Mappino[i][j] > 2) && ((i != Location.y) || (j != Location.x)) && (Mappino[i][j] < 500) && (Distance(Location.x,Location.y,j,i) < See))
{
Temp.x = j;
Temp.y = i;
TempV.push_back(Temp);
}
}
}
if (TempV.size() == 0)
{
return Temp;
}
else if (TempV.size() == 1)
{
return TempV[0];
}
else
{
for (unsigned int i = 0; i < TempV.size(); i++)
{
if (Distance(Location.x,Location.y,TempV[i].x,TempV[i].y) < dist)
{
dist = Distance(Location.x,Location.y,TempV[i].x,TempV[i].y);
where = i;
}
}
return TempV[where];
}
}

Coord SenseClosestTwo()
{
Coord Temp;
Temp.x = 1500;
Temp.y = 1500;
int dist = See;
int where = 0;
vector <Coord> TempV;
for (int i = 0; i < 500; i++)
{
for (int j = 0; j < 700; j++)
{
if ((Mappino[i][j] > 500) && ((i != Location.y) || (j != Location.x)) && (Distance(Location.x,Location.y,j,i) < See))
{
Temp.x = j;
Temp.y = i;
TempV.push_back(Temp);
}
}
}
if (TempV.size() == 0)
{
return Temp;
}
else if (TempV.size() == 1)
{
return TempV[0];
}
else
{
for (unsigned int i = 0; i < TempV.size(); i++)
{
if (Distance(Location.x,Location.y,TempV[i].x,TempV[i].y) < dist)
{
dist = Distance(Location.x,Location.y,TempV[i].x,TempV[i].y);
where = i;
}
}
return TempV[where];
}
}

void MoveWithBrain()
{
Coord Temp1 = SenseClosestFood();
Coord Temp2 = SenseClosestObstacle();
Coord Temp3 = SenseClosestOne();
Coord Temp4 = SenseClosestTwo();
if (Type == "One")
{
if (Distance(Location.x,Location.y, Temp2.x, Temp2.y) < 30)
{
MoveAway(Temp2.x,Temp2.y);
MoveAway(Temp2.x,Temp2.y);
}
else if (Distance(Location.x,Location.y, Temp3.x, Temp3.y) < 30)
{
MoveAway(Temp3.x,Temp3.y);
MoveAway(Temp3.x,Temp3.y);
}
else if ((Distance(Location.x,Location.y, Temp4.x, Temp4.y) < See) && (Distance(Location.x,Location.y, Temp4.x, Temp4.y) >20) && (Distance(Location.x,Location.y, Temp4.x, Temp4.y)*2 < Distance(Location.x,Location.y, Temp1.x, Temp1.y)))
{
MoveTowards(Temp4.x,Temp4.y);
MoveTowards(Temp4.x,Temp4.y);
}
else if (Distance(Location.x,Location.y, Temp4.x, Temp4.y) <= 20)
{
Mappino[Temp4.y][Temp4.x] = 0;
Health+= 200;
RandomMove();
}
else if ((Distance(Location.x,Location.y, Temp1.x, Temp1.y) < See) && (Distance(Location.x,Location.y, Temp1.x, Temp1.y) >20))
{
MoveTowards(Temp1.x,Temp1.y);
MoveTowards(Temp1.x,Temp1.y);
}
else if (Distance(Location.x,Location.y, Temp1.x, Temp1.y) < 20)
{
Health += 200;
RandomMove();
Mappino[Temp1.y][Temp1.x] = 0;
}
else
{
RandomMove();
RandomMove();
}
}
else
{
if (Distance(Location.x,Location.y, Temp2.x, Temp2.y) < 30)
{
MoveAway(Temp2.x,Temp2.y);
MoveAway(Temp2.x,Temp2.y);
}
else if (Distance(Location.x,Location.y, Temp4.x, Temp4.y) < 30)
{
MoveAway(Temp4.x,Temp4.y);
MoveAway(Temp4.x,Temp4.y);
}
else if ((Distance(Location.x,Location.y, Temp3.x, Temp3.y) < See) && (Distance(Location.x,Location.y, Temp3.x, Temp3.y) >20) && (Distance(Location.x,Location.y, Temp3.x, Temp3.y)*2 < Distance(Location.x,Location.y, Temp1.x, Temp1.y)))
{
MoveAway(Temp3.x,Temp3.y);
MoveAway(Temp3.x,Temp3.y);
MoveAway(Temp3.x,Temp3.y);
}
else if (Distance(Location.x,Location.y, Temp3.x, Temp3.y) <= 20)
{
Health = -100;
}
else if ((Distance(Location.x,Location.y, Temp1.x, Temp1.y) < See) && (Distance(Location.x,Location.y, Temp1.x, Temp1.y) >20))
{
MoveTowards(Temp1.x,Temp1.y);
MoveTowards(Temp1.x,Temp1.y);
MoveTowards(Temp1.x,Temp1.y);
}
else if (Distance(Location.x,Location.y, Temp1.x, Temp1.y) < 20)
{
Mappino[Temp1.y][Temp1.x] = 0;
Health += 200;
RandomMove();
}
else
{
RandomMove();
RandomMove();
}

}

}

void WriteLocation(int x, int y)
{
MoveTo(x-2,y-15);
Color(0,0,0);
Box(290,17);
MoveTo(x,y);
Color(255,255,255);
gout << text("Buggy : ( ") << text(Convert(Location.x)) << text(", ") << text(Convert(Location.y)) << text(" - ") << text(Orientation) << text(" )") << text(" HP : ") << text(Convert(Health));
}
};
Member
Posts: 35,964
Joined: Dec 27 2007
Gold: 0.00
Jan 27 2014 01:45pm
food.h

Code
#include "Map.h"
#include "Coord.h"
#include <cstdlib>

class Food{
public:
Coord Location;
Food(){}

Food(int x, int y)
{
Location.x = x;
Location.y = y;
}

void PlaceFood()
{
int tempx = rand() % 660 + 20;
int tempy = rand() % 460 + 20;
while (AnythingNearby(tempx,tempy))
{
tempx = rand() % 660 + 20;
tempy = rand() % 460 + 20;
}
Location.x = tempx;
Location.y = tempy;
}

void StampFood()
{
if (Mappino[Location.y][Location.x] != 0)
{
Stamp(RetFood(),Location.x-12,Location.y-12);
}
else
{
Location.x = 0;
Location.y = 0;
}
}

void PlaceFoodOnMap()
{
PlaceToMap(2,Location.x,Location.y);
}

void RemoveFoodFromMap()
{
RemoveFromMap(Location.x,Location.y);
}

void WriteLocation(int x, int y)
{
MoveTo(x-2,y-15);
Color(0,0,0);
Box(250,17);
MoveTo(x,y);
Color(255,255,255);
gout << text("Kaja : ( ") << text(Convert(Location.x)) << text(" - ") << text(Convert(Location.y)) << text(" )");
}
};
Member
Posts: 35,964
Joined: Dec 27 2007
Gold: 0.00
Jan 27 2014 01:45pm
map.h

Code
#include "Commands.h"

int Mappino[500][700];

// #################################
// 0 = Szabad hely
// 1 = Akadály
// 2 = Kaja
// #################################


void DrawMap()
{
Color(255,255,255);
MoveTo(700,0);
Box(5,500);
MoveTo(780,15);
Text("Robotika Beadandó");
MoveTo(705,20);
Box(295,2);
//
MoveTo(790,38);
Color(250,0,0);
Text("Támadó Bogarak");
Color(255,255,255);
MoveTo(705,45);
Box(295,1);
//
MoveTo(705,200);
Box(295,1);
Color(0,0,250);
MoveTo(780,218);
Text("Menekülõ Bogarak");
Color(255,255,255);
MoveTo(705,225);
Box(295,1);
//
MoveTo(705,370);
Box(295,1);
Color(0,250,0);
MoveTo(820,388);
Text("Étel");
Color(255,255,255);
MoveTo(705,395);
Box(295,1);
}

void ClearLeft()
{
MoveTo(0,0);
Color(0,0,0);
Box(700,500);
}

void InitMap()
{
for (int i = 0; i < 500; i ++)
{
for (int j = 0; j < 700; j++)
{
if ((i == 0) || (i == 499) || (j == 0) || (j == 699))
{
Mappino[i][j] = 1;
}
else
{
Mappino[i][j] = 0;
}
}
}
}

bool AnythingNearby(int x, int y)
{
int counter = 0;
for (int i = 0; i < 500; i++)
{
for (int j = 0; j < 700; j++)
{
if ((Mappino[i][j] != 0 ) && ((i != y) || (j != x)))
{
if (Distance(j,i,x,y) < 50)
{
counter++;
}
}
}
}
if (counter == 0)
{
return false;
}
else
{
return true;
}
}

void PlaceToMap(int i, int x, int y){Mappino[y][x] = i;}
void RemoveFromMap(int x, int y){Mappino[y][x] = 0;}

void WriteLocation(int x, int y, int a)
{
MoveTo(x-2,y-15);
Color(0,0,0);
Box(290,17);
MoveTo(x,y);
Color(255,255,255);
gout << text("Halottak Szama : ") << text(Convert(a));
}
Member
Posts: 35,964
Joined: Dec 27 2007
Gold: 0.00
Jan 27 2014 01:47pm
commands.h


Code
#include <sstream>
#include "Images.h"
#include <cmath>

void Open(int x, int y)
{
gout.open(x,y);
}
void Move(int x, int y)
{
gout << move(x,y);
}
void MoveTo(int x, int y)
{
gout << move_to(x,y);
}
void Color(int r, int g, int b)
{
gout << color(r,g,b);
}
void Text(string s)
{
gout << text(s);
}
void Box(int x, int y)
{
gout << box(x,y);
}
void Stamp(canvas c, int x, int y)
{
gout << stamp(c,x,y);
}

void Refresh(){gout << refresh;}

double Distance(int dX0, int dY0, int dX1, int dY1)
{
return sqrt((dX1 - dX0)*(dX1 - dX0) + (dY1 - dY0)*(dY1 - dY0));
}

string Convert(int number)
{
stringstream ss; //create a stringstream
ss << number; //add number to the stream
return ss.str(); //return a string with the contents of the stream
}



images.h

Code
#include "graphics.hpp"
#include <fstream>
#include <iostream>

using namespace std;
using namespace genv;

canvas ImageRead(string s)
{
canvas c;
ifstream f;
f.open(s.c_str());
int w, h, r, g, b = 0;
f >> w;
f >> h;
c.open(w, h);
c.transparent(true);
for(int i = 0; i < h; i++)
{
for(int j = 0; j < w; j++)
{
f >> r;
f >> g;
f >> b;
c << move_to(j, i);
c << color(r,g,b);
c << dot;
}
}
f.close();
return c;
}

canvas Ret1N()
{
return ImageRead("InsectOne/1n.kep");
}
canvas Ret1NE()
{
return ImageRead("InsectOne/1ne.kep");
}
canvas Ret1E()
{
return ImageRead("InsectOne/1e.kep");
}
canvas Ret1ES()
{
return ImageRead("InsectOne/1es.kep");
}
canvas Ret1S()
{
return ImageRead("InsectOne/1s.kep");
}
canvas Ret1SW()
{
return ImageRead("InsectOne/1sw.kep");
}
canvas Ret1W()
{
return ImageRead("InsectOne/1w.kep");
}
canvas Ret1WN()
{
return ImageRead("InsectOne/1wn.kep");
}
canvas Ret2N()
{
return ImageRead("InsectTwo/2n.kep");
}
canvas Ret2NE()
{
return ImageRead("InsectTwo/2ne.kep");
}
canvas Ret2E()
{
return ImageRead("InsectTwo/2e.kep");
}
canvas Ret2ES()
{
return ImageRead("InsectTwo/2es.kep");
}
canvas Ret2S()
{
return ImageRead("InsectTwo/2s.kep");
}
canvas Ret2SW()
{
return ImageRead("InsectTwo/2sw.kep");
}
canvas Ret2W()
{
return ImageRead("InsectTwo/2w.kep");
}
canvas Ret2WN()
{
return ImageRead("InsectTwo/2wn.kep");
}
canvas RetFood()
{
return ImageRead("Others/Food.kep");
}
canvas RetObst()
{
return ImageRead("Others/Obstacle.kep");
}


coord.h

Code
class Coord{
public:
int x;
int y;
};
Member
Posts: 43,332
Joined: Dec 21 2006
Gold: 343.00
Jan 27 2014 01:47pm
pm me ha kell vmi segítség
Member
Posts: 22,735
Joined: Apr 30 2011
Gold: 122.92
Jan 27 2014 02:25pm
iskolában visual c# 2010 et használunk
itthon vs express 2013 van
köze nincs a 2010 hez legalábbis szerintem, és egyik parancsot se ismeri
át lehet állitani valahol, hogy a 2010-es "nyelvet??" használja?

wat do
(szerdára kéne házit irnom :D)
Member
Posts: 14,235
Joined: Apr 20 2007
Gold: 15.00
Jan 27 2014 03:24pm
omg gurke ez geciranda :DDDDDD

patrik nem értelek, a c# az c#. mi nem működik? írj nyugodtan facen

This post was edited by kuzdithom on Jan 27 2014 03:25pm
Go Back To Magyar Topic List
Prev13233343536249Next
Add Reply New Topic New Poll