Compare commits
9 Commits
v0.9.1
...
07cd523514
| Author | SHA1 | Date | |
|---|---|---|---|
| 07cd523514 | |||
| 7ed762bd87 | |||
| 9b6f7c704e | |||
| 2af67b420e | |||
| 72d9c8c77f | |||
| a8dc4ca67c | |||
| 3384f2a6f7 | |||
| 76ab190357 | |||
| be7aea1d7d |
55
.github/workflows/build.yml
vendored
@@ -1,55 +0,0 @@
|
|||||||
name: windows-build
|
|
||||||
|
|
||||||
on:
|
|
||||||
# 在设置git tag时触发执行
|
|
||||||
push:
|
|
||||||
tags:
|
|
||||||
- 'v*'
|
|
||||||
|
|
||||||
env:
|
|
||||||
# 设置编译的类型
|
|
||||||
BUILD_TYPE: Release
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
name: "Build the application"
|
|
||||||
runs-on: windows-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- name: Install Qt
|
|
||||||
# 安装Qt
|
|
||||||
uses: jurplel/install-qt-action@v2
|
|
||||||
with:
|
|
||||||
version: '6.1.3'
|
|
||||||
host: 'windows'
|
|
||||||
target: 'desktop'
|
|
||||||
arch: 'win64_msvc2019_64'
|
|
||||||
|
|
||||||
- name: Config Cmake
|
|
||||||
# 设置cmake
|
|
||||||
env:
|
|
||||||
CMAKE_PREFIX_PATH: ${{env.Qt6_Dir}}
|
|
||||||
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
|
|
||||||
|
|
||||||
- name: Compile
|
|
||||||
# 编译程序
|
|
||||||
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
|
|
||||||
|
|
||||||
- name: Deploy Qt
|
|
||||||
# 寻找需要的dll并压缩为单个文件
|
|
||||||
run: |
|
|
||||||
mkdir release
|
|
||||||
cp build/Release/auto_bus_gui.exe release
|
|
||||||
windeployqt release/auto_bus_gui.exe
|
|
||||||
7z a release.zip .\release\*
|
|
||||||
|
|
||||||
- name: Upload Release
|
|
||||||
# 上传发布
|
|
||||||
uses: "marvinpinto/action-automatic-releases@latest"
|
|
||||||
with:
|
|
||||||
repo_token: "${{ secrets.GITHUB_TOKEN }}"
|
|
||||||
prerelease: false
|
|
||||||
files: |
|
|
||||||
release.zip
|
|
||||||
8
.gitignore
vendored
@@ -6,4 +6,10 @@ cmake-build-*/
|
|||||||
.vscode/
|
.vscode/
|
||||||
|
|
||||||
# CLion的配置文件夹
|
# CLion的配置文件夹
|
||||||
.idea/
|
.idea/
|
||||||
|
|
||||||
|
# draw.io的缓存文件
|
||||||
|
*.bkp
|
||||||
|
|
||||||
|
# 合成的全部代码文件
|
||||||
|
all.c
|
||||||
@@ -1,40 +1,22 @@
|
|||||||
cmake_minimum_required(VERSION 3.10)
|
cmake_minimum_required(VERSION 3.10) # 设置cmake项目需要的cmake最小版本
|
||||||
project(auto_bus_gui)
|
|
||||||
|
|
||||||
file(GLOB_RECURSE QRC_SOURCE_FILES ${PROJECT_SOURCE_DIR}/*.qrc)
|
add_subdirectory(third_party/GTest)
|
||||||
|
add_subdirectory(test)
|
||||||
|
add_subdirectory(all_test)
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 14)
|
project(auto_pilot_bus) # 设置项目的名称
|
||||||
set(CMAKE_AUTOMOC ON)
|
|
||||||
set(CMAKE_AUTORCC ON)
|
|
||||||
set(CMAKE_AUTOUIC ON)
|
|
||||||
set(QRC_SOURCE_FILES Resources.qrc)
|
|
||||||
|
|
||||||
set(CMAKE_PREFIX_PATH "C:/Users/ricardo.DESKTOP-N6OVBK5/Programs/Qt/6.1.3/msvc2019_64")
|
set(CMAKE_C_STANDARD 11) # 设置项目的C语言标准版本
|
||||||
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
|
||||||
|
|
||||||
find_package(Qt6 COMPONENTS
|
set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/build) # 设置项目的产生的库的路径,这里直接设为二进制文件处
|
||||||
Core
|
|
||||||
Gui
|
|
||||||
Widgets
|
|
||||||
REQUIRED)
|
|
||||||
|
|
||||||
qt6_add_resources(QRC_FILES ${QRC_SOURCE_FILES})
|
|
||||||
SOURCE_GROUP("Resource Files" FILES ${QRC_SOURCE_FILES})
|
|
||||||
|
|
||||||
|
# 设置项目的头文件目录
|
||||||
include_directories(
|
include_directories(
|
||||||
${PROJECT_SOURCE_DIR}/include
|
${PROJECT_SOURCE_DIR}/include/
|
||||||
${PROJECT_SOURCE_DIR}/src/header
|
|
||||||
)
|
)
|
||||||
|
|
||||||
aux_source_directory(${PROJECT_SOURCE_DIR}/src SRCS)
|
aux_source_directory(./src SRC)
|
||||||
|
|
||||||
if (CMAKE_BUILD_TYPE MATCHES "Debug")
|
# 产生可执行文件
|
||||||
add_executable(auto_bus_gui main.cpp ${SRCS} ${QRC_FILES})
|
add_executable(bus main.c ${SRC})
|
||||||
else()
|
|
||||||
add_executable(auto_bus_gui WIN32 main.cpp ${SRCS} ${QRC_FILES})
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
target_link_libraries(auto_bus_gui
|
|
||||||
Qt::Core
|
|
||||||
Qt::Gui
|
|
||||||
Qt::Widgets
|
|
||||||
)
|
|
||||||
674
LICENSE
Normal file
@@ -0,0 +1,674 @@
|
|||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
Version 3, 29 June 2007
|
||||||
|
|
||||||
|
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
Preamble
|
||||||
|
|
||||||
|
The GNU General Public License is a free, copyleft license for
|
||||||
|
software and other kinds of works.
|
||||||
|
|
||||||
|
The licenses for most software and other practical works are designed
|
||||||
|
to take away your freedom to share and change the works. By contrast,
|
||||||
|
the GNU General Public License is intended to guarantee your freedom to
|
||||||
|
share and change all versions of a program--to make sure it remains free
|
||||||
|
software for all its users. We, the Free Software Foundation, use the
|
||||||
|
GNU General Public License for most of our software; it applies also to
|
||||||
|
any other work released this way by its authors. You can apply it to
|
||||||
|
your programs, too.
|
||||||
|
|
||||||
|
When we speak of free software, we are referring to freedom, not
|
||||||
|
price. Our General Public Licenses are designed to make sure that you
|
||||||
|
have the freedom to distribute copies of free software (and charge for
|
||||||
|
them if you wish), that you receive source code or can get it if you
|
||||||
|
want it, that you can change the software or use pieces of it in new
|
||||||
|
free programs, and that you know you can do these things.
|
||||||
|
|
||||||
|
To protect your rights, we need to prevent others from denying you
|
||||||
|
these rights or asking you to surrender the rights. Therefore, you have
|
||||||
|
certain responsibilities if you distribute copies of the software, or if
|
||||||
|
you modify it: responsibilities to respect the freedom of others.
|
||||||
|
|
||||||
|
For example, if you distribute copies of such a program, whether
|
||||||
|
gratis or for a fee, you must pass on to the recipients the same
|
||||||
|
freedoms that you received. You must make sure that they, too, receive
|
||||||
|
or can get the source code. And you must show them these terms so they
|
||||||
|
know their rights.
|
||||||
|
|
||||||
|
Developers that use the GNU GPL protect your rights with two steps:
|
||||||
|
(1) assert copyright on the software, and (2) offer you this License
|
||||||
|
giving you legal permission to copy, distribute and/or modify it.
|
||||||
|
|
||||||
|
For the developers' and authors' protection, the GPL clearly explains
|
||||||
|
that there is no warranty for this free software. For both users' and
|
||||||
|
authors' sake, the GPL requires that modified versions be marked as
|
||||||
|
changed, so that their problems will not be attributed erroneously to
|
||||||
|
authors of previous versions.
|
||||||
|
|
||||||
|
Some devices are designed to deny users access to install or run
|
||||||
|
modified versions of the software inside them, although the manufacturer
|
||||||
|
can do so. This is fundamentally incompatible with the aim of
|
||||||
|
protecting users' freedom to change the software. The systematic
|
||||||
|
pattern of such abuse occurs in the area of products for individuals to
|
||||||
|
use, which is precisely where it is most unacceptable. Therefore, we
|
||||||
|
have designed this version of the GPL to prohibit the practice for those
|
||||||
|
products. If such problems arise substantially in other domains, we
|
||||||
|
stand ready to extend this provision to those domains in future versions
|
||||||
|
of the GPL, as needed to protect the freedom of users.
|
||||||
|
|
||||||
|
Finally, every program is threatened constantly by software patents.
|
||||||
|
States should not allow patents to restrict development and use of
|
||||||
|
software on general-purpose computers, but in those that do, we wish to
|
||||||
|
avoid the special danger that patents applied to a free program could
|
||||||
|
make it effectively proprietary. To prevent this, the GPL assures that
|
||||||
|
patents cannot be used to render the program non-free.
|
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and
|
||||||
|
modification follow.
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
0. Definitions.
|
||||||
|
|
||||||
|
"This License" refers to version 3 of the GNU General Public License.
|
||||||
|
|
||||||
|
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||||
|
works, such as semiconductor masks.
|
||||||
|
|
||||||
|
"The Program" refers to any copyrightable work licensed under this
|
||||||
|
License. Each licensee is addressed as "you". "Licensees" and
|
||||||
|
"recipients" may be individuals or organizations.
|
||||||
|
|
||||||
|
To "modify" a work means to copy from or adapt all or part of the work
|
||||||
|
in a fashion requiring copyright permission, other than the making of an
|
||||||
|
exact copy. The resulting work is called a "modified version" of the
|
||||||
|
earlier work or a work "based on" the earlier work.
|
||||||
|
|
||||||
|
A "covered work" means either the unmodified Program or a work based
|
||||||
|
on the Program.
|
||||||
|
|
||||||
|
To "propagate" a work means to do anything with it that, without
|
||||||
|
permission, would make you directly or secondarily liable for
|
||||||
|
infringement under applicable copyright law, except executing it on a
|
||||||
|
computer or modifying a private copy. Propagation includes copying,
|
||||||
|
distribution (with or without modification), making available to the
|
||||||
|
public, and in some countries other activities as well.
|
||||||
|
|
||||||
|
To "convey" a work means any kind of propagation that enables other
|
||||||
|
parties to make or receive copies. Mere interaction with a user through
|
||||||
|
a computer network, with no transfer of a copy, is not conveying.
|
||||||
|
|
||||||
|
An interactive user interface displays "Appropriate Legal Notices"
|
||||||
|
to the extent that it includes a convenient and prominently visible
|
||||||
|
feature that (1) displays an appropriate copyright notice, and (2)
|
||||||
|
tells the user that there is no warranty for the work (except to the
|
||||||
|
extent that warranties are provided), that licensees may convey the
|
||||||
|
work under this License, and how to view a copy of this License. If
|
||||||
|
the interface presents a list of user commands or options, such as a
|
||||||
|
menu, a prominent item in the list meets this criterion.
|
||||||
|
|
||||||
|
1. Source Code.
|
||||||
|
|
||||||
|
The "source code" for a work means the preferred form of the work
|
||||||
|
for making modifications to it. "Object code" means any non-source
|
||||||
|
form of a work.
|
||||||
|
|
||||||
|
A "Standard Interface" means an interface that either is an official
|
||||||
|
standard defined by a recognized standards body, or, in the case of
|
||||||
|
interfaces specified for a particular programming language, one that
|
||||||
|
is widely used among developers working in that language.
|
||||||
|
|
||||||
|
The "System Libraries" of an executable work include anything, other
|
||||||
|
than the work as a whole, that (a) is included in the normal form of
|
||||||
|
packaging a Major Component, but which is not part of that Major
|
||||||
|
Component, and (b) serves only to enable use of the work with that
|
||||||
|
Major Component, or to implement a Standard Interface for which an
|
||||||
|
implementation is available to the public in source code form. A
|
||||||
|
"Major Component", in this context, means a major essential component
|
||||||
|
(kernel, window system, and so on) of the specific operating system
|
||||||
|
(if any) on which the executable work runs, or a compiler used to
|
||||||
|
produce the work, or an object code interpreter used to run it.
|
||||||
|
|
||||||
|
The "Corresponding Source" for a work in object code form means all
|
||||||
|
the source code needed to generate, install, and (for an executable
|
||||||
|
work) run the object code and to modify the work, including scripts to
|
||||||
|
control those activities. However, it does not include the work's
|
||||||
|
System Libraries, or general-purpose tools or generally available free
|
||||||
|
programs which are used unmodified in performing those activities but
|
||||||
|
which are not part of the work. For example, Corresponding Source
|
||||||
|
includes interface definition files associated with source files for
|
||||||
|
the work, and the source code for shared libraries and dynamically
|
||||||
|
linked subprograms that the work is specifically designed to require,
|
||||||
|
such as by intimate data communication or control flow between those
|
||||||
|
subprograms and other parts of the work.
|
||||||
|
|
||||||
|
The Corresponding Source need not include anything that users
|
||||||
|
can regenerate automatically from other parts of the Corresponding
|
||||||
|
Source.
|
||||||
|
|
||||||
|
The Corresponding Source for a work in source code form is that
|
||||||
|
same work.
|
||||||
|
|
||||||
|
2. Basic Permissions.
|
||||||
|
|
||||||
|
All rights granted under this License are granted for the term of
|
||||||
|
copyright on the Program, and are irrevocable provided the stated
|
||||||
|
conditions are met. This License explicitly affirms your unlimited
|
||||||
|
permission to run the unmodified Program. The output from running a
|
||||||
|
covered work is covered by this License only if the output, given its
|
||||||
|
content, constitutes a covered work. This License acknowledges your
|
||||||
|
rights of fair use or other equivalent, as provided by copyright law.
|
||||||
|
|
||||||
|
You may make, run and propagate covered works that you do not
|
||||||
|
convey, without conditions so long as your license otherwise remains
|
||||||
|
in force. You may convey covered works to others for the sole purpose
|
||||||
|
of having them make modifications exclusively for you, or provide you
|
||||||
|
with facilities for running those works, provided that you comply with
|
||||||
|
the terms of this License in conveying all material for which you do
|
||||||
|
not control copyright. Those thus making or running the covered works
|
||||||
|
for you must do so exclusively on your behalf, under your direction
|
||||||
|
and control, on terms that prohibit them from making any copies of
|
||||||
|
your copyrighted material outside their relationship with you.
|
||||||
|
|
||||||
|
Conveying under any other circumstances is permitted solely under
|
||||||
|
the conditions stated below. Sublicensing is not allowed; section 10
|
||||||
|
makes it unnecessary.
|
||||||
|
|
||||||
|
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||||
|
|
||||||
|
No covered work shall be deemed part of an effective technological
|
||||||
|
measure under any applicable law fulfilling obligations under article
|
||||||
|
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||||
|
similar laws prohibiting or restricting circumvention of such
|
||||||
|
measures.
|
||||||
|
|
||||||
|
When you convey a covered work, you waive any legal power to forbid
|
||||||
|
circumvention of technological measures to the extent such circumvention
|
||||||
|
is effected by exercising rights under this License with respect to
|
||||||
|
the covered work, and you disclaim any intention to limit operation or
|
||||||
|
modification of the work as a means of enforcing, against the work's
|
||||||
|
users, your or third parties' legal rights to forbid circumvention of
|
||||||
|
technological measures.
|
||||||
|
|
||||||
|
4. Conveying Verbatim Copies.
|
||||||
|
|
||||||
|
You may convey verbatim copies of the Program's source code as you
|
||||||
|
receive it, in any medium, provided that you conspicuously and
|
||||||
|
appropriately publish on each copy an appropriate copyright notice;
|
||||||
|
keep intact all notices stating that this License and any
|
||||||
|
non-permissive terms added in accord with section 7 apply to the code;
|
||||||
|
keep intact all notices of the absence of any warranty; and give all
|
||||||
|
recipients a copy of this License along with the Program.
|
||||||
|
|
||||||
|
You may charge any price or no price for each copy that you convey,
|
||||||
|
and you may offer support or warranty protection for a fee.
|
||||||
|
|
||||||
|
5. Conveying Modified Source Versions.
|
||||||
|
|
||||||
|
You may convey a work based on the Program, or the modifications to
|
||||||
|
produce it from the Program, in the form of source code under the
|
||||||
|
terms of section 4, provided that you also meet all of these conditions:
|
||||||
|
|
||||||
|
a) The work must carry prominent notices stating that you modified
|
||||||
|
it, and giving a relevant date.
|
||||||
|
|
||||||
|
b) The work must carry prominent notices stating that it is
|
||||||
|
released under this License and any conditions added under section
|
||||||
|
7. This requirement modifies the requirement in section 4 to
|
||||||
|
"keep intact all notices".
|
||||||
|
|
||||||
|
c) You must license the entire work, as a whole, under this
|
||||||
|
License to anyone who comes into possession of a copy. This
|
||||||
|
License will therefore apply, along with any applicable section 7
|
||||||
|
additional terms, to the whole of the work, and all its parts,
|
||||||
|
regardless of how they are packaged. This License gives no
|
||||||
|
permission to license the work in any other way, but it does not
|
||||||
|
invalidate such permission if you have separately received it.
|
||||||
|
|
||||||
|
d) If the work has interactive user interfaces, each must display
|
||||||
|
Appropriate Legal Notices; however, if the Program has interactive
|
||||||
|
interfaces that do not display Appropriate Legal Notices, your
|
||||||
|
work need not make them do so.
|
||||||
|
|
||||||
|
A compilation of a covered work with other separate and independent
|
||||||
|
works, which are not by their nature extensions of the covered work,
|
||||||
|
and which are not combined with it such as to form a larger program,
|
||||||
|
in or on a volume of a storage or distribution medium, is called an
|
||||||
|
"aggregate" if the compilation and its resulting copyright are not
|
||||||
|
used to limit the access or legal rights of the compilation's users
|
||||||
|
beyond what the individual works permit. Inclusion of a covered work
|
||||||
|
in an aggregate does not cause this License to apply to the other
|
||||||
|
parts of the aggregate.
|
||||||
|
|
||||||
|
6. Conveying Non-Source Forms.
|
||||||
|
|
||||||
|
You may convey a covered work in object code form under the terms
|
||||||
|
of sections 4 and 5, provided that you also convey the
|
||||||
|
machine-readable Corresponding Source under the terms of this License,
|
||||||
|
in one of these ways:
|
||||||
|
|
||||||
|
a) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by the
|
||||||
|
Corresponding Source fixed on a durable physical medium
|
||||||
|
customarily used for software interchange.
|
||||||
|
|
||||||
|
b) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by a
|
||||||
|
written offer, valid for at least three years and valid for as
|
||||||
|
long as you offer spare parts or customer support for that product
|
||||||
|
model, to give anyone who possesses the object code either (1) a
|
||||||
|
copy of the Corresponding Source for all the software in the
|
||||||
|
product that is covered by this License, on a durable physical
|
||||||
|
medium customarily used for software interchange, for a price no
|
||||||
|
more than your reasonable cost of physically performing this
|
||||||
|
conveying of source, or (2) access to copy the
|
||||||
|
Corresponding Source from a network server at no charge.
|
||||||
|
|
||||||
|
c) Convey individual copies of the object code with a copy of the
|
||||||
|
written offer to provide the Corresponding Source. This
|
||||||
|
alternative is allowed only occasionally and noncommercially, and
|
||||||
|
only if you received the object code with such an offer, in accord
|
||||||
|
with subsection 6b.
|
||||||
|
|
||||||
|
d) Convey the object code by offering access from a designated
|
||||||
|
place (gratis or for a charge), and offer equivalent access to the
|
||||||
|
Corresponding Source in the same way through the same place at no
|
||||||
|
further charge. You need not require recipients to copy the
|
||||||
|
Corresponding Source along with the object code. If the place to
|
||||||
|
copy the object code is a network server, the Corresponding Source
|
||||||
|
may be on a different server (operated by you or a third party)
|
||||||
|
that supports equivalent copying facilities, provided you maintain
|
||||||
|
clear directions next to the object code saying where to find the
|
||||||
|
Corresponding Source. Regardless of what server hosts the
|
||||||
|
Corresponding Source, you remain obligated to ensure that it is
|
||||||
|
available for as long as needed to satisfy these requirements.
|
||||||
|
|
||||||
|
e) Convey the object code using peer-to-peer transmission, provided
|
||||||
|
you inform other peers where the object code and Corresponding
|
||||||
|
Source of the work are being offered to the general public at no
|
||||||
|
charge under subsection 6d.
|
||||||
|
|
||||||
|
A separable portion of the object code, whose source code is excluded
|
||||||
|
from the Corresponding Source as a System Library, need not be
|
||||||
|
included in conveying the object code work.
|
||||||
|
|
||||||
|
A "User Product" is either (1) a "consumer product", which means any
|
||||||
|
tangible personal property which is normally used for personal, family,
|
||||||
|
or household purposes, or (2) anything designed or sold for incorporation
|
||||||
|
into a dwelling. In determining whether a product is a consumer product,
|
||||||
|
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||||
|
product received by a particular user, "normally used" refers to a
|
||||||
|
typical or common use of that class of product, regardless of the status
|
||||||
|
of the particular user or of the way in which the particular user
|
||||||
|
actually uses, or expects or is expected to use, the product. A product
|
||||||
|
is a consumer product regardless of whether the product has substantial
|
||||||
|
commercial, industrial or non-consumer uses, unless such uses represent
|
||||||
|
the only significant mode of use of the product.
|
||||||
|
|
||||||
|
"Installation Information" for a User Product means any methods,
|
||||||
|
procedures, authorization keys, or other information required to install
|
||||||
|
and execute modified versions of a covered work in that User Product from
|
||||||
|
a modified version of its Corresponding Source. The information must
|
||||||
|
suffice to ensure that the continued functioning of the modified object
|
||||||
|
code is in no case prevented or interfered with solely because
|
||||||
|
modification has been made.
|
||||||
|
|
||||||
|
If you convey an object code work under this section in, or with, or
|
||||||
|
specifically for use in, a User Product, and the conveying occurs as
|
||||||
|
part of a transaction in which the right of possession and use of the
|
||||||
|
User Product is transferred to the recipient in perpetuity or for a
|
||||||
|
fixed term (regardless of how the transaction is characterized), the
|
||||||
|
Corresponding Source conveyed under this section must be accompanied
|
||||||
|
by the Installation Information. But this requirement does not apply
|
||||||
|
if neither you nor any third party retains the ability to install
|
||||||
|
modified object code on the User Product (for example, the work has
|
||||||
|
been installed in ROM).
|
||||||
|
|
||||||
|
The requirement to provide Installation Information does not include a
|
||||||
|
requirement to continue to provide support service, warranty, or updates
|
||||||
|
for a work that has been modified or installed by the recipient, or for
|
||||||
|
the User Product in which it has been modified or installed. Access to a
|
||||||
|
network may be denied when the modification itself materially and
|
||||||
|
adversely affects the operation of the network or violates the rules and
|
||||||
|
protocols for communication across the network.
|
||||||
|
|
||||||
|
Corresponding Source conveyed, and Installation Information provided,
|
||||||
|
in accord with this section must be in a format that is publicly
|
||||||
|
documented (and with an implementation available to the public in
|
||||||
|
source code form), and must require no special password or key for
|
||||||
|
unpacking, reading or copying.
|
||||||
|
|
||||||
|
7. Additional Terms.
|
||||||
|
|
||||||
|
"Additional permissions" are terms that supplement the terms of this
|
||||||
|
License by making exceptions from one or more of its conditions.
|
||||||
|
Additional permissions that are applicable to the entire Program shall
|
||||||
|
be treated as though they were included in this License, to the extent
|
||||||
|
that they are valid under applicable law. If additional permissions
|
||||||
|
apply only to part of the Program, that part may be used separately
|
||||||
|
under those permissions, but the entire Program remains governed by
|
||||||
|
this License without regard to the additional permissions.
|
||||||
|
|
||||||
|
When you convey a copy of a covered work, you may at your option
|
||||||
|
remove any additional permissions from that copy, or from any part of
|
||||||
|
it. (Additional permissions may be written to require their own
|
||||||
|
removal in certain cases when you modify the work.) You may place
|
||||||
|
additional permissions on material, added by you to a covered work,
|
||||||
|
for which you have or can give appropriate copyright permission.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, for material you
|
||||||
|
add to a covered work, you may (if authorized by the copyright holders of
|
||||||
|
that material) supplement the terms of this License with terms:
|
||||||
|
|
||||||
|
a) Disclaiming warranty or limiting liability differently from the
|
||||||
|
terms of sections 15 and 16 of this License; or
|
||||||
|
|
||||||
|
b) Requiring preservation of specified reasonable legal notices or
|
||||||
|
author attributions in that material or in the Appropriate Legal
|
||||||
|
Notices displayed by works containing it; or
|
||||||
|
|
||||||
|
c) Prohibiting misrepresentation of the origin of that material, or
|
||||||
|
requiring that modified versions of such material be marked in
|
||||||
|
reasonable ways as different from the original version; or
|
||||||
|
|
||||||
|
d) Limiting the use for publicity purposes of names of licensors or
|
||||||
|
authors of the material; or
|
||||||
|
|
||||||
|
e) Declining to grant rights under trademark law for use of some
|
||||||
|
trade names, trademarks, or service marks; or
|
||||||
|
|
||||||
|
f) Requiring indemnification of licensors and authors of that
|
||||||
|
material by anyone who conveys the material (or modified versions of
|
||||||
|
it) with contractual assumptions of liability to the recipient, for
|
||||||
|
any liability that these contractual assumptions directly impose on
|
||||||
|
those licensors and authors.
|
||||||
|
|
||||||
|
All other non-permissive additional terms are considered "further
|
||||||
|
restrictions" within the meaning of section 10. If the Program as you
|
||||||
|
received it, or any part of it, contains a notice stating that it is
|
||||||
|
governed by this License along with a term that is a further
|
||||||
|
restriction, you may remove that term. If a license document contains
|
||||||
|
a further restriction but permits relicensing or conveying under this
|
||||||
|
License, you may add to a covered work material governed by the terms
|
||||||
|
of that license document, provided that the further restriction does
|
||||||
|
not survive such relicensing or conveying.
|
||||||
|
|
||||||
|
If you add terms to a covered work in accord with this section, you
|
||||||
|
must place, in the relevant source files, a statement of the
|
||||||
|
additional terms that apply to those files, or a notice indicating
|
||||||
|
where to find the applicable terms.
|
||||||
|
|
||||||
|
Additional terms, permissive or non-permissive, may be stated in the
|
||||||
|
form of a separately written license, or stated as exceptions;
|
||||||
|
the above requirements apply either way.
|
||||||
|
|
||||||
|
8. Termination.
|
||||||
|
|
||||||
|
You may not propagate or modify a covered work except as expressly
|
||||||
|
provided under this License. Any attempt otherwise to propagate or
|
||||||
|
modify it is void, and will automatically terminate your rights under
|
||||||
|
this License (including any patent licenses granted under the third
|
||||||
|
paragraph of section 11).
|
||||||
|
|
||||||
|
However, if you cease all violation of this License, then your
|
||||||
|
license from a particular copyright holder is reinstated (a)
|
||||||
|
provisionally, unless and until the copyright holder explicitly and
|
||||||
|
finally terminates your license, and (b) permanently, if the copyright
|
||||||
|
holder fails to notify you of the violation by some reasonable means
|
||||||
|
prior to 60 days after the cessation.
|
||||||
|
|
||||||
|
Moreover, your license from a particular copyright holder is
|
||||||
|
reinstated permanently if the copyright holder notifies you of the
|
||||||
|
violation by some reasonable means, this is the first time you have
|
||||||
|
received notice of violation of this License (for any work) from that
|
||||||
|
copyright holder, and you cure the violation prior to 30 days after
|
||||||
|
your receipt of the notice.
|
||||||
|
|
||||||
|
Termination of your rights under this section does not terminate the
|
||||||
|
licenses of parties who have received copies or rights from you under
|
||||||
|
this License. If your rights have been terminated and not permanently
|
||||||
|
reinstated, you do not qualify to receive new licenses for the same
|
||||||
|
material under section 10.
|
||||||
|
|
||||||
|
9. Acceptance Not Required for Having Copies.
|
||||||
|
|
||||||
|
You are not required to accept this License in order to receive or
|
||||||
|
run a copy of the Program. Ancillary propagation of a covered work
|
||||||
|
occurring solely as a consequence of using peer-to-peer transmission
|
||||||
|
to receive a copy likewise does not require acceptance. However,
|
||||||
|
nothing other than this License grants you permission to propagate or
|
||||||
|
modify any covered work. These actions infringe copyright if you do
|
||||||
|
not accept this License. Therefore, by modifying or propagating a
|
||||||
|
covered work, you indicate your acceptance of this License to do so.
|
||||||
|
|
||||||
|
10. Automatic Licensing of Downstream Recipients.
|
||||||
|
|
||||||
|
Each time you convey a covered work, the recipient automatically
|
||||||
|
receives a license from the original licensors, to run, modify and
|
||||||
|
propagate that work, subject to this License. You are not responsible
|
||||||
|
for enforcing compliance by third parties with this License.
|
||||||
|
|
||||||
|
An "entity transaction" is a transaction transferring control of an
|
||||||
|
organization, or substantially all assets of one, or subdividing an
|
||||||
|
organization, or merging organizations. If propagation of a covered
|
||||||
|
work results from an entity transaction, each party to that
|
||||||
|
transaction who receives a copy of the work also receives whatever
|
||||||
|
licenses to the work the party's predecessor in interest had or could
|
||||||
|
give under the previous paragraph, plus a right to possession of the
|
||||||
|
Corresponding Source of the work from the predecessor in interest, if
|
||||||
|
the predecessor has it or can get it with reasonable efforts.
|
||||||
|
|
||||||
|
You may not impose any further restrictions on the exercise of the
|
||||||
|
rights granted or affirmed under this License. For example, you may
|
||||||
|
not impose a license fee, royalty, or other charge for exercise of
|
||||||
|
rights granted under this License, and you may not initiate litigation
|
||||||
|
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||||
|
any patent claim is infringed by making, using, selling, offering for
|
||||||
|
sale, or importing the Program or any portion of it.
|
||||||
|
|
||||||
|
11. Patents.
|
||||||
|
|
||||||
|
A "contributor" is a copyright holder who authorizes use under this
|
||||||
|
License of the Program or a work on which the Program is based. The
|
||||||
|
work thus licensed is called the contributor's "contributor version".
|
||||||
|
|
||||||
|
A contributor's "essential patent claims" are all patent claims
|
||||||
|
owned or controlled by the contributor, whether already acquired or
|
||||||
|
hereafter acquired, that would be infringed by some manner, permitted
|
||||||
|
by this License, of making, using, or selling its contributor version,
|
||||||
|
but do not include claims that would be infringed only as a
|
||||||
|
consequence of further modification of the contributor version. For
|
||||||
|
purposes of this definition, "control" includes the right to grant
|
||||||
|
patent sublicenses in a manner consistent with the requirements of
|
||||||
|
this License.
|
||||||
|
|
||||||
|
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||||
|
patent license under the contributor's essential patent claims, to
|
||||||
|
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||||
|
propagate the contents of its contributor version.
|
||||||
|
|
||||||
|
In the following three paragraphs, a "patent license" is any express
|
||||||
|
agreement or commitment, however denominated, not to enforce a patent
|
||||||
|
(such as an express permission to practice a patent or covenant not to
|
||||||
|
sue for patent infringement). To "grant" such a patent license to a
|
||||||
|
party means to make such an agreement or commitment not to enforce a
|
||||||
|
patent against the party.
|
||||||
|
|
||||||
|
If you convey a covered work, knowingly relying on a patent license,
|
||||||
|
and the Corresponding Source of the work is not available for anyone
|
||||||
|
to copy, free of charge and under the terms of this License, through a
|
||||||
|
publicly available network server or other readily accessible means,
|
||||||
|
then you must either (1) cause the Corresponding Source to be so
|
||||||
|
available, or (2) arrange to deprive yourself of the benefit of the
|
||||||
|
patent license for this particular work, or (3) arrange, in a manner
|
||||||
|
consistent with the requirements of this License, to extend the patent
|
||||||
|
license to downstream recipients. "Knowingly relying" means you have
|
||||||
|
actual knowledge that, but for the patent license, your conveying the
|
||||||
|
covered work in a country, or your recipient's use of the covered work
|
||||||
|
in a country, would infringe one or more identifiable patents in that
|
||||||
|
country that you have reason to believe are valid.
|
||||||
|
|
||||||
|
If, pursuant to or in connection with a single transaction or
|
||||||
|
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||||
|
covered work, and grant a patent license to some of the parties
|
||||||
|
receiving the covered work authorizing them to use, propagate, modify
|
||||||
|
or convey a specific copy of the covered work, then the patent license
|
||||||
|
you grant is automatically extended to all recipients of the covered
|
||||||
|
work and works based on it.
|
||||||
|
|
||||||
|
A patent license is "discriminatory" if it does not include within
|
||||||
|
the scope of its coverage, prohibits the exercise of, or is
|
||||||
|
conditioned on the non-exercise of one or more of the rights that are
|
||||||
|
specifically granted under this License. You may not convey a covered
|
||||||
|
work if you are a party to an arrangement with a third party that is
|
||||||
|
in the business of distributing software, under which you make payment
|
||||||
|
to the third party based on the extent of your activity of conveying
|
||||||
|
the work, and under which the third party grants, to any of the
|
||||||
|
parties who would receive the covered work from you, a discriminatory
|
||||||
|
patent license (a) in connection with copies of the covered work
|
||||||
|
conveyed by you (or copies made from those copies), or (b) primarily
|
||||||
|
for and in connection with specific products or compilations that
|
||||||
|
contain the covered work, unless you entered into that arrangement,
|
||||||
|
or that patent license was granted, prior to 28 March 2007.
|
||||||
|
|
||||||
|
Nothing in this License shall be construed as excluding or limiting
|
||||||
|
any implied license or other defenses to infringement that may
|
||||||
|
otherwise be available to you under applicable patent law.
|
||||||
|
|
||||||
|
12. No Surrender of Others' Freedom.
|
||||||
|
|
||||||
|
If conditions are imposed on you (whether by court order, agreement or
|
||||||
|
otherwise) that contradict the conditions of this License, they do not
|
||||||
|
excuse you from the conditions of this License. If you cannot convey a
|
||||||
|
covered work so as to satisfy simultaneously your obligations under this
|
||||||
|
License and any other pertinent obligations, then as a consequence you may
|
||||||
|
not convey it at all. For example, if you agree to terms that obligate you
|
||||||
|
to collect a royalty for further conveying from those to whom you convey
|
||||||
|
the Program, the only way you could satisfy both those terms and this
|
||||||
|
License would be to refrain entirely from conveying the Program.
|
||||||
|
|
||||||
|
13. Use with the GNU Affero General Public License.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, you have
|
||||||
|
permission to link or combine any covered work with a work licensed
|
||||||
|
under version 3 of the GNU Affero General Public License into a single
|
||||||
|
combined work, and to convey the resulting work. The terms of this
|
||||||
|
License will continue to apply to the part which is the covered work,
|
||||||
|
but the special requirements of the GNU Affero General Public License,
|
||||||
|
section 13, concerning interaction through a network will apply to the
|
||||||
|
combination as such.
|
||||||
|
|
||||||
|
14. Revised Versions of this License.
|
||||||
|
|
||||||
|
The Free Software Foundation may publish revised and/or new versions of
|
||||||
|
the GNU General Public License from time to time. Such new versions will
|
||||||
|
be similar in spirit to the present version, but may differ in detail to
|
||||||
|
address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the
|
||||||
|
Program specifies that a certain numbered version of the GNU General
|
||||||
|
Public License "or any later version" applies to it, you have the
|
||||||
|
option of following the terms and conditions either of that numbered
|
||||||
|
version or of any later version published by the Free Software
|
||||||
|
Foundation. If the Program does not specify a version number of the
|
||||||
|
GNU General Public License, you may choose any version ever published
|
||||||
|
by the Free Software Foundation.
|
||||||
|
|
||||||
|
If the Program specifies that a proxy can decide which future
|
||||||
|
versions of the GNU General Public License can be used, that proxy's
|
||||||
|
public statement of acceptance of a version permanently authorizes you
|
||||||
|
to choose that version for the Program.
|
||||||
|
|
||||||
|
Later license versions may give you additional or different
|
||||||
|
permissions. However, no additional obligations are imposed on any
|
||||||
|
author or copyright holder as a result of your choosing to follow a
|
||||||
|
later version.
|
||||||
|
|
||||||
|
15. Disclaimer of Warranty.
|
||||||
|
|
||||||
|
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||||
|
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||||
|
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||||
|
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||||
|
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||||
|
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||||
|
|
||||||
|
16. Limitation of Liability.
|
||||||
|
|
||||||
|
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||||
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||||
|
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||||
|
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||||
|
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||||
|
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||||
|
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||||
|
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||||
|
SUCH DAMAGES.
|
||||||
|
|
||||||
|
17. Interpretation of Sections 15 and 16.
|
||||||
|
|
||||||
|
If the disclaimer of warranty and limitation of liability provided
|
||||||
|
above cannot be given local legal effect according to their terms,
|
||||||
|
reviewing courts shall apply local law that most closely approximates
|
||||||
|
an absolute waiver of all civil liability in connection with the
|
||||||
|
Program, unless a warranty or assumption of liability accompanies a
|
||||||
|
copy of the Program in return for a fee.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
How to Apply These Terms to Your New Programs
|
||||||
|
|
||||||
|
If you develop a new program, and you want it to be of the greatest
|
||||||
|
possible use to the public, the best way to achieve this is to make it
|
||||||
|
free software which everyone can redistribute and change under these terms.
|
||||||
|
|
||||||
|
To do so, attach the following notices to the program. It is safest
|
||||||
|
to attach them to the start of each source file to most effectively
|
||||||
|
state the exclusion of warranty; and each file should have at least
|
||||||
|
the "copyright" line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
|
<one line to give the program's name and a brief idea of what it does.>
|
||||||
|
Copyright (C) <year> <name of author>
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
|
If the program does terminal interaction, make it output a short
|
||||||
|
notice like this when it starts in an interactive mode:
|
||||||
|
|
||||||
|
<program> Copyright (C) <year> <name of author>
|
||||||
|
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||||
|
This is free software, and you are welcome to redistribute it
|
||||||
|
under certain conditions; type `show c' for details.
|
||||||
|
|
||||||
|
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||||
|
parts of the General Public License. Of course, your program's commands
|
||||||
|
might be different; for a GUI interface, you would use an "about box".
|
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or school,
|
||||||
|
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||||
|
For more information on this, and how to apply and follow the GNU GPL, see
|
||||||
|
<https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
The GNU General Public License does not permit incorporating your program
|
||||||
|
into proprietary programs. If your program is a subroutine library, you
|
||||||
|
may consider it more useful to permit linking proprietary applications with
|
||||||
|
the library. If this is what you want to do, use the GNU Lesser General
|
||||||
|
Public License instead of this License. But first, please read
|
||||||
|
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
||||||
118
README.md
@@ -1,51 +1,105 @@
|
|||||||
# Auto Bus GUI
|
# Auto Pilot Bus
|
||||||
|
|
||||||
[](https://github.com/jackfiled/auto_bus/actions/workflows/build.yml)
|
北京邮电大学计算机学院2021级《计算导论与程序设计》实践大作业项目仓库,本次课程的题目为“自动公交车调度”。
|
||||||
|
|
||||||
北京邮电大学计算机学院2021级《计算导论与程序设计》实践大作业“公交车调度”的GUI分支。
|
> `master`分支为控制台输出的核心版
|
||||||
|
>
|
||||||
|
> `gui`分支为采用`Qt`实现的动画版
|
||||||
|
|
||||||
## 构建
|
### 特点
|
||||||
|
|
||||||
### 构建环境
|
- 采用`cmake`进行项目管理,编译轻松快捷。
|
||||||
|
- 程序模块化设计,注释详尽,代码可读性高。
|
||||||
|
- 含有`GTest`单元测试模块和自行设计的全局测试模块,还提供了不少测试用例。
|
||||||
|
- 完全使用`markdown`撰写的文档
|
||||||
|
|
||||||
- 编译器`Visual Studio 2022 MSVC++ 14.3`
|
## 项目使用
|
||||||
- Qt` 6.1.3`
|
|
||||||
- CMake `3.22`
|
|
||||||
|
|
||||||
### 构建
|
### 结构
|
||||||
|
|
||||||
```bash
|
```
|
||||||
git clone https://github.com/jackfiled/auto_bus.git
|
auto_pilot_bus
|
||||||
git checkout -b gui origin/gui
|
|
|
||||||
mkdir build
|
+-all_test //本地全局测试文件夹
|
||||||
cd build
|
|
|
||||||
cmake .. -G "Visual Studio 17 2022"
|
+-docs // 文档文件夹
|
||||||
|
|
|
||||||
|
+-include // 头文件文件夹
|
||||||
|
|
|
||||||
|
+-src // 源代码文件夹
|
||||||
|
|
|
||||||
|
+-test //单元测试文件夹
|
||||||
|
|
|
||||||
|
+-main.c // 程序入口
|
||||||
|
+-convert.py //产生测试集的Python脚本
|
||||||
|
+-main.py //将C代码合并到同一个文件的Python脚本
|
||||||
|
+-CMakeLists.txt // CMake文件
|
||||||
|
+-.gitignore //git的忽略文件名录
|
||||||
|
+-README.md // 项目介绍文件
|
||||||
```
|
```
|
||||||
|
|
||||||
再使用`Visual Studio 2022`打开`build`文件夹下的解决方案文件,即可编译。
|
### 编译环境
|
||||||
|
|
||||||
> 或者直接使用VS打开签出分支之后的项目文件夹,也可编译使用。
|
- 编译工具 `cmake 3.23.1`
|
||||||
>
|
- 理论上不依赖特定的编译器
|
||||||
> Visual Studio 2022已经支持用`cmake`管理并编译`C/C++`项目。
|
|
||||||
|
|
||||||
## 使用
|
> `MinGW64 GCC`和`GNU GCC`编译器经过测试可正常编译。
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
### 主界面
|
|
||||||
|
|
||||||
主界面由四个部分组成,分别是最上方的菜单栏,左侧的动画区,右侧的控制面板,下方的日志输出。
|
|
||||||
|
|
||||||
### 使用
|
### 使用
|
||||||
|
|
||||||
首先使用`File-Read ConfigFile`读取一个配置文件,在读取结束后动画区会显示公交车与公交站台,在控制面板的上方会显示当前选择的策略种类。
|
使用
|
||||||
|
|
||||||
使用`Run-Run Bus`和`Run-Stop Bus`控制公交的启动和停止。在开始运行之后,在日志输出区会打印当前的状态。
|
```bash
|
||||||
|
git clone https://github.com/jackfiled/auto_bus.git
|
||||||
|
```
|
||||||
|
|
||||||
在控制面板的下方可以查看当前存在的请求与添加请求。
|
下载完成后文件夹`auto_bus`即为项目的文件夹。
|
||||||
|
|
||||||

|
使用
|
||||||
|
|
||||||
### 策略上的补充说明
|
> 可自行指定使用的编译器
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd auto_bus
|
||||||
|
mkdir build # 创建编译的文件夹
|
||||||
|
cd build
|
||||||
|
cmake .. -G "MinGW Makefiles" # 在第一次生成之后就不必再使用"-G"参数指定编译类型
|
||||||
|
cmake --build .
|
||||||
|
```
|
||||||
|
|
||||||
|
在编译执行完成之后,`build`文件下的`bus.exe`即为编译产生的程序。
|
||||||
|
|
||||||
|
程序具体支持的指令可以查看文档中的说明文档。
|
||||||
|
|
||||||
|
### 测试
|
||||||
|
|
||||||
|
#### 单元测试
|
||||||
|
|
||||||
|
在编译之后,`build/test`文件夹内即为`google test`框架生成的单元测试。
|
||||||
|
|
||||||
|
#### 全局测试
|
||||||
|
|
||||||
|
在编译之后,`build/all_test`内的`bus_all_test.exe`就是全局本地测试程序。
|
||||||
|
|
||||||
|
运行这个程序,根据程序的提示选择适当的测试集,程序会自动读取选定的测试集中的配置文件和输入文件,并且将程序的输出和测试集中的输出文件进行对比,输出比对的结果。
|
||||||
|
|
||||||
|
程序现有的测试集存储在`all_test/test_cases`下面,目前已有18个测试集,对应测试集采用的调度策略可以查看测试集中的配置文件。
|
||||||
|
|
||||||
|
## 支持
|
||||||
|
|
||||||
|
如果你在学习/使用的过程中遇到的任何问题,或者有任何的意见与建议,可以在仓库中提交`Issue`和`Pull Request`同我们讨论。
|
||||||
|
|
||||||
|
当然,也可以给我发电子邮件。
|
||||||
|
|
||||||
|
## 贡献者
|
||||||
|
|
||||||
|
[jackfiled](https://github.com/jackfiled)
|
||||||
|
|
||||||
|
[nvhaizi1](https://github.com/nvhaizi1)
|
||||||
|
|
||||||
|
[Yerolling](https://github.com/Yerolling)
|
||||||
|
|
||||||
|
## 鸣谢
|
||||||
|
|
||||||
|
[GoogleTest](https://github.com/google/googletest)
|
||||||
|
|
||||||
由于GUI的性质,所有的请求都是立即调度的,不同于OJ版的等待一个clock结束之后在进行调度。
|
|
||||||
|
|||||||
@@ -1,8 +0,0 @@
|
|||||||
<RCC>
|
|
||||||
<qresource prefix="/">
|
|
||||||
<file>picture/stop.png</file>
|
|
||||||
</qresource>
|
|
||||||
<qresource prefix="/">
|
|
||||||
<file>picture/bus.png</file>
|
|
||||||
</qresource>
|
|
||||||
</RCC>
|
|
||||||
15
all_test/CMakeLists.txt
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
cmake_minimum_required(VERSION 3.0)
|
||||||
|
project(bus_all_test)
|
||||||
|
|
||||||
|
include_directories(../include)
|
||||||
|
include_directories(include)
|
||||||
|
|
||||||
|
aux_source_directory("../src/" SRCS)
|
||||||
|
aux_source_directory("${CMAKE_CURRENT_SOURCE_DIR}/src" ALL_TEST_SRCS)
|
||||||
|
|
||||||
|
add_executable(bus_all_test ${SRCS} ${ALL_TEST_SRCS} main.c)
|
||||||
|
|
||||||
|
add_custom_command(TARGET bus_all_test POST_BUILD
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E copy_directory
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/test_cases"
|
||||||
|
"$<TARGET_FILE_DIR:bus_all_test>/test_cases")
|
||||||
24
all_test/include/tools.h
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
//
|
||||||
|
// Created by ricardo on 2022/5/20.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef AUTO_PILOT_BUS_TOOLS_H
|
||||||
|
#define AUTO_PILOT_BUS_TOOLS_H
|
||||||
|
#include "stdio.h"
|
||||||
|
#include "string.h"
|
||||||
|
#include "define.h"
|
||||||
|
#include "rail.h"
|
||||||
|
#include "controller.h"
|
||||||
|
|
||||||
|
void ChooseTestCaseInput(char *path, int index);
|
||||||
|
|
||||||
|
void ChooseTestCaseOutput(char *path, int index);
|
||||||
|
|
||||||
|
rail_node_t *ChooseConfigFile(int index);
|
||||||
|
|
||||||
|
void ReadOutputFile(char *result, FILE *f);
|
||||||
|
|
||||||
|
int CheckOutput(char *program_output, char *read_output);
|
||||||
|
|
||||||
|
rail_node_t *ReadChosenConfigFile(char *config_file_path);
|
||||||
|
#endif //AUTO_PILOT_BUS_TOOLS_H
|
||||||
258
all_test/main.c
Normal file
@@ -0,0 +1,258 @@
|
|||||||
|
//
|
||||||
|
// Created by ricardo on 2022/5/20.
|
||||||
|
//
|
||||||
|
#include "bus_io.h"
|
||||||
|
#include "tools.h"
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 输入的字符串
|
||||||
|
*/
|
||||||
|
char input[30];
|
||||||
|
/**
|
||||||
|
* 输出的字符串
|
||||||
|
*/
|
||||||
|
char output[150];
|
||||||
|
/**
|
||||||
|
* the_bus指针的本体
|
||||||
|
*/
|
||||||
|
bus_t main_bus;
|
||||||
|
/**
|
||||||
|
* 公交车前进的方向
|
||||||
|
*/
|
||||||
|
int direction;
|
||||||
|
/**
|
||||||
|
* 完成的请求
|
||||||
|
*/
|
||||||
|
bus_query_t *finished_query;
|
||||||
|
int index;
|
||||||
|
char path[50];
|
||||||
|
char read_output[150];
|
||||||
|
FILE *input_file = NULL;
|
||||||
|
FILE *output_file = NULL;
|
||||||
|
|
||||||
|
printf("Please choose which test case to use:");
|
||||||
|
scanf("%d", &index);
|
||||||
|
|
||||||
|
ChooseTestCaseInput(path, index);
|
||||||
|
input_file = fopen(path, "r");
|
||||||
|
ChooseTestCaseOutput(path, index);
|
||||||
|
output_file = fopen(path, "r");
|
||||||
|
|
||||||
|
// 读取配置文件
|
||||||
|
rails = ChooseConfigFile(index);
|
||||||
|
|
||||||
|
// 制造公交车
|
||||||
|
the_bus = &main_bus;
|
||||||
|
the_bus->distance = 0;
|
||||||
|
the_bus->rail_node_pos = FindNode(rails, 1);
|
||||||
|
|
||||||
|
// 开始时公交车应该是停下的
|
||||||
|
direction = BUS_STOP;
|
||||||
|
|
||||||
|
PrintStateInner(output);
|
||||||
|
ReadOutputFile(read_output, output_file);
|
||||||
|
if(CheckOutput(output, read_output) == BUS_FAlSE)
|
||||||
|
{
|
||||||
|
printf("Right:\n");
|
||||||
|
printf("%s", read_output);
|
||||||
|
printf("Wrong:\n");
|
||||||
|
printf("%s", output);
|
||||||
|
printf("\n"); // 打印一个空白作为分界线
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
printf("%d Ok\n", bus_time);
|
||||||
|
}
|
||||||
|
|
||||||
|
for(;;)
|
||||||
|
{
|
||||||
|
fgets(input, sizeof input, input_file);
|
||||||
|
|
||||||
|
int result = ReadInput(input);
|
||||||
|
if(result == IO_CLOCK)
|
||||||
|
{
|
||||||
|
// 时间流动
|
||||||
|
AddTime();
|
||||||
|
|
||||||
|
switch (chosen_strategy)
|
||||||
|
{
|
||||||
|
case BUS_FCFS:
|
||||||
|
// 如果到站,处理请求和
|
||||||
|
if(JudgeOnStation() == BUS_TRUE)
|
||||||
|
{
|
||||||
|
direction = FCFSDirection(); //在开始得判断一次方向
|
||||||
|
finished_query = FCFSQuery();
|
||||||
|
|
||||||
|
if(finished_query != NULL) // 有请求就处理请求
|
||||||
|
{
|
||||||
|
// 循环处理所有可以处理的请求,总共消耗一秒
|
||||||
|
while (finished_query != NULL)
|
||||||
|
{
|
||||||
|
DeleteQuery(finished_query);
|
||||||
|
finished_query = FCFSQuery();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 请求处理完再进行方向的判断
|
||||||
|
direction = FCFSDirection();
|
||||||
|
}
|
||||||
|
else //如果没有请求就继续前进
|
||||||
|
{
|
||||||
|
RunBus(direction);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
RunBus(direction);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case BUS_SSTF:
|
||||||
|
if(JudgeOnStation() == BUS_TRUE)
|
||||||
|
{
|
||||||
|
// 在没有目标请求的时候,获取一个目标站点
|
||||||
|
if(target_query == NULL)
|
||||||
|
{
|
||||||
|
target_query = SSTFGetQuery();
|
||||||
|
direction = SSTFDirection(target_query);
|
||||||
|
|
||||||
|
// 处理下一个需要处理的请求就在脚底下的情况
|
||||||
|
if(target_query != NULL && direction == BUS_STOP && target_query->node == the_bus->rail_node_pos)
|
||||||
|
{
|
||||||
|
while (target_query != NULL && direction == BUS_STOP && target_query->node == the_bus->rail_node_pos)
|
||||||
|
{
|
||||||
|
DeleteQuery(target_query);
|
||||||
|
target_query = SSTFGetQuery();
|
||||||
|
direction = SSTFDirection(target_query);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
RunBus(direction);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
bus_query_t *btw_query = SSTFBTWQuery(direction);
|
||||||
|
// 如果到站了
|
||||||
|
if(target_query->node == the_bus->rail_node_pos)
|
||||||
|
{
|
||||||
|
// 如果刚好在站点上就有不少请求,处理一波
|
||||||
|
// 这里利用了&&运算符的短路特性,如果第一个判断为假,则不进行下一个判断,也就避免了段错误
|
||||||
|
while (target_query != NULL && target_query->node == the_bus->rail_node_pos)
|
||||||
|
{
|
||||||
|
DeleteQuery(target_query);
|
||||||
|
target_query = SSTFGetQuery();
|
||||||
|
direction = SSTFDirection(target_query);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(btw_query != NULL)
|
||||||
|
{
|
||||||
|
// 如果没有到站就看看能不能顺便服务
|
||||||
|
while (btw_query != NULL)
|
||||||
|
{
|
||||||
|
DeleteQuery(btw_query);
|
||||||
|
btw_query = SSTFBTWQuery(direction);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// 如果啥也不能做就走吧
|
||||||
|
RunBus(direction);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// 没到站的话那就走吧
|
||||||
|
RunBus(direction);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case BUS_SCAN:
|
||||||
|
// 如果没有指定的请求就获得指定的请求
|
||||||
|
if(JudgeOnStation() == BUS_TRUE)
|
||||||
|
{
|
||||||
|
// 在没有目标请求的时候,获取一个目标站点
|
||||||
|
if(target_query == NULL)
|
||||||
|
{
|
||||||
|
target_query = SCANGetQuery(direction);
|
||||||
|
direction = SCANDirection(target_query, direction);
|
||||||
|
|
||||||
|
// 处理下一个需要处理的请求就在脚底下的情况
|
||||||
|
if(target_query != NULL && target_query->node == the_bus->rail_node_pos)
|
||||||
|
{
|
||||||
|
while (target_query != NULL && target_query->node == the_bus->rail_node_pos)
|
||||||
|
{
|
||||||
|
DeleteQuery(target_query);
|
||||||
|
target_query = SSTFGetQuery();
|
||||||
|
direction = SSTFDirection(target_query);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
RunBus(direction);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
bus_query_t *btw_query = SCANBTWQuery();
|
||||||
|
// 如果到站了
|
||||||
|
if(target_query->node == the_bus->rail_node_pos)
|
||||||
|
{
|
||||||
|
// 如果刚好在站点上就有不少请求,处理一波
|
||||||
|
// 这里利用了&&运算符的短路特性,如果第一个判断为假,则不进行下一个判断,也就避免了段错误
|
||||||
|
while (target_query != NULL && target_query->node == the_bus->rail_node_pos)
|
||||||
|
{
|
||||||
|
DeleteQuery(target_query);
|
||||||
|
target_query = SCANGetQuery(direction);
|
||||||
|
direction = SCANDirection(target_query, direction);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(btw_query != NULL)
|
||||||
|
{
|
||||||
|
// 如果没有到站就看看能不能顺便服务
|
||||||
|
while (btw_query != NULL)
|
||||||
|
{
|
||||||
|
DeleteQuery(btw_query);
|
||||||
|
btw_query = SCANBTWQuery();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// 如果啥也不能做就走吧
|
||||||
|
RunBus(direction);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// 没到站的话那就走吧
|
||||||
|
RunBus(direction);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
// 这个分支只是为了符合代码规范而存在,理论上不会用到这个分支
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
PrintStateInner(output);
|
||||||
|
ReadOutputFile(read_output, output_file);
|
||||||
|
if(CheckOutput(output, read_output) == BUS_FAlSE)
|
||||||
|
{
|
||||||
|
printf("Right:\n");
|
||||||
|
printf("%s", read_output);
|
||||||
|
printf("Wrong:\n");
|
||||||
|
printf("%s", output);
|
||||||
|
printf("\n"); // 打印一个空白行作为分界线
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
printf("%d Ok\n", bus_time);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else if(result == IO_END)
|
||||||
|
{
|
||||||
|
printf("end\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//在读取到创建请求的情况下,不做任何事
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,23 +1,92 @@
|
|||||||
//
|
//
|
||||||
// Created by ricardo on 2022/6/27.
|
// Created by ricardo on 2022/5/20.
|
||||||
//
|
//
|
||||||
|
#include "tools.h"
|
||||||
|
|
||||||
#include "StrategyFactory.h"
|
void ChooseTestCaseInput(char *path, int index)
|
||||||
|
|
||||||
BusStrategyBase *StrategyFactory::GetStrategy(const QString& file_name)
|
|
||||||
{
|
{
|
||||||
QByteArray bytes = file_name.toLatin1();
|
memset(path, 0, 50);
|
||||||
|
|
||||||
FILE *config_file = nullptr;
|
char root_path[] = "./test_cases/";
|
||||||
|
char input_file[] = "/input.txt";
|
||||||
|
char case_path[3];
|
||||||
|
|
||||||
|
sprintf(case_path, "%d", index);
|
||||||
|
|
||||||
|
strcat(path, root_path);
|
||||||
|
strcat(path, case_path);
|
||||||
|
strcat(path, input_file);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ChooseTestCaseOutput(char *path, int index)
|
||||||
|
{
|
||||||
|
memset(path, 0, 50);
|
||||||
|
|
||||||
|
char root_path[] = "./test_cases/";
|
||||||
|
char output_file[] = "/output.txt";
|
||||||
|
char case_path[3];
|
||||||
|
|
||||||
|
sprintf(case_path, "%d", index);
|
||||||
|
|
||||||
|
strcat(path, root_path);
|
||||||
|
strcat(path, case_path);
|
||||||
|
strcat(path, output_file);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ReadOutputFile(char *result, FILE *f)
|
||||||
|
{
|
||||||
|
memset(result, 0, 150);
|
||||||
|
|
||||||
|
for(size_t i = 0; i < 7; i++)
|
||||||
|
{
|
||||||
|
char temp[50];
|
||||||
|
fgets(temp, 50, f);
|
||||||
|
strcat(result, temp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int CheckOutput(char *program_output, char *read_output)
|
||||||
|
{
|
||||||
|
int result = strcmp(program_output, read_output);
|
||||||
|
|
||||||
|
if(result == 0)
|
||||||
|
{
|
||||||
|
return BUS_TRUE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return BUS_FAlSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
rail_node_t *ChooseConfigFile(int index)
|
||||||
|
{
|
||||||
|
char root_path[] = "./test_cases/";
|
||||||
|
char config_path[] = "/dict.dic";
|
||||||
|
char case_path[3];
|
||||||
|
|
||||||
|
sprintf(case_path, "%d", index);
|
||||||
|
|
||||||
|
char file_path[30] = {0};
|
||||||
|
|
||||||
|
strcat(file_path, root_path);
|
||||||
|
strcat(file_path, case_path);
|
||||||
|
strcat(file_path, config_path);
|
||||||
|
|
||||||
|
return ReadChosenConfigFile(file_path);
|
||||||
|
}
|
||||||
|
|
||||||
|
rail_node_t *ReadChosenConfigFile(char *config_file_path)
|
||||||
|
{
|
||||||
|
FILE *config_file = NULL;
|
||||||
char buffer[30];
|
char buffer[30];
|
||||||
int total_station = 0;
|
int total_station = 0;
|
||||||
int distance = 0;
|
int distance = 0;
|
||||||
int chosen_strategy = 0;
|
|
||||||
|
|
||||||
fopen_s(&config_file, bytes.data(), "r");
|
config_file = fopen(config_file_path, "r");
|
||||||
|
|
||||||
// 循环读取文件的每一行
|
// 循环读取文件的每一行
|
||||||
while (fgets(buffer, sizeof buffer, config_file) != nullptr)
|
while (fgets(buffer, sizeof buffer, config_file) != NULL)
|
||||||
{
|
{
|
||||||
char first_char = buffer[0];
|
char first_char = buffer[0];
|
||||||
char *p;
|
char *p;
|
||||||
@@ -51,7 +120,6 @@ BusStrategyBase *StrategyFactory::GetStrategy(const QString& file_name)
|
|||||||
case 'S':
|
case 'S':
|
||||||
// STRATEGY
|
// STRATEGY
|
||||||
p = buffer;
|
p = buffer;
|
||||||
|
|
||||||
// 将=前的字符全部略去
|
// 将=前的字符全部略去
|
||||||
while (*p != '=')
|
while (*p != '=')
|
||||||
{
|
{
|
||||||
@@ -103,6 +171,7 @@ BusStrategyBase *StrategyFactory::GetStrategy(const QString& file_name)
|
|||||||
default:
|
default:
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 处理参数去缺省值的情况
|
// 处理参数去缺省值的情况
|
||||||
@@ -119,25 +188,7 @@ BusStrategyBase *StrategyFactory::GetStrategy(const QString& file_name)
|
|||||||
chosen_strategy = BUS_FCFS;
|
chosen_strategy = BUS_FCFS;
|
||||||
}
|
}
|
||||||
|
|
||||||
BusStrategyBase *controller;
|
all_distance = distance * total_station;
|
||||||
|
rail_node_t *head = CreateRails(distance, total_station);
|
||||||
switch (chosen_strategy)
|
return head;
|
||||||
{
|
}
|
||||||
case BUS_FCFS:
|
|
||||||
controller = new BusFCFSStrategy;
|
|
||||||
break;
|
|
||||||
case BUS_SSTF:
|
|
||||||
controller = new BusSSTFStrategy;
|
|
||||||
break;
|
|
||||||
case BUS_SCAN:
|
|
||||||
controller = new BusSCANStrategy;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
controller = nullptr;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
controller->rails_model->CreateRails(distance, total_station);
|
|
||||||
controller->strategy = chosen_strategy;
|
|
||||||
return controller;
|
|
||||||
}
|
|
||||||
3
all_test/test_cases/1/dict.dic
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
TOTAL_STATION = 10
|
||||||
|
STRATEGY = FCFS
|
||||||
|
DISTANCE = 3
|
||||||
21
all_test/test_cases/1/input.txt
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
clock
|
||||||
|
counterclockwise 3
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
target 10
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
end
|
||||||
134
all_test/test_cases/1/output.txt
Normal file
@@ -0,0 +1,134 @@
|
|||||||
|
TIME:0
|
||||||
|
BUS:
|
||||||
|
position:0
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:1
|
||||||
|
BUS:
|
||||||
|
position:0
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:2
|
||||||
|
BUS:
|
||||||
|
position:1
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0010000000
|
||||||
|
TIME:3
|
||||||
|
BUS:
|
||||||
|
position:2
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0010000000
|
||||||
|
TIME:4
|
||||||
|
BUS:
|
||||||
|
position:3
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0010000000
|
||||||
|
TIME:5
|
||||||
|
BUS:
|
||||||
|
position:4
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0010000000
|
||||||
|
TIME:6
|
||||||
|
BUS:
|
||||||
|
position:5
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0010000000
|
||||||
|
TIME:7
|
||||||
|
BUS:
|
||||||
|
position:6
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0010000000
|
||||||
|
TIME:8
|
||||||
|
BUS:
|
||||||
|
position:6
|
||||||
|
target:0000000001
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:9
|
||||||
|
BUS:
|
||||||
|
position:5
|
||||||
|
target:0000000001
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:10
|
||||||
|
BUS:
|
||||||
|
position:4
|
||||||
|
target:0000000001
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:11
|
||||||
|
BUS:
|
||||||
|
position:3
|
||||||
|
target:0000000001
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:12
|
||||||
|
BUS:
|
||||||
|
position:2
|
||||||
|
target:0000000001
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:13
|
||||||
|
BUS:
|
||||||
|
position:1
|
||||||
|
target:0000000001
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:14
|
||||||
|
BUS:
|
||||||
|
position:0
|
||||||
|
target:0000000001
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:15
|
||||||
|
BUS:
|
||||||
|
position:29
|
||||||
|
target:0000000001
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:16
|
||||||
|
BUS:
|
||||||
|
position:28
|
||||||
|
target:0000000001
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:17
|
||||||
|
BUS:
|
||||||
|
position:27
|
||||||
|
target:0000000001
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:18
|
||||||
|
BUS:
|
||||||
|
position:27
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
end
|
||||||
3
all_test/test_cases/10/dict.dic
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
TOTAL_STATION = 10
|
||||||
|
STRATEGY = SSTF
|
||||||
|
#end
|
||||||
11
all_test/test_cases/10/input.txt
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
clock
|
||||||
|
clockwise 8
|
||||||
|
clock
|
||||||
|
clockwise 8
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
end
|
||||||
64
all_test/test_cases/10/output.txt
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
TIME:0
|
||||||
|
BUS:
|
||||||
|
position:0
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:1
|
||||||
|
BUS:
|
||||||
|
position:0
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:2
|
||||||
|
BUS:
|
||||||
|
position:19
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000100
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:3
|
||||||
|
BUS:
|
||||||
|
position:18
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000100
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:4
|
||||||
|
BUS:
|
||||||
|
position:17
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000100
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:5
|
||||||
|
BUS:
|
||||||
|
position:16
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000100
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:6
|
||||||
|
BUS:
|
||||||
|
position:15
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000100
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:7
|
||||||
|
BUS:
|
||||||
|
position:14
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000100
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:8
|
||||||
|
BUS:
|
||||||
|
position:14
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
end
|
||||||
3
all_test/test_cases/11/dict.dic
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
TOTAL_STATION = 10
|
||||||
|
STRATEGY = SSTF
|
||||||
|
#end
|
||||||
14
all_test/test_cases/11/input.txt
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
clock
|
||||||
|
clockwise 8
|
||||||
|
clock
|
||||||
|
clockwise 9
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
end
|
||||||
85
all_test/test_cases/11/output.txt
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
TIME:0
|
||||||
|
BUS:
|
||||||
|
position:0
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:1
|
||||||
|
BUS:
|
||||||
|
position:0
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:2
|
||||||
|
BUS:
|
||||||
|
position:19
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000100
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:3
|
||||||
|
BUS:
|
||||||
|
position:18
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000110
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:4
|
||||||
|
BUS:
|
||||||
|
position:17
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000110
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:5
|
||||||
|
BUS:
|
||||||
|
position:16
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000110
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:6
|
||||||
|
BUS:
|
||||||
|
position:15
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000110
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:7
|
||||||
|
BUS:
|
||||||
|
position:14
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000110
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:8
|
||||||
|
BUS:
|
||||||
|
position:14
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000010
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:9
|
||||||
|
BUS:
|
||||||
|
position:15
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000010
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:10
|
||||||
|
BUS:
|
||||||
|
position:16
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000010
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:11
|
||||||
|
BUS:
|
||||||
|
position:16
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
end
|
||||||
3
all_test/test_cases/12/dict.dic
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
TOTAL_STATION = 10
|
||||||
|
STRATEGY = SSTF
|
||||||
|
#end
|
||||||
14
all_test/test_cases/12/input.txt
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
clock
|
||||||
|
clockwise 4
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
target 3
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
end
|
||||||
85
all_test/test_cases/12/output.txt
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
TIME:0
|
||||||
|
BUS:
|
||||||
|
position:0
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:1
|
||||||
|
BUS:
|
||||||
|
position:0
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:2
|
||||||
|
BUS:
|
||||||
|
position:1
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0001000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:3
|
||||||
|
BUS:
|
||||||
|
position:2
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0001000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:4
|
||||||
|
BUS:
|
||||||
|
position:3
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0001000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:5
|
||||||
|
BUS:
|
||||||
|
position:4
|
||||||
|
target:0010000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0001000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:6
|
||||||
|
BUS:
|
||||||
|
position:4
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0001000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:7
|
||||||
|
BUS:
|
||||||
|
position:5
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0001000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:8
|
||||||
|
BUS:
|
||||||
|
position:6
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0001000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:9
|
||||||
|
BUS:
|
||||||
|
position:6
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:10
|
||||||
|
BUS:
|
||||||
|
position:6
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:11
|
||||||
|
BUS:
|
||||||
|
position:6
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
end
|
||||||
3
all_test/test_cases/13/dict.dic
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
TOTAL_STATION = 10
|
||||||
|
STRATEGY = SSTF
|
||||||
|
#end
|
||||||
16
all_test/test_cases/13/input.txt
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
clock
|
||||||
|
clockwise 4
|
||||||
|
clock
|
||||||
|
clockwise 5
|
||||||
|
clock
|
||||||
|
counterclockwise 4
|
||||||
|
clock
|
||||||
|
target 4
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
end
|
||||||
85
all_test/test_cases/13/output.txt
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
TIME:0
|
||||||
|
BUS:
|
||||||
|
position:0
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:1
|
||||||
|
BUS:
|
||||||
|
position:0
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:2
|
||||||
|
BUS:
|
||||||
|
position:1
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0001000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:3
|
||||||
|
BUS:
|
||||||
|
position:2
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0001100000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:4
|
||||||
|
BUS:
|
||||||
|
position:3
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0001100000
|
||||||
|
counterclockwise:0001000000
|
||||||
|
TIME:5
|
||||||
|
BUS:
|
||||||
|
position:4
|
||||||
|
target:0001000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0001100000
|
||||||
|
counterclockwise:0001000000
|
||||||
|
TIME:6
|
||||||
|
BUS:
|
||||||
|
position:5
|
||||||
|
target:0001000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0001100000
|
||||||
|
counterclockwise:0001000000
|
||||||
|
TIME:7
|
||||||
|
BUS:
|
||||||
|
position:6
|
||||||
|
target:0001000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0001100000
|
||||||
|
counterclockwise:0001000000
|
||||||
|
TIME:8
|
||||||
|
BUS:
|
||||||
|
position:6
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000100000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:9
|
||||||
|
BUS:
|
||||||
|
position:7
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000100000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:10
|
||||||
|
BUS:
|
||||||
|
position:8
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000100000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:11
|
||||||
|
BUS:
|
||||||
|
position:8
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
end
|
||||||
3
all_test/test_cases/14/dict.dic
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
TOTAL_STATION = 10
|
||||||
|
STRATEGY = SSTF
|
||||||
|
#end
|
||||||
12
all_test/test_cases/14/input.txt
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
clock
|
||||||
|
clockwise 2
|
||||||
|
counterclockwise 10
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
end
|
||||||
71
all_test/test_cases/14/output.txt
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
TIME:0
|
||||||
|
BUS:
|
||||||
|
position:0
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:1
|
||||||
|
BUS:
|
||||||
|
position:0
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:2
|
||||||
|
BUS:
|
||||||
|
position:1
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0100000000
|
||||||
|
counterclockwise:0000000001
|
||||||
|
TIME:3
|
||||||
|
BUS:
|
||||||
|
position:2
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0100000000
|
||||||
|
counterclockwise:0000000001
|
||||||
|
TIME:4
|
||||||
|
BUS:
|
||||||
|
position:2
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000000001
|
||||||
|
TIME:5
|
||||||
|
BUS:
|
||||||
|
position:1
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000000001
|
||||||
|
TIME:6
|
||||||
|
BUS:
|
||||||
|
position:0
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000000001
|
||||||
|
TIME:7
|
||||||
|
BUS:
|
||||||
|
position:19
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000000001
|
||||||
|
TIME:8
|
||||||
|
BUS:
|
||||||
|
position:18
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000000001
|
||||||
|
TIME:9
|
||||||
|
BUS:
|
||||||
|
position:18
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
end
|
||||||
3
all_test/test_cases/15/dict.dic
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
TOTAL_STATION = 10
|
||||||
|
STRATEGY = SSTF
|
||||||
|
#end
|
||||||
48
all_test/test_cases/15/input.txt
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
clock
|
||||||
|
clockwise 6
|
||||||
|
clock
|
||||||
|
clockwise 5
|
||||||
|
clock
|
||||||
|
counterclockwise 9
|
||||||
|
clock
|
||||||
|
target 3
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
target 10
|
||||||
|
clockwise 7
|
||||||
|
clock
|
||||||
|
target 1
|
||||||
|
clock
|
||||||
|
counterclockwise 2
|
||||||
|
clock
|
||||||
|
target 4
|
||||||
|
clock
|
||||||
|
target 8
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
end
|
||||||
267
all_test/test_cases/15/output.txt
Normal file
@@ -0,0 +1,267 @@
|
|||||||
|
TIME:0
|
||||||
|
BUS:
|
||||||
|
position:0
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:1
|
||||||
|
BUS:
|
||||||
|
position:0
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:2
|
||||||
|
BUS:
|
||||||
|
position:1
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000010000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:3
|
||||||
|
BUS:
|
||||||
|
position:2
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000110000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:4
|
||||||
|
BUS:
|
||||||
|
position:3
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000110000
|
||||||
|
counterclockwise:0000000010
|
||||||
|
TIME:5
|
||||||
|
BUS:
|
||||||
|
position:4
|
||||||
|
target:0010000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000110000
|
||||||
|
counterclockwise:0000000010
|
||||||
|
TIME:6
|
||||||
|
BUS:
|
||||||
|
position:4
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000110000
|
||||||
|
counterclockwise:0000000010
|
||||||
|
TIME:7
|
||||||
|
BUS:
|
||||||
|
position:5
|
||||||
|
target:0000000001
|
||||||
|
STATION:
|
||||||
|
clockwise:0000111000
|
||||||
|
counterclockwise:0000000010
|
||||||
|
TIME:8
|
||||||
|
BUS:
|
||||||
|
position:6
|
||||||
|
target:1000000001
|
||||||
|
STATION:
|
||||||
|
clockwise:0000111000
|
||||||
|
counterclockwise:0000000010
|
||||||
|
TIME:9
|
||||||
|
BUS:
|
||||||
|
position:7
|
||||||
|
target:1000000001
|
||||||
|
STATION:
|
||||||
|
clockwise:0000111000
|
||||||
|
counterclockwise:0100000010
|
||||||
|
TIME:10
|
||||||
|
BUS:
|
||||||
|
position:8
|
||||||
|
target:1001000001
|
||||||
|
STATION:
|
||||||
|
clockwise:0000111000
|
||||||
|
counterclockwise:0100000010
|
||||||
|
TIME:11
|
||||||
|
BUS:
|
||||||
|
position:8
|
||||||
|
target:1001000101
|
||||||
|
STATION:
|
||||||
|
clockwise:0000011000
|
||||||
|
counterclockwise:0100000010
|
||||||
|
TIME:12
|
||||||
|
BUS:
|
||||||
|
position:9
|
||||||
|
target:1001000101
|
||||||
|
STATION:
|
||||||
|
clockwise:0000011000
|
||||||
|
counterclockwise:0100000010
|
||||||
|
TIME:13
|
||||||
|
BUS:
|
||||||
|
position:10
|
||||||
|
target:1001000101
|
||||||
|
STATION:
|
||||||
|
clockwise:0000011000
|
||||||
|
counterclockwise:0100000010
|
||||||
|
TIME:14
|
||||||
|
BUS:
|
||||||
|
position:10
|
||||||
|
target:1001000101
|
||||||
|
STATION:
|
||||||
|
clockwise:0000001000
|
||||||
|
counterclockwise:0100000010
|
||||||
|
TIME:15
|
||||||
|
BUS:
|
||||||
|
position:11
|
||||||
|
target:1001000101
|
||||||
|
STATION:
|
||||||
|
clockwise:0000001000
|
||||||
|
counterclockwise:0100000010
|
||||||
|
TIME:16
|
||||||
|
BUS:
|
||||||
|
position:12
|
||||||
|
target:1001000101
|
||||||
|
STATION:
|
||||||
|
clockwise:0000001000
|
||||||
|
counterclockwise:0100000010
|
||||||
|
TIME:17
|
||||||
|
BUS:
|
||||||
|
position:12
|
||||||
|
target:1001000101
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0100000010
|
||||||
|
TIME:18
|
||||||
|
BUS:
|
||||||
|
position:13
|
||||||
|
target:1001000101
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0100000010
|
||||||
|
TIME:19
|
||||||
|
BUS:
|
||||||
|
position:14
|
||||||
|
target:1001000101
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0100000010
|
||||||
|
TIME:20
|
||||||
|
BUS:
|
||||||
|
position:14
|
||||||
|
target:1001000001
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0100000010
|
||||||
|
TIME:21
|
||||||
|
BUS:
|
||||||
|
position:15
|
||||||
|
target:1001000001
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0100000010
|
||||||
|
TIME:22
|
||||||
|
BUS:
|
||||||
|
position:16
|
||||||
|
target:1001000001
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0100000010
|
||||||
|
TIME:23
|
||||||
|
BUS:
|
||||||
|
position:16
|
||||||
|
target:1001000001
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0100000000
|
||||||
|
TIME:24
|
||||||
|
BUS:
|
||||||
|
position:17
|
||||||
|
target:1001000001
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0100000000
|
||||||
|
TIME:25
|
||||||
|
BUS:
|
||||||
|
position:18
|
||||||
|
target:1001000001
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0100000000
|
||||||
|
TIME:26
|
||||||
|
BUS:
|
||||||
|
position:18
|
||||||
|
target:1001000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0100000000
|
||||||
|
TIME:27
|
||||||
|
BUS:
|
||||||
|
position:19
|
||||||
|
target:1001000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0100000000
|
||||||
|
TIME:28
|
||||||
|
BUS:
|
||||||
|
position:0
|
||||||
|
target:1001000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0100000000
|
||||||
|
TIME:29
|
||||||
|
BUS:
|
||||||
|
position:0
|
||||||
|
target:0001000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0100000000
|
||||||
|
TIME:30
|
||||||
|
BUS:
|
||||||
|
position:1
|
||||||
|
target:0001000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0100000000
|
||||||
|
TIME:31
|
||||||
|
BUS:
|
||||||
|
position:2
|
||||||
|
target:0001000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0100000000
|
||||||
|
TIME:32
|
||||||
|
BUS:
|
||||||
|
position:2
|
||||||
|
target:0001000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:33
|
||||||
|
BUS:
|
||||||
|
position:3
|
||||||
|
target:0001000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:34
|
||||||
|
BUS:
|
||||||
|
position:4
|
||||||
|
target:0001000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:35
|
||||||
|
BUS:
|
||||||
|
position:5
|
||||||
|
target:0001000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:36
|
||||||
|
BUS:
|
||||||
|
position:6
|
||||||
|
target:0001000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:37
|
||||||
|
BUS:
|
||||||
|
position:6
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
end
|
||||||
3
all_test/test_cases/16/dict.dic
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
TOTAL_STATION = 10
|
||||||
|
STRATEGY = SSTF
|
||||||
|
#end
|
||||||
24
all_test/test_cases/16/input.txt
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
clock
|
||||||
|
clockwise 8
|
||||||
|
clock
|
||||||
|
counterclockwise 9
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clockwise 6
|
||||||
|
clock
|
||||||
|
counterclockwise 7
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
end
|
||||||
141
all_test/test_cases/16/output.txt
Normal file
@@ -0,0 +1,141 @@
|
|||||||
|
TIME:0
|
||||||
|
BUS:
|
||||||
|
position:0
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:1
|
||||||
|
BUS:
|
||||||
|
position:0
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:2
|
||||||
|
BUS:
|
||||||
|
position:19
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000100
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:3
|
||||||
|
BUS:
|
||||||
|
position:18
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000100
|
||||||
|
counterclockwise:0000000010
|
||||||
|
TIME:4
|
||||||
|
BUS:
|
||||||
|
position:17
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000100
|
||||||
|
counterclockwise:0000000010
|
||||||
|
TIME:5
|
||||||
|
BUS:
|
||||||
|
position:16
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000100
|
||||||
|
counterclockwise:0000000010
|
||||||
|
TIME:6
|
||||||
|
BUS:
|
||||||
|
position:16
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000100
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:7
|
||||||
|
BUS:
|
||||||
|
position:15
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000100
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:8
|
||||||
|
BUS:
|
||||||
|
position:14
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000100
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:9
|
||||||
|
BUS:
|
||||||
|
position:14
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:10
|
||||||
|
BUS:
|
||||||
|
position:14
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:11
|
||||||
|
BUS:
|
||||||
|
position:14
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:12
|
||||||
|
BUS:
|
||||||
|
position:13
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000010000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:13
|
||||||
|
BUS:
|
||||||
|
position:12
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000010000
|
||||||
|
counterclockwise:0000001000
|
||||||
|
TIME:14
|
||||||
|
BUS:
|
||||||
|
position:12
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000010000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:15
|
||||||
|
BUS:
|
||||||
|
position:11
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000010000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:16
|
||||||
|
BUS:
|
||||||
|
position:10
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000010000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:17
|
||||||
|
BUS:
|
||||||
|
position:10
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:18
|
||||||
|
BUS:
|
||||||
|
position:10
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:19
|
||||||
|
BUS:
|
||||||
|
position:10
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
end
|
||||||
3
all_test/test_cases/17/dict.dic
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
TOTAL_STATION = 10
|
||||||
|
STRATEGY = SSTF
|
||||||
|
#end
|
||||||
15
all_test/test_cases/17/input.txt
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
clock
|
||||||
|
counterclockwise 6
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
end
|
||||||
99
all_test/test_cases/17/output.txt
Normal file
@@ -0,0 +1,99 @@
|
|||||||
|
TIME:0
|
||||||
|
BUS:
|
||||||
|
position:0
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:1
|
||||||
|
BUS:
|
||||||
|
position:0
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:2
|
||||||
|
BUS:
|
||||||
|
position:1
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000010000
|
||||||
|
TIME:3
|
||||||
|
BUS:
|
||||||
|
position:2
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000010000
|
||||||
|
TIME:4
|
||||||
|
BUS:
|
||||||
|
position:3
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000010000
|
||||||
|
TIME:5
|
||||||
|
BUS:
|
||||||
|
position:4
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000010000
|
||||||
|
TIME:6
|
||||||
|
BUS:
|
||||||
|
position:5
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000010000
|
||||||
|
TIME:7
|
||||||
|
BUS:
|
||||||
|
position:6
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000010000
|
||||||
|
TIME:8
|
||||||
|
BUS:
|
||||||
|
position:7
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000010000
|
||||||
|
TIME:9
|
||||||
|
BUS:
|
||||||
|
position:8
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000010000
|
||||||
|
TIME:10
|
||||||
|
BUS:
|
||||||
|
position:9
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000010000
|
||||||
|
TIME:11
|
||||||
|
BUS:
|
||||||
|
position:10
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000010000
|
||||||
|
TIME:12
|
||||||
|
BUS:
|
||||||
|
position:10
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:13
|
||||||
|
BUS:
|
||||||
|
position:10
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
end
|
||||||
3
all_test/test_cases/18/dict.dic
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
TOTAL_STATION = 10
|
||||||
|
DISTANCE = 3
|
||||||
|
STRATEGY = SCAN
|
||||||
57
all_test/test_cases/18/input.txt
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
clock
|
||||||
|
clockwise 7
|
||||||
|
clockwise 2
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
target 7
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
counterclockwise 7
|
||||||
|
clockwise 2
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
target 2
|
||||||
|
target 3
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
target 1
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
end
|
||||||
344
all_test/test_cases/18/output.txt
Normal file
@@ -0,0 +1,344 @@
|
|||||||
|
TIME:0
|
||||||
|
BUS:
|
||||||
|
position:0
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:1
|
||||||
|
BUS:
|
||||||
|
position:0
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:2
|
||||||
|
BUS:
|
||||||
|
position:1
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0100001000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:3
|
||||||
|
BUS:
|
||||||
|
position:2
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0100001000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:4
|
||||||
|
BUS:
|
||||||
|
position:3
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0100001000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:5
|
||||||
|
BUS:
|
||||||
|
position:3
|
||||||
|
target:0000001000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000001000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:6
|
||||||
|
BUS:
|
||||||
|
position:4
|
||||||
|
target:0000001000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000001000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:7
|
||||||
|
BUS:
|
||||||
|
position:5
|
||||||
|
target:0000001000
|
||||||
|
STATION:
|
||||||
|
clockwise:0100001000
|
||||||
|
counterclockwise:0000001000
|
||||||
|
TIME:8
|
||||||
|
BUS:
|
||||||
|
position:6
|
||||||
|
target:0000001000
|
||||||
|
STATION:
|
||||||
|
clockwise:0100001000
|
||||||
|
counterclockwise:0000001000
|
||||||
|
TIME:9
|
||||||
|
BUS:
|
||||||
|
position:7
|
||||||
|
target:0000001000
|
||||||
|
STATION:
|
||||||
|
clockwise:0100001000
|
||||||
|
counterclockwise:0000001000
|
||||||
|
TIME:10
|
||||||
|
BUS:
|
||||||
|
position:8
|
||||||
|
target:0000001000
|
||||||
|
STATION:
|
||||||
|
clockwise:0100001000
|
||||||
|
counterclockwise:0000001000
|
||||||
|
TIME:11
|
||||||
|
BUS:
|
||||||
|
position:9
|
||||||
|
target:0000001000
|
||||||
|
STATION:
|
||||||
|
clockwise:0100001000
|
||||||
|
counterclockwise:0000001000
|
||||||
|
TIME:12
|
||||||
|
BUS:
|
||||||
|
position:10
|
||||||
|
target:0000001000
|
||||||
|
STATION:
|
||||||
|
clockwise:0100001000
|
||||||
|
counterclockwise:0000001000
|
||||||
|
TIME:13
|
||||||
|
BUS:
|
||||||
|
position:11
|
||||||
|
target:0000001000
|
||||||
|
STATION:
|
||||||
|
clockwise:0100001000
|
||||||
|
counterclockwise:0000001000
|
||||||
|
TIME:14
|
||||||
|
BUS:
|
||||||
|
position:12
|
||||||
|
target:0000001000
|
||||||
|
STATION:
|
||||||
|
clockwise:0100001000
|
||||||
|
counterclockwise:0000001000
|
||||||
|
TIME:15
|
||||||
|
BUS:
|
||||||
|
position:13
|
||||||
|
target:0000001000
|
||||||
|
STATION:
|
||||||
|
clockwise:0100001000
|
||||||
|
counterclockwise:0000001000
|
||||||
|
TIME:16
|
||||||
|
BUS:
|
||||||
|
position:14
|
||||||
|
target:0000001000
|
||||||
|
STATION:
|
||||||
|
clockwise:0100001000
|
||||||
|
counterclockwise:0000001000
|
||||||
|
TIME:17
|
||||||
|
BUS:
|
||||||
|
position:15
|
||||||
|
target:0000001000
|
||||||
|
STATION:
|
||||||
|
clockwise:0100001000
|
||||||
|
counterclockwise:0000001000
|
||||||
|
TIME:18
|
||||||
|
BUS:
|
||||||
|
position:16
|
||||||
|
target:0000001000
|
||||||
|
STATION:
|
||||||
|
clockwise:0100001000
|
||||||
|
counterclockwise:0000001000
|
||||||
|
TIME:19
|
||||||
|
BUS:
|
||||||
|
position:17
|
||||||
|
target:0000001000
|
||||||
|
STATION:
|
||||||
|
clockwise:0100001000
|
||||||
|
counterclockwise:0000001000
|
||||||
|
TIME:20
|
||||||
|
BUS:
|
||||||
|
position:18
|
||||||
|
target:0000001000
|
||||||
|
STATION:
|
||||||
|
clockwise:0100001000
|
||||||
|
counterclockwise:0000001000
|
||||||
|
TIME:21
|
||||||
|
BUS:
|
||||||
|
position:18
|
||||||
|
target:0110000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0100000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:22
|
||||||
|
BUS:
|
||||||
|
position:19
|
||||||
|
target:0110000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0100000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:23
|
||||||
|
BUS:
|
||||||
|
position:20
|
||||||
|
target:0110000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0100000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:24
|
||||||
|
BUS:
|
||||||
|
position:21
|
||||||
|
target:0110000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0100000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:25
|
||||||
|
BUS:
|
||||||
|
position:22
|
||||||
|
target:0110000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0100000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:26
|
||||||
|
BUS:
|
||||||
|
position:23
|
||||||
|
target:0110000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0100000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:27
|
||||||
|
BUS:
|
||||||
|
position:24
|
||||||
|
target:0110000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0100000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:28
|
||||||
|
BUS:
|
||||||
|
position:25
|
||||||
|
target:0110000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0100000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:29
|
||||||
|
BUS:
|
||||||
|
position:26
|
||||||
|
target:0110000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0100000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:30
|
||||||
|
BUS:
|
||||||
|
position:27
|
||||||
|
target:0110000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0100000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:31
|
||||||
|
BUS:
|
||||||
|
position:28
|
||||||
|
target:0110000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0100000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:32
|
||||||
|
BUS:
|
||||||
|
position:29
|
||||||
|
target:0110000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0100000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:33
|
||||||
|
BUS:
|
||||||
|
position:0
|
||||||
|
target:0110000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0100000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:34
|
||||||
|
BUS:
|
||||||
|
position:1
|
||||||
|
target:0110000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0100000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:35
|
||||||
|
BUS:
|
||||||
|
position:2
|
||||||
|
target:0110000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0100000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:36
|
||||||
|
BUS:
|
||||||
|
position:3
|
||||||
|
target:0110000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0100000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:37
|
||||||
|
BUS:
|
||||||
|
position:3
|
||||||
|
target:1010000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:38
|
||||||
|
BUS:
|
||||||
|
position:4
|
||||||
|
target:1010000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:39
|
||||||
|
BUS:
|
||||||
|
position:5
|
||||||
|
target:1010000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:40
|
||||||
|
BUS:
|
||||||
|
position:6
|
||||||
|
target:1010000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:41
|
||||||
|
BUS:
|
||||||
|
position:6
|
||||||
|
target:1000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:42
|
||||||
|
BUS:
|
||||||
|
position:5
|
||||||
|
target:1000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:43
|
||||||
|
BUS:
|
||||||
|
position:4
|
||||||
|
target:1000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:44
|
||||||
|
BUS:
|
||||||
|
position:3
|
||||||
|
target:1000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:45
|
||||||
|
BUS:
|
||||||
|
position:2
|
||||||
|
target:1000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:46
|
||||||
|
BUS:
|
||||||
|
position:1
|
||||||
|
target:1000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:47
|
||||||
|
BUS:
|
||||||
|
position:0
|
||||||
|
target:1000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:48
|
||||||
|
BUS:
|
||||||
|
position:0
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
end
|
||||||
4
all_test/test_cases/2/dict.dic
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
# first come first serve
|
||||||
|
STRATEGY = FCFS
|
||||||
|
TOTAL_STATION = 10
|
||||||
|
DISTANCE = 2
|
||||||
30
all_test/test_cases/2/input.txt
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
clock
|
||||||
|
clockwise 2
|
||||||
|
clock
|
||||||
|
clockwise 4
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clockwise 6
|
||||||
|
clock
|
||||||
|
target 8
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
target 10
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
end
|
||||||
176
all_test/test_cases/2/output.txt
Normal file
@@ -0,0 +1,176 @@
|
|||||||
|
TIME:0
|
||||||
|
BUS:
|
||||||
|
position:0
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:1
|
||||||
|
BUS:
|
||||||
|
position:0
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:2
|
||||||
|
BUS:
|
||||||
|
position:1
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0100000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:3
|
||||||
|
BUS:
|
||||||
|
position:2
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0101000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:4
|
||||||
|
BUS:
|
||||||
|
position:2
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0001000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:5
|
||||||
|
BUS:
|
||||||
|
position:3
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0001010000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:6
|
||||||
|
BUS:
|
||||||
|
position:4
|
||||||
|
target:0000000100
|
||||||
|
STATION:
|
||||||
|
clockwise:0001010000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:7
|
||||||
|
BUS:
|
||||||
|
position:5
|
||||||
|
target:0000000100
|
||||||
|
STATION:
|
||||||
|
clockwise:0001010000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:8
|
||||||
|
BUS:
|
||||||
|
position:6
|
||||||
|
target:0000000100
|
||||||
|
STATION:
|
||||||
|
clockwise:0001010000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:9
|
||||||
|
BUS:
|
||||||
|
position:6
|
||||||
|
target:0000000101
|
||||||
|
STATION:
|
||||||
|
clockwise:0000010000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:10
|
||||||
|
BUS:
|
||||||
|
position:7
|
||||||
|
target:0000000101
|
||||||
|
STATION:
|
||||||
|
clockwise:0000010000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:11
|
||||||
|
BUS:
|
||||||
|
position:8
|
||||||
|
target:0000000101
|
||||||
|
STATION:
|
||||||
|
clockwise:0000010000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:12
|
||||||
|
BUS:
|
||||||
|
position:9
|
||||||
|
target:0000000101
|
||||||
|
STATION:
|
||||||
|
clockwise:0000010000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:13
|
||||||
|
BUS:
|
||||||
|
position:10
|
||||||
|
target:0000000101
|
||||||
|
STATION:
|
||||||
|
clockwise:0000010000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:14
|
||||||
|
BUS:
|
||||||
|
position:10
|
||||||
|
target:0000000101
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:15
|
||||||
|
BUS:
|
||||||
|
position:11
|
||||||
|
target:0000000101
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:16
|
||||||
|
BUS:
|
||||||
|
position:12
|
||||||
|
target:0000000101
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:17
|
||||||
|
BUS:
|
||||||
|
position:13
|
||||||
|
target:0000000101
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:18
|
||||||
|
BUS:
|
||||||
|
position:14
|
||||||
|
target:0000000101
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:19
|
||||||
|
BUS:
|
||||||
|
position:14
|
||||||
|
target:0000000001
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:20
|
||||||
|
BUS:
|
||||||
|
position:15
|
||||||
|
target:0000000001
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:21
|
||||||
|
BUS:
|
||||||
|
position:16
|
||||||
|
target:0000000001
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:22
|
||||||
|
BUS:
|
||||||
|
position:17
|
||||||
|
target:0000000001
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:23
|
||||||
|
BUS:
|
||||||
|
position:18
|
||||||
|
target:0000000001
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:24
|
||||||
|
BUS:
|
||||||
|
position:18
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
end
|
||||||
4
all_test/test_cases/3/dict.dic
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
# first come first serve
|
||||||
|
STRATEGY = FCFS
|
||||||
|
TOTAL_STATION = 10
|
||||||
|
DISTANCE = 2
|
||||||
30
all_test/test_cases/3/input.txt
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
clock
|
||||||
|
clockwise 2
|
||||||
|
clock
|
||||||
|
target 10
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clockwise 3
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
target 9
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
end
|
||||||
183
all_test/test_cases/3/output.txt
Normal file
@@ -0,0 +1,183 @@
|
|||||||
|
TIME:0
|
||||||
|
BUS:
|
||||||
|
position:0
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:1
|
||||||
|
BUS:
|
||||||
|
position:0
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:2
|
||||||
|
BUS:
|
||||||
|
position:1
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0100000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:3
|
||||||
|
BUS:
|
||||||
|
position:2
|
||||||
|
target:0000000001
|
||||||
|
STATION:
|
||||||
|
clockwise:0100000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:4
|
||||||
|
BUS:
|
||||||
|
position:2
|
||||||
|
target:0000000001
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:5
|
||||||
|
BUS:
|
||||||
|
position:1
|
||||||
|
target:0000000001
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:6
|
||||||
|
BUS:
|
||||||
|
position:0
|
||||||
|
target:0000000001
|
||||||
|
STATION:
|
||||||
|
clockwise:0010000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:7
|
||||||
|
BUS:
|
||||||
|
position:19
|
||||||
|
target:0000000001
|
||||||
|
STATION:
|
||||||
|
clockwise:0010000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:8
|
||||||
|
BUS:
|
||||||
|
position:18
|
||||||
|
target:0000000011
|
||||||
|
STATION:
|
||||||
|
clockwise:0010000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:9
|
||||||
|
BUS:
|
||||||
|
position:18
|
||||||
|
target:0000000010
|
||||||
|
STATION:
|
||||||
|
clockwise:0010000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:10
|
||||||
|
BUS:
|
||||||
|
position:19
|
||||||
|
target:0000000010
|
||||||
|
STATION:
|
||||||
|
clockwise:0010000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:11
|
||||||
|
BUS:
|
||||||
|
position:0
|
||||||
|
target:0000000010
|
||||||
|
STATION:
|
||||||
|
clockwise:0010000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:12
|
||||||
|
BUS:
|
||||||
|
position:1
|
||||||
|
target:0000000010
|
||||||
|
STATION:
|
||||||
|
clockwise:0010000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:13
|
||||||
|
BUS:
|
||||||
|
position:2
|
||||||
|
target:0000000010
|
||||||
|
STATION:
|
||||||
|
clockwise:0010000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:14
|
||||||
|
BUS:
|
||||||
|
position:3
|
||||||
|
target:0000000010
|
||||||
|
STATION:
|
||||||
|
clockwise:0010000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:15
|
||||||
|
BUS:
|
||||||
|
position:4
|
||||||
|
target:0000000010
|
||||||
|
STATION:
|
||||||
|
clockwise:0010000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:16
|
||||||
|
BUS:
|
||||||
|
position:4
|
||||||
|
target:0000000010
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:17
|
||||||
|
BUS:
|
||||||
|
position:3
|
||||||
|
target:0000000010
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:18
|
||||||
|
BUS:
|
||||||
|
position:2
|
||||||
|
target:0000000010
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:19
|
||||||
|
BUS:
|
||||||
|
position:1
|
||||||
|
target:0000000010
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:20
|
||||||
|
BUS:
|
||||||
|
position:0
|
||||||
|
target:0000000010
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:21
|
||||||
|
BUS:
|
||||||
|
position:19
|
||||||
|
target:0000000010
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:22
|
||||||
|
BUS:
|
||||||
|
position:18
|
||||||
|
target:0000000010
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:23
|
||||||
|
BUS:
|
||||||
|
position:17
|
||||||
|
target:0000000010
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:24
|
||||||
|
BUS:
|
||||||
|
position:16
|
||||||
|
target:0000000010
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:25
|
||||||
|
BUS:
|
||||||
|
position:16
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
end
|
||||||
4
all_test/test_cases/4/dict.dic
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
DISTANCE = 4
|
||||||
|
STRATEGY = SCAN
|
||||||
|
TOTAL_STATION = 6
|
||||||
|
# scan serve
|
||||||
34
all_test/test_cases/4/input.txt
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
clock
|
||||||
|
clockwise 2
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
counterclockwise 6
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
target 1
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
counterclockwise 5
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
end
|
||||||
211
all_test/test_cases/4/output.txt
Normal file
@@ -0,0 +1,211 @@
|
|||||||
|
TIME:0
|
||||||
|
BUS:
|
||||||
|
position:0
|
||||||
|
target:000000
|
||||||
|
STATION:
|
||||||
|
clockwise:000000
|
||||||
|
counterclockwise:000000
|
||||||
|
TIME:1
|
||||||
|
BUS:
|
||||||
|
position:0
|
||||||
|
target:000000
|
||||||
|
STATION:
|
||||||
|
clockwise:000000
|
||||||
|
counterclockwise:000000
|
||||||
|
TIME:2
|
||||||
|
BUS:
|
||||||
|
position:1
|
||||||
|
target:000000
|
||||||
|
STATION:
|
||||||
|
clockwise:010000
|
||||||
|
counterclockwise:000000
|
||||||
|
TIME:3
|
||||||
|
BUS:
|
||||||
|
position:2
|
||||||
|
target:000000
|
||||||
|
STATION:
|
||||||
|
clockwise:010000
|
||||||
|
counterclockwise:000000
|
||||||
|
TIME:4
|
||||||
|
BUS:
|
||||||
|
position:3
|
||||||
|
target:000000
|
||||||
|
STATION:
|
||||||
|
clockwise:010000
|
||||||
|
counterclockwise:000001
|
||||||
|
TIME:5
|
||||||
|
BUS:
|
||||||
|
position:4
|
||||||
|
target:000000
|
||||||
|
STATION:
|
||||||
|
clockwise:010000
|
||||||
|
counterclockwise:000001
|
||||||
|
TIME:6
|
||||||
|
BUS:
|
||||||
|
position:4
|
||||||
|
target:000000
|
||||||
|
STATION:
|
||||||
|
clockwise:000000
|
||||||
|
counterclockwise:000001
|
||||||
|
TIME:7
|
||||||
|
BUS:
|
||||||
|
position:3
|
||||||
|
target:000000
|
||||||
|
STATION:
|
||||||
|
clockwise:000000
|
||||||
|
counterclockwise:000001
|
||||||
|
TIME:8
|
||||||
|
BUS:
|
||||||
|
position:2
|
||||||
|
target:000000
|
||||||
|
STATION:
|
||||||
|
clockwise:000000
|
||||||
|
counterclockwise:000001
|
||||||
|
TIME:9
|
||||||
|
BUS:
|
||||||
|
position:1
|
||||||
|
target:000000
|
||||||
|
STATION:
|
||||||
|
clockwise:000000
|
||||||
|
counterclockwise:000001
|
||||||
|
TIME:10
|
||||||
|
BUS:
|
||||||
|
position:0
|
||||||
|
target:000000
|
||||||
|
STATION:
|
||||||
|
clockwise:000000
|
||||||
|
counterclockwise:000001
|
||||||
|
TIME:11
|
||||||
|
BUS:
|
||||||
|
position:23
|
||||||
|
target:000000
|
||||||
|
STATION:
|
||||||
|
clockwise:000000
|
||||||
|
counterclockwise:000001
|
||||||
|
TIME:12
|
||||||
|
BUS:
|
||||||
|
position:22
|
||||||
|
target:100000
|
||||||
|
STATION:
|
||||||
|
clockwise:000000
|
||||||
|
counterclockwise:000001
|
||||||
|
TIME:13
|
||||||
|
BUS:
|
||||||
|
position:21
|
||||||
|
target:100000
|
||||||
|
STATION:
|
||||||
|
clockwise:000000
|
||||||
|
counterclockwise:000001
|
||||||
|
TIME:14
|
||||||
|
BUS:
|
||||||
|
position:20
|
||||||
|
target:100000
|
||||||
|
STATION:
|
||||||
|
clockwise:000000
|
||||||
|
counterclockwise:000001
|
||||||
|
TIME:15
|
||||||
|
BUS:
|
||||||
|
position:20
|
||||||
|
target:100000
|
||||||
|
STATION:
|
||||||
|
clockwise:000000
|
||||||
|
counterclockwise:000000
|
||||||
|
TIME:16
|
||||||
|
BUS:
|
||||||
|
position:21
|
||||||
|
target:100000
|
||||||
|
STATION:
|
||||||
|
clockwise:000000
|
||||||
|
counterclockwise:000000
|
||||||
|
TIME:17
|
||||||
|
BUS:
|
||||||
|
position:22
|
||||||
|
target:100000
|
||||||
|
STATION:
|
||||||
|
clockwise:000000
|
||||||
|
counterclockwise:000000
|
||||||
|
TIME:18
|
||||||
|
BUS:
|
||||||
|
position:23
|
||||||
|
target:100000
|
||||||
|
STATION:
|
||||||
|
clockwise:000000
|
||||||
|
counterclockwise:000010
|
||||||
|
TIME:19
|
||||||
|
BUS:
|
||||||
|
position:0
|
||||||
|
target:100000
|
||||||
|
STATION:
|
||||||
|
clockwise:000000
|
||||||
|
counterclockwise:000010
|
||||||
|
TIME:20
|
||||||
|
BUS:
|
||||||
|
position:0
|
||||||
|
target:000000
|
||||||
|
STATION:
|
||||||
|
clockwise:000000
|
||||||
|
counterclockwise:000010
|
||||||
|
TIME:21
|
||||||
|
BUS:
|
||||||
|
position:23
|
||||||
|
target:000000
|
||||||
|
STATION:
|
||||||
|
clockwise:000000
|
||||||
|
counterclockwise:000010
|
||||||
|
TIME:22
|
||||||
|
BUS:
|
||||||
|
position:22
|
||||||
|
target:000000
|
||||||
|
STATION:
|
||||||
|
clockwise:000000
|
||||||
|
counterclockwise:000010
|
||||||
|
TIME:23
|
||||||
|
BUS:
|
||||||
|
position:21
|
||||||
|
target:000000
|
||||||
|
STATION:
|
||||||
|
clockwise:000000
|
||||||
|
counterclockwise:000010
|
||||||
|
TIME:24
|
||||||
|
BUS:
|
||||||
|
position:20
|
||||||
|
target:000000
|
||||||
|
STATION:
|
||||||
|
clockwise:000000
|
||||||
|
counterclockwise:000010
|
||||||
|
TIME:25
|
||||||
|
BUS:
|
||||||
|
position:19
|
||||||
|
target:000000
|
||||||
|
STATION:
|
||||||
|
clockwise:000000
|
||||||
|
counterclockwise:000010
|
||||||
|
TIME:26
|
||||||
|
BUS:
|
||||||
|
position:18
|
||||||
|
target:000000
|
||||||
|
STATION:
|
||||||
|
clockwise:000000
|
||||||
|
counterclockwise:000010
|
||||||
|
TIME:27
|
||||||
|
BUS:
|
||||||
|
position:17
|
||||||
|
target:000000
|
||||||
|
STATION:
|
||||||
|
clockwise:000000
|
||||||
|
counterclockwise:000010
|
||||||
|
TIME:28
|
||||||
|
BUS:
|
||||||
|
position:16
|
||||||
|
target:000000
|
||||||
|
STATION:
|
||||||
|
clockwise:000000
|
||||||
|
counterclockwise:000010
|
||||||
|
TIME:29
|
||||||
|
BUS:
|
||||||
|
position:16
|
||||||
|
target:000000
|
||||||
|
STATION:
|
||||||
|
clockwise:000000
|
||||||
|
counterclockwise:000000
|
||||||
|
end
|
||||||
4
all_test/test_cases/5/dict.dic
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
DISTANCE = 4
|
||||||
|
STRATEGY = SCAN
|
||||||
|
TOTAL_STATION = 6
|
||||||
|
# scan serve
|
||||||
26
all_test/test_cases/5/input.txt
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
clock
|
||||||
|
clockwise 2
|
||||||
|
counterclockwise 3
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
target 4
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clockwise 5
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
end
|
||||||
155
all_test/test_cases/5/output.txt
Normal file
@@ -0,0 +1,155 @@
|
|||||||
|
TIME:0
|
||||||
|
BUS:
|
||||||
|
position:0
|
||||||
|
target:000000
|
||||||
|
STATION:
|
||||||
|
clockwise:000000
|
||||||
|
counterclockwise:000000
|
||||||
|
TIME:1
|
||||||
|
BUS:
|
||||||
|
position:0
|
||||||
|
target:000000
|
||||||
|
STATION:
|
||||||
|
clockwise:000000
|
||||||
|
counterclockwise:000000
|
||||||
|
TIME:2
|
||||||
|
BUS:
|
||||||
|
position:1
|
||||||
|
target:000000
|
||||||
|
STATION:
|
||||||
|
clockwise:010000
|
||||||
|
counterclockwise:001000
|
||||||
|
TIME:3
|
||||||
|
BUS:
|
||||||
|
position:2
|
||||||
|
target:000000
|
||||||
|
STATION:
|
||||||
|
clockwise:010000
|
||||||
|
counterclockwise:001000
|
||||||
|
TIME:4
|
||||||
|
BUS:
|
||||||
|
position:3
|
||||||
|
target:000000
|
||||||
|
STATION:
|
||||||
|
clockwise:010000
|
||||||
|
counterclockwise:001000
|
||||||
|
TIME:5
|
||||||
|
BUS:
|
||||||
|
position:4
|
||||||
|
target:000000
|
||||||
|
STATION:
|
||||||
|
clockwise:010000
|
||||||
|
counterclockwise:001000
|
||||||
|
TIME:6
|
||||||
|
BUS:
|
||||||
|
position:4
|
||||||
|
target:000000
|
||||||
|
STATION:
|
||||||
|
clockwise:000000
|
||||||
|
counterclockwise:001000
|
||||||
|
TIME:7
|
||||||
|
BUS:
|
||||||
|
position:5
|
||||||
|
target:000000
|
||||||
|
STATION:
|
||||||
|
clockwise:000000
|
||||||
|
counterclockwise:001000
|
||||||
|
TIME:8
|
||||||
|
BUS:
|
||||||
|
position:6
|
||||||
|
target:000100
|
||||||
|
STATION:
|
||||||
|
clockwise:000000
|
||||||
|
counterclockwise:001000
|
||||||
|
TIME:9
|
||||||
|
BUS:
|
||||||
|
position:7
|
||||||
|
target:000100
|
||||||
|
STATION:
|
||||||
|
clockwise:000000
|
||||||
|
counterclockwise:001000
|
||||||
|
TIME:10
|
||||||
|
BUS:
|
||||||
|
position:8
|
||||||
|
target:000100
|
||||||
|
STATION:
|
||||||
|
clockwise:000000
|
||||||
|
counterclockwise:001000
|
||||||
|
TIME:11
|
||||||
|
BUS:
|
||||||
|
position:8
|
||||||
|
target:000100
|
||||||
|
STATION:
|
||||||
|
clockwise:000000
|
||||||
|
counterclockwise:000000
|
||||||
|
TIME:12
|
||||||
|
BUS:
|
||||||
|
position:9
|
||||||
|
target:000100
|
||||||
|
STATION:
|
||||||
|
clockwise:000000
|
||||||
|
counterclockwise:000000
|
||||||
|
TIME:13
|
||||||
|
BUS:
|
||||||
|
position:10
|
||||||
|
target:000100
|
||||||
|
STATION:
|
||||||
|
clockwise:000000
|
||||||
|
counterclockwise:000000
|
||||||
|
TIME:14
|
||||||
|
BUS:
|
||||||
|
position:11
|
||||||
|
target:000100
|
||||||
|
STATION:
|
||||||
|
clockwise:000010
|
||||||
|
counterclockwise:000000
|
||||||
|
TIME:15
|
||||||
|
BUS:
|
||||||
|
position:12
|
||||||
|
target:000100
|
||||||
|
STATION:
|
||||||
|
clockwise:000010
|
||||||
|
counterclockwise:000000
|
||||||
|
TIME:16
|
||||||
|
BUS:
|
||||||
|
position:12
|
||||||
|
target:000000
|
||||||
|
STATION:
|
||||||
|
clockwise:000010
|
||||||
|
counterclockwise:000000
|
||||||
|
TIME:17
|
||||||
|
BUS:
|
||||||
|
position:13
|
||||||
|
target:000000
|
||||||
|
STATION:
|
||||||
|
clockwise:000010
|
||||||
|
counterclockwise:000000
|
||||||
|
TIME:18
|
||||||
|
BUS:
|
||||||
|
position:14
|
||||||
|
target:000000
|
||||||
|
STATION:
|
||||||
|
clockwise:000010
|
||||||
|
counterclockwise:000000
|
||||||
|
TIME:19
|
||||||
|
BUS:
|
||||||
|
position:15
|
||||||
|
target:000000
|
||||||
|
STATION:
|
||||||
|
clockwise:000010
|
||||||
|
counterclockwise:000000
|
||||||
|
TIME:20
|
||||||
|
BUS:
|
||||||
|
position:16
|
||||||
|
target:000000
|
||||||
|
STATION:
|
||||||
|
clockwise:000010
|
||||||
|
counterclockwise:000000
|
||||||
|
TIME:21
|
||||||
|
BUS:
|
||||||
|
position:16
|
||||||
|
target:000000
|
||||||
|
STATION:
|
||||||
|
clockwise:000000
|
||||||
|
counterclockwise:000000
|
||||||
|
end
|
||||||
4
all_test/test_cases/6/dict.dic
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
TOTAL_STATION = 5
|
||||||
|
DISTANCE = 3
|
||||||
|
# shortest seek time first
|
||||||
|
STRATEGY = SSTF
|
||||||
47
all_test/test_cases/6/input.txt
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
clock
|
||||||
|
clockwise 4
|
||||||
|
clockwise 2
|
||||||
|
counterclockwise 4
|
||||||
|
clock
|
||||||
|
clockwise 2
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
counterclockwise 1
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clockwise 3
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
target 5
|
||||||
|
clock
|
||||||
|
target 3
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
target 4
|
||||||
|
target 1
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
end
|
||||||
260
all_test/test_cases/6/output.txt
Normal file
@@ -0,0 +1,260 @@
|
|||||||
|
TIME:0
|
||||||
|
BUS:
|
||||||
|
position:0
|
||||||
|
target:00000
|
||||||
|
STATION:
|
||||||
|
clockwise:00000
|
||||||
|
counterclockwise:00000
|
||||||
|
TIME:1
|
||||||
|
BUS:
|
||||||
|
position:0
|
||||||
|
target:00000
|
||||||
|
STATION:
|
||||||
|
clockwise:00000
|
||||||
|
counterclockwise:00000
|
||||||
|
TIME:2
|
||||||
|
BUS:
|
||||||
|
position:1
|
||||||
|
target:00000
|
||||||
|
STATION:
|
||||||
|
clockwise:01010
|
||||||
|
counterclockwise:00010
|
||||||
|
TIME:3
|
||||||
|
BUS:
|
||||||
|
position:2
|
||||||
|
target:00000
|
||||||
|
STATION:
|
||||||
|
clockwise:01010
|
||||||
|
counterclockwise:00010
|
||||||
|
TIME:4
|
||||||
|
BUS:
|
||||||
|
position:3
|
||||||
|
target:00000
|
||||||
|
STATION:
|
||||||
|
clockwise:01010
|
||||||
|
counterclockwise:00010
|
||||||
|
TIME:5
|
||||||
|
BUS:
|
||||||
|
position:3
|
||||||
|
target:00000
|
||||||
|
STATION:
|
||||||
|
clockwise:00010
|
||||||
|
counterclockwise:10010
|
||||||
|
TIME:6
|
||||||
|
BUS:
|
||||||
|
position:2
|
||||||
|
target:00000
|
||||||
|
STATION:
|
||||||
|
clockwise:00010
|
||||||
|
counterclockwise:10010
|
||||||
|
TIME:7
|
||||||
|
BUS:
|
||||||
|
position:1
|
||||||
|
target:00000
|
||||||
|
STATION:
|
||||||
|
clockwise:00110
|
||||||
|
counterclockwise:10010
|
||||||
|
TIME:8
|
||||||
|
BUS:
|
||||||
|
position:0
|
||||||
|
target:00000
|
||||||
|
STATION:
|
||||||
|
clockwise:00110
|
||||||
|
counterclockwise:10010
|
||||||
|
TIME:9
|
||||||
|
BUS:
|
||||||
|
position:0
|
||||||
|
target:00000
|
||||||
|
STATION:
|
||||||
|
clockwise:00110
|
||||||
|
counterclockwise:00010
|
||||||
|
TIME:10
|
||||||
|
BUS:
|
||||||
|
position:1
|
||||||
|
target:00000
|
||||||
|
STATION:
|
||||||
|
clockwise:00110
|
||||||
|
counterclockwise:00010
|
||||||
|
TIME:11
|
||||||
|
BUS:
|
||||||
|
position:2
|
||||||
|
target:00000
|
||||||
|
STATION:
|
||||||
|
clockwise:00110
|
||||||
|
counterclockwise:00010
|
||||||
|
TIME:12
|
||||||
|
BUS:
|
||||||
|
position:3
|
||||||
|
target:00000
|
||||||
|
STATION:
|
||||||
|
clockwise:00110
|
||||||
|
counterclockwise:00010
|
||||||
|
TIME:13
|
||||||
|
BUS:
|
||||||
|
position:4
|
||||||
|
target:00000
|
||||||
|
STATION:
|
||||||
|
clockwise:00110
|
||||||
|
counterclockwise:00010
|
||||||
|
TIME:14
|
||||||
|
BUS:
|
||||||
|
position:5
|
||||||
|
target:00001
|
||||||
|
STATION:
|
||||||
|
clockwise:00110
|
||||||
|
counterclockwise:00010
|
||||||
|
TIME:15
|
||||||
|
BUS:
|
||||||
|
position:6
|
||||||
|
target:00101
|
||||||
|
STATION:
|
||||||
|
clockwise:00110
|
||||||
|
counterclockwise:00010
|
||||||
|
TIME:16
|
||||||
|
BUS:
|
||||||
|
position:6
|
||||||
|
target:00001
|
||||||
|
STATION:
|
||||||
|
clockwise:00010
|
||||||
|
counterclockwise:00010
|
||||||
|
TIME:17
|
||||||
|
BUS:
|
||||||
|
position:7
|
||||||
|
target:00001
|
||||||
|
STATION:
|
||||||
|
clockwise:00010
|
||||||
|
counterclockwise:00010
|
||||||
|
TIME:18
|
||||||
|
BUS:
|
||||||
|
position:8
|
||||||
|
target:00001
|
||||||
|
STATION:
|
||||||
|
clockwise:00010
|
||||||
|
counterclockwise:00010
|
||||||
|
TIME:19
|
||||||
|
BUS:
|
||||||
|
position:9
|
||||||
|
target:00001
|
||||||
|
STATION:
|
||||||
|
clockwise:00010
|
||||||
|
counterclockwise:00010
|
||||||
|
TIME:20
|
||||||
|
BUS:
|
||||||
|
position:9
|
||||||
|
target:00001
|
||||||
|
STATION:
|
||||||
|
clockwise:00000
|
||||||
|
counterclockwise:00000
|
||||||
|
TIME:21
|
||||||
|
BUS:
|
||||||
|
position:10
|
||||||
|
target:00001
|
||||||
|
STATION:
|
||||||
|
clockwise:00000
|
||||||
|
counterclockwise:00000
|
||||||
|
TIME:22
|
||||||
|
BUS:
|
||||||
|
position:11
|
||||||
|
target:00001
|
||||||
|
STATION:
|
||||||
|
clockwise:00000
|
||||||
|
counterclockwise:00000
|
||||||
|
TIME:23
|
||||||
|
BUS:
|
||||||
|
position:12
|
||||||
|
target:10011
|
||||||
|
STATION:
|
||||||
|
clockwise:00000
|
||||||
|
counterclockwise:00000
|
||||||
|
TIME:24
|
||||||
|
BUS:
|
||||||
|
position:12
|
||||||
|
target:10010
|
||||||
|
STATION:
|
||||||
|
clockwise:00000
|
||||||
|
counterclockwise:00000
|
||||||
|
TIME:25
|
||||||
|
BUS:
|
||||||
|
position:13
|
||||||
|
target:10010
|
||||||
|
STATION:
|
||||||
|
clockwise:00000
|
||||||
|
counterclockwise:00000
|
||||||
|
TIME:26
|
||||||
|
BUS:
|
||||||
|
position:14
|
||||||
|
target:10010
|
||||||
|
STATION:
|
||||||
|
clockwise:00000
|
||||||
|
counterclockwise:00000
|
||||||
|
TIME:27
|
||||||
|
BUS:
|
||||||
|
position:0
|
||||||
|
target:10010
|
||||||
|
STATION:
|
||||||
|
clockwise:00000
|
||||||
|
counterclockwise:00000
|
||||||
|
TIME:28
|
||||||
|
BUS:
|
||||||
|
position:0
|
||||||
|
target:00010
|
||||||
|
STATION:
|
||||||
|
clockwise:00000
|
||||||
|
counterclockwise:00000
|
||||||
|
TIME:29
|
||||||
|
BUS:
|
||||||
|
position:14
|
||||||
|
target:00010
|
||||||
|
STATION:
|
||||||
|
clockwise:00000
|
||||||
|
counterclockwise:00000
|
||||||
|
TIME:30
|
||||||
|
BUS:
|
||||||
|
position:13
|
||||||
|
target:00010
|
||||||
|
STATION:
|
||||||
|
clockwise:00000
|
||||||
|
counterclockwise:00000
|
||||||
|
TIME:31
|
||||||
|
BUS:
|
||||||
|
position:12
|
||||||
|
target:00010
|
||||||
|
STATION:
|
||||||
|
clockwise:00000
|
||||||
|
counterclockwise:00000
|
||||||
|
TIME:32
|
||||||
|
BUS:
|
||||||
|
position:11
|
||||||
|
target:00010
|
||||||
|
STATION:
|
||||||
|
clockwise:00000
|
||||||
|
counterclockwise:00000
|
||||||
|
TIME:33
|
||||||
|
BUS:
|
||||||
|
position:10
|
||||||
|
target:00010
|
||||||
|
STATION:
|
||||||
|
clockwise:00000
|
||||||
|
counterclockwise:00000
|
||||||
|
TIME:34
|
||||||
|
BUS:
|
||||||
|
position:9
|
||||||
|
target:00010
|
||||||
|
STATION:
|
||||||
|
clockwise:00000
|
||||||
|
counterclockwise:00000
|
||||||
|
TIME:35
|
||||||
|
BUS:
|
||||||
|
position:9
|
||||||
|
target:00000
|
||||||
|
STATION:
|
||||||
|
clockwise:00000
|
||||||
|
counterclockwise:00000
|
||||||
|
TIME:36
|
||||||
|
BUS:
|
||||||
|
position:9
|
||||||
|
target:00000
|
||||||
|
STATION:
|
||||||
|
clockwise:00000
|
||||||
|
counterclockwise:00000
|
||||||
|
end
|
||||||
4
all_test/test_cases/7/dict.dic
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
TOTAL_STATION = 5
|
||||||
|
DISTANCE = 3
|
||||||
|
# shortest seek time first
|
||||||
|
STRATEGY = SSTF
|
||||||
42
all_test/test_cases/7/input.txt
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
clock
|
||||||
|
clockwise 2
|
||||||
|
counterclockwise 4
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
counterclockwise 3
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
target 5
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
counterclockwise 4
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
target 1
|
||||||
|
clockwise 3
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
target 2
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
end
|
||||||
239
all_test/test_cases/7/output.txt
Normal file
@@ -0,0 +1,239 @@
|
|||||||
|
TIME:0
|
||||||
|
BUS:
|
||||||
|
position:0
|
||||||
|
target:00000
|
||||||
|
STATION:
|
||||||
|
clockwise:00000
|
||||||
|
counterclockwise:00000
|
||||||
|
TIME:1
|
||||||
|
BUS:
|
||||||
|
position:0
|
||||||
|
target:00000
|
||||||
|
STATION:
|
||||||
|
clockwise:00000
|
||||||
|
counterclockwise:00000
|
||||||
|
TIME:2
|
||||||
|
BUS:
|
||||||
|
position:1
|
||||||
|
target:00000
|
||||||
|
STATION:
|
||||||
|
clockwise:01000
|
||||||
|
counterclockwise:00010
|
||||||
|
TIME:3
|
||||||
|
BUS:
|
||||||
|
position:2
|
||||||
|
target:00000
|
||||||
|
STATION:
|
||||||
|
clockwise:01000
|
||||||
|
counterclockwise:00010
|
||||||
|
TIME:4
|
||||||
|
BUS:
|
||||||
|
position:3
|
||||||
|
target:00000
|
||||||
|
STATION:
|
||||||
|
clockwise:01000
|
||||||
|
counterclockwise:00010
|
||||||
|
TIME:5
|
||||||
|
BUS:
|
||||||
|
position:3
|
||||||
|
target:00000
|
||||||
|
STATION:
|
||||||
|
clockwise:00000
|
||||||
|
counterclockwise:00010
|
||||||
|
TIME:6
|
||||||
|
BUS:
|
||||||
|
position:4
|
||||||
|
target:00000
|
||||||
|
STATION:
|
||||||
|
clockwise:00000
|
||||||
|
counterclockwise:00010
|
||||||
|
TIME:7
|
||||||
|
BUS:
|
||||||
|
position:5
|
||||||
|
target:00000
|
||||||
|
STATION:
|
||||||
|
clockwise:00000
|
||||||
|
counterclockwise:00110
|
||||||
|
TIME:8
|
||||||
|
BUS:
|
||||||
|
position:6
|
||||||
|
target:00000
|
||||||
|
STATION:
|
||||||
|
clockwise:00000
|
||||||
|
counterclockwise:00110
|
||||||
|
TIME:9
|
||||||
|
BUS:
|
||||||
|
position:7
|
||||||
|
target:00000
|
||||||
|
STATION:
|
||||||
|
clockwise:00000
|
||||||
|
counterclockwise:00110
|
||||||
|
TIME:10
|
||||||
|
BUS:
|
||||||
|
position:8
|
||||||
|
target:00000
|
||||||
|
STATION:
|
||||||
|
clockwise:00000
|
||||||
|
counterclockwise:00110
|
||||||
|
TIME:11
|
||||||
|
BUS:
|
||||||
|
position:9
|
||||||
|
target:00001
|
||||||
|
STATION:
|
||||||
|
clockwise:00000
|
||||||
|
counterclockwise:00110
|
||||||
|
TIME:12
|
||||||
|
BUS:
|
||||||
|
position:9
|
||||||
|
target:00001
|
||||||
|
STATION:
|
||||||
|
clockwise:00000
|
||||||
|
counterclockwise:00100
|
||||||
|
TIME:13
|
||||||
|
BUS:
|
||||||
|
position:10
|
||||||
|
target:00001
|
||||||
|
STATION:
|
||||||
|
clockwise:00000
|
||||||
|
counterclockwise:00100
|
||||||
|
TIME:14
|
||||||
|
BUS:
|
||||||
|
position:11
|
||||||
|
target:00001
|
||||||
|
STATION:
|
||||||
|
clockwise:00000
|
||||||
|
counterclockwise:00100
|
||||||
|
TIME:15
|
||||||
|
BUS:
|
||||||
|
position:12
|
||||||
|
target:00001
|
||||||
|
STATION:
|
||||||
|
clockwise:00000
|
||||||
|
counterclockwise:00100
|
||||||
|
TIME:16
|
||||||
|
BUS:
|
||||||
|
position:12
|
||||||
|
target:00000
|
||||||
|
STATION:
|
||||||
|
clockwise:00000
|
||||||
|
counterclockwise:00100
|
||||||
|
TIME:17
|
||||||
|
BUS:
|
||||||
|
position:11
|
||||||
|
target:00000
|
||||||
|
STATION:
|
||||||
|
clockwise:00000
|
||||||
|
counterclockwise:00110
|
||||||
|
TIME:18
|
||||||
|
BUS:
|
||||||
|
position:10
|
||||||
|
target:00000
|
||||||
|
STATION:
|
||||||
|
clockwise:00000
|
||||||
|
counterclockwise:00110
|
||||||
|
TIME:19
|
||||||
|
BUS:
|
||||||
|
position:9
|
||||||
|
target:00000
|
||||||
|
STATION:
|
||||||
|
clockwise:00000
|
||||||
|
counterclockwise:00110
|
||||||
|
TIME:20
|
||||||
|
BUS:
|
||||||
|
position:9
|
||||||
|
target:00000
|
||||||
|
STATION:
|
||||||
|
clockwise:00000
|
||||||
|
counterclockwise:00100
|
||||||
|
TIME:21
|
||||||
|
BUS:
|
||||||
|
position:8
|
||||||
|
target:00000
|
||||||
|
STATION:
|
||||||
|
clockwise:00000
|
||||||
|
counterclockwise:00100
|
||||||
|
TIME:22
|
||||||
|
BUS:
|
||||||
|
position:7
|
||||||
|
target:10000
|
||||||
|
STATION:
|
||||||
|
clockwise:00100
|
||||||
|
counterclockwise:00100
|
||||||
|
TIME:23
|
||||||
|
BUS:
|
||||||
|
position:6
|
||||||
|
target:10000
|
||||||
|
STATION:
|
||||||
|
clockwise:00100
|
||||||
|
counterclockwise:00100
|
||||||
|
TIME:24
|
||||||
|
BUS:
|
||||||
|
position:6
|
||||||
|
target:10000
|
||||||
|
STATION:
|
||||||
|
clockwise:00000
|
||||||
|
counterclockwise:00000
|
||||||
|
TIME:25
|
||||||
|
BUS:
|
||||||
|
position:5
|
||||||
|
target:10000
|
||||||
|
STATION:
|
||||||
|
clockwise:00000
|
||||||
|
counterclockwise:00000
|
||||||
|
TIME:26
|
||||||
|
BUS:
|
||||||
|
position:4
|
||||||
|
target:11000
|
||||||
|
STATION:
|
||||||
|
clockwise:00000
|
||||||
|
counterclockwise:00000
|
||||||
|
TIME:27
|
||||||
|
BUS:
|
||||||
|
position:3
|
||||||
|
target:11000
|
||||||
|
STATION:
|
||||||
|
clockwise:00000
|
||||||
|
counterclockwise:00000
|
||||||
|
TIME:28
|
||||||
|
BUS:
|
||||||
|
position:3
|
||||||
|
target:10000
|
||||||
|
STATION:
|
||||||
|
clockwise:00000
|
||||||
|
counterclockwise:00000
|
||||||
|
TIME:29
|
||||||
|
BUS:
|
||||||
|
position:2
|
||||||
|
target:10000
|
||||||
|
STATION:
|
||||||
|
clockwise:00000
|
||||||
|
counterclockwise:00000
|
||||||
|
TIME:30
|
||||||
|
BUS:
|
||||||
|
position:1
|
||||||
|
target:10000
|
||||||
|
STATION:
|
||||||
|
clockwise:00000
|
||||||
|
counterclockwise:00000
|
||||||
|
TIME:31
|
||||||
|
BUS:
|
||||||
|
position:0
|
||||||
|
target:10000
|
||||||
|
STATION:
|
||||||
|
clockwise:00000
|
||||||
|
counterclockwise:00000
|
||||||
|
TIME:32
|
||||||
|
BUS:
|
||||||
|
position:0
|
||||||
|
target:00000
|
||||||
|
STATION:
|
||||||
|
clockwise:00000
|
||||||
|
counterclockwise:00000
|
||||||
|
TIME:33
|
||||||
|
BUS:
|
||||||
|
position:0
|
||||||
|
target:00000
|
||||||
|
STATION:
|
||||||
|
clockwise:00000
|
||||||
|
counterclockwise:00000
|
||||||
|
end
|
||||||
3
all_test/test_cases/8/dict.dic
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
TOTAL_STATION = 10
|
||||||
|
STRATEGY = SSTF
|
||||||
|
#end
|
||||||
16
all_test/test_cases/8/input.txt
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
clock
|
||||||
|
clockwise 3
|
||||||
|
clockwise 10
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clockwise 2
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
end
|
||||||
92
all_test/test_cases/8/output.txt
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
TIME:0
|
||||||
|
BUS:
|
||||||
|
position:0
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:1
|
||||||
|
BUS:
|
||||||
|
position:0
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:2
|
||||||
|
BUS:
|
||||||
|
position:19
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0010000001
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:3
|
||||||
|
BUS:
|
||||||
|
position:18
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0010000001
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:4
|
||||||
|
BUS:
|
||||||
|
position:18
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0010000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:5
|
||||||
|
BUS:
|
||||||
|
position:19
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0010000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:6
|
||||||
|
BUS:
|
||||||
|
position:0
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0010000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:7
|
||||||
|
BUS:
|
||||||
|
position:1
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0110000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:8
|
||||||
|
BUS:
|
||||||
|
position:2
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0110000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:9
|
||||||
|
BUS:
|
||||||
|
position:2
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0010000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:10
|
||||||
|
BUS:
|
||||||
|
position:3
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0010000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:11
|
||||||
|
BUS:
|
||||||
|
position:4
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0010000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:12
|
||||||
|
BUS:
|
||||||
|
position:4
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
end
|
||||||
3
all_test/test_cases/9/dict.dic
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
TOTAL_STATION = 10
|
||||||
|
STRATEGY = SSTF
|
||||||
|
#end
|
||||||
12
all_test/test_cases/9/input.txt
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
clock
|
||||||
|
clockwise 3
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clockwise 2
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
clock
|
||||||
|
end
|
||||||
71
all_test/test_cases/9/output.txt
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
TIME:0
|
||||||
|
BUS:
|
||||||
|
position:0
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:1
|
||||||
|
BUS:
|
||||||
|
position:0
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:2
|
||||||
|
BUS:
|
||||||
|
position:1
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0010000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:3
|
||||||
|
BUS:
|
||||||
|
position:2
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0010000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:4
|
||||||
|
BUS:
|
||||||
|
position:3
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0110000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:5
|
||||||
|
BUS:
|
||||||
|
position:4
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0110000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:6
|
||||||
|
BUS:
|
||||||
|
position:4
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0100000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:7
|
||||||
|
BUS:
|
||||||
|
position:3
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0100000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:8
|
||||||
|
BUS:
|
||||||
|
position:2
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0100000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
TIME:9
|
||||||
|
BUS:
|
||||||
|
position:2
|
||||||
|
target:0000000000
|
||||||
|
STATION:
|
||||||
|
clockwise:0000000000
|
||||||
|
counterclockwise:0000000000
|
||||||
|
end
|
||||||
37
convert.py
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
import os
|
||||||
|
|
||||||
|
path = "SSTF/"
|
||||||
|
dict_path = path + "dict.dic"
|
||||||
|
|
||||||
|
in_path = path + "{}.in"
|
||||||
|
out_path = path + "{}.out"
|
||||||
|
|
||||||
|
dict_file = open(dict_path, "r", encoding="utf8")
|
||||||
|
dict_str = dict_file.read()
|
||||||
|
dict_file.close()
|
||||||
|
|
||||||
|
for i in range(1, 11):
|
||||||
|
dir_path = "{}/".format(i + 7)
|
||||||
|
|
||||||
|
input_path = dir_path + "input.txt"
|
||||||
|
output_path = dir_path + "output.txt"
|
||||||
|
dict_path = dir_path + "dict.dic"
|
||||||
|
|
||||||
|
os.mkdir("{}".format(i + 7))
|
||||||
|
|
||||||
|
in_file = open(in_path.format(i), "r", encoding="utf8")
|
||||||
|
out_file = open(out_path.format(i), "r", encoding="utf8")
|
||||||
|
input_file = open(input_path, "w", encoding="utf8")
|
||||||
|
output_file = open(output_path, "w", encoding="utf8")
|
||||||
|
dict_file = open(dict_path, "w", encoding="utf8")
|
||||||
|
|
||||||
|
input_file.write(in_file.read())
|
||||||
|
output_file.write(out_file.read())
|
||||||
|
dict_file.write(dict_str)
|
||||||
|
|
||||||
|
in_file.close()
|
||||||
|
out_file.close()
|
||||||
|
input_file.close()
|
||||||
|
output_file.close()
|
||||||
|
dict_file.close()
|
||||||
|
|
||||||
BIN
docs/代码规范/1.png
Normal file
|
After Width: | Height: | Size: 116 KiB |
BIN
docs/代码规范/2.png
Normal file
|
After Width: | Height: | Size: 31 KiB |
BIN
docs/代码规范/3.png
Normal file
|
After Width: | Height: | Size: 174 KiB |
BIN
docs/代码规范/4.png
Normal file
|
After Width: | Height: | Size: 28 KiB |
159
docs/代码规范/代码规范.md
Normal file
@@ -0,0 +1,159 @@
|
|||||||
|
# 代码规范
|
||||||
|
|
||||||
|
### 命名规则
|
||||||
|
|
||||||
|
#### 变量命名规则
|
||||||
|
|
||||||
|
**所有**的局部变量都使用小写的下划线命名法。
|
||||||
|
|
||||||
|
```C
|
||||||
|
int bus_position;
|
||||||
|
char* output_string
|
||||||
|
```
|
||||||
|
|
||||||
|
在变量命名时应注意尽可能简洁清晰,但在不能为了简洁而导致变量意义的不明。
|
||||||
|
|
||||||
|
错误示范:
|
||||||
|
|
||||||
|
```C
|
||||||
|
// DO NOT DO THIS:
|
||||||
|
lv_indev_drv_t indev_drv;
|
||||||
|
```
|
||||||
|
|
||||||
|
正确示范:
|
||||||
|
|
||||||
|
```C
|
||||||
|
lv_input_device_driver_t mouse_input;
|
||||||
|
```
|
||||||
|
|
||||||
|
> 本例子来自LVGL库。
|
||||||
|
>
|
||||||
|
> lv表示这个类型来自LVGL库,input_device表示这个一个输入设备,driver表示这是一个驱动,后缀t表示这是一个类型。
|
||||||
|
|
||||||
|
#### 常量命名规则
|
||||||
|
|
||||||
|
采用`#define`定义的常量采用全大写下划线命名法
|
||||||
|
|
||||||
|
```C
|
||||||
|
#define MAX_STR_LENGTH 1000
|
||||||
|
```
|
||||||
|
|
||||||
|
#### 函数命名规则
|
||||||
|
|
||||||
|
**所有**函数采用驼峰命名法。
|
||||||
|
|
||||||
|
```C
|
||||||
|
int StrLength(char* str);
|
||||||
|
```
|
||||||
|
|
||||||
|
### 代码风格
|
||||||
|
|
||||||
|
#### 缩进
|
||||||
|
|
||||||
|
统一使用`tab`,四个空格的缩进。
|
||||||
|
|
||||||
|
```C
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
printf("缩进是四格。\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
> 这点一般不需要注意,现在流行的IDE都是四格缩进。
|
||||||
|
|
||||||
|
#### 大括号
|
||||||
|
|
||||||
|
所有的大括号都需要提行书写。
|
||||||
|
|
||||||
|
```C
|
||||||
|
if()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
for()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
同时注意在代码中所有的代码块都需要用大括号包裹,即使是一行的情形。
|
||||||
|
|
||||||
|
```c
|
||||||
|
// DO NOT DO THIS
|
||||||
|
if(1)
|
||||||
|
printf("...");
|
||||||
|
// DO THIS
|
||||||
|
if(1)
|
||||||
|
{
|
||||||
|
printf("...");
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### 注释
|
||||||
|
|
||||||
|
采用`Doxygen`风格的注释
|
||||||
|
|
||||||
|
> 在`VSCode`中安装`Doxygen Documentation Generator`这个扩展。
|
||||||
|
>
|
||||||
|
> 
|
||||||
|
>
|
||||||
|
> 方便使用下列的功能。
|
||||||
|
|
||||||
|
在函数,变量的**上一行**输入`/**`后回车来创建模板。
|
||||||
|
|
||||||
|
```C
|
||||||
|
/**
|
||||||
|
* @brief 在stdin打印一个字符串
|
||||||
|
*
|
||||||
|
* @param str 指向需要打印的字符串指针
|
||||||
|
*/
|
||||||
|
void print(char* str)
|
||||||
|
{
|
||||||
|
printf("%s", str);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
```C
|
||||||
|
#include "example.h"
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @brief 需要输出的字符串
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
char* string = "Good morning!\n";
|
||||||
|
print(string);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
在`@brief`的后面输入函数的作用简述,在`@param`的输入每个参数的意义, 在`@return`的后面输入返回值的意义。
|
||||||
|
|
||||||
|
在`VSCode`中将指针悬停在函数上时就可以查看这个注释。
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
其他的注释都应该放在需要注释行的上一行。
|
||||||
|
|
||||||
|
> 在`Doxygen`规范中,所有的注释都是注释下一行的代码。
|
||||||
|
|
||||||
|
在文件开头的注释**不做要求**,我感觉应该没有什么用。
|
||||||
|
|
||||||
|
> 这里推荐一个`VSCode`插件`GitLens`,可以方便的查看提交信息,~~便于在发现问题时锤人~~。
|
||||||
|
>
|
||||||
|
> 
|
||||||
|
|
||||||
|
### 杂项
|
||||||
|
|
||||||
|
- 函数中的局部变量不必在函数的头部统一命名,但是建议比较重要的变量在头部先声明,并且使用注释注明变量的作用
|
||||||
|
- 循环的变量一般情况下都在`for`语句中声明,不在循环以外的地方使用。但如果较为特殊的地方使用到,请使用注释表明。并且循环变量使用`i`,`j`,`k`。
|
||||||
|
- `switch`语句中必须要有`default`的部分。
|
||||||
|
- 每行代码不超过80个字符。
|
||||||
54
docs/开发指北/开发指北.md
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
# 开发指北
|
||||||
|
|
||||||
|
> 遇到任何问题都可以问。
|
||||||
|
|
||||||
|
## 任务一
|
||||||
|
|
||||||
|
> 布置时间:2022-4-29
|
||||||
|
|
||||||
|
### 终端(命令行)界面入门
|
||||||
|
|
||||||
|
#### 背景
|
||||||
|
|
||||||
|
我们在开发过程中需要用到的大部分工具都是以命令行交互为主,比如`cmake`, `gcc`,`git`;而且我们编译出来的应用也是在命令行界面中运行,所以掌握一些基本的命令是必要的。
|
||||||
|
|
||||||
|
#### 目标
|
||||||
|
|
||||||
|
掌握命令行界面的基础知识。
|
||||||
|
|
||||||
|
### Git入门
|
||||||
|
|
||||||
|
#### 背景
|
||||||
|
|
||||||
|
`git`是版本管理和团队合作的利器,掌握`git`的基本使用也是必要的。
|
||||||
|
|
||||||
|
#### 目标
|
||||||
|
|
||||||
|
克隆本次的大作业的项目仓库,并且进行**至少一次**提交。
|
||||||
|
|
||||||
|
> 可以在`main.c`文件中调用`printf`函数输出一些内容作为提交的内容。
|
||||||
|
|
||||||
|
### 模块入门
|
||||||
|
|
||||||
|
#### 背景
|
||||||
|
|
||||||
|
多模块编译是一个比较困难的部分,但是也是我们开发中十分有用的技能。
|
||||||
|
|
||||||
|
#### 目标
|
||||||
|
|
||||||
|
在项目中新建一个模块,包括头文件和源文件,在模块中设计实现一个简单的函数,并在`main.c`中调用。
|
||||||
|
|
||||||
|
### 概要设计
|
||||||
|
|
||||||
|
#### 背景
|
||||||
|
|
||||||
|
大作业有点难,不能只让我一个人抠脑壳,你们也得一起想。
|
||||||
|
|
||||||
|
#### 目标
|
||||||
|
|
||||||
|
设计完成函数原型,数据结构,全局常量。
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
BIN
docs/生产环境/1.png
Normal file
|
After Width: | Height: | Size: 18 KiB |
BIN
docs/生产环境/10.png
Normal file
|
After Width: | Height: | Size: 67 KiB |
BIN
docs/生产环境/11.png
Normal file
|
After Width: | Height: | Size: 68 KiB |
BIN
docs/生产环境/12.png
Normal file
|
After Width: | Height: | Size: 73 KiB |
BIN
docs/生产环境/13.png
Normal file
|
After Width: | Height: | Size: 38 KiB |
BIN
docs/生产环境/14.png
Normal file
|
After Width: | Height: | Size: 17 KiB |
BIN
docs/生产环境/15.png
Normal file
|
After Width: | Height: | Size: 5.5 KiB |
BIN
docs/生产环境/16.png
Normal file
|
After Width: | Height: | Size: 59 KiB |
BIN
docs/生产环境/17.png
Normal file
|
After Width: | Height: | Size: 175 KiB |
BIN
docs/生产环境/18.png
Normal file
|
After Width: | Height: | Size: 72 KiB |
BIN
docs/生产环境/19.png
Normal file
|
After Width: | Height: | Size: 216 KiB |
BIN
docs/生产环境/2.png
Normal file
|
After Width: | Height: | Size: 364 KiB |
BIN
docs/生产环境/20.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
docs/生产环境/21.png
Normal file
|
After Width: | Height: | Size: 24 KiB |
BIN
docs/生产环境/22.png
Normal file
|
After Width: | Height: | Size: 10 KiB |
BIN
docs/生产环境/3.png
Normal file
|
After Width: | Height: | Size: 48 KiB |
BIN
docs/生产环境/4.png
Normal file
|
After Width: | Height: | Size: 78 KiB |
BIN
docs/生产环境/5.png
Normal file
|
After Width: | Height: | Size: 69 KiB |
BIN
docs/生产环境/6.png
Normal file
|
After Width: | Height: | Size: 91 KiB |
BIN
docs/生产环境/7.png
Normal file
|
After Width: | Height: | Size: 80 KiB |
BIN
docs/生产环境/8.png
Normal file
|
After Width: | Height: | Size: 44 KiB |
BIN
docs/生产环境/9.png
Normal file
|
After Width: | Height: | Size: 41 KiB |
291
docs/生产环境/生产环境.md
Normal file
@@ -0,0 +1,291 @@
|
|||||||
|
|
||||||
|
|
||||||
|
# 生产环境
|
||||||
|
|
||||||
|
> 遇到任何的问题都可以告诉我!!
|
||||||
|
|
||||||
|
## 软件安装
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
在`Program.zip`压缩包中有两个程序,分别是`cmake`和`VSCode`。
|
||||||
|
|
||||||
|
这两个软件的安装都比较的简单。先解压缩文件,分别双击两个安装程序安装就可以了。在安装的过程应该只用无脑下一步。
|
||||||
|
|
||||||
|
> 在安装`VSCode`的过程中可能需要选择为”所有用户“还是”当前用户“安装,一般选择当前用户就可以了。
|
||||||
|
|
||||||
|
## 编译器的安装
|
||||||
|
|
||||||
|
编译器的安装算是比较复杂的。
|
||||||
|
|
||||||
|
首先解压缩`mingw64.zip`这个压缩包,然后把这个文件夹放在一个**你自己记得到**而且**文件路径中间没有空格没有中文没有什么奇奇怪怪字符**的地方。
|
||||||
|
|
||||||
|
> 这里表示把工具添加进入环境变量,我们就不用再运行程序的时候指定程序所在的位置,系统会根据我们提供的名称在我们指定的路径下去搜索可执行的程序。
|
||||||
|
|
||||||
|
然后同时按下`win`和`s`组合键,打开搜索面板,搜索`环境变量`,选择`编辑系统环境变量`
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
打开这个界面
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
点击右下方的`环境变量...`,打开下面的界面
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
我的界面可能和你们的看起来相当的不一样,尤其是里面的内容。
|
||||||
|
|
||||||
|
选中上面那一块区域,也就是“用户变量”中的`path`,就像下图所示
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
然后点击中间那三个按钮中的“编辑”,打开下一个界面
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
> 可能我们的界面看起来相当的不一样,我设置了相当数量的环境变量,这也侧面说明了设置这个是非常重要的(
|
||||||
|
|
||||||
|
点击右侧的“新建”按钮,
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
然后再点击右边的“浏览”按钮,
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
选择到之前解压的编译器路径下,指向`bin`文件夹。
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
点击确定。
|
||||||
|
|
||||||
|
然后再次点击右侧的“新建”-“浏览”,但是这次选择`C:\Program Files\cmake\bin`这个文件夹,然后一路点击确定。
|
||||||
|
|
||||||
|
编译器的安装就算是结束了。
|
||||||
|
|
||||||
|
## 测试环境的安装
|
||||||
|
|
||||||
|
现在将第三个压缩包`auto_drived_bus.zip`解压到你打算写代码的地方,这个地方的路径同样需要具有**没有中文没有空格没有什么奇奇怪怪的字符**的buff。
|
||||||
|
|
||||||
|
然后打开`VSCode`,选择打开文件夹,打开刚才解压的那个文件,现在界面应该是这样的。
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
然后按下`ctrl`和`~`组合键,打开终端。
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
依次输入下列三条命令
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd build
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cmake .. -G "MinGW Makefiles"
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cmake --build .
|
||||||
|
```
|
||||||
|
|
||||||
|
> 在输入的时候不要遗漏了`.`这类符号。
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
然后输入
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bus.exe
|
||||||
|
```
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
说明everything works well。
|
||||||
|
|
||||||
|
## 原理的简单解释
|
||||||
|
|
||||||
|
### 多文件编译
|
||||||
|
|
||||||
|
在之前的学习中我们接触的都是单文件的编译
|
||||||
|
|
||||||
|
```bash
|
||||||
|
gcc example.c -o example.exe
|
||||||
|
```
|
||||||
|
|
||||||
|
在上面的命令中`gcc`是编译器,`example.c`是源文件,`example.exe`是编译之后生成的可执行文件。
|
||||||
|
|
||||||
|
但是如果我们现在是多文件编译呢?我们假设现在有两个文件`lib.c`和`main.c`,`lib.c`是一个库的源文件,里面有一些函数是我们需要的,我们会在`main.c`中调用这些函数。
|
||||||
|
|
||||||
|
那现在我们需要解决两个问题:
|
||||||
|
|
||||||
|
- `main.c`文件中没有`lib.c`中编写函数的定义
|
||||||
|
- 如何才能将两个文件编译为一个可以运行的可执行文件
|
||||||
|
|
||||||
|
对于第一个问题,我们使用头文件来解决,`lib.h`这个头文件中就包含了在`lib.c`中编写的所有函数的声明,当我们在`main.c`文件中添加
|
||||||
|
|
||||||
|
```C
|
||||||
|
#include "lib.h"
|
||||||
|
```
|
||||||
|
|
||||||
|
之后,我们就可以在`main.c`文件中愉快的使用`lib.c`中的函数了。
|
||||||
|
|
||||||
|
对于第二个问题,我们使用一种名叫“链接”的方法解决
|
||||||
|
|
||||||
|
```bash
|
||||||
|
gcc lib.c -o lib.o # 生成lib.c对应的可执行文件
|
||||||
|
gcc main.c -o main.o # 生成main.c对应的可执行文件
|
||||||
|
gcc mian.o lib.o -o main.exe # 将两个可执行文件链接在一个生成一个可执行文件
|
||||||
|
```
|
||||||
|
|
||||||
|
> 我们常常使用的`stdio.h`等的头文件对应的可执行文件通过差不多的原理实现的。
|
||||||
|
|
||||||
|
然后我们假设一下,如果我们的文件数一多,编译起来要输很多行代码,是不是就很崩溃!
|
||||||
|
|
||||||
|
然后我们使用了`cmake`工具。这是一个跨平台的编译工具,~~用过的人都说好~~。
|
||||||
|
|
||||||
|
我们只用在`CMakeLists.txt`这个文件中一次写明我们需要使用的文件,就可以一直套用这个模板编译软件。
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cmake .. -G "MinGw Makefiles"
|
||||||
|
```
|
||||||
|
|
||||||
|
这一行的命令表示在我们目前所在的`build`文件夹中生成用于构建程序的一些文件,`..`是一个指针,指向当前文件的上一级目录,也就是`CMakeLists.txt`以及我们程序源代码所在的地方,`-G "MinGw Makefiles"`表示的是生成的文件是我们使用的编译器`mingw64`可以识别的格式。
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cmake --build .
|
||||||
|
```
|
||||||
|
|
||||||
|
这一行是用我们刚刚生成的生成文件调用编译器生成可执行文件,`.`也是一个指针,它指向当前目录。
|
||||||
|
|
||||||
|
注意,如果在之后我们没有修改过`CMakeLists.txt`文件,那我们每次修改了源代码之后就只用执行
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cmake --build .
|
||||||
|
```
|
||||||
|
|
||||||
|
来重新生成可执行文件;
|
||||||
|
|
||||||
|
如果我们修改了`CMakeLists.txt`文件,我们就需要在执行
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cmake ..
|
||||||
|
```
|
||||||
|
|
||||||
|
来重新生成那个辅助文件。
|
||||||
|
|
||||||
|
> 这里我们不用加上 `-G "MinGw Makefiles"` ,编译器只用指定一次。
|
||||||
|
|
||||||
|
### 在工程的实际
|
||||||
|
|
||||||
|
在初步了解了相关的知识之后,我们就可以开始把他们运用在工程中了。
|
||||||
|
|
||||||
|
我们的实际项目结构如下
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
`include`目录下是我们各个模块的头文件,现在的示例是`print`模块的`print.h`,而这个模块的源文件是在`src`目录下的`print.c`文件。
|
||||||
|
|
||||||
|
`src`目录下就是我们当前各个模块和主程序的源代码文件。
|
||||||
|
|
||||||
|
> CMakeLists.txt由我编写,我会写上比较详尽的注释,你们可以观摩。
|
||||||
|
|
||||||
|
那我们第一阶段的架构设计实际上就是头文件的编写。为啥?头文件包括我们各个模块中需要使用的函数的定义,在项目中会使用到的结构体、自行定义的类型等的都会写在我们的头文件里面,实际上,编写头文件的过程就是架构设计的过程。
|
||||||
|
|
||||||
|
在编写完成我们的头文件之后,我们只需在对应的源文件中实现相关的函数,我们的开发就算是完成了。
|
||||||
|
|
||||||
|
## VSCode的配置
|
||||||
|
|
||||||
|
### 安装扩展
|
||||||
|
|
||||||
|
为了能在`VSCode`中流畅的写`C\C++`,我们需要在`VSCode`中安装几个插件。
|
||||||
|
|
||||||
|
在`VSCode`的主界面上选择“插件”图标,也就是右侧的最后一个
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
> 图中的最下面那个图标
|
||||||
|
|
||||||
|
打开这个界面
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
在搜索栏中只用数一个字母`C`,
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
选择这个`C/C++ Extension Pack`,这是一个辅助`C/C++`编写的扩展的合集,只用安装这个扩展我们就可以愉快~~并不~~的在`VSCode`中写代码了。
|
||||||
|
|
||||||
|
> 如果对`VSCode`的全英文界面感到不适,也可以搜索`Chinese`,安装简体中文的扩展包。
|
||||||
|
|
||||||
|
### 加载CMake项目
|
||||||
|
|
||||||
|
在`VSCode`中也有扩展提供了对于`Cmake`的支持,让我们可以不用在一次次的输入命令来编译。
|
||||||
|
|
||||||
|
在安装完扩展之后,我们重新启动`VSCode`,再次打开我们的工程文件夹,这个时候左下角应该会弹出来一个气泡,
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
这个气泡就是`cmake`插件在询问你是否设置这个名为`auto_drived_bus`的工程,我们选择"Yes", 这时`cmake`扩展就会使用系统中安装的`cmake`来设置我们的项目。
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
这时在我们`VSCode`底部的状态栏就会出现一些`cmake`的选项,我们逐个来看
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
第一个表示`cmake`目前使用的是`debug`模式,我们可以点击切换不同的生成模式
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
第二个表示我们当前使用的编译器,如果我们在电脑上安装了不同的编译器,例如微软的`msvc`就可以在点击切换,当然,这里切换不仅是编译器的选项,生成的编译文件也从`makefile`变成了`vcporj`。
|
||||||
|
|
||||||
|
第三个按钮`build`是编译按钮,点击这个按钮就会生成可执行文件。
|
||||||
|
|
||||||
|
第四个按钮`all`是选择生成的对象,在一般情况下不用改动。
|
||||||
|
|
||||||
|
> 在这里我们的生成对象主要有两个,一个是我们的库,另一个是我们的主程序。
|
||||||
|
|
||||||
|
第五六个是两个按钮,长得像虫一样的那个表示调试按钮,说明这是用来抓`bug`的,下一个的那个就是一个简单的运行按钮,点一下就会自动开始编译运行。
|
||||||
|
|
||||||
|
> 我们也可以使用一些快捷键来代替上面的一些东西,比如`F5`表示运行,`ctrl`和`F5`同时按表示运行,按`F7`表示编译。
|
||||||
|
|
||||||
|
> 我这边的建议是使用`F7`编译之后,再在终端中执行,这样和OJ上的执行比较的近似。
|
||||||
|
|
||||||
|
## 下一步...
|
||||||
|
|
||||||
|
### 关于Git
|
||||||
|
|
||||||
|
再实际使用Git之前,先推荐这篇MIT的英文教程[VERSION CONTROL](https://missing.csail.mit.edu/2020/version-control/),这边文章没有像一般的Git教程一样扔给你一大堆的命令,而是介绍了Git的原理,我觉得这样可能更加易懂。
|
||||||
|
|
||||||
|
> 如果看英文有困难,可以看这个[翻译版](https://missing-semester-cn.github.io/2020/version-control/)
|
||||||
|
|
||||||
|
如果黄海还不发`Gitlab`的文档的话,我就会打算在`gitee`上建立仓库开始干活了,我们在实践中学习`git`。
|
||||||
|
|
||||||
|
> 高情商:在实践中学习
|
||||||
|
>
|
||||||
|
> 低情商:你们自己摸索
|
||||||
|
|
||||||
|
### 关于typora
|
||||||
|
|
||||||
|
用`markdown`撰写文档是我一直的习惯,用word写东西实在不是碳基生物能干的活。不过由于我们需要叫word格式的文档,我结合`markdown`转`word`的效果和大家的意见在做决定。
|
||||||
|
|
||||||
|
> 最后再次强调,有什么问题一定要问!!
|
||||||
|
|
||||||
|
## 写在最后
|
||||||
|
|
||||||
|
你们可能嫌我为啥要搞这么麻烦,为啥不直接简简单单的一个文件和`Dev C++`开发了事。
|
||||||
|
|
||||||
|
我当时想的是既然这是一次“大作业”,而且黄海也反复强调“软件工程”,那我们不如好好的体验一下“现代”的`C/C++`开发是什么样子的。
|
||||||
|
|
||||||
|
我最开始的想法仅仅是统一用`VSCode`进行开发,但是使用`VSCode`进行开发涉及到一个比较麻烦的环境配置问题。为了确保只用配置一次环境之后就可以在不同的电脑上获得流畅的编码体验,我就使用现在流行的`Cmake`工具进行统一的环境配置。
|
||||||
|
|
||||||
|
使用这个工具的好处有以下几点:
|
||||||
|
|
||||||
|
- 不必关心比较复杂的`VSCode`设置
|
||||||
|
- 可以进行比较舒适的模块化开发,避免的繁琐的编译
|
||||||
|
- 便于后期引入图形库进行图形界面的开发
|
||||||
|
- `CMake`是现在`C/C++`项目开发的事实标准。
|
||||||
498
docs/说明文档/document_of_oj.md
Normal file
@@ -0,0 +1,498 @@
|
|||||||
|
# 公交车调度说明(OJ版)
|
||||||
|
|
||||||
|
## 站点说明
|
||||||
|
|
||||||
|
环形轨道,一辆车,车辆可以双向任意行驶。我们规定**车辆的原始位置为0**(该位置**也是车站1的位置**),按顺时针方向每个单位位置坐标加1。如果轨道总长为10,则按顺时针方向走,位置9的下一个为位置0。车站编号同理,也是按顺时针方向依次递增。**车速固定,每秒一个单位**。停车接人或乘客下车时需要**停车一秒钟**。无论一次停站完成几个服务停留时间统一为1秒钟。各站之间距离相等,车辆经过站点时,根据调度策略,车辆可以停也可以不停。其他位置不允许停车。车辆只能在站点停站时才能改变行驶方向。
|
||||||
|
|
||||||
|
## 配置文件
|
||||||
|
|
||||||
|
各站之间距离可配置,站点个数可配置,调度策略可配置。这三个参数保存在配置文件中,程序要通过读配置文件获取。**配置文件的名字为`dict.dic`**。
|
||||||
|
|
||||||
|
配置文件为**文本文件**,以#号开头的行是注释,井号只可能出现在每一行的开头。
|
||||||
|
|
||||||
|
每行一个参数,格式为:
|
||||||
|
|
||||||
|
参数 = 值
|
||||||
|
|
||||||
|
的形式。每个参数前无空格,参数名、等号、参数值用空格分隔。
|
||||||
|
|
||||||
|
其中参数有三个,即TOTAL_STATION,代表**站点总数,为大于1且小于等于20的整数**;DISTANCE,代表**每站之间的距离,为大于0且小于6的整数**;STRATEGY,代表调度策略,只能是FCFS(先来先服务),SSTF(最短寻找时间优先)和
|
||||||
|
SCAN(顺便服务)之一。
|
||||||
|
|
||||||
|
另外:
|
||||||
|
|
||||||
|
1、如果某个参数没有出现在配置文件中,则该参数取缺省值。
|
||||||
|
|
||||||
|
三个参数的缺省值如下:
|
||||||
|
|
||||||
|
```
|
||||||
|
TOTAL_STATION = 5
|
||||||
|
|
||||||
|
STRATEGY = FCFS
|
||||||
|
|
||||||
|
DISTANCE = 2
|
||||||
|
```
|
||||||
|
|
||||||
|
2、**三个参数在文件中的顺序没有规定**。
|
||||||
|
|
||||||
|
3、显然,**TOTAL_STATION与DISTANCE乘积就是轨道总长度**,所以配置文件中没有这个参数。
|
||||||
|
|
||||||
|
## 输入格式
|
||||||
|
|
||||||
|
若干行,每行一个指令。
|
||||||
|
|
||||||
|
指令共5种。分别为end、clock、counterclockwise、clockwise 和target。
|
||||||
|
|
||||||
|
**其中end是程序退出指令(不是停运指令,是时钟停止,程序退出的意思),只在最后一行出现一次**;
|
||||||
|
|
||||||
|
clock是时钟指令,每出现一次代表过了一秒钟;
|
||||||
|
|
||||||
|
counterclockwise、clockwise、target为请求指令,如果它们出现,同一行内后边一定有一个整数。如果是counterclockwise和clockwise,代表站台上的请求,后边的整数代表请求发生的站点号,counterclockwise表示逆时针方向乘车请求,clockwise代表顺时针方向乘车请求。如果是target,代表车厢内下车请求,后边的整数代表要去的站点号。
|
||||||
|
|
||||||
|
## 输出格式
|
||||||
|
|
||||||
|
程序开始,**先输出一次初始状态**,然后**每个clock输出一次当前状态**;程序**退出时输出end**。每次输出的格式如下,冒号后面没有空格,最后一次输出end后有一个换行。
|
||||||
|
|
||||||
|
> **TIME:秒数**
|
||||||
|
>
|
||||||
|
> **BUS:**
|
||||||
|
>
|
||||||
|
> position:0
|
||||||
|
>
|
||||||
|
> target:0000000000
|
||||||
|
>
|
||||||
|
> STATION:
|
||||||
|
>
|
||||||
|
> clockwise:0000000000
|
||||||
|
>
|
||||||
|
> counterclockwise:0000000000
|
||||||
|
>
|
||||||
|
|
||||||
|
**首先输出当前的时间,即已过的秒数。**
|
||||||
|
|
||||||
|
然后三行代表车辆,BUS:固定不变,position:固定不变,后边的数字代表当前车辆位置,target:固定不变,后边一排数字依次代表车内站点请求情况,0表示没有请求,1表示有请求。
|
||||||
|
|
||||||
|
最后三行代表各站点的状态,
|
||||||
|
|
||||||
|
STATION: 固定不变,
|
||||||
|
|
||||||
|
clockwise:固定不变,后边的数字依次代表各站点顺时针方向的请求情况,0表示没有请求,1表示有请求。
|
||||||
|
|
||||||
|
counterclockwise:固定不变,后边的数字依次代表各站点逆时针方向的请求情况,0表示没有请求,1表示有请求。
|
||||||
|
|
||||||
|
具体可参考输入样例。
|
||||||
|
|
||||||
|
## 策略补充说明
|
||||||
|
|
||||||
|
1. 公交车在没有任何请求时,留在当前位置静止不动,处于空闲状态;只有收到上车或下车请求,确定服务目标后,才进入行驶状态。
|
||||||
|
2. 每一个请求均为单独的服务,即车内请求与站台请求没有必然联系。
|
||||||
|
3. 当公交车在空闲状态,或者完成上次请求 (到达目标站点并停满1秒)后,开始一次新的调度。调度时,以之前收到的请求以及当前1秒内新发生的所有请求作为候选,按照调度规则选择出目标请求,整个调度过程执行时间忽略不计,即公交车在1秒的最开始完成上述所有动作,然后立即服务目标请求。
|
||||||
|
4. 当车服务目标时要选择路程短的方向行驶,如果两个方向路程相同则选择顺时针方向;
|
||||||
|
5. 如果在某个请求没有完成时再有相同的请求(请求类型和站点全部相同)发生,则该请求被抛弃。如果已完成的请求再次发生时应按新请求处理。
|
||||||
|
6. 对于先来先服务策略,车一次停站只完成一个请求,即使在这个站点上即有乘车请求,车内也有到该站的请求,也只能按策略完成已经调度的那个请求。但是完成当前请求后,如果发现时间序列上后续的一个或多个连续请求都恰好在同一站点(即连续的同站点请求位置相同,但请求类型不同),则可以立即完成这些连续的同站点请求,也就是说特殊情况下,一次停车的1秒内可完成多个请求。
|
||||||
|
7. 对于最短寻找时间优先策略,一次服务的目标请求一旦确定,即使中途产生更优的请求也不可以更改。但如果新的请求恰好可以顺便服务(同方向的站台请求或车内请求),可以为新的请求停站。具体为:程序计算离当前车的位置最近的请求,如果没有请求则原地不动,否则按最近的路线(顺、逆时针)去接(送)。如果车途中遇到与车目前同方向的上车或下车请求,可以停下一秒解决,反方向的上车请求不停车。车服务完目标后,反复此过程,直到end。特别地,当车到达目标站点时,可以停一次车(1秒钟)完成该站点已接收的所有类型请求(区别于顺便站停靠)。
|
||||||
|
8. 对于顺便服务策略。第一次行驶方向由时间最短请求站点决定。确定方向后,每次调度都按照当前方向,选择寻找时间最短的请求(不区分类型或方向)作为服务目标。如果去往服务目标站点行驶的距离超过轨道一半时,则需要切换行驶方向服务该请求。车辆行驶过程中,如果经过的站点有服务请求(上车或下车),则不管这个请求的类型或方向,一律停站并完成此请求。这意味着一次停车可能同时完成3个服务请求(上车(顺时、逆时)和下车)。车辆没有请求时则原地不动,直到有新的请求时再按照上述规则继续运行。
|
||||||
|
9. 对于后两种策略(最短寻找时间、顺便服务),如果车辆途经某站点本没有停车计划,则新的请求只要在车辆到达该站点前产生,就能允许停车服务。
|
||||||
|
10. 车处于停止状态开始一次新调度时(空闲状态或者完成上一次服务后),如果本站有请求且根据规则可以为该请求服务,则该请求立即完成,不再停1秒钟。
|
||||||
|
|
||||||
|
### 不保熟的策略详细说明
|
||||||
|
|
||||||
|
**(1)调度策略配置**
|
||||||
|
|
||||||
|
公交车的调度策略只有如下三种:
|
||||||
|
|
||||||
|
(a)先来先服务策略(FCFS):所有请求按照发出时间先后顺序来逐一完成
|
||||||
|
|
||||||
|
(b)最短寻找时间优先策略(SSTF):每次寻找完成时间最短(即距公交车位置最近)的请求并完成。
|
||||||
|
|
||||||
|
(c)顺便服务策略(SCAN):依照车辆行驶方向来完成请求,车辆行驶方向按照要求进行改变。
|
||||||
|
|
||||||
|
在默认情况下,我们设置调度策略为先来先服务策略(FCFS)。
|
||||||
|
|
||||||
|
**(2)策略详细说明**
|
||||||
|
|
||||||
|
(a)先来先服务策略(FCFS):
|
||||||
|
|
||||||
|
按照请求先后顺序来逐一完成,即谁请求在前,谁先执行。
|
||||||
|
|
||||||
|
> 就是按照文件输入中指令的先后顺序来执行
|
||||||
|
|
||||||
|
站点请求的顺逆方向对请求执行顺序无影响,车辆在完成请求时按照距离最近原则来选择行驶方向。
|
||||||
|
|
||||||
|
> 例:总共五站点,公交车在2站点完成请求后,下一请求是到达3站点,则选择顺时针方向行驶,而不是逆时针
|
||||||
|
|
||||||
|
在这种策略下,车一次停站只完成一个请求。
|
||||||
|
|
||||||
|
> 也就是说按照指令先后顺序来执行,在相邻请求所要求站点不同的情况下,车一次停站也就只能完成一个请求,即使在该站点有多个请求。
|
||||||
|
|
||||||
|
但是如果下一个请求恰好在同一站点,则可以一次停站完成2个或2个以上的请求。
|
||||||
|
|
||||||
|
> 在相邻请求所要求站点相同的情况下可以完成多个请求,例如:公交车接下来请求分别是在clockwise2, counterclockwise2, target3,则公交车到达2站点后可以一次性完成3个请求
|
||||||
|
>
|
||||||
|
> 请求之前夹杂着的clock指令无影响
|
||||||
|
|
||||||
|
(b)最短寻找时间优先策略(SSTF):
|
||||||
|
|
||||||
|
每次按照完成时间最短(即距离最近)来完成相应请求。
|
||||||
|
|
||||||
|
程序计算离当前车的位置最近的target、counterclockwise、clockwise请求,
|
||||||
|
|
||||||
|
> 与先来先服务策略不同,这种策略的执行顺序主要依靠公交车的当前状态,即当前状态target,clockwise,counterclockwise中的请求,判断哪一个请求离公交车当前位置最近,然后执行
|
||||||
|
|
||||||
|
如果都没有请求则原地不动,否则按最近的路线(顺、逆时针)去接(送),直至完成请求。反复此过程,直到end。
|
||||||
|
|
||||||
|
一次服务的请求(目标)一旦确定,即使中途产生更优的请求也不可以更改。
|
||||||
|
|
||||||
|
> 请求只能一个一个地完成,中途不能更改当前正在执行的请求
|
||||||
|
|
||||||
|
但如果新的请求恰好可以顺便服务,即如果车途中遇到与车目前同方向的上车请求或下车请求可以停下一秒解决,反方向的上车请求忽略。
|
||||||
|
|
||||||
|
当车到达目标地点时,该站点恰好有两个相反的请求,可以停一次车完成这2个服务。
|
||||||
|
|
||||||
|
>该站点有多个请求时,到达该站点之后可以同时完成
|
||||||
|
>
|
||||||
|
>与顺便服务不同,在去往目标站点的行驶过程中,如果有关于目标站点的新请求出现时,则不必要求其一定要在到达目标站点前起码1秒钟前提出,例如:公交车当前目标是行驶到3站点,如果车在到达3站点之后,立刻有一个关于3站点的另一个新请求,则这几个请求可以一起完成。
|
||||||
|
|
||||||
|
(c)顺便服务策略(SCAN):
|
||||||
|
|
||||||
|
依照车辆行驶方向来完成请求,可以顺便服务(对车辆行驶方向无要求)。
|
||||||
|
|
||||||
|
> 与SSTF不同,这个策略中的顺便服务不会判断站台请求要求的方向与车辆行驶方向是否相同
|
||||||
|
|
||||||
|
第一次行驶方向由第一个请求出现后1秒钟内全部请求中时间最短(即距离最短)的那个请求决定。在行使过程中,如果所有的请求按照当前的行驶方向找出的最短完成时间都超过跑完轨道一半距离时间时,应该切换行驶方向。这是唯一的一个切换方向的规则。
|
||||||
|
|
||||||
|
> 分析:在确定最初行驶方向后,车辆切换方向有且仅有一种可能,即在当前请求完成之后再去改变方向。因为在车辆行驶至目标站点的过程中,其与目标站点的距离一定小于等于轨道总长度的一半,所以不能切换方向
|
||||||
|
>
|
||||||
|
> 每次执行完一次操作后都要判断当前行驶方向是否满足要求,不行就切换方向
|
||||||
|
|
||||||
|
车辆行驶过程中如果经过的站点有服务请求,则不管这个请求的类型一律停站,并认为此请求完成。这意味着一次停车可能完成3个服务。
|
||||||
|
|
||||||
|
> 公交车可以到达目标站点后一次性完成所有请求
|
||||||
|
|
||||||
|
**(3)策略补充说明**
|
||||||
|
|
||||||
|
(a)每一个请求均为单独的服务,就是说车内请求与站台请求没有必然联系。
|
||||||
|
|
||||||
|
(b)在寻找时间最短(即距离最近)的请求时,如果两个方向路程相同则选择顺时针方向。
|
||||||
|
|
||||||
|
(c)如果在某个请求没有完成时再有相同的请求发生,则该请求被抛弃。如果已完成的请求再次发生时应按新请求处理。
|
||||||
|
|
||||||
|
(d)对于SSTF和SCAN策略,如果车辆在某站点本没有停车计划,新的请求要至少要提前1秒钟产生才能享受顺便服务,忽略到达该请求地时再提出的请求。
|
||||||
|
|
||||||
|
## 样例
|
||||||
|
|
||||||
|
> 配置参数为TOTAL_STATION = 10、STRATEGY = FCFS、DISTANCE = 3
|
||||||
|
|
||||||
|
### 输入样例
|
||||||
|
|
||||||
|
clock
|
||||||
|
|
||||||
|
counterclockwise 3
|
||||||
|
|
||||||
|
clock
|
||||||
|
|
||||||
|
clock
|
||||||
|
|
||||||
|
clock
|
||||||
|
|
||||||
|
clock
|
||||||
|
|
||||||
|
clock
|
||||||
|
|
||||||
|
clock
|
||||||
|
|
||||||
|
target 10
|
||||||
|
|
||||||
|
clock
|
||||||
|
|
||||||
|
clock
|
||||||
|
|
||||||
|
clock
|
||||||
|
|
||||||
|
clock
|
||||||
|
|
||||||
|
clock
|
||||||
|
|
||||||
|
clock
|
||||||
|
|
||||||
|
clock
|
||||||
|
|
||||||
|
clock
|
||||||
|
|
||||||
|
clock
|
||||||
|
|
||||||
|
clock
|
||||||
|
|
||||||
|
clock
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
### 输出样例
|
||||||
|
|
||||||
|
**TIME:0**
|
||||||
|
|
||||||
|
BUS:
|
||||||
|
|
||||||
|
position:0
|
||||||
|
|
||||||
|
target:0000000000
|
||||||
|
|
||||||
|
STATION:
|
||||||
|
|
||||||
|
clockwise:0000000000
|
||||||
|
|
||||||
|
counterclockwise:0000000000
|
||||||
|
|
||||||
|
**TIME:1**
|
||||||
|
|
||||||
|
BUS:
|
||||||
|
|
||||||
|
position:0
|
||||||
|
|
||||||
|
target:0000000000
|
||||||
|
|
||||||
|
STATION:
|
||||||
|
|
||||||
|
clockwise:0000000000
|
||||||
|
|
||||||
|
counterclockwise:0000000000
|
||||||
|
|
||||||
|
**TIME:2**
|
||||||
|
|
||||||
|
BUS:
|
||||||
|
|
||||||
|
position:1
|
||||||
|
|
||||||
|
target:0000000000
|
||||||
|
|
||||||
|
STATION:
|
||||||
|
|
||||||
|
clockwise:0000000000
|
||||||
|
|
||||||
|
counterclockwise:0010000000
|
||||||
|
|
||||||
|
**TIME:3**
|
||||||
|
|
||||||
|
BUS:
|
||||||
|
|
||||||
|
position:2
|
||||||
|
|
||||||
|
target:0000000000
|
||||||
|
|
||||||
|
STATION:
|
||||||
|
|
||||||
|
clockwise:0000000000
|
||||||
|
|
||||||
|
counterclockwise:0010000000
|
||||||
|
|
||||||
|
**TIME:4**
|
||||||
|
|
||||||
|
BUS:
|
||||||
|
|
||||||
|
position:3
|
||||||
|
|
||||||
|
target:0000000000
|
||||||
|
|
||||||
|
STATION:
|
||||||
|
|
||||||
|
clockwise:0000000000
|
||||||
|
|
||||||
|
counterclockwise:0010000000
|
||||||
|
|
||||||
|
**TIME:5**
|
||||||
|
|
||||||
|
BUS:
|
||||||
|
|
||||||
|
position:4
|
||||||
|
|
||||||
|
target:0000000000
|
||||||
|
|
||||||
|
STATION:
|
||||||
|
|
||||||
|
clockwise:0000000000
|
||||||
|
|
||||||
|
counterclockwise:0010000000
|
||||||
|
|
||||||
|
**TIME:6**
|
||||||
|
|
||||||
|
BUS:
|
||||||
|
|
||||||
|
position:5
|
||||||
|
|
||||||
|
target:0000000000
|
||||||
|
|
||||||
|
STATION:
|
||||||
|
|
||||||
|
clockwise:0000000000
|
||||||
|
|
||||||
|
counterclockwise:0010000000
|
||||||
|
|
||||||
|
**TIME:7**
|
||||||
|
|
||||||
|
BUS:
|
||||||
|
|
||||||
|
position:6
|
||||||
|
|
||||||
|
target:0000000000
|
||||||
|
|
||||||
|
STATION:
|
||||||
|
|
||||||
|
clockwise:0000000000
|
||||||
|
|
||||||
|
counterclockwise:0010000000
|
||||||
|
|
||||||
|
**TIME:8**
|
||||||
|
|
||||||
|
BUS:
|
||||||
|
|
||||||
|
position:6
|
||||||
|
|
||||||
|
target:0000000001
|
||||||
|
|
||||||
|
STATION:
|
||||||
|
|
||||||
|
clockwise:0000000000
|
||||||
|
|
||||||
|
counterclockwise:0000000000
|
||||||
|
|
||||||
|
**TIME:9**
|
||||||
|
|
||||||
|
BUS:
|
||||||
|
|
||||||
|
position:5
|
||||||
|
|
||||||
|
target:0000000001
|
||||||
|
|
||||||
|
STATION:
|
||||||
|
|
||||||
|
clockwise:0000000000
|
||||||
|
|
||||||
|
counterclockwise:0000000000
|
||||||
|
|
||||||
|
**TIME:10**
|
||||||
|
|
||||||
|
BUS:
|
||||||
|
|
||||||
|
position:4
|
||||||
|
|
||||||
|
target:0000000001
|
||||||
|
|
||||||
|
STATION:
|
||||||
|
|
||||||
|
clockwise:0000000000
|
||||||
|
|
||||||
|
counterclockwise:0000000000
|
||||||
|
|
||||||
|
**TIME:11**
|
||||||
|
|
||||||
|
BUS:
|
||||||
|
|
||||||
|
position:3
|
||||||
|
|
||||||
|
target:0000000001
|
||||||
|
|
||||||
|
STATION:
|
||||||
|
|
||||||
|
clockwise:0000000000
|
||||||
|
|
||||||
|
counterclockwise:0000000000
|
||||||
|
|
||||||
|
**TIME:12**
|
||||||
|
|
||||||
|
BUS:
|
||||||
|
|
||||||
|
position:2
|
||||||
|
|
||||||
|
target:0000000001
|
||||||
|
|
||||||
|
STATION:
|
||||||
|
|
||||||
|
clockwise:0000000000
|
||||||
|
|
||||||
|
counterclockwise:0000000000
|
||||||
|
|
||||||
|
**TIME:13**
|
||||||
|
|
||||||
|
BUS:
|
||||||
|
|
||||||
|
position:1
|
||||||
|
|
||||||
|
target:0000000001
|
||||||
|
|
||||||
|
STATION:
|
||||||
|
|
||||||
|
clockwise:0000000000
|
||||||
|
|
||||||
|
counterclockwise:0000000000
|
||||||
|
|
||||||
|
**TIME:14**
|
||||||
|
|
||||||
|
BUS:
|
||||||
|
|
||||||
|
position:0
|
||||||
|
|
||||||
|
target:0000000001
|
||||||
|
|
||||||
|
STATION:
|
||||||
|
|
||||||
|
clockwise:0000000000
|
||||||
|
|
||||||
|
counterclockwise:0000000000
|
||||||
|
|
||||||
|
**TIME:15**
|
||||||
|
|
||||||
|
BUS:
|
||||||
|
|
||||||
|
position:29
|
||||||
|
|
||||||
|
target:0000000001
|
||||||
|
|
||||||
|
STATION:
|
||||||
|
|
||||||
|
clockwise:0000000000
|
||||||
|
|
||||||
|
counterclockwise:0000000000
|
||||||
|
|
||||||
|
**TIME:16**
|
||||||
|
|
||||||
|
BUS:
|
||||||
|
|
||||||
|
position:28
|
||||||
|
|
||||||
|
target:0000000001
|
||||||
|
|
||||||
|
STATION:
|
||||||
|
|
||||||
|
clockwise:0000000000
|
||||||
|
|
||||||
|
counterclockwise:0000000000
|
||||||
|
|
||||||
|
**TIME:17**
|
||||||
|
|
||||||
|
BUS:
|
||||||
|
|
||||||
|
position:27
|
||||||
|
|
||||||
|
target:0000000001
|
||||||
|
|
||||||
|
STATION:
|
||||||
|
|
||||||
|
clockwise:0000000000
|
||||||
|
|
||||||
|
counterclockwise:0000000000
|
||||||
|
|
||||||
|
**TIME:18**
|
||||||
|
|
||||||
|
BUS:
|
||||||
|
|
||||||
|
position:27
|
||||||
|
|
||||||
|
target:0000000000
|
||||||
|
|
||||||
|
STATION:
|
||||||
|
|
||||||
|
clockwise:0000000000
|
||||||
|
|
||||||
|
counterclockwise:0000000000
|
||||||
|
|
||||||
|
end
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
//
|
|
||||||
// Created by ricardo on 2022/6/27.
|
|
||||||
//
|
|
||||||
|
|
||||||
#ifndef AUTO_BUS_GUI_BUS_FCFS_STRATEGY_H
|
|
||||||
#define AUTO_BUS_GUI_BUS_FCFS_STRATEGY_H
|
|
||||||
#include "BusStrategyBase.h"
|
|
||||||
|
|
||||||
class BusFCFSStrategy : public BusStrategyBase
|
|
||||||
{
|
|
||||||
int GetBusDirection() override;
|
|
||||||
|
|
||||||
bus_query_t *GetTargetQuery() override;
|
|
||||||
|
|
||||||
bus_query_t *HandleBTWQuery() override;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#endif //AUTO_BUS_GUI_BUS_FCFS_STRATEGY_H
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
//
|
|
||||||
// Created by ricardo on 2022/6/27.
|
|
||||||
//
|
|
||||||
|
|
||||||
#ifndef AUTO_BUS_GUI_BUS_SCAN_STRATEGY_H
|
|
||||||
#define AUTO_BUS_GUI_BUS_SCAN_STRATEGY_H
|
|
||||||
#include "BusStrategyBase.h"
|
|
||||||
|
|
||||||
|
|
||||||
class BusSCANStrategy : public BusStrategyBase
|
|
||||||
{
|
|
||||||
int GetBusDirection() override;
|
|
||||||
|
|
||||||
bus_query_t *GetTargetQuery() override;
|
|
||||||
|
|
||||||
bus_query_t *HandleBTWQuery() override;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#endif //AUTO_BUS_GUI_BUS_SCAN_STRATEGY_H
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
//
|
|
||||||
// Created by ricardo on 2022/6/27.
|
|
||||||
//
|
|
||||||
|
|
||||||
#ifndef AUTO_BUS_GUI_BUS_SSTF_STRATEGY_H
|
|
||||||
#define AUTO_BUS_GUI_BUS_SSTF_STRATEGY_H
|
|
||||||
#include "BusStrategyBase.h"
|
|
||||||
|
|
||||||
class BusSSTFStrategy : public BusStrategyBase
|
|
||||||
{
|
|
||||||
int GetBusDirection() override;
|
|
||||||
|
|
||||||
bus_query_t *GetTargetQuery() override;
|
|
||||||
|
|
||||||
bus_query_t *HandleBTWQuery() override;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#endif //AUTO_BUS_GUI_BUS_SSTF_STRATEGY_H
|
|
||||||
@@ -1,139 +0,0 @@
|
|||||||
//
|
|
||||||
// Created by ricardo on 2022/6/27.
|
|
||||||
//
|
|
||||||
|
|
||||||
#ifndef AUTO_BUS_GUI_BUS_CONTROLLER_BASE_H
|
|
||||||
#define AUTO_BUS_GUI_BUS_CONTROLLER_BASE_H
|
|
||||||
#include "QObject"
|
|
||||||
#include "QString"
|
|
||||||
#include "QTimer"
|
|
||||||
|
|
||||||
#include "railsModel.h"
|
|
||||||
#include "queryModel.h"
|
|
||||||
#include "busModel.h"
|
|
||||||
#include "Settings.h"
|
|
||||||
|
|
||||||
class BusStrategyBase : public QObject
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
/**
|
|
||||||
* 轨道模型
|
|
||||||
*/
|
|
||||||
RailsModel *rails_model;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 请求模型
|
|
||||||
*/
|
|
||||||
QueryModel *query_model;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 公交车模型
|
|
||||||
*/
|
|
||||||
BusModel *bus_model;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 当前的计时时刻
|
|
||||||
*/
|
|
||||||
int bus_tick;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 当前的处理策略
|
|
||||||
*/
|
|
||||||
int strategy;
|
|
||||||
|
|
||||||
BusStrategyBase();
|
|
||||||
|
|
||||||
~BusStrategyBase() override;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获得当前公交车应该前进的方向
|
|
||||||
* @return 公交车前进的方向
|
|
||||||
*/
|
|
||||||
virtual int GetBusDirection() = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获得公交车在当前指定的策略下应该处理的请求
|
|
||||||
* @return 请求指针
|
|
||||||
*/
|
|
||||||
virtual bus_query_t *GetTargetQuery() = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取公交车现在可以顺便处理的请求
|
|
||||||
* @return 请求指针
|
|
||||||
*/
|
|
||||||
virtual bus_query_t *HandleBTWQuery() = 0;
|
|
||||||
|
|
||||||
signals:
|
|
||||||
/**
|
|
||||||
* 删除请求信号
|
|
||||||
* @param query 需要删除请求的指针
|
|
||||||
*/
|
|
||||||
void DeleteQuerySignal(int query_type, int node_id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 打印状态信号
|
|
||||||
* @param string 状态字符串
|
|
||||||
*/
|
|
||||||
void PrintStateSignal(QString string);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 运行公交车的信号
|
|
||||||
* @param direction 公交车前进的方向
|
|
||||||
* @param duration 前进需要的时间
|
|
||||||
*/
|
|
||||||
void BusRunningSignal(int direction, int duration);
|
|
||||||
|
|
||||||
public slots:
|
|
||||||
/**
|
|
||||||
* 添加请求的槽函数
|
|
||||||
* @param query_type 请求的类别
|
|
||||||
* @param node_id 请求的站点ID
|
|
||||||
*/
|
|
||||||
void AppendQuerySlot(int query_type, int node_id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 处理开始事件的槽函数
|
|
||||||
*/
|
|
||||||
void BusBeginSlot();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 处理结束事件的槽函数
|
|
||||||
*/
|
|
||||||
void BusEndSlot();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 处理tick事件的槽函数
|
|
||||||
*/
|
|
||||||
void OneTickSlot(int remaining_time);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 处理到站事件的槽函数
|
|
||||||
*/
|
|
||||||
void OnStopSlot();
|
|
||||||
|
|
||||||
private:
|
|
||||||
/**
|
|
||||||
* 储存当前的状态
|
|
||||||
*/
|
|
||||||
int status = BUS_END;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 打印当前状态
|
|
||||||
* @return 表示当前状态的字符串
|
|
||||||
*/
|
|
||||||
QString PrintState(int remaining_time) const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 决定公交车状态的函数
|
|
||||||
*/
|
|
||||||
void DetermineBusStatus();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 处理请求
|
|
||||||
*/
|
|
||||||
void HandleQuery();
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#endif //AUTO_BUS_GUI_BUS_CONTROLLER_BASE_H
|
|
||||||
@@ -1,81 +0,0 @@
|
|||||||
//
|
|
||||||
// Created by ricardo on 2022/6/28.
|
|
||||||
//
|
|
||||||
|
|
||||||
#ifndef AUTO_BUS_GUI_BUS_WIDGET_H
|
|
||||||
#define AUTO_BUS_GUI_BUS_WIDGET_H
|
|
||||||
#include "QGraphicsPixmapItem"
|
|
||||||
#include "QTransform"
|
|
||||||
#include "QPropertyAnimation"
|
|
||||||
|
|
||||||
#include "PosPair.h"
|
|
||||||
#include "define.h"
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 显示公交车的对象
|
|
||||||
* 继承了QObject QGraphicsPixmapItem
|
|
||||||
* 用以使用qt的动画框架
|
|
||||||
*/
|
|
||||||
class BusItem: public QObject, public QGraphicsPixmapItem
|
|
||||||
{
|
|
||||||
// 调用这个宏使其qt对象化
|
|
||||||
Q_OBJECT
|
|
||||||
// 注册了一个QPointF类型的变量pos
|
|
||||||
// 读取这个变量通过 pos()函数
|
|
||||||
// 写入这个变量通过 setPos()函数
|
|
||||||
Q_PROPERTY(QPointF pos READ pos WRITE setPos)
|
|
||||||
public:
|
|
||||||
explicit BusItem(const QPixmap& pixmap);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class BusWidget
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
/**
|
|
||||||
* 真正的公交车显示对象
|
|
||||||
*/
|
|
||||||
BusItem *item;
|
|
||||||
|
|
||||||
explicit BusWidget();
|
|
||||||
|
|
||||||
~BusWidget();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 重置公交车
|
|
||||||
* @param s 位置对数组的头指针
|
|
||||||
* @param num 站点数目
|
|
||||||
*/
|
|
||||||
void ResetBusPos(PosPair *s, int num);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 开始公交车动画
|
|
||||||
* @param direction 动画的方向
|
|
||||||
* @param duration 动画持续的时间 ms
|
|
||||||
*/
|
|
||||||
void StartAnimation(int direction, int duration);
|
|
||||||
|
|
||||||
private:
|
|
||||||
/**
|
|
||||||
* 存储各个站点位置对的数组
|
|
||||||
*/
|
|
||||||
PosPair *pos_pairs = nullptr;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 动画对象
|
|
||||||
*/
|
|
||||||
QPropertyAnimation *animation;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 公交车所在的站点
|
|
||||||
*/
|
|
||||||
int pos = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 站点总数
|
|
||||||
*/
|
|
||||||
int node_num = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#endif //AUTO_BUS_GUI_BUS_WIDGET_H
|
|
||||||