Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Andrii Polukhin, Olexii Liaskovskiy. Group Computer Mathematics 02. Project 12 #18

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,5 @@
*.exe
*.out
*.app

.vscode
Binary file added Flat+Polukhin_and_Liaskovskiy/UML/UML.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
238 changes: 238 additions & 0 deletions Flat+Polukhin_and_Liaskovskiy/UML/UML.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,238 @@
@startuml





/' Objects '/

class Action {
+Action()
+Action(double distance, double angle)
+~Action()
+GetAngle() : double
+GetDistance() : double
-angle : double
-distance : double
}


class Apartment {
+Apartment()
+~Apartment()
+GetDoor(unsigned int i) : Door
+GetWall(unsigned int i) : Wall
+isCorrect() : bool
+GetDoors() : std::vector<Door>
-doors : std::vector<Door>
+GetWalls() : std::vector<Wall>
-walls : std::vector<Wall>
+GetDoorsCount() : unsigned int
+GetWallsCount() : unsigned int
}


class Door {
+Door()
+~Door()
+GetP1() : Point
+GetP2() : Point
-p1 : Point
-p2 : Point
}


class Flat {
+Flat()
+~Flat()
+GetApartment(unsigned int i) : Apartment
+isComplete() : bool
+GetApartments() : std::vector<Apartment>
-apartments : std::vector<Apartment>
+GetHallsCount() : unsigned int
+GetRoomsCount() : unsigned int
-hallsCount : unsigned int
-roomsCount : unsigned int
}


class Furniture {
+Furniture()
+~Furniture()
+GetPoints() : std::vector<Point>
-points : std::vector<Point>
}


class Hall {
+Hall()
+~Hall()
}


class Point {
+Point()
+Point(double x, double y)
+~Point()
+GetX() : double
+GetY() : double
-x : double
-y : double
}


class Robot {
+Robot()
+Robot(Point start, unsigned int max_stamina, Flat* flat, Target* target)
+~Robot()
-flat : Flat*
-CenterOfMass() : Point
-position : Point
-target : Target*
-way : Way
-DistancePP(Point p1, Point p2) : double
-DistancePP(double x1, double y1, double x2, double y2) : double
-GetCos(Point p) : double
-GetTan(Point p) : double
-angle : double
-sumOfMassX : double
-sumOfMassY : double
-SignedTriangleArea(Point p1, Point p2, Point p3) : int
-NextAction() : std::pair<double , Action>
-Cross() : std::pair<double , std::vector<Point> >
+GetCurrentApartmentId() : unsigned int
-max_stamina : unsigned int
-stamina : unsigned int
+Start() : void
}


class Room {
+Room()
+~Room()
+GetFurniture(unsigned int i) : Furniture
+GetFurnitures() : std::vector<Furniture>
-furnitures : std::vector<Furniture>
+GetFurnitureCount() : unsigned int
}


class Target {
+Target()
+Target(Point point)
+Target(unsigned int apartment)
+~Target()
+GetPoint() : Point
-point : Point
+GetType() : TargetType
-targetType : TargetType
+GetApartmentID() : unsigned int
-apartment : unsigned int
}


class Task {
+Task()
+~Task()
-flat : Flat
-target : Target
-robots : std::vector<Robot>
-results : std::vector<uint>
+GetAverageScore() : unsigned int
+DoTest() : void
}


class Wall {
+Wall()
+~Wall()
+GetP1() : Point
+GetP2() : Point
-p1 : Point
-p2 : Point
}


class Way {
+Way()
+~Way()
+GetAction(unsigned int i) : Action
+GetActions() : std::vector<Action>
-actions : std::vector<Action>
+AddAction(Action action) : void
}


enum TargetType {
APARTMENT
POINT
}





/' Inheritance relationships '/

Apartment <|-- Hall


Apartment <|-- Room





/' Aggregation relationships '/

Apartment o-- Door


Apartment o-- Wall


Door "2" o-- Point


Flat o-- Apartment


Furniture o-- Point


Robot o-- Flat


Robot o-- Point


Robot o-- Target


Robot o-- Way


Room o-- Furniture


Target o-- Point


Task o-- Flat


Task o-- Robot


Task o-- Target


Wall "2" o-- Point


Way o-- Action




@enduml
24 changes: 24 additions & 0 deletions Flat+Polukhin_and_Liaskovskiy/src/Action.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#include "Action.hpp"

Action::Action(){
this->distance = 0;
this->angle = 0;
}

Action::Action(double distance, double angle)
{
this->distance = distance;
this->angle = angle;
}

Action::~Action()
{
}

double Action::GetDistance(){
return this->distance;
}

double Action::GetAngle(){
return this->angle;
}
16 changes: 16 additions & 0 deletions Flat+Polukhin_and_Liaskovskiy/src/Action.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#pragma once

#include "common.hpp"

class Action
{
private:
double distance, angle;

public:
Action();
Action(double distance, double angle);
~Action();
double GetDistance();
double GetAngle();
};
63 changes: 63 additions & 0 deletions Flat+Polukhin_and_Liaskovskiy/src/Apartment.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#include "Apartment.hpp"

#include <iostream>

Apartment::Apartment()
{
uint wallsCount, doorsCount;

std::cout << "Number of walls:\n";
std::cin >> wallsCount;

for (size_t i = 0; i < wallsCount; i++)
{
Wall wall = Wall();
walls.push_back(wall);
}

std::cout << "Number of doors:\n";
std::cin >> doorsCount;

for (size_t i = 0; i < doorsCount; i++)
{
Door door = Door();
doors.push_back(door);
}
}

Apartment::~Apartment()
{
}

Wall Apartment::GetWall(uint i)
{
return this->walls[i];
}

Door Apartment::GetDoor(uint i)
{
return this->doors[i];
}

uint Apartment::GetWallsCount(){
return this->walls.size();
}

uint Apartment::GetDoorsCount(){
return this->doors.size();
}

std::vector<Wall> Apartment::GetWalls()
{
return this->walls;
}

std::vector<Door> Apartment::GetDoors()
{
return this->doors;
}

bool Apartment::isCorrect()
{
return true;
}
26 changes: 26 additions & 0 deletions Flat+Polukhin_and_Liaskovskiy/src/Apartment.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#pragma once

#include <vector>
#include <iostream>

#include "common.hpp"
#include "Wall.hpp"
#include "Door.hpp"

class Apartment
{
private:
std::vector<Wall> walls;
std::vector<Door> doors;

public:
Apartment();
~Apartment();
Wall GetWall(uint i);
Door GetDoor(uint i);
uint GetWallsCount();
uint GetDoorsCount();
std::vector<Wall> GetWalls();
std::vector<Door> GetDoors();
virtual bool isCorrect();
};
Loading