2002年趨勢百萬程式競賽 (初賽題目)
| Introduction |
|---|
Good Neighbors is a LAN-based groupware application. In the neighborhood, each user (neighbor) contributes a small amount of disk space to construct a collectively shared storage, which is globally accessible to all neighbors in the neighborhood. Neighbors can freely share files in this system, and the files are stored in a distributed way. This system has the following characteristics:
|
Architecture Overview |
|---|
|
Global Directory Structure |
|---|
All files in the neighborhood reside on a single level global directory, all the shared files are listed in this directory.
File Identification
A file is identified by its full name (file name with its path in the global directory) and its owner. In other words, a "unique" file must have a unique combination of a full name and an owner. Therefore, two files with identical file names but different owners are treated as two unique files and can coexist in the global directory.
A file must have the following attributes:
| Attribute | Description |
|---|---|
| File Name | The file name with an extension and path. E.g. \pub\mystuff.doc
|
| Creation time | The time the file was put in the global directory (time
according to the node that the user was on when he/she put the file
in).
|
| File Size | The size of the file (not the fragments, or the size of
a fragment).
|
| Owner | The user who put the file in the global directory.
|
|
Functional Requirements |
|---|
|
Setup |
|---|
The setup can either be an auto-installation script (a batch file or shell script) or an instruction to let users manually install the binaries. However, those who implement auto-installation scripts will earn more points based on the installation criteria.
The default installation path is:
For Windows: c:\Good_Neighbor
For Linux: /home/<current user>/Good_Neighbor
|
Application Behavior |
|---|
After successful installation, the program should include a command line tool named gbn.exe (either in Windows or Linux) to support commands listed as the following:
(Note: All functions should behave similarly to the MS-DOS command line utility or Unix Shell commands; if there is any ambiguity, please refer to the MS-DOS command line utility or UNIX Shell commands.)
| Function | Parameter | Example | Description |
|---|---|---|---|
| start | user_name | start david | Starts the application. This function has to be called before all other functions can function properly. |
| setlocal local_path | local_path: local directory path | setlocal c:\my documents\ | Sets the local directory. |
| put local_filename | local_filename: local file name |
put public.doc |
Put a files from the local directory to the global directory. |
| get [-o owner] remote_filename |
[-o owner]: select owner remote_filename: remote file name |
1. get -o David homework.doc
2. get homework.doc |
Retrieves a file from the global directory to the local directory. If there are files with duplicate file names, the user can specify which file to get by specifying the owner using the -o flag. By default, the most current file will be retrieved. |
| ls | ls
|
Shows all files in the global directory.
Displays all attributes of the file listed in File Identification. | |
| exit | exit | Leaves the neighborhood |
|
File Manipulation Mechanism Let N = all participants in the LAN (all nodes that have the program installed). Let n = number of online neighbors in N (n <= N). Let M = number of fragments of one file when putting the file (M <= n). Let m = number of fragments in M that are accessible (m <= M).
|
|---|
Restrictions on "ls", "put", "get":
"ls" and "del" must be operational when n >= 1.
Restrictions on "ls"
Only unique files are displayed. If there are duplicate files (with the same path and same owner), only the latest file should be displayed so that the file list is unambiguous.
Restrictions on "put"
When a file is "put" into the neighborhood, it is actually split into many fragments and each fragment is stored on one node.
Put is operational when n >= 3. In other words, min(M) = 3.
Restrictions on "get"
There are two restrictions on Get.
The file is not salvageable when m = 1.
The file must be salvageable when m >= (2/3)M.
Details are explained below.
| M | m | Salvageable | M | m | Salvageable |
|---|---|---|---|---|---|
| 3 | 1 | no | 5 | 3 | no restriction |
| 2 | yes | 4 | yes | ||
| 3 | yes | 5 | yes | ||
| 4 | 1 | no | 6 | 1 | no |
| 2 | no restriction | 2 | no restriction | ||
| 3 | yes | 3 | no restriction | ||
| 4 | yes | 4 | yes | ||
| 5 | 1 | no | 5 | yes | |
| 2 | no restriction | 6 | yes |
Click here for comprehensive use cases.
|
Sample Execution |
|---|
PRE condition
There is one file, david6.doc in the local directory c:\my documents\.
| Command | Sample Output | ||||||||
|---|---|---|---|---|---|---|---|---|---|
|
start David |
Entering neighborhood... Welcome! | ||||||||
|
setlocal c:\my documents\ |
local directory is set to "c:\my documents\" | ||||||||
| ls |
| ||||||||
| put david6.doc | File put. | ||||||||
| Get jenny2.txt | File retrieved. | ||||||||
| Exit | Bye... |
POST condition
The following files are present in c:\my documents\:
david6.doc
jenny2.txt
|
Test Environment |
|---|
1. At least six PCs will be used for testing.
Hardware specification: Intel Pentium III 600MHz, 128MB RAM, 20GB available hard disk space.
Operating System:
Contestants can choose any of the following environments to be designated as the test environments:
Microsoft Windows 2000 Professional (Service Pack 2), Windows XP Professional, Windows 98SE.
RedHat Linux 7.2 (full install) or Mandrake Linux 8.1 (full install).
2. The testing environment is a closed, pure LAN environment, and each
machine has an internal IP. All operating systems are installed with default
protocols. No firewalls or routers are present in the environment.
|
Evaluation Process |
|---|
The contestants must inform Trend Micro of the desired test environment before July 14th.
The contestants must email completed applications to contest@trend.com.tw before 11:50PM, July 15th. Late applications will not be accepted. A complete application should contain the following items:
Name of the team
Source code
The executable (binary) and any components the binary needs to run
Installation guide, user manual or any documentation explaining the installation process
Design documentation (all design decisions, implementation strategies, and system architecture must be documented here)
Other documents if needed for explanatory purposes
Testing and evaluation will commence July 16th.
Program will be installed according to the installation guide provided by contestants.
Program will be tested in the environment listed in "Test Environment".
Results will be announced on 6:00pm, July 22nd at
http://www.trendmicro.com.tw/contest.
|
Evaluation Criteria |
|---|
Installation (15):
Full score if the package can be successfully installed and all functions work well, deduct 3 points for each defect.
If installation is in the form of automatic script/program, 3 bonus points are added (however, you cannot exceed the maximum score).
No points if the installation fails and cannot execute (bonus points will be discarded).
Required Features and Functions (75):
put/get (55): Full score if files can be stored by the requirement listed above and downloaded without any errors.
setlocal (5): Full score if the selected file can be downloaded to the designated local directory.
ls (10): Full score if all files stored in the systems can be successfully listed.
start/exit (5): Full score if the system can be entered and exited repeatedly and functions well.
Deduct 3 points for each defect found.
Design Document (5)
Installation Guide/Manual (5)
Bonus Points (25): The earlier you can release your completed project, the more time it's available on the market and the greater the chance you can become the market leader. The first 50 teams that send completed applications before the deadline will receive 25 bonus points. But teams must include all items in their applications to be considered for the bonus points.
咀opyright 2002 Trend Micro Corporation. All Rights Reserved.