Zum Inhalt springen
#0888
Terminal

The grader waits for the prompt, like a person would

Week four's assignment is an interactive program: a bank teller in C that asks for an account number, then a command, then an amount. You can't grade it by running it and reading stdout. You have to talk to it.

The grader talks over HTTP. It launches the student's binary in a terminal session, then calls POST /terminal/wait with mode: regex and pattern: "Account number:". It returns with a screen snapshot when the prompt appears, timeout at timeout_ms if it never does, or exited if the program crashed. POST /terminal/paste answers. Another wait, another paste. At the end, GET /terminal/find with a PCRE2 pattern checks the balance on screen. A missing prompt fails one wait, not the run.

The old version was an expect script nobody could read. This one is a loop of waits and pastes, run against forty terminals from one file.

The grader waits for the prompt, like a person would.