Since today is play of Sunday I wanted to make my a random generating score program . Use this to tell what is going to happen today
Sample output :
NY Giants:10GB Packers:
20
SD Cahrgers:
13
NE Patriots:
19
Have Fun Today !
If you would like me to explain any line let me know . I didn’t comment like I should have but I could fix that. Also if you want to change or add anything to make it better let me know .
Chris
#####################################################
#Scriptname: Get-FootballScore.ps1
#Created Date: 1/20/2008
#####################################################
Function Get-FootballScore
{
#create new instance of random object
$intNumofScores = New-Object system.Random
#create random max number of scores from 1-7
$intMaxNumofScores = $intNumofScores.Next(1,7)
#create a random Touchdown or fieldgoal
$score = New-Object system.Random
for ($s = 1;$s -le $intMaxNumofScores;$s++)
{
$intTypeofScore=$score.Next(1,3)
switch -c ($intTypeofScore)
{
{$_ -eq 1} {$intTypeofScore = 7} #Touchdown
{$_ -eq 2} {$intTypeofScore = 3} #FieldGoal
{$_ -eq 3} {$intTypeofScore = 2} #Safety
}
$FinalScore = $FinalScore + $intTypeofScore
}
$FinalScore
}
Write-Host "NY Giants:"
Get-FootballScore
Write-Host "GB Packers:"
Get-FootballScore
""
""
Write-Host "SD Cahrgers:"
Get-FootballScore
Write-Host "NE Patriots:"
Get-FootballScore

[...] used to them. In order to learn this new style I decided to go back to an earlier blog I did called Playoff Sunday with powershell. So I decided to do this script over with the new Advanced Function format . I will explain it [...]
Pingback by Advanced Functions with Powershell –Having some Fun! « A brooklyn Tale — December 27, 2008 @ 8:22 pm