THINK FIRST·CODE LATER

← All labs

Autonomy-level advisor

Problem

Decide the maximum AI autonomy level (L0–L5, as in this chapter) allowed for proposed tasks.

Input: lines task risk reversibility data checks until the end of input:

  • risk: LOW, MEDIUM, HIGH (impact on people, security, money)
  • reversibility: EASY (rollback in minutes) or HARD
  • data: NONE, PERSONAL, SENSITIVE
  • checks: WEAK or STRONG (quality of automated tests/evals/scans for this change)

Rules — start at L4 and lower the level:

  1. risk HIGH → at most L2; risk MEDIUM → at most L3.
  2. reversibility HARD → lower by 1.
  3. data PERSONAL → at most L2; data SENSITIVE → at most L1.
  4. checks WEAK → lower by 1.
  5. The level never goes below L0. (L5 is never allowed.)

Apply rules 1 and 3 as caps (minimum with the current level) and rules 2 and 4 as reductions, in the order 1, 2, 3, 4.

Output per task: task: L<n> - <control> with the control for the resulting level:

  • L4: auto-merge if gates pass; audit samples
  • L3: agent PR; human reviews every change
  • L2: AI assists on request; human writes and commits
  • L1: suggestions only
  • L0: human only

Then Tasks: n, human-reviewed (L0-L3): h.

Input:

readme-typos LOW EASY NONE STRONG
search-filter MEDIUM EASY NONE STRONG
hidden-post-rule HIGH HARD PERSONAL STRONG
harassment-reply HIGH HARD SENSITIVE WEAK

Output:

readme-typos: L4 - auto-merge if gates pass; audit samples
search-filter: L3 - agent PR; human reviews every change
hidden-post-rule: L1 - suggestions only
harassment-reply: L0 - human only
Tasks: 4, human-reviewed (L0-L3): 3

Data for this lab

Your program reads its data from standard input. Download the file, then give it to your program as shown below. Start with data set 1: its expected output is given.

s14-1-data-1.txt

readme-typos LOW EASY NONE STRONG
search-filter MEDIUM EASY NONE STRONG
hidden-post-rule HIGH HARD PERSONAL STRONG
harassment-reply HIGH HARD SENSITIVE WEAK
What your program must print for s14-1-data-1.txt
readme-typos: L4 - auto-merge if gates pass; audit samples
search-filter: L3 - agent PR; human reviews every change
hidden-post-rule: L1 - suggestions only
harassment-reply: L0 - human only
Tasks: 4, human-reviewed (L0-L3): 3

Run your program first, then open this and compare line by line: your output must contain these lines exactly.

How to give the file to my program

Terminal (macOS, Linux, or Windows Command Prompt), after compiling:

java Main < s14-1-data-1.txt

Windows PowerShell does not understand <:

Get-Content s14-1-data-1.txt | java Main

IntelliJ IDEA: Run → Edit Configurations → Redirect input from. Or simply paste the content of the file into the console when the program waits for input.

Write it here or in your IDE, then paste it. Compile and test it yourself before comparing. Your code stays in your browser — it is never sent to or stored on the server.