-
Notifications
You must be signed in to change notification settings - Fork 126
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
afa4d26
commit 4fa44af
Showing
14 changed files
with
366 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
name: Flash Cards Build | ||
on: | ||
push: | ||
paths: | ||
- 'Projects/Flash Cards/**' | ||
- '!**.md' | ||
pull_request: | ||
paths: | ||
- 'Projects/Flash Cards/**' | ||
- '!**.md' | ||
workflow_dispatch: | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-dotnet@v3 | ||
with: | ||
dotnet-version: 7.0.x | ||
- run: dotnet build "Projects\Flash Cards\Flash Cards.csproj" --configuration Release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net7.0</TargetFramework> | ||
<ImplicitUsings>disable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
using System; | ||
|
||
(char Letter, string CodeWord)[] array = new[] | ||
{ | ||
( 'A', "Alpha" ), ( 'B', "Bravo" ), ( 'C', "Charlie" ), ( 'D', "Delta" ), | ||
( 'E', "Echo" ), ( 'F', "Foxtrot" ), ( 'G', "Golf" ), ( 'H', "Hotel" ), | ||
( 'I', "India" ), ( 'J', "Juliett" ), ( 'K', "Kilo" ), ( 'L', "Lima" ), | ||
( 'M', "Mike" ), ( 'N', "November" ), ( 'O', "Oscar" ), ( 'P', "Papa" ), | ||
( 'Q', "Quebec" ), ( 'R', "Romeo" ), ( 'S', "Sierra" ), ( 'T', "Tango" ), | ||
( 'U', "Uniform" ), ( 'V', "Victor" ), ( 'W', "Whiskey" ), ( 'X', "X-ray" ), | ||
( 'Y', "Yankee" ), ( 'Z', "Zulu" ), | ||
}; | ||
|
||
while (true) | ||
{ | ||
Console.Clear(); | ||
Console.WriteLine(); | ||
Console.WriteLine(" Flash Cards"); | ||
Console.WriteLine(); | ||
Console.WriteLine(" In this game you will be doing flash card exercises"); | ||
Console.WriteLine(" to help you memorize the NATO phonetic alphabet. The"); | ||
Console.WriteLine(" NATO phonetic alphabet is commonly used during radio"); | ||
Console.WriteLine(" communication in aviation. Each flash card will have"); | ||
Console.WriteLine(" a letter from the english alphabet and you need to"); | ||
Console.WriteLine(" provide the corresponding code word for that letter."); | ||
Console.WriteLine(); | ||
Console.WriteLine(" | NATO phonetic alphabet code words"); | ||
Console.WriteLine(" |"); | ||
Console.WriteLine(" | A -> Alpha B -> Bravo C -> Charlie D -> Delta"); | ||
Console.WriteLine(" | E -> Echo F -> Foxtrot G -> Golf H -> Hotel"); | ||
Console.WriteLine(" | I -> India J -> Juliett K -> Kilo L -> Lima"); | ||
Console.WriteLine(" | M -> Mike N -> November O -> Oscar P -> Papa"); | ||
Console.WriteLine(" | Q -> Quebec R -> Romeo S -> Sierra T -> Tango"); | ||
Console.WriteLine(" | U -> Uniform V -> Victor W -> Whiskey X -> X-ray"); | ||
Console.WriteLine(" | Y -> Yankee Z -> Zulu"); | ||
Console.WriteLine(); | ||
Console.Write(" Press [enter] to continue or [escape] to quit..."); | ||
while (true) | ||
{ | ||
ConsoleKey key = Console.ReadKey(true).Key; | ||
if (key is ConsoleKey.Enter) | ||
{ | ||
break; | ||
} | ||
if (key is ConsoleKey.Escape) | ||
{ | ||
Console.Clear(); | ||
Console.WriteLine("Flash Cards was closed."); | ||
return; | ||
} | ||
} | ||
bool returnToMainMenu = false; | ||
while (!returnToMainMenu) | ||
{ | ||
int index = Random.Shared.Next(array.Length); | ||
Console.Clear(); | ||
Console.WriteLine(); | ||
Console.WriteLine(" What is the NATO phonetic alphabet code word for..."); | ||
Console.WriteLine(); | ||
Console.Write($" {array[index].Letter}? "); | ||
string input = Console.ReadLine()!; | ||
Console.WriteLine(); | ||
if (input.Trim().ToUpper() == array[index].CodeWord.ToUpper()) | ||
{ | ||
Console.WriteLine(" Correct! :)"); | ||
} | ||
else | ||
{ | ||
Console.WriteLine($" Incorrect. :( {array[index].Letter} -> {array[index].CodeWord}"); | ||
} | ||
Console.Write(" Press [enter] to continue or [escape] to return to main menu..."); | ||
while (true) | ||
{ | ||
ConsoleKey key = Console.ReadKey(true).Key; | ||
if (key is ConsoleKey.Enter) | ||
{ | ||
break; | ||
} | ||
if (key is ConsoleKey.Escape) | ||
{ | ||
returnToMainMenu = true; | ||
break; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<h1 align="center"> | ||
Flash Cards | ||
</h1> | ||
|
||
<p align="center"> | ||
<a href="https://github.com/dotnet/dotnet-console-games"><img src="../../.github/resources/github-repo-black.svg" alt="GitHub repo"></a> | ||
<a href="https://docs.microsoft.com/en-us/dotnet/csharp/"><img src="../../.github/resources/language-csharp.svg" alt="Language C#"></a> | ||
<a href="https://dotnet.microsoft.com/download"><img src="../../.github/resources/dotnet-badge.svg" title="Target Framework" alt="Target Framework"></a> | ||
<a href="https://github.com/dotnet/dotnet-console-games/actions"><img src="https://github.com/dotnet/dotnet-console-games/workflows/Flash%20Cards%20Build/badge.svg" title="Goto Build" alt="Build"></a> | ||
<a href="https://discord.gg/4XbQbwF"><img src="../../.github/resources/discord-badge.svg" title="Go To Discord Server" alt="Discord"></a> | ||
<a href="../../LICENSE"><img src="../../.github/resources/license-MIT-green.svg" alt="License"></a> | ||
</p> | ||
|
||
<p align="center"> | ||
You can play this game in your browser: | ||
<br /> | ||
<a href="https://dotnet.github.io/dotnet-console-games/Flash Cards" alt="Play Now"> | ||
<sub><img height="40"src="../../.github/resources/play-badge.svg" alt="Play Now"></sub> | ||
</a> | ||
<br /> | ||
<sup>Hosted On GitHub Pages</sup> | ||
</p> | ||
|
||
In this game you will be doing flash card exercises to help you memorize the NATO phonetic alphabet. | ||
The NATO phonetic alphabet is commonly used during radio communication in aviation. Each flash card | ||
will have a letter from the english alphabet and you need to provide the corresponding code word for | ||
that letter. | ||
|
||
``` | ||
| NATO phonetic alphabet code words | ||
| | ||
| A -> Alpha B -> Bravo C -> Charlie D -> Delta | ||
| E -> Echo F -> Foxtrot G -> Golf H -> Hotel | ||
| I -> India J -> Juliett K -> Kilo L -> Lima | ||
| M -> Mike N -> November O -> Oscar P -> Papa | ||
| Q -> Quebec R -> Romeo S -> Sierra T -> Tango | ||
| U -> Uniform V -> Victor W -> Whiskey X -> X-ray | ||
| Y -> Yankee Z -> Zulu | ||
``` | ||
|
||
``` | ||
What is the NATO phonetic alphabet code word for... | ||
C? Casper | ||
Incorrect. :( C -> Charlie | ||
``` | ||
|
||
## Input | ||
|
||
- `enter`: confirm | ||
|
||
## Downloads | ||
|
||
[win-x64](https://github.com/dotnet/dotnet-console-games/raw/binaries/win-x64/Flash%20Cards.exe) | ||
|
||
[linux-x64](https://github.com/dotnet/dotnet-console-games/raw/binaries/linux-x64/Flash%20Cards) | ||
|
||
[osx-x64](https://github.com/dotnet/dotnet-console-games/raw/binaries/osx-x64/Flash%20Cards) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
using System; | ||
using System.Threading.Tasks; | ||
|
||
namespace Website.Games.Flash_Cards; | ||
|
||
public class Flash_Cards | ||
{ | ||
public readonly BlazorConsole Console = new(); | ||
|
||
public async Task Run() | ||
{ | ||
(char Letter, string CodeWord)[] array = new[] | ||
{ | ||
( 'A', "Alpha" ), ( 'B', "Bravo" ), ( 'C', "Charlie" ), ( 'D', "Delta" ), | ||
( 'E', "Echo" ), ( 'F', "Foxtrot" ), ( 'G', "Golf" ), ( 'H', "Hotel" ), | ||
( 'I', "India" ), ( 'J', "Juliett" ), ( 'K', "Kilo" ), ( 'L', "Lima" ), | ||
( 'M', "Mike" ), ( 'N', "November" ), ( 'O', "Oscar" ), ( 'P', "Papa" ), | ||
( 'Q', "Quebec" ), ( 'R', "Romeo" ), ( 'S', "Sierra" ), ( 'T', "Tango" ), | ||
( 'U', "Uniform" ), ( 'V', "Victor" ), ( 'W', "Whiskey" ), ( 'X', "X-ray" ), | ||
( 'Y', "Yankee" ), ( 'Z', "Zulu" ), | ||
}; | ||
|
||
while (true) | ||
{ | ||
await Console.Clear(); | ||
await Console.WriteLine(); | ||
await Console.WriteLine(" Flash Cards"); | ||
await Console.WriteLine(); | ||
await Console.WriteLine(" In this game you will be doing flash card exercises"); | ||
await Console.WriteLine(" to help you memorize the NATO phonetic alphabet. The"); | ||
await Console.WriteLine(" NATO phonetic alphabet is commonly used during radio"); | ||
await Console.WriteLine(" communication in aviation. Each flash card will have"); | ||
await Console.WriteLine(" a letter from the english alphabet and you need to"); | ||
await Console.WriteLine(" provide the corresponding code word for that letter."); | ||
await Console.WriteLine(); | ||
await Console.WriteLine(" | NATO phonetic alphabet code words"); | ||
await Console.WriteLine(" |"); | ||
await Console.WriteLine(" | A -> Alpha B -> Bravo C -> Charlie D -> Delta"); | ||
await Console.WriteLine(" | E -> Echo F -> Foxtrot G -> Golf H -> Hotel"); | ||
await Console.WriteLine(" | I -> India J -> Juliett K -> Kilo L -> Lima"); | ||
await Console.WriteLine(" | M -> Mike N -> November O -> Oscar P -> Papa"); | ||
await Console.WriteLine(" | Q -> Quebec R -> Romeo S -> Sierra T -> Tango"); | ||
await Console.WriteLine(" | U -> Uniform V -> Victor W -> Whiskey X -> X-ray"); | ||
await Console.WriteLine(" | Y -> Yankee Z -> Zulu"); | ||
await Console.WriteLine(); | ||
await Console.Write(" Press [enter] to continue or [escape] to quit..."); | ||
while (true) | ||
{ | ||
ConsoleKey key = (await Console.ReadKey(true)).Key; | ||
if (key is ConsoleKey.Enter) | ||
{ | ||
break; | ||
} | ||
if (key is ConsoleKey.Escape) | ||
{ | ||
await Console.Clear(); | ||
await Console.WriteLine("Flash Cards was closed."); | ||
return; | ||
} | ||
} | ||
bool returnToMainMenu = false; | ||
while (!returnToMainMenu) | ||
{ | ||
int index = Random.Shared.Next(array.Length); | ||
await Console.Clear(); | ||
await Console.WriteLine(); | ||
await Console.WriteLine(" What is the NATO phonetic alphabet code word for..."); | ||
await Console.WriteLine(); | ||
await Console.Write($" {array[index].Letter}? "); | ||
string input = await Console.ReadLine()!; | ||
await Console.WriteLine(); | ||
if (input.Trim().ToUpper() == array[index].CodeWord.ToUpper()) | ||
{ | ||
await Console.WriteLine(" Correct! :)"); | ||
} | ||
else | ||
{ | ||
await Console.WriteLine($" Incorrect. :( {array[index].Letter} -> {array[index].CodeWord}"); | ||
} | ||
await Console.Write(" Press [enter] to continue or [escape] to return to main menu..."); | ||
while (true) | ||
{ | ||
ConsoleKey key = (await Console.ReadKey(true)).Key; | ||
if (key is ConsoleKey.Enter) | ||
{ | ||
break; | ||
} | ||
if (key is ConsoleKey.Escape) | ||
{ | ||
returnToMainMenu = true; | ||
break; | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
@using System | ||
|
||
@page "/Flash Cards" | ||
|
||
<PageTitle>Flash Cards</PageTitle> | ||
|
||
<h1>Flash Cards</h1> | ||
|
||
<a href="https://github.com/dotnet/dotnet-console-games/tree/main/Projects/Flash%20Cards" alt="Go To Readme"> | ||
<img title="Go To Readme" alt="Go To Readme" src="https://raw.githubusercontent.com/dotnet/dotnet-console-games/main/.github/resources/readme-black.svg"> | ||
</a> | ||
|
||
<div class="console-window text-center my-3" @onkeydown="@Console.OnKeyDown" tabindex="0"> | ||
<div class="d-inline-block bg-dark text-light border p-2 text-start shadow padding-0"> | ||
<pre class="console"> | ||
<code>@Console.State</code> | ||
</pre> | ||
</div> | ||
<div> | ||
@for (char i = 'a'; i <= 'z'; i++) | ||
{ | ||
char c = i; | ||
<span></span> | ||
<button class="btn btn-primary" @onclick="() => Console.EnqueueInput(ConsoleKey.A + (c - 'a'))">@c</button> | ||
<span></span> | ||
} | ||
<button class="btn btn-primary" @onclick="() => Console.EnqueueInput(ConsoleKey.OemMinus)">-</button> | ||
<button class="btn btn-primary" @onclick="() => Console.EnqueueInput(ConsoleKey.Enter) ">enter</button> | ||
<button class="btn btn-primary" @onclick="() => Console.EnqueueInput(ConsoleKey.Escape) ">escape</button> | ||
</div> | ||
</div> | ||
|
||
<div class="alert alert-secondary" role="alert"> | ||
⌨ Keyboard input is supported if you <strong>click</strong> on the game. | ||
</div> | ||
|
||
<div class="alert alert-secondary" role="alert"> | ||
↻ You can restart the game by <strong>refreshing</strong> the page. | ||
</div> | ||
|
||
@code | ||
{ | ||
Games.Flash_Cards.Flash_Cards Game; | ||
BlazorConsole Console; | ||
|
||
public Flash_Cards() | ||
{ | ||
Game = new(); | ||
Console = Game.Console; | ||
Console.WindowWidth = 70; | ||
Console.WindowHeight = 24; | ||
Console.TriggerRefresh = StateHasChanged; | ||
} | ||
|
||
protected override void OnInitialized() => InvokeAsync(Game.Run); | ||
} |
Oops, something went wrong.