Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

docs: add freshcup mid. add problem type description. #2

Merged
merged 3 commits into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/.vitepress/config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,10 @@ export default withMermaid({
{
text: 'Go-judge 中间件',
link: '/gojudge-mid'
},
{
text: 'FreshCup 中间件',
link: '/freshcup-mid'
}
]
},
Expand Down
73 changes: 73 additions & 0 deletions docs/dev-guide/backend/judge-mid/freshcup-mid.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# FreshCup 中间件

## 简介

sastoj 通过 FreshCup 中间件提供了对 `单选题、多选题、简答题` 的支持

## 题目类型

该评测机支持的题目类型为选择题、填空题。对应的题目类型信息如下:

| 题目类型 | Slug Name | Display Name | Description | Submission Channel Name | Self Test Channel Name | Judge |
|:----:|:------------------------:|:---------------:|:-------------------------------------------:|:-----------------------:|:----------------------:|:--------:|
| 单选题 | freshcup-single-choice | Single-Choice | Single Choice Problem powered by Freshcup | freshcup-submission | freshcup-self-test | freshcup |
| 多选题 | freshcup-multiple-choice | Multiple-Choice | Multiple Choice Problem powered by Freshcup | freshcup-submission | freshcup-self-test | freshcup |
| 简答题 | freshcup-short-answer | Short-Answer | Short Answer Problem powered by Freshcup | freshcup-submission | freshcup-self-test | freshcup |

## 代码结构

``` plaintext
.
├── Dockerfile
├── Makefile
├── cmd
│   └── freshcup
│   ├── main.go
│   ├── wire.go
│   └── wire_gen.go
└── internal
├── biz
│   ├── biz.go
│   ├── submission.go
├── conf
│   ├── conf.pb.go
│   └── conf.proto
├── data
│   ├── data.go
│   └── submission.go
├── server
│   ├── server.go
│   └── submission.go
└── service
   ├── service.go
   └── submission.go

```

## 评测流程

1. 监听消息队列,接收提交消息。
2. 从消息中提取提交信息,包括提交 ID、题目 ID、提交内容等。
3. 通过题目 ID 获取题目信息,包括题目的测试数据。
4. 根据题目类型(单选、多选、填空)不同,决定立即评分还是等待手动评分。
5. 若题目为选择题,根据答案对提交进行评分。
6. 将评分结果持久化到数据库中,并同步缓存至 Redis 中。
7. 结束评测。

## 元数据

题目元数据包括题目选项等信息

以下是选择题的元数据示例:

```json
{
"options": {
"A": "选项A",
"B": "选项B",
"C": "选项C",
"D": "选项D"
},
"size": "4"
}
```
13 changes: 11 additions & 2 deletions docs/dev-guide/backend/judge-mid/gojudge-mid.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,16 @@

sastoj 通过 Go-judge 中间件提供了对 [`Go-judge`](https://github.com/criyle/go-judge) 评测机的支持。

Go-judge 中间件是搭建了 sastoj 和 Go-judge 服务直接的桥梁,将 sastoj 的提交和自测发送到 Go-judge 服务,通过分析 Go-judge 的回传对提交进行评分,并持久化数据。
Go-judge 中间件是搭建了 sastoj 和 Go-judge 服务直接的桥梁,将 sastoj 的提交和自测发送到 Go-judge 服务,通过分析 Go-judge
ballade0d marked this conversation as resolved.
Show resolved Hide resolved
的回传对提交进行评分,并持久化数据。

## 题目类型

该评测机支持的题目类型为编程题。对应的题目类型信息如下:

| 题目类型 | Slug Name | Display Name | Description | Submission Channel Name | Self Test Channel Name | Judge |
|:----:|:--------------------:|:------------:|:---------------------------------------:|:-----------------------:|:----------------------:|:-------:|
| 编程题 | gojudge-classic-algo | Classic-Algo | Classic Algo Problem powered by Gojudge | gojudge-submission | gojudge-self-test | gojudge |

## 代码结构

Expand Down Expand Up @@ -115,7 +124,7 @@ message ExecConfig{
1. 监听消息队列,接收提交消息。
2. 从消息中提取提交信息,包括提交 ID、题目 ID、语言、代码等。
3. 通过题目 ID 获取题目信息,包括题目的测试数据。
4. 根据题目类型(simple, subtasks)不同,调用不同的评测函数。
4. 根据评测类型(simple, subtasks)不同,调用不同的评测函数。
5. 从配置文件中获取对应语言的编译、运行、源文件、目标文件等信息。
6. 编译代码,运行代码,获取运行结果。
7. 根据运行结果,对提交进行评分。
Expand Down
11 changes: 10 additions & 1 deletion docs/user-guide/admin-console/judge/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

在sastoj上传题目时,配置文件的命名应为 `config.toml`,并放置在题目的根目录下。

以下是一份传统题、简易任务类型的配置文件示例:
以下是一份编程题、传统评测类型、简易任务类型的配置文件示例:

```toml
# 题目总分
Expand Down Expand Up @@ -39,6 +39,15 @@ answer = "2.ans"
score = 60
```

以下是选择题或主观题的配置文件示例:

```toml
# 参考答案
ReferenceAnswer = "A"
# 多选题未完全正确的得分(总分为100)
PartialScore = 50
```

字段含义将在下文进行解释。

## 评测类型 (`judgeType`)
Expand Down
Loading