Instructions
Create a solution for the problems listed. Create pseudocode based on your solution. Create a PowerShell script from your pseudocode. Ensure that you clearly identify the sections of your script that show sequence, iteration and condition.
Question1
BOOGLE
Create a Boogle game. It should have an introduction briefly describing the game. IT should produce 9 random characters weighted on standard English word letter frequency. It should output the characters in a 3x3 grid like:
Q|N|P
-----
R|D|E
-----
R|O|L
You can then enter a word, greater than 2 characters, from the 9 letters. You must check that it is a valid word and get it scored using the wordnik scrabble score API. If it is valid, store the word in a collection of words and scores.
A person can then use E to exit S to Shuffle the characters L to list found words and their scores.
Upon exit display the Final score with the word list. If it is above 50 congratulate them.
I am putting a example u just need to make a few changes to finish question 1
function Get-RandomWeightedCharacter {
param(
[string] $Letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ",
[int[]] $Weights= @(9, 2, 2, 4, 12, 2, 3, 2, 9, 1, 1, 4, 2, 6, 8, 2, 1, 6, 4, 6, 4, 2, 2, 1, 2, 1),
[int] $Number = 1
)
if($Weights.Count -ne $Letters.Length)
{
Write-Host -ForegroundColor DarkBlue "String length and weight counts do not match"
}
else
{
foreach ($Weight in $Weights) { $TotalWeight += $Weight }
$loop = 0
$RandomLetters = New-Object System.Collections.ArrayList
do
{
$RandomValue = Get-Random -Minimum 0 -Maximum $TotalWeight
$LetterIndex = 0
$Count=0
while($LetterIndex -lt $Weights.Count)
{
$Count += $Weights[$LetterIndex]
$LetterIndex += 1
if($Count -gt $RandomValue) { break; }
}
$Loop += 1
$RandomLetter = $Letters.ToCharArray()[$LetterIndex-1]
if($Number -gt 1)
{
$result = $RandomLetters.Add($RandomLetter)
}
}
while ($Loop -lt $Number)
if($Number -gt 1)
{