Main Flashcards

1
Q

What are the global variables initialised inside main?

A

NumbersAllowed: A list of integers representing which numbers the player can currently use in expressions.

Targets: A list of target values the player needs to “hit” with their expressions.

MaxNumberOfTargets, MaxTarget, MaxNumber: Limits that control how large the target values can be, how many targets will exist, and how large the random “usable numbers” can be.

TrainingGame: Flag that indicates if we are in a “training” scenario (fixed big numbers) or in a standard random game.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How does a user choose a game mode?

A

Reads user input, decides if they typed “y” (training mode) or something else (random mode).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What happens when the user chooses the training method? what are the conditions for the maxNumber and maxTarget?

A

Sets MaxNumber and MaxTarget to 1000.

Preloads Targets with a fixed list of integers (some set to -1, others to actual numbers).

This ensures the user sees predictable values if they want to practice.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What if the user chooses a random game ? What happens to the maxNumber and maxTarget.

A

Sets smaller numbers for a more typical random game.
CreateTargets is called to populate the Targets list with random integers.

MaxNumber = 10;
MaxTarget = 50;
MaxNumberOfTargets: We want a maximum of 20 targets for the random game.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How are the numbers allowed for a training game?

A

NumbersAllowed with [2,3,2,8,512] if training.
NumbersAllowedFillNumbers(NumbersAllowed, TrainingGame, MaxNumber);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What function is called inside main to start the game?

A

Calls PlayGame, passing all the relevant parameters.

Waits for user input at the end (ReadLine) so the console doesn’t close immediately.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

what is the overall purpose of main?

A

Main is the entry point where all variables get set up. It’s the director of the entire program, deciding training vs. random, and then launching the main loop in PlayGame.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

what kind of data structure does the targets list simulate?

A

A queue-like structure of integer targets the user tries to match with expressions.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

where are targets generated

A

Targets is generated via CreateTargets, which randomly populates targets up to those limits.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

what are the numbers allowed in a target game and what function is called to ensure that the correct numbers are being used?

A

FillNumbers
Sets up the starting 5 numbers the player can use: either a fixed set [2, 3, 2, 8, 512] for training or random ones between 1 and MaxNumber.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly