Make vector diagram + comments for DFS method
This commit is contained in:
1 parent
651e8ec5aa
commit
b0fb83e030
4 files changed
+28
-2
No files matched your search
Binary file not shown.
|
Before Width: | Height: | Size: 35 KiB |
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" contentStyleType="text/css" height="429px" preserveAspectRatio="none" style="width:525px;height:429px;background:#FFFFFF;" version="1.1" viewBox="0 0 525 429" width="525px" zoomAndPan="magnify"><defs/><g><rect fill="none" height="206.9297" style="stroke:#000000;stroke-width:1.5;" width="509" x="10" y="169.8281"/><rect fill="none" height="75.3984" style="stroke:#000000;stroke-width:1.5;" width="407.5" x="20" y="294.3594"/><line style="stroke:#181818;stroke-width:0.5;stroke-dasharray:5.0,5.0;" x1="75" x2="75" y1="36.2969" y2="393.7578"/><line style="stroke:#181818;stroke-width:0.5;stroke-dasharray:5.0,5.0;" x1="369.5" x2="369.5" y1="36.2969" y2="393.7578"/><rect fill="#E2E2F0" height="30.2969" rx="2.5" ry="2.5" style="stroke:#181818;stroke-width:0.5;" width="90" x="30" y="5"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacing" textLength="76" x="37" y="24.9951">MazeClient</text><rect fill="#E2E2F0" height="30.2969" rx="2.5" ry="2.5" style="stroke:#181818;stroke-width:0.5;" width="90" x="30" y="392.7578"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacing" textLength="76" x="37" y="412.7529">MazeClient</text><rect fill="#E2E2F0" height="30.2969" rx="2.5" ry="2.5" style="stroke:#181818;stroke-width:0.5;" width="95" x="322.5" y="5"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacing" textLength="81" x="329.5" y="24.9951">MazeServer</text><rect fill="#E2E2F0" height="30.2969" rx="2.5" ry="2.5" style="stroke:#181818;stroke-width:0.5;" width="95" x="322.5" y="392.7578"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacing" textLength="81" x="329.5" y="412.7529">MazeServer</text><polygon fill="#181818" points="358,63.4297,368,67.4297,358,71.4297,362,67.4297" style="stroke:#181818;stroke-width:1.0;"/><line style="stroke:#181818;stroke-width:1.0;" x1="75" x2="364" y1="67.4297" y2="67.4297"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacing" textLength="271" x="82" y="62.3638">Установка соединения (TCP, порт 1024)</text><polygon fill="#181818" points="86,92.5625,76,96.5625,86,100.5625,82,96.5625" style="stroke:#181818;stroke-width:1.0;"/><line style="stroke:#181818;stroke-width:1.0;" x1="80" x2="369" y1="96.5625" y2="96.5625"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacing" textLength="199" x="92" y="91.4966">Подтверждение соединения</text><polygon fill="#181818" points="358,121.6953,368,125.6953,358,129.6953,362,125.6953" style="stroke:#181818;stroke-width:1.0;"/><line style="stroke:#181818;stroke-width:1.0;" x1="75" x2="364" y1="125.6953" y2="125.6953"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacing" textLength="163" x="82" y="120.6294">Отправка имени игрока</text><polygon fill="#181818" points="86,150.8281,76,154.8281,86,158.8281,82,154.8281" style="stroke:#181818;stroke-width:1.0;"/><line style="stroke:#181818;stroke-width:1.0;" x1="80" x2="369" y1="154.8281" y2="154.8281"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacing" textLength="159" x="92" y="149.7622">Подтверждение имени</text><path d="M10,169.8281 L87,169.8281 L87,176.9609 L77,186.9609 L10,186.9609 L10,169.8281 " fill="#EEEEEE" style="stroke:#000000;stroke-width:1.5;"/><rect fill="none" height="206.9297" style="stroke:#000000;stroke-width:1.5;" width="509" x="10" y="169.8281"/><text fill="#000000" font-family="sans-serif" font-size="13" font-weight="bold" lengthAdjust="spacing" textLength="32" x="25" y="182.895">loop</text><text fill="#000000" font-family="sans-serif" font-size="11" font-weight="bold" lengthAdjust="spacing" textLength="99" x="102" y="182.0386">[Игровой цикл]</text><polygon fill="#181818" points="358,204.0938,368,208.0938,358,212.0938,362,208.0938" style="stroke:#181818;stroke-width:1.0;"/><line style="stroke:#181818;stroke-width:1.0;" x1="75" x2="364" y1="208.0938" y2="208.0938"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacing" textLength="132" x="82" y="203.0278">Отправка команды</text><line style="stroke:#181818;stroke-width:1.0;" x1="370" x2="412" y1="237.2266" y2="237.2266"/><line style="stroke:#181818;stroke-width:1.0;" x1="412" x2="412" y1="237.2266" y2="250.2266"/><line style="stroke:#181818;stroke-width:1.0;" x1="371" x2="412" y1="250.2266" y2="250.2266"/><polygon fill="#181818" points="381,246.2266,371,250.2266,381,254.2266,377,250.2266" style="stroke:#181818;stroke-width:1.0;"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacing" textLength="130" x="377" y="232.1606">Проверка команды</text><polygon fill="#181818" points="86,275.3594,76,279.3594,86,Line truncated
|
||||
@startuml
|
||||
MazeClient -> MazeServer: Установка соединения (TCP, порт 1024)
|
||||
MazeServer -> MazeClient: Подтверждение соединения
|
||||
MazeClient -> MazeServer: Отправка имени игрока
|
||||
MazeServer -> MazeClient: Подтверждение имени
|
||||
loop Игровой цикл
|
||||
MazeClient -> MazeServer: Отправка команды
|
||||
MazeServer -> MazeServer: Проверка команды
|
||||
MazeServer -> MazeClient: Отправка ответа
|
||||
alt Команда "сдаюсь" или конец игры
|
||||
MazeClient -> MazeServer: Закрытие соединения
|
||||
MazeServer -> MazeClient: Подтверждение закрытия
|
||||
end
|
||||
end
|
||||
@enduml
|
||||
|
||||
PlantUML version 1.2022.7(Mon Aug 22 17:01:30 UTC 2022)
|
||||
(GPL source distribution)
|
||||
Java Runtime: OpenJDK Runtime Environment
|
||||
JVM: OpenJDK 64-Bit Server VM
|
||||
Default Encoding: UTF-8
|
||||
Language: en
|
||||
Country: null
|
||||
--></g></svg>
|
||||
|
After Width: | Height: | Size: 7.5 KiB |
@@ -3,7 +3,7 @@
|
||||
|
||||
## Протокол пользовательского уровня
|
||||
UML-диаграмма протокола пользовательского уровня представлена на рисунке ниже.
|
||||

|
||||

|
||||
|
||||
## Описание работы приложения
|
||||
Сервер `MazeServer` ожидает подключения клиентов по протоколу TCP на заданный порт (по умолчанию 1024). После установления соединения сервер запрашивает имя игрока, а затем начинает игру в лабиринте. Лабиринт генерируется случайным образом при старте каждой новой игровой сессии. Гарантируется наличие хотя бы одного пути из начальной точки `(0, 0)` в конечную точку `(2, 2)`. Добавление дополнительных стен происходит с соблюдением условия достижимости цели.
|
||||
|
||||
+2
-1
@@ -7,7 +7,8 @@
|
||||
|
||||
Maze::Maze(bool _test_mode, int _steps){
|
||||
// Инициализация графа лабиринта и его ребер
|
||||
std::vector<Edge> edges = {
|
||||
// Индексы направлений: 0 - север, 1 - восток, 2 - юг, 3 - запад
|
||||
std::vector<Edge> edges = {
|
||||
{0, 1, 1, 3}, {0, 0, 3, 2}, {1, 1, 2, 3}, {1, 0, 4, 2},
|
||||
{2, 0, 5, 2}, {3, 1, 4, 3}, {3, 0, 6, 2}, {4, 1, 5, 3},
|
||||
{4, 0, 7, 2}, {5, 0, 8, 2}, {6, 1, 7, 3}, {7, 1, 8, 3}
|
||||
|
||||
Reference in new issue
Block a user