-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPNUT Design Doc.txt
149 lines (126 loc) · 3.63 KB
/
PNUT Design Doc.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
----- P.N.U.T. Design Doc -----
# OOP
class Entity:
name
class Contestant -> Entity:
group -> string
etc...
sources -> string // folder with sources of the contestant
class Problem -> Entity:
memory_limit
time_limit
points
tests -> List<Test>
class Test:
input_file
output_file
class Assingment:
contestant -> Contestant
problem -> Problem
source
executable
tests -> List<AssingmentTest>
ToJudge -> bool
ToDelete -> bool
JudgeNext():
// Compile if the source code of the assignment hasn't yet been compiled
// Judge a test from test by running Executor.Execute()
class AssingmentTest:
result -> TestResult
test -> Test
// For further types of problems (if we do them) extend the Problem,
// Test, Assingment, Compiler, Executor and (maybe) AssingmentTest classes
enum TestResult:
TBD
OK
WA
TL
ML
CE
RE
static class Judge:
contestants -> List<Contestant>
problems -> List<Problem>
assignments -> List<Assingment>
completed_assignments -> List<Assingment>
num_parallel_threads -> int
Run():
// Delete assignments which are marked with ToDelete
// Judge at most num_parallel_threads assignments (which haven't been judged) at
// the same time by running the assignment's JudgeNext() function
static class Compiler:
Compile()
// Maybe some (private) auxiliary functions
static class Executor:
Execute()
// Maybe some (private) auxiliary functions
static class CLI:
Run()
public class CommandAttribute -> Attribute:
names -> List<string> // property
help_title -> string // property
help_description -> string // property
static class Commands:
// Use the command attribute to set the string name of each command
// and the help descriptions for each command
CmdHelp(args -> string) -> bool
CmdJudge(args -> string) -> bool
CmdProblem(args -> string) -> bool
CmdContestant(args -> string) -> bool
CmdDelete(args -> string) -> bool
etc...
class ProgressBar
etc... (other helpful CLI Components)
# Folder Structure
Core
Program.cs
Objects
Entity
Entity.cs
Contestant
Contestant.cs
Problem
Problem.cs
Test.cs
Assingment
Assingment.cs
AssingmentTest.cs
TestResult.cs
BackEnd
Judge.cs
Compiler.cs
Executor.cs
CLI
CLI.cs
CommandAttribute.cs
Commands.cs
ProgressBar.cs
etc...
# Command Line Interface
PNUT> problem SomeStupidName "C:/Desktop/Folder With Tests" -tl 0.5 -ml 256
// Each time we call a command we get it's function from the command attributes
// We split the command with spaces (except when there are quotes)
// We pass those arguments to the function
// The function deals with them
// And returns true if the command executed successfully
PNUT> help
// Lists commands
PNUT> help problem
// Lists description of the problem command
PNUT> judge
// Lists a table with dynamic progress bars
// Once you start judging something a table with dynamic information looking something like this should appear
Contestant | Group | Problem | Points | Status
John Cena ASD plz_cout0 50/100 100% [++++++++++++++++++++++++++++++]
free_pts TBD 5% [+-----------------------------]
Johnny Cena B plz_cout0 TBD 0% [------------------------------]
free_pts TBD 0% [------------------------------]
// The progress bar should be made by colour coding a bunch of this '━' character
// something like grey for the portion of tests (percentage) that haven't been judged
// green - OK
// red - Wrong Answer
// purple - Compilation Error (so basically the whole progress bar will go purple)
// blue - Runtime Error
// orange - Time Limit
// yellow - Memory Limit
// these colours aren't set in stone, idc tbh just an example