> For the complete documentation index, see [llms.txt](https://alham-rizvi.gitbook.io/alhamrizvi/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://alham-rizvi.gitbook.io/alhamrizvi/picoctf-writeups/picoctf/reverse-engineering/ready-gladiator-2.md).

# Ready Gladiator 2

This challenge was another Core War task where we had to submit a Redcode warrior that can consistently defeat the opponent. The goal is to make the enemy program crash while keeping our own program alive.

The solution used a very small but effective program:

```
jmp 0, <-2
```

This instruction creates a tight infinite loop. The `JMP 0` keeps execution at the same instruction, so the program never moves forward or executes anything else. The `<-2` part uses pre-decrement indirect addressing, which keeps modifying nearby memory locations as the instruction runs.

Because of this behavior, the program acts like a defensive trap. It keeps looping forever while also interfering with memory around it. This makes it difficult for the opponent program (especially simple “imp” style programs that move linearly through memory) to survive, as they eventually run into corrupted instructions or invalid states.

To solve the challenge, I saved this code in a file and sent it to the remote service using netcat. The server runs 100 rounds between both warriors. In this case, the program won all 100 rounds, completely defeating the opponent.

Since the solution achieved consistent wins, the challenge returned the flag after execution.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://alham-rizvi.gitbook.io/alhamrizvi/picoctf-writeups/picoctf/reverse-engineering/ready-gladiator-2.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
