> For the complete documentation index, see [llms.txt](https://brkt-gg.gitbook.io/brkt.gg-whitepaper/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://brkt-gg.gitbook.io/brkt.gg-whitepaper/3.2-predictablecompetition.md).

# 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. |
