# 12 - blackjack

## The Challenge

Hey! check out this C implementation of blackjack game! I found it online

* <http://cboard.cprogramming.com/c-programming/114023-simple-blackjack-program.html>

I like to give my flags to millionares. how much money you got?

Running at: nc pwnable.kr 9009

## The Solution

We need to own more than a million dollars. After some interaction with the game, it is obvious we can't profit that much in legitimate ways.

Here is the betting function:

![](/files/-MHeyMWFkcrzr79ggwXf)

The program is caring enough to not let us bet more than what we have, but what if we bet with a negative amount?

Most of the games we will lose, and when we lose our bet is subtracted from our total amount:

![](/files/-MHezu8KC9mBqgJw3AJp)

So, just bet with a negative amount greater than a million, and grab that flag.


---

# Agent Instructions: 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:

```
GET https://nickbhe.gitbook.io/shikata-ga-nai/pwnable.kr/12-blackjack.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
