-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNoteGame.ps1
More file actions
33 lines (23 loc) · 804 Bytes
/
NoteGame.ps1
File metadata and controls
33 lines (23 loc) · 804 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#frequencys from https://pages.mtu.edu/~suits/notefreqs.html
$note = @(
[pscustomobject]@{note='a';Frequency='440'}
[pscustomobject]@{note='b';Frequency='494'}
[pscustomobject]@{note='c';Frequency='523'}
[pscustomobject]@{note='d';Frequency='587'}
[pscustomobject]@{note='e';Frequency='659'}
[pscustomobject]@{note='f';Frequency='698'}
[pscustomobject]@{note='g';Frequency='784'}
)
$strprint=''
$RandomNumber = Get-Random -Minimum 1 -Maximum 7
[console]::beep($note.Frequency[$RandomNumber],500)
$answer=$note.note[$RandomNumber].tostring()
$guess=Read-Host -Prompt 'What note was that?'
if ($guess -eq $answer)
{$strprint+="Yes"
}
else
{$strprint+="no"}
$strprint+=", that was the note "
$strprint+=$answer
Write-Output $strprint