Frodo's Way Home: Functions

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/12

flashcard set

Earn XP

Description and Tags

Vocabulary flashcards detailing each function used in Frodo's Way Home, including parameters, return types, call locations in main, and authorship attribution.

13 Terms

1
New cards

roll_die

A team-written function with parameter sides (default 3) that returns a random int from 1 to sides. It is called in the turn loop after the player picks 1 (Roll), and called again if the collar is on.

2
New cards

move_frodo

A team-written function with parameters position, roll, and board_len (default 50) that returns the new position (max 50). It is called in the turn loop right after roll_die.

3
New cards

load_board

A team-written function with parameter filename that returns a list of (description, score) tuples. It is called once at the start: cardOptions = load_board("cards.csv").

4
New cards

draw_map

An AI-assisted function with parameters position and board_len (default 50) that returns the grid (list of lists) and prints it. It is called in the turn loop right after move_frodo.

5
New cards

printCard

A team-written function that takes no parameters (nothing) and returns treats and health change while also printing the card. It is called in the turn loop after draw_map.

6
New cards

newCard

A team-written function that takes no parameters (nothing) and returns card text, treats, and health change. It is not called by main; it is called by printCard.

7
New cards

show_powerups

A team-written function with parameter powerups that prints counts and returns 1 if any owned, or 0 if none. It is called in Menu option 3 and menu option 4 (Status).

8
New cards

buy_item

A team-written function with parameters item, shop, stats, and powerups that returns True if bought and False if not. It is not called by main; it is called by open_shop.

9
New cards

open_shop

A team-written function with parameters shop, stats, powerups, and log that returns nothing but changes stats, powerups, and log. It is called in Menu option 2 (Shop).

10
New cards

use_powerup

A team-written function with parameters item and game that returns True if used and False if not. It is called in Menu option 3, inside the for/else name check.

11
New cards

check_game_over

A team-written function with parameters stats (health), position, and board_len that returns "win", "lose", or "in progress". It is called in the turn loop's while condition, before rolling, and after the loop.

12
New cards

log_turn

A team-written function with parameters log, turn, action, and result that returns nothing (appends to log). It is called at the end of every turn, and when the player quits.

13
New cards

write_log

A team-written function with parameters log, stats, turns, and filename that returns nothing (writes frodo_log.txt). It is called once, after the turn loop ends.