Skip to the content.

Game DLC

This directory contains additional Game functions and SAW contracts for you to reference. You will notice:

DLC Functions

Below is a list of functions included in Game/.

levelUp(uint32_t level)

Goal: Determine how to set up and verify a very simple function in a SAW contract.

Lessons Learned

getDefaultLevel()

Goal: Determine how to handle global variables in a SAW contract.

Lessons Learned:

initDefaultPlayer(player_t* player)

Goal: Determine how to setup a struct variable in a SAW contract.

Lessons Learned:

checkStats(character_t* character)

Goal: Determine how to use parameterized contracts to set preconditions and postconditions.

Lessons Learned:

Additional Notes:

resolveAttack(character_t* target, uint32_t atk)

Goal: Expand upon the lessons learned with checkStats to get a contract ready for overrides/lemmas.

Lessons Learned:

selfDamage(player_t* player)

Goal: To provide a case study where SAW should have complained about its memory disjoint assertion being violated. Note that SAW’s Python API silently resolves this issue.

resetInventoryItems(inventory_t* inventory)

Goal: To show the problems SAW faces when verifying structs with pointer fields.

Lessons Learned:

initScreen(screen_t* screen, uint8_t assetID)

Goal: To provide a case study where SAW should have complained about not knowing what nested defines resolve to. Note that SAW’s Python API silently resolves this issue.

setScreenTile(screen_t* screen, uint32_t screenIdx, uint32_t tableIdx)

Goal: Demonstrate how to initialize an extern global array.

Lessons Learned:

quickBattle(player_t* player, character_t* opponent)

Goal: To show how to pass overrides (lemmas) to a Unit test.

Lessons Learned:

Additional Notes: