# 3.2 PredictableCompetition

The PredictableCompetition contract builds upon the base Competition contract and allows users to register and create 'bracket predictions.' Participants can acquire points by accurately predicting match outcomes, enhancing user engagement and fostering a competitive environment.

#### Function 1: createBracketPrediction

```solidity
function createBracketPrediction(address _registrant, uint8[] calldata _matchPredictions) public virtual whenNotLive
```

This function allows a user to submit their bracket predictions for the competition.

| Name               | Type              | Description                                                |
| ------------------ | ----------------- | ---------------------------------------------------------- |
| \_registrant       | address           | The address of the user submitting the prediction.         |
| \_matchPredictions | uint8\[] calldata | An array containing the user's predictions for each match. |

#### Function 2: getUserBracketPrediction

```solidity
function getUserBracketPrediction(address _user) public view returns(uint8[] memory bracketPrediction_)
```

This function retrieves a user's bracket predictions for the competition.

| Name   | Type    | Description                                                  |
| ------ | ------- | ------------------------------------------------------------ |
| \_user | address | The address of the user whose predictions are to be fetched. |

#### Function 3: hasUserRegistered

```solidity
function hasUserRegistered(address _user) public view returns(bool isRegistered_)
```

This function checks whether a user has registered for the competition or not.

| Name   | Type    | Description                                                         |
| ------ | ------- | ------------------------------------------------------------------- |
| \_user | address | The address of the user whose registration status is to be checked. |

#### Function 4: getTotalScore

```solidity
function getTotalScore() external view returns(uint256 totalScore_)
```

This function calculates and returns the total score of the competition.

#### Function 5: getUserScorePercent

```solidity
function getUserScorePercent(address _user) external view returns(uint256 scorePercent_)
```

This function calculates and returns the user's score as a percentage of the total possible score.

| Name   | Type    | Description                                                         |
| ------ | ------- | ------------------------------------------------------------------- |
| \_user | address | The address of the user whose score percentage is to be calculated. |

#### Function 6: getUserBracketScore

```solidity
function getUserBracketScore(address _user) public view returns(uint256 score_)
```

This function calculates and returns the user's bracket score based on their predictions.

| Name   | Type    | Description                                                      |
| ------ | ------- | ---------------------------------------------------------------- |
| \_user | address | The address of the user whose bracket score is to be calculated. |


---

# 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://brkt-gg.gitbook.io/brkt.gg-whitepaper/3.2-predictablecompetition.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.
