In this exercise, you need to implement some rules from Pac-Man, the classic 1980s-era arcade-game.
There are six tasks in total, four of them are rules related to the game states.
Do not worry about how the arguments are derived in functions, just focus on combining the arguments to return the intended result.
Define a variable named PowerOn with a value to represent that the power is indeed on.
> $PowerOn
TrueDefine the EatGhost function that takes two parameters (if Pac-Man has a power pellet active and if Pac-Man is touching a ghost) and returns a Boolean value if Pac-Man is able to eat the ghost.
The function should return True only if Pac-Man has a power pellet active and is touching a ghost.
> EatGhost -ActivePower $false -TouchingGhost $true
FalseDefine the Score function that takes two parameters (if Pac-Man is touching a power pellet and if Pac-Man is touching a dot) and returns a Boolean value if Pac-Man scored.
The function should return True if Pac-Man is touching a power pellet or a dot.
> Score -TouchDot $true -TouchPowerPellet $true
4Define the Lose function that takes two parameters (if Pac-Man has a power pellet active and if Pac-Man is touching a ghost) and returns a Boolean value if Pac-Man loses.
The function should return True if Pac-Man is touching a ghost and does not have a power pellet active.
> Lose -ActivePower $false -TouchingGhost $true
TrueDefine the Win function that takes three parameters (if Pac-Man has eaten all of the dots, if Pac-Man has a power pellet active, and if Pac-Man is touching a ghost) and returns a Boolean value if Pac-Man wins.
The function should return True if Pac-Man has eaten all of the dots and has not lost based on the parameters defined in part 3.
> Win -EatenAllDots $false -ActivePower $true -TouchingGhost $false
FalseGo back to the last function, add a Synopsis section to the comment block as a short description of how to win the game.
The description should be at minimum ten characters long.
function MyFunc($Arg) {
<#
.DESCRIPTION
This is a demonstration of the comment-based help with the description keyword.
#>
}In this exercise, you need to implement some rules from Pac-Man, the classic 1980s-era arcade-game.
There are six tasks in total, four of them are rules related to the game states.
Do not worry about how the arguments are derived in functions, just focus on combining the arguments to return the intended result.
Define a variable named PowerOn with a value to represent that the power is indeed on.
> $PowerOn
TrueDefine the EatGhost function that takes two parameters (if Pac-Man has a power pellet active and if Pac-Man is touching a ghost) and returns a Boolean value if Pac-Man is able to eat the ghost.
The function should return True only if Pac-Man has a power pellet active and is touching a ghost.
> EatGhost -ActivePower $false -TouchingGhost $true
FalseDefine the Score function that takes two parameters (if Pac-Man is touching a power pellet and if Pac-Man is touching a dot) and returns a Boolean value if Pac-Man scored.
The function should return True if Pac-Man is touching a power pellet or a dot.
> Score -TouchDot $true -TouchPowerPellet $true
4Define the Lose function that takes two parameters (if Pac-Man has a power pellet active and if Pac-Man is touching a ghost) and returns a Boolean value if Pac-Man loses.
The function should return True if Pac-Man is touching a ghost and does not have a power pellet active.
> Lose -ActivePower $false -TouchingGhost $true
TrueDefine the Win function that takes three parameters (if Pac-Man has eaten all of the dots, if Pac-Man has a power pellet active, and if Pac-Man is touching a ghost) and returns a Boolean value if Pac-Man wins.
The function should return True if Pac-Man has eaten all of the dots and has not lost based on the parameters defined in part 3.
> Win -EatenAllDots $false -ActivePower $true -TouchingGhost $false
FalseGo back to the last function, add a Synopsis section to the comment block as a short description of how to win the game.
The description should be at minimum ten characters long.
function MyFunc($Arg) {
<#
.DESCRIPTION
This is a demonstration of the comment-based help with the description keyword.
#>
}