diff --git a/.gitignore b/.gitignore index 64e591f9..fea38bce 100644 --- a/.gitignore +++ b/.gitignore @@ -30,5 +30,4 @@ out/ Pipfile .DS_Store -/.vs/basic-computer-games/v16 -/.vs +.vs/ diff --git a/00_Utilities/DotnetUtils/DotnetUtils/Extensions.cs b/00_Utilities/DotnetUtils/DotnetUtils/Extensions.cs index 82ff9532..11f05177 100644 --- a/00_Utilities/DotnetUtils/DotnetUtils/Extensions.cs +++ b/00_Utilities/DotnetUtils/DotnetUtils/Extensions.cs @@ -1,4 +1,5 @@ using System.Diagnostics.CodeAnalysis; +using static System.IO.Path; namespace DotnetUtils; @@ -9,6 +10,11 @@ public static class Extensions { src.Select(x => selector(x.Item1, x.Item2, x.Item3)); public static IEnumerable<(T1, T2, int)> WithIndex(this IEnumerable<(T1, T2)> src) => src.Select((x, index) => (x.Item1, x.Item2, index)); + public static bool None(this IEnumerable src, Func? predicate = null) => + predicate is null ? + !src.Any() : + !src.Any(predicate); + public static bool IsNullOrWhitespace([NotNullWhen(false)] this string? s) => string.IsNullOrWhiteSpace(s); [return: NotNullIfNotNull("path")] @@ -18,10 +24,7 @@ public static class Extensions { rootPath.IsNullOrWhitespace() ) { return path; } - var path1 = path.TrimEnd('\\'); - rootPath = rootPath.TrimEnd('\\'); - if (!path1.StartsWith(rootPath, StringComparison.InvariantCultureIgnoreCase)) { return path; } - - return path1[(rootPath.Length + 1)..]; // ignore the initial / + path = path.TrimEnd('\\'); // remove trailing backslash, if present + return GetRelativePath(rootPath, path.TrimEnd('\\')); } } diff --git a/00_Utilities/DotnetUtils/DotnetUtils/Functions.cs b/00_Utilities/DotnetUtils/DotnetUtils/Functions.cs new file mode 100644 index 00000000..cc31170e --- /dev/null +++ b/00_Utilities/DotnetUtils/DotnetUtils/Functions.cs @@ -0,0 +1,35 @@ +using System.Xml.Linq; +using static System.Console; + +namespace DotnetUtils; + +public static class Functions { + public static string? getValue(string path, params string[] names) { + if (names.Length == 0) { throw new InvalidOperationException(); } + var parent = XDocument.Load(path).Element("Project")?.Element("PropertyGroup"); + return getValue(parent, names); + } + + public static string? getValue(XElement? parent, params string[] names) { + if (names.Length == 0) { throw new InvalidOperationException(); } + XElement? elem = null; + foreach (var name in names) { + elem = parent?.Element(name); + if (elem != null) { break; } + } + return elem?.Value; + } + + public static int getChoice(int maxValue) => getChoice(0, maxValue); + + public static int getChoice(int minValue, int maxValue) { + int result; + do { + Write("? "); + } while (!int.TryParse(ReadLine(), out result) || result < minValue || result > maxValue); + //WriteLine(); + return result; + } + + +} diff --git a/00_Utilities/DotnetUtils/DotnetUtils/Methods.cs b/00_Utilities/DotnetUtils/DotnetUtils/Methods.cs new file mode 100644 index 00000000..a8d3532b --- /dev/null +++ b/00_Utilities/DotnetUtils/DotnetUtils/Methods.cs @@ -0,0 +1,88 @@ +using System.Diagnostics; + +namespace DotnetUtils; + +public static class Methods { + public static ProcessResult RunProcess(string filename, string arguments) { + var process = new Process() { + StartInfo = { + FileName = filename, + Arguments = arguments, + UseShellExecute = false, + CreateNoWindow = true, + RedirectStandardOutput = true, + RedirectStandardError = true, + }, + EnableRaisingEvents = true + }; + return RunProcess(process); + } + + public static ProcessResult RunProcess(Process process, string input = "") { + var (output, error) = ("", ""); + var (redirectOut, redirectErr) = ( + process.StartInfo.RedirectStandardOutput, + process.StartInfo.RedirectStandardError + ); + if (redirectOut) { + process.OutputDataReceived += (s, ea) => output += ea.Data + "\n"; + } + if (redirectErr) { + process.ErrorDataReceived += (s, ea) => error += ea.Data + "\n"; + } + + if (!process.Start()) { + throw new InvalidOperationException(); + }; + + if (redirectOut) { process.BeginOutputReadLine(); } + if (redirectErr) { process.BeginErrorReadLine(); } + if (!string.IsNullOrEmpty(input)) { + process.StandardInput.WriteLine(input); + process.StandardInput.Close(); + } + process.WaitForExit(); + return new ProcessResult(process.ExitCode, output, error); + } + + public static Task RunProcessAsync(Process process, string input = "") { + var tcs = new TaskCompletionSource(); + var (output, error) = ("", ""); + var (redirectOut, redirectErr) = ( + process.StartInfo.RedirectStandardOutput, + process.StartInfo.RedirectStandardError + ); + + process.Exited += (s, e) => tcs.SetResult(new ProcessResult(process.ExitCode, output, error)); + + if (redirectOut) { + process.OutputDataReceived += (s, ea) => output += ea.Data + "\n"; + } + if (redirectErr) { + process.ErrorDataReceived += (s, ea) => error += ea.Data + "\n"; + } + + if (!process.Start()) { + // what happens to the Exited event if process doesn't start successfully? + throw new InvalidOperationException(); + } + + if (redirectOut) { process.BeginOutputReadLine(); } + if (redirectErr) { process.BeginErrorReadLine(); } + if (!string.IsNullOrEmpty(input)) { + process.StandardInput.WriteLine(input); + process.StandardInput.Close(); + } + + return tcs.Task; + } +} + +public sealed record ProcessResult(int ExitCode, string StdOut, string StdErr) { + public override string? ToString() => + StdOut + + (StdOut is not (null or "") && ExitCode > 0 ? "\n" : "") + + (ExitCode != 0 ? + $"{ExitCode}\n{StdErr}" : + ""); +} diff --git a/00_Utilities/DotnetUtils/DotnetUtils/PortInfo.cs b/00_Utilities/DotnetUtils/DotnetUtils/PortInfo.cs index 894c8834..535c0ca0 100644 --- a/00_Utilities/DotnetUtils/DotnetUtils/PortInfo.cs +++ b/00_Utilities/DotnetUtils/DotnetUtils/PortInfo.cs @@ -1,12 +1,11 @@ -using System.Reflection; -using static System.IO.Directory; +using static System.IO.Directory; using static System.IO.Path; using static DotnetUtils.Globals; namespace DotnetUtils; public record PortInfo( - string FullPath, string FolderName, int Index, string GameName, + string GamePath, string FolderName, int Index, string GameName, string LangPath, string Lang, string Ext, string ProjExt, string[] CodeFiles, string[] Slns, string[] Projs ) { @@ -17,31 +16,40 @@ public record PortInfo( MatchCasing = MatchCasing.CaseInsensitive }; - public static PortInfo? Create(string fullPath, string langKeyword) { - var folderName = GetFileName(fullPath); + // .NET namespaces cannot have a digit as the first character + // For games whose name starts with a digit, we map the name to a specific string + private static readonly Dictionary specialGameNames = new() { + { "3-D_Plot", "Plot" }, + { "3-D_Tic-Tac-Toe", "ThreeDTicTacToe" }, + { "23_Matches", "TwentyThreeMatches"} + }; + + public static PortInfo? Create(string gamePath, string langKeyword) { + var folderName = GetFileName(gamePath); var parts = folderName.Split('_', 2); - var index = - parts.Length > 0 && int.TryParse(parts[0], out var n) ? + if (parts.Length <= 1) { return null; } + + var (index, gameName) = ( + int.TryParse(parts[0], out var n) && n > 0 ? // ignore utilities folder n : - (int?)null; + (int?)null, + specialGameNames.TryGetValue(parts[1], out var specialName) ? + specialName : + parts[1].Replace("_", "").Replace("-", "") + ); - var gameName = - parts.Length > 1 ? - parts[1].Replace("_", "") : - null; - - if (index is 0 or null || gameName is null) { return null; } + if (index is null || gameName is null) { return null; } var (ext, projExt) = LangData[langKeyword]; - var langPath = Combine(fullPath, langKeyword); + var langPath = Combine(gamePath, langKeyword); var codeFiles = GetFiles(langPath, $"*.{ext}", enumerationOptions) .Where(x => !x.Contains("\\bin\\") && !x.Contains("\\obj\\")) .ToArray(); return new PortInfo( - fullPath, folderName, index.Value, gameName, + gamePath, folderName, index.Value, gameName, langPath, langKeyword, ext, projExt, codeFiles, GetFiles(langPath, "*.sln", enumerationOptions), diff --git a/00_Utilities/DotnetUtils/DotnetUtils/PortInfos.cs b/00_Utilities/DotnetUtils/DotnetUtils/PortInfos.cs index b8c1afd3..af824b33 100644 --- a/00_Utilities/DotnetUtils/DotnetUtils/PortInfos.cs +++ b/00_Utilities/DotnetUtils/DotnetUtils/PortInfos.cs @@ -12,8 +12,8 @@ public static class PortInfos { Root = Root[..Root.IndexOf(@"\00_Utilities")]; Get = GetDirectories(Root) - .SelectMany(fullPath => LangData.Keys.Select(keyword => (fullPath, keyword))) - .SelectT((fullPath, keyword) => PortInfo.Create(fullPath, keyword)) + .SelectMany(gamePath => LangData.Keys.Select(keyword => (gamePath, keyword))) + .SelectT((gamePath, keyword) => PortInfo.Create(gamePath, keyword)) .Where(x => x is not null) .ToArray()!; } diff --git a/00_Utilities/DotnetUtils/DotnetUtils/Program.cs b/00_Utilities/DotnetUtils/DotnetUtils/Program.cs index 6d4594b7..6e51d4f1 100644 --- a/00_Utilities/DotnetUtils/DotnetUtils/Program.cs +++ b/00_Utilities/DotnetUtils/DotnetUtils/Program.cs @@ -1,6 +1,9 @@ -using DotnetUtils; +using System.Xml.Linq; +using DotnetUtils; using static System.Console; using static System.IO.Path; +using static DotnetUtils.Methods; +using static DotnetUtils.Functions; var infos = PortInfos.Get; @@ -11,7 +14,14 @@ var actions = new (Action action, string description)[] { (multipleSlns, "Output multiple sln files"), (missingProj, "Output missing project file"), (unexpectedProjName, "Output misnamed project files"), - (multipleProjs, "Output multiple project files") + (multipleProjs, "Output multiple project files"), + (checkProjects, "Check .csproj/.vbproj files for target framework, nullability etc."), + (checkExecutableProject, "Check that there is at least one executable project per port"), + (noCodeFiles, "Output ports without any code files"), + (printPortInfo, "Print info about a single port"), + + (generateMissingSlns, "Generate solution files when missing"), + (generateMissingProjs, "Generate project files when missing") }; foreach (var (_, description, index) in actions.WithIndex()) { @@ -22,15 +32,6 @@ WriteLine(); actions[getChoice(actions.Length - 1)].action(); -int getChoice(int maxValue) { - int result; - do { - Write("? "); - } while (!int.TryParse(ReadLine(), out result) || result < 0 || result > maxValue); - WriteLine(); - return result; -} - void printSlns(PortInfo pi) { switch (pi.Slns.Length) { case 0: @@ -65,7 +66,6 @@ void printProjs(PortInfo pi) { } break; } - WriteLine(); } void printInfos() { @@ -88,7 +88,7 @@ void printInfos() { } void missingSln() { - var data = infos.Where(x => !x.Slns.Any()).ToArray(); + var data = infos.Where(x => x.Slns.None()).ToArray(); foreach (var item in data) { WriteLine(item.LangPath); } @@ -99,10 +99,10 @@ void missingSln() { void unexpectedSlnName() { var counter = 0; foreach (var item in infos) { - if (!item.Slns.Any()) { continue; } + if (item.Slns.None()) { continue; } var expectedSlnName = $"{item.GameName}.sln"; - if (item.Slns.Contains(Combine(item.LangPath, expectedSlnName))) { continue; } + if (item.Slns.Contains(Combine(item.LangPath, expectedSlnName), StringComparer.InvariantCultureIgnoreCase)) { continue; } counter += 1; WriteLine(item.LangPath); @@ -126,7 +126,7 @@ void multipleSlns() { } void missingProj() { - var data = infos.Where(x => !x.Projs.Any()).ToArray(); + var data = infos.Where(x => x.Projs.None()).ToArray(); foreach (var item in data) { WriteLine(item.LangPath); } @@ -137,7 +137,7 @@ void missingProj() { void unexpectedProjName() { var counter = 0; foreach (var item in infos) { - if (!item.Projs.Any()) { continue; } + if (item.Projs.None()) { continue; } var expectedProjName = $"{item.GameName}.{item.ProjExt}"; if (item.Projs.Contains(Combine(item.LangPath, expectedProjName))) { continue; } @@ -159,8 +159,205 @@ void multipleProjs() { WriteLine(item.LangPath); WriteLine(); printProjs(item); - } WriteLine(); WriteLine($"Count: {data.Length}"); } + +void generateMissingSlns() { + foreach (var item in infos.Where(x => x.Slns.None())) { + var result = RunProcess("dotnet", $"new sln -n {item.GameName} -o {item.LangPath}"); + WriteLine(result); + + var slnFullPath = Combine(item.LangPath, $"{item.GameName}.sln"); + foreach (var proj in item.Projs) { + result = RunProcess("dotnet", $"sln {slnFullPath} add {proj}"); + WriteLine(result); + } + } +} + +void generateMissingProjs() { + foreach (var item in infos.Where(x => x.Projs.None())) { + // We can't use the dotnet command to create a new project using the built-in console template, because part of that template + // is a Program.cs / Program.vb file. If there already are code files, there's no need to add a new empty one; and + // if there's already such a file, it might try to overwrite it. + + var projText = item.Lang switch { + "csharp" => @" + + Exe + net6.0 + 10 + enable + enable + + +", + "vbnet" => @$" + + Exe + {item.GameName} + net6.0 + 16.9 + + +", + _ => throw new InvalidOperationException() + }; + var projFullPath = Combine(item.LangPath, $"{item.GameName}.{item.ProjExt}"); + File.WriteAllText(projFullPath, projText); + + if (item.Slns.Length == 1) { + var result = RunProcess("dotnet", $"sln {item.Slns[0]} add {projFullPath}"); + WriteLine(result); + } + } +} + +void checkProjects() { + foreach (var info in infos) { + WriteLine(info.LangPath); + printProjectWarnings(info); + } +} + +void printProjectWarnings(PortInfo info) { + foreach (var proj in info.Projs) { + var warnings = new List(); + var parent = XDocument.Load(proj).Element("Project")?.Element("PropertyGroup"); + + var ( + framework, + nullable, + implicitUsing, + rootNamespace, + langVersion, + optionStrict + ) = ( + getValue(parent, "TargetFramework", "TargetFrameworks"), + getValue(parent, "Nullable"), + getValue(parent, "ImplicitUsings"), + getValue(parent, "RootNamespace"), + getValue(parent, "LangVersion"), + getValue(parent, "OptionStrict") + ); + + if (framework != "net6.0") { + warnings.Add($"Target: {framework}"); + } + + if (info.Lang == "csharp") { + if (nullable != "enable") { + warnings.Add($"Nullable: {nullable}"); + } + if (implicitUsing != "enable") { + warnings.Add($"ImplicitUsings: {implicitUsing}"); + } + if (rootNamespace != null && rootNamespace != info.GameName) { + warnings.Add($"RootNamespace: {rootNamespace}"); + } + if (langVersion != "10") { + warnings.Add($"LangVersion: {langVersion}"); + } + } + + if (info.Lang == "vbnet") { + if (rootNamespace != info.GameName) { + warnings.Add($"RootNamespace: {rootNamespace}"); + } + if (langVersion != "16.9") { + warnings.Add($"LangVersion: {langVersion}"); + } + if (optionStrict != "On") { + warnings.Add($"OptionStrict: {optionStrict}"); + } + } + + if (warnings.Any()) { + WriteLine(proj.RelativePath(info.LangPath)); + WriteLine(string.Join("\n", warnings)); + WriteLine(); + } + } +} + +void checkExecutableProject() { + foreach (var item in infos) { + if (item.Projs.All(proj => getValue(proj, "OutputType") != "Exe")) { + WriteLine($"{item.LangPath}"); + } + } +} + +void noCodeFiles() { + var qry = infos + .Where(x => x.CodeFiles.None()) + .OrderBy(x => x.Lang); + foreach (var item in qry) { + WriteLine(item.LangPath); + } +} + +void tryBuild() { + // if has code files, try to build +} + +void printPortInfo() { + // prompt for port number + Write("Enter number from 1 to 96 "); + var index = getChoice(1, 96); + + Write("Enter 0 for C#, 1 for VB "); + var lang = getChoice(1) switch { + 0 => "csharp", + 1 => "vbnet", + _ => throw new InvalidOperationException() + }; + + WriteLine(); + + var info = infos.Single(x => x.Index == index && x.Lang == lang); + + WriteLine(info.LangPath); + WriteLine(new string('-', 50)); + + // print solutions + printSlns(info); + + // mismatched solution name/location? (expected x) + var expectedSlnName = Combine(info.LangPath, $"{info.GameName}.sln"); + if (!info.Slns.Contains(expectedSlnName)) { + WriteLine($"Expected name/path: {expectedSlnName.RelativePath(info.LangPath)}"); + } + + // has executable project? + if (info.Projs.All(proj => getValue(proj, "OutputType") != "Exe")) { + WriteLine("No executable project"); + } + + WriteLine(); + + // print projects + printProjs(info); + + // mimsatched project name/location? (expected x) + var expectedProjName = Combine(info.LangPath, $"{info.GameName}.{info.ProjExt}"); + if (info.Projs.Length < 2 && !info.Projs.Contains(expectedProjName)) { + WriteLine($"Expected name/path: {expectedProjName.RelativePath(info.LangPath)}"); + } + + WriteLine(); + + // verify project properties + printProjectWarnings(info); + + WriteLine("Code files:"); + + // list code files + foreach (var codeFile in info.CodeFiles) { + WriteLine(codeFile.RelativePath(info.LangPath)); + } + + // try build +} diff --git a/00_Utilities/yatol.pl b/00_Utilities/yatol.pl new file mode 100755 index 00000000..0f4ef111 --- /dev/null +++ b/00_Utilities/yatol.pl @@ -0,0 +1,55 @@ +#!/usr/bin/perl +#YATOL: Yet Another TOdo List +use strict; + +#REM: Get list of basic files ordered by number of lines. +#REM: This way you can do the easier ones first. +my @Ret=`find .. -iname '*.bas' -exec wc -l \{\} \\; | sort -h`; + + +my @Langs= qw(PL JS VB PAS RB C# JAVA PY); +my @Dirs= qw(perl javascript vbnet pascal ruby csharp java python); +my %Sum; + +print " "x 25 ."BAS\t"; +foreach my $Dir (@Langs) { + print "$Dir\t"; + } +print "\n"; + +my $Count; +foreach my $Lin (@Ret) { + $Count++; + chomp $Lin; + my ($Num, $File)= split (" ", $Lin); + my @Parts= split(/\//, $File); + my $Base= $Parts[1]; + + my $Tab= 25-length($Base); + print "$Base".(" "x$Tab)."$Num\t"; + + foreach my $Dir (@Dirs) { + my $Path= "../$Base/$Dir/"; + my $Ret= `ls $Path | wc -l`; + if ($Ret>1) { print "YES"; $Sum{$Dir}++; } + else { print " ";} + print "\t"; + } + print "\n"; + + } + +print "\t\tFILES:\t\t"; +foreach my $Dir (@Dirs) { + print "$Sum{$Dir}\t"; + } +print "\n"; + + +print "\t\tADVANCE:\t"; +foreach my $Dir (@Dirs) { + my $Per= int($Sum{$Dir}/$Count*100)."%"; + print "$Per\t"; + } +print "\n"; + diff --git a/01_Acey_Ducey/kotlin/aceyducey.kt b/01_Acey_Ducey/kotlin/aceyducey.kt new file mode 100644 index 00000000..fe7c32c7 --- /dev/null +++ b/01_Acey_Ducey/kotlin/aceyducey.kt @@ -0,0 +1,74 @@ +import java.util.Random + +fun printCard(a: Int) { + if (a < 11) println(a) + if (a == 11) println("JACK") + if (a == 12) println("QUEEN") + if (a == 13) println("KING") + if (a == 14) println("ACE") +} + +fun main() { + println("ACEY DUCEY CARD GAME") + println("CREATIVE COMPUTING MORRISTOWN, NEW JERSEY") + println() + println() + println("ACEY-DUCEY IS PLAYED IN THE FOLLOWING MANNER ") + println("THE DEALER (COMPUTER) DEALS TWO CARDS FACE UP") + println("YOU HAVE AN OPTION TO BET OR NOT BET DEPENDING") + println("ON WHETHER OR NOT YOU FEEL THE CARD WILL HAVE") + println("A VALUE BETWEEN THE FIRST TWO.") + println("IF YOU DO NOT WANT TO BET, INPUT A 0") + var random = Random() + do { + var q = 100 + var a : Int + var b : Int + var m : Int + println("YOU NOW HAVE " + q + " DOLLARS.") + println() + do { + do { + do { + println("HERE ARE YOUR NEXT TWO CARDS: ") + do { + a = random.nextInt(12) + 2 + b = random.nextInt(12) + 2 + } while (a >= b); + printCard(a) + printCard(b) + println() + println() + print("WHAT IS YOUR BET") + m = readLine()!!.toInt() + if (m == 0) { + println("CHICKEN!!") + println() + } + } while (m == 0); + if (m > q) { + println("SORRY, MY FRIEND, BUT YOU BET TOO MUCH.") + println("YOU HAVE ONLY " + q + " DOLLARS TO BET.") + } + } while (m > q); + var c = random.nextInt(12) + 2 + printCard(c) + println() + if (c > a && c < b) { + println("YOU WIN!!!") + q += m + } + else { + println("SORRY, YOU LOSE") + if (m < q) q -= m + } + } while (m < q); + println() + println() + println("SORRY, FRIEND, BUT YOU BLEW YOUR WAD.") + println() + println() + println("TRY AGAIN (YES OR NO)") + } while (readLine() == "YES"); + println("O.K., HOPE YOU HAD FUN!") +} diff --git a/01_Acey_Ducey/vbnet/AceyDucy.sln b/01_Acey_Ducey/vbnet/AceyDucey.sln similarity index 64% rename from 01_Acey_Ducey/vbnet/AceyDucy.sln rename to 01_Acey_Ducey/vbnet/AceyDucey.sln index 881d7c9c..1c5cafb6 100644 --- a/01_Acey_Ducey/vbnet/AceyDucy.sln +++ b/01_Acey_Ducey/vbnet/AceyDucey.sln @@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.0.31903.59 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "AceyDucy", "AceyDucy\AceyDucy.vbproj", "{37496710-B458-4502-ADCB-4C57203866F9}" +Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "AceyDucey", "AceyDucey.vbproj", "{54C05475-238D-4A82-A67B-B6C1BF2CA337}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -11,10 +11,10 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {37496710-B458-4502-ADCB-4C57203866F9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {37496710-B458-4502-ADCB-4C57203866F9}.Debug|Any CPU.Build.0 = Debug|Any CPU - {37496710-B458-4502-ADCB-4C57203866F9}.Release|Any CPU.ActiveCfg = Release|Any CPU - {37496710-B458-4502-ADCB-4C57203866F9}.Release|Any CPU.Build.0 = Release|Any CPU + {54C05475-238D-4A82-A67B-B6C1BF2CA337}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {54C05475-238D-4A82-A67B-B6C1BF2CA337}.Debug|Any CPU.Build.0 = Debug|Any CPU + {54C05475-238D-4A82-A67B-B6C1BF2CA337}.Release|Any CPU.ActiveCfg = Release|Any CPU + {54C05475-238D-4A82-A67B-B6C1BF2CA337}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/01_Acey_Ducey/vbnet/AceyDucey.vb b/01_Acey_Ducey/vbnet/AceyDucey.vb new file mode 100644 index 00000000..8727e6b2 --- /dev/null +++ b/01_Acey_Ducey/vbnet/AceyDucey.vb @@ -0,0 +1,242 @@ +Public Class AceyDucey + ''' + ''' Create a single instance of the Random class to be used + ''' throughout the program. + ''' + Private ReadOnly Property Rnd As New Random() + + ''' + ''' Define a varaible to store the the player balance.
+ ''' Defaults to 0 + '''
+ ''' + ''' Since is a value type, and no value + ''' has been explicitly set, the default value of the type is used. + ''' + Private _balance As Integer + + Public Sub New() + DisplayIntroduction() + End Sub + + ''' + ''' Play multiple games of Acey Ducey until the player chooses to quit. + ''' + Public Sub Play() + Do + PlayGame() + Loop While TryAgain() 'Loop (play again) based on the Boolean value returned by TryAgain + + Console.WriteLine("O.K., HOPE YOU HAD FUN!") + End Sub + + ''' + ''' Play a game of Acey Ducey, which ends when the player balance reaches 0 + ''' + Private Sub PlayGame() + _balance = 100 'At the start of the game, set the player balance to 100 + + Console.WriteLine() + Console.WriteLine($"YOU NOW HAVE {_balance} DOLLARS.") + + Do + PlayTurn() + Loop While _balance > 0 'Continue playing while the user has a balance + + Console.WriteLine() + Console.WriteLine("SORRY, FRIEND, BUT YOU BLEW YOUR WAD.") + End Sub + + ''' + ''' Play one turn of Acey Ducey + ''' + ''' + ''' A turn consists of displaying to cards, making a wager + ''' and determining the result (win/lose) + ''' + Private Sub PlayTurn() + Console.WriteLine() + Console.WriteLine("HERE ARE YOUR NEXT TWO CARDS: ") + + Dim cards = GetOrderedCards() + + For Each card In cards + DisplayCard(card) + Next + + Dim wager As Integer = GetWager() + Dim finalCard As Integer = GetCard() + + If wager = 0 Then + Console.WriteLine("CHICKEN!!") + Return + End If + + DisplayCard(finalCard) + + Console.WriteLine() + + '''Check if the value of the final card is between the first and second cards. + ''' + '''The use of AndAlso is used to short-circuit the evaluation of the IF condition. + '''Short-circuiting means that both sides of the condition do not need to be + '''evaluated. In this case, if the left criteria returns FALSE, the right criteria + '''is ignored and the evaluation result is returned as FALSE. + ''' + '''This works because AndAlso requires both condition to return TRUE in order to be + '''evaluated as TRUE. If the first condition is FALSE we already know the evaluation result. + If finalCard >= cards.First() AndAlso finalCard <= cards.Last() Then + Console.WriteLine("YOU WIN!!!") + _balance += wager 'Condensed version of _balance = _balance + wager + Else + Console.WriteLine("SORRY, YOU LOSE.") + _balance -= wager 'Condensed version of _balance = _balance - wager + End If + End Sub + + ''' + ''' Get two cards in ascending order + ''' + ''' + ''' The original version generates two cards (A and B) + ''' If A is greater than or equal to B, both cards are regenerated. + '''

+ ''' This version generates the two cards, but only regenerates A + ''' if A is equal to B. The cards are then returned is ascending order, + ''' ensuring that A is less than B (maintaining the original end result) + '''
+ Private Function GetOrderedCards() As Integer() + '''When declaring fixed size arrays in VB.NET you declare the MAX INDEX of the array + '''and NOT the SIZE (number of elements) of the array. + '''As such, card(1) gives you and array with index 0 and index 1, which means + '''the array stores two elements and not one + Dim cards(1) As Integer + + cards(0) = GetCard() + cards(1) = GetCard() + + 'Perform this action as long as the first card is equal to the second card + While cards(0) = cards(1) + cards(0) = GetCard() + End While + + Array.Sort(cards) 'Sort the values in ascending order + + Return cards + End Function + + ''' + ''' Get a random number (card) ranked 2 to 14 + ''' + Private Function GetCard() As Integer + Return Rnd.Next(2, 15) + End Function + + ''' + ''' Display the face value of the card + ''' + Private Sub DisplayCard(card As Integer) + Dim output As String + + Select Case card + Case 2 To 10 + output = card.ToString() + Case 11 + output = "JACK" + Case 12 + output = "QUEEN" + Case 13 + output = "KING" + Case 14 + output = "ACE" + Case Else + Throw New ArgumentOutOfRangeException(NameOf(card), "Value must be between 2 and 14") + End Select + + Console.WriteLine(output) + End Sub + + ''' + ''' Prompt the user to make a bet + ''' + ''' + ''' The function will not return until a valid bet is made.
+ ''' is used to validate that the user input is a valid + '''
+ Private Function GetWager() As Integer + Dim wager As Integer + Do + Console.WriteLine() + Console.Write("WHAT IS YOUR BET? ") + + Dim input As String = Console.ReadLine() + + '''Determine if the user input is an Integer + '''If it is an Integer, store the value in the variable wager + If Not Integer.TryParse(input, wager) Then + Console.WriteLine("SORRY, I DID'T QUITE GET THAT.") + Continue Do 'restart the loop + End If + + 'Prevent the user from betting more than their current balance + If _balance < wager Then + Console.WriteLine("SORRY, MY FRIEND, BUT YOU BET TOO MUCH.") + Console.WriteLine($"YOU HAVE ONLY {_balance} DOLLARS TO BET.") + Continue Do 'restart the loop + End If + + 'Prevent the user from betting negative values + If wager < 0 Then + Console.WriteLine("FUNNY GUY! YOU CANNOT MAKE A NEGATIVE BET.") + Continue Do 'restart the loop + End If + + Exit Do 'If we get to this line, exit the loop as all above validations passed + Loop + + Return wager + End Function + + ''' + ''' Prompt the user to try again + ''' + ''' + ''' This function will not return until a valid reponse is given + ''' + Private Function TryAgain() As Boolean + Dim response As String + Do + Console.Write("TRY AGAIN (YES OR NO) ") + + response = Console.ReadLine() + + If response.Equals("YES", StringComparison.OrdinalIgnoreCase) Then Return True + If response.Equals("NO", StringComparison.OrdinalIgnoreCase) Then Return False + + Console.WriteLine("SORRY, I DID'T QUITE GET THAT.") + Loop + End Function + + ''' + ''' Display the opening title and instructions + ''' + ''' + ''' Refer to + ''' + ''' Interpolated Strings + ''' documentation for the use of $ and { } with strings + ''' + Private Sub DisplayIntroduction() + Console.WriteLine($"{Space((Console.WindowWidth \ 2) - 10)}ACEY DUCEY CARD GAME") + Console.WriteLine($"{Space((Console.WindowWidth \ 2) - 21)}CREATIVE COMPUTING MORRISTOWN, NEW JERSEY") + Console.WriteLine("") + Console.WriteLine("") + Console.WriteLine("ACEY-DUCEY IS PLAYED IN THE FOLLOWING MANNER") + Console.WriteLine("THE DEALER (COMPUTER) DEALS TWO CARDS FACE UP") + Console.WriteLine("YOU HAVE AN OPTION TO BET OR NOT BET DEPENDING") + Console.WriteLine("ON WHETHER OR NOT YOU FEEL THE CARD WILL HAVE") + Console.WriteLine("A VALUE BETWEEN THE FIRST TWO.") + Console.WriteLine("IF YOU DO NOT WANT TO BET, INPUT A 0") + Console.WriteLine("") + End Sub +End Class diff --git a/01_Acey_Ducey/vbnet/AceyDucey.vbproj b/01_Acey_Ducey/vbnet/AceyDucey.vbproj new file mode 100644 index 00000000..88e8cd5e --- /dev/null +++ b/01_Acey_Ducey/vbnet/AceyDucey.vbproj @@ -0,0 +1,10 @@ + + + + Exe + AceyDucey + net6.0 + 16.9 + + + diff --git a/01_Acey_Ducey/vbnet/AceyDucy/Program.vb b/01_Acey_Ducey/vbnet/AceyDucy/Program.vb deleted file mode 100644 index bfa518ca..00000000 --- a/01_Acey_Ducey/vbnet/AceyDucy/Program.vb +++ /dev/null @@ -1,178 +0,0 @@ -Imports System - -''' -''' This is a modern adapation of Acey Ducey from BASIC Computer Games. -''' -''' The structural changes primarily consist of replacing the many GOTOs with -''' Do/Loop constructs to force the continual execution of the program. -''' -''' Because modern Basic allows multi-line If/Then blocks, many GOTO jumps were -''' able to be eliminated and the logic was able to be moved to more relevant areas, -''' For example, the increment/decrement of the player's balance could be in the same -''' area as the notification of win/loss. -''' -''' Some modern improvements were added, primarily the inclusion of a function, which -''' eliminated a thrice-repeated block of logic to display the card value. The archaic -''' RND function is greatly simplified with the .NET Framework's Random class. -''' -''' Elementary comments are provided for non-programmers or novices. -''' -Module Program - Sub Main(args As String()) - ' These are the variables that will hold values during the program's execution - Dim input As String - Dim rnd As New Random ' You can create a new instance of an object during declaration - Dim currentBalance As Integer = 100 ' You can set a initial value at declaration - Dim currentWager As Integer - Dim cardA, cardB, cardC As Integer ' You can specify multiple variables of the same type in one declaration statement - - ' Display the opening title and instructions - ' Use a preceding $ to insert calculated values within the string using {} - Console.WriteLine($"{Space((Console.WindowWidth \ 2) - 10)}ACEY DUCEY CARD GAME") - Console.WriteLine($"{Space((Console.WindowWidth \ 2) - 21)}CREATIVE COMPUTING MORRISTOWN, NEW JERSEY") - Console.WriteLine("") - Console.WriteLine("") - Console.WriteLine("ACEY-DUCEY IS PLAYED IN THE FOLLOWING MANNER") - Console.WriteLine("THE DEALER (COMPUTER) DEALS TWO CARDS FACE UP") - Console.WriteLine("YOU HAVE AN OPTION TO BET OR NOT BET DEPENDING") - Console.WriteLine("ON WHETHER OR NOT YOU FEEL THE CARD WILL HAVE") - Console.WriteLine("A VALUE BETWEEN THE FIRST TWO.") - Console.WriteLine("IF YOU DO NOT WANT TO BET, INPUT A 0") - - Do ' This loop continues as long as the player wants to keep playing - - Do ' This loop continues as long as the player has money to play - - Console.WriteLine("") - Console.WriteLine($"YOU NOW HAVE {currentBalance} DOLLARS.") - Console.WriteLine("") - - Console.WriteLine("HERE ARE YOUR NEXT TWO CARDS:") - - ' We need to ensure that card B is a higher value for our later comparison, - ' so we will loop until we have two cards that meet this criteria - Do - cardA = rnd.Next(2, 14) - cardB = rnd.Next(2, 14) - - Loop While cardA > cardB - - ' We use a function to display the text value of the numeric card value - ' because we do this 3 times and a function reduces repetition of code - Console.WriteLine(DisplayCard(cardA)) - Console.WriteLine(DisplayCard(cardB)) - - Do ' This loop continues until the player provides a valid wager value - Console.WriteLine("") - Console.WriteLine("WHAT IS YOUR BET") - - currentWager = 0 - input = Console.ReadLine - - ' Any input from the console is a string, but we require a number. - ' Test the input to make sure it is a numeric value. - If Integer.TryParse(input, currentWager) Then - ' Test to ensure the player has not wagered more than their balance - If currentWager > currentBalance Then - Console.WriteLine("SORRY, MY FRIEND, BUT YOU BET TOO MUCH.") - Console.WriteLine($"YOU HAVE ONLY {currentBalance} DOLLARS TO BET.") - - Else - ' The player has provided a numeric value that is less/equal to their balance, - ' exit the loop and continue play - Exit Do - - End If ' check player balance - - End If ' check numeric input - - Loop ' wager loop - - ' If the player is wagering, draw the third card, otherwise, mock them. - If currentWager > 0 Then - cardC = rnd.Next(2, 14) - - Console.WriteLine(DisplayCard(cardC)) - - ' The effort we made to have two cards in numeric order earlier makes this check easier, - ' otherwise we would have to have a second check in the opposite direction - If cardC < cardA OrElse cardC >= cardB Then - Console.WriteLine("SORRY, YOU LOSE") - currentBalance -= currentWager ' Shorthand code to decrement a number (currentBalance=currentBalance - currentWager) - - Else - Console.WriteLine("YOU WIN!!!") - currentBalance += currentWager ' Shorthand code to increment a number (currentBalance=currentBalance + currentWager) - - End If - - Else - Console.WriteLine("CHICKEN!!") - Console.WriteLine("") - - End If - - Loop While currentBalance > 0 ' loop as long as the player has money - - ' At this point, the player has no money (currentBalance=0). Inform them of such. - Console.WriteLine("") - Console.WriteLine("SORRY, FRIEND, BUT YOU BLEW YOUR WAD.") - Console.WriteLine("") - Console.WriteLine("") - - ' We will loop to ensure the player provides some answer. - Do - Console.WriteLine("TRY AGAIN (YES OR NO)") - Console.WriteLine("") - - input = Console.ReadLine - - Loop While String.IsNullOrWhiteSpace(input) - - ' We will assume that the player wants to play again only if they answer yes. - ' (yeah and ya are valid as well, because we only check the first letter) - If input.Substring(0, 1).Equals("y", StringComparison.CurrentCultureIgnoreCase) Then ' This allows upper and lower case to be entered. - currentBalance = 100 ' Reset the players balance before restarting - - Else - ' Exit the outer loop which will end the game. - Exit Do - - End If - - Loop ' The full game loop - - Console.WriteLine("O.K., HOPE YOU HAD FUN!") - - End Sub - - ' This function is called for each of the 3 cards used in the game. - ' The input and the output are both consistent, making it a good candidate for a function. - Private Function DisplayCard(value As Integer) As String - ' We check the value of the input and run a block of code for whichever - ' evaluation matches - Select Case value - Case 2 To 10 ' Case statements can be ranges of values, also multiple values (Case 2,3,4,5,6,7,8,9,10) - Return value.ToString - - Case 11 - Return "JACK" - - Case 12 - Return "QUEEN" - - Case 13 - Return "KING" - - Case 14 - Return "ACE" - - End Select - - ' Although we have full knowledge of the program and never plan to send an invalid - ' card value, it's important to provide a message for the next developer who won't - Throw New ArgumentOutOfRangeException("Card value must be between 2 and 14") - - End Function - -End Module diff --git a/01_Acey_Ducey/vbnet/Program.vb b/01_Acey_Ducey/vbnet/Program.vb new file mode 100644 index 00000000..2f82fd60 --- /dev/null +++ b/01_Acey_Ducey/vbnet/Program.vb @@ -0,0 +1,21 @@ +Imports System + +''' +''' This is a modern adapation of Acey Ducey from BASIC Computer Games. +''' +''' The structural changes primarily consist of replacing the many GOTOs with +''' Do/Loop constructs to force the continual execution of the program. +''' +''' Some modern improvements were added, primarily the inclusion of a multiple +''' subroutines and functions, which eliminates repeated logic and reduces +''' then need for nested loops. +''' +''' The archaic RND function is greatly simplified with the .NET Framework's Random class. +''' +''' Elementary comments are provided for non-programmers or novices. +''' +Module Program + Sub Main() + Call New AceyDucey().Play() + End Sub +End Module diff --git a/02_Amazing/vbnet/Amazing.sln b/02_Amazing/vbnet/Amazing.sln new file mode 100644 index 00000000..81309fe0 --- /dev/null +++ b/02_Amazing/vbnet/Amazing.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Amazing", "Amazing.vbproj", "{FB9DF301-CB34-4C9A-8823-F034303F5DA3}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {FB9DF301-CB34-4C9A-8823-F034303F5DA3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FB9DF301-CB34-4C9A-8823-F034303F5DA3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FB9DF301-CB34-4C9A-8823-F034303F5DA3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FB9DF301-CB34-4C9A-8823-F034303F5DA3}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/02_Amazing/vbnet/Amazing.vbproj b/02_Amazing/vbnet/Amazing.vbproj new file mode 100644 index 00000000..c619d3fa --- /dev/null +++ b/02_Amazing/vbnet/Amazing.vbproj @@ -0,0 +1,8 @@ + + + Exe + Amazing + net6.0 + 16.9 + + diff --git a/03_Animal/java/Animal.java b/03_Animal/java/Animal.java index 11e9e889..681425c1 100644 --- a/03_Animal/java/Animal.java +++ b/03_Animal/java/Animal.java @@ -2,159 +2,244 @@ import java.util.ArrayList; import java.util.List; import java.util.Locale; import java.util.Scanner; +import java.util.stream.Collectors; /** * ANIMAL *

* Converted from BASIC to Java by Aldrin Misquitta (@aldrinm) + * The original BASIC program uses an array to maintain the questions and answers and to decide which question to + * ask next. Updated this Java implementation to use a tree instead of the earlier faulty one based on a list (thanks @patimen). */ public class Animal { - public static void main(String[] args) { - printIntro(); - Scanner scan = new Scanner(System.in); + public static void main(String[] args) { + printIntro(); + Scanner scan = new Scanner(System.in); - List questions = new ArrayList<>(); - questions.add(new Question("DOES IT SWIM", "FISH", "BIRD")); + Node root = new QuestionNode("DOES IT SWIM", + new AnimalNode("FISH"), new AnimalNode("BIRD")); - boolean stopGame = false; - while (!stopGame) { - String choice = readMainChoice(scan); - switch (choice) { - case "LIST": - printKnownAnimals(questions); - break; - case "Q": - case "QUIT": - stopGame = true; - break; - default: - if (choice.toUpperCase(Locale.ROOT).startsWith("Y")) { - int k = 0; - boolean correctGuess = false; - while (questions.size() > k && !correctGuess) { - Question question = questions.get(k); - correctGuess = askQuestion(question, scan); - if (correctGuess) { - System.out.println("WHY NOT TRY ANOTHER ANIMAL?"); - } else { - k++; - } - } + boolean stopGame = false; + while (!stopGame) { + String choice = readMainChoice(scan); + switch (choice) { + case "TREE": + printTree(root); + break; + case "LIST": + printKnownAnimals(root); + break; + case "Q": + case "QUIT": + stopGame = true; + break; + default: + if (choice.toUpperCase(Locale.ROOT).startsWith("Y")) { + Node current = root; //where we are in the question tree + Node previous; //keep track of parent of current in order to place new questions later on. - if (!correctGuess) { - askForInformationAndSave(scan, questions); - } - } - } - } + while (current instanceof QuestionNode) { + var currentQuestion = (QuestionNode) current; + var reply = askQuestionAndGetReply(currentQuestion, scan); - } + previous = current; + current = reply ? currentQuestion.getTrueAnswer() : currentQuestion.getFalseAnswer(); + if (current instanceof AnimalNode) { + //We have reached a animal node, so offer it as the guess + var currentAnimal = (AnimalNode) current; + System.out.printf("IS IT A %s ? ", currentAnimal.getAnimal()); + var animalGuessResponse = readYesOrNo(scan); + if (animalGuessResponse) { + //we guessed right! end this round + System.out.println("WHY NOT TRY ANOTHER ANIMAL?"); + } else { + //we guessed wrong :(, ask for feedback + //cast previous to QuestionNode since we know at this point that it is not a leaf node + askForInformationAndSave(scan, currentAnimal, (QuestionNode) previous, reply); + } + } + } + } + } + } + } - private static void askForInformationAndSave(Scanner scan, List questions) { - //Failed to get it right and ran out of questions - //Let's ask the user for the new information - System.out.print("THE ANIMAL YOU WERE THINKING OF WAS A "); - String animal = scan.nextLine(); - System.out.printf("PLEASE TYPE IN A QUESTION THAT WOULD DISTINGUISH A %s FROM A %s ", animal, questions.get( - questions.size() - 1).falseAnswer); - String newQuestion = scan.nextLine(); - System.out.printf("FOR A %s THE ANSWER WOULD BE ", animal); - boolean newAnswer = readYesOrNo(scan); - //Add it to our list - addNewAnimal(questions, animal, newQuestion, newAnswer); - } + /** + * Prompt for information about the animal we got wrong + * @param current The animal that we guessed wrong + * @param previous The root of current + * @param previousToCurrentDecisionChoice Whether it was a Y or N answer that got us here. true = Y, false = N + */ + private static void askForInformationAndSave(Scanner scan, AnimalNode current, QuestionNode previous, boolean previousToCurrentDecisionChoice) { + //Failed to get it right and ran out of questions + //Let's ask the user for the new information + System.out.print("THE ANIMAL YOU WERE THINKING OF WAS A "); + String animal = scan.nextLine(); + System.out.printf("PLEASE TYPE IN A QUESTION THAT WOULD DISTINGUISH A %s FROM A %s ", animal, current.getAnimal()); + String newQuestion = scan.nextLine(); + System.out.printf("FOR A %s THE ANSWER WOULD BE ", animal); + boolean newAnswer = readYesOrNo(scan); + //Add it to our question store + addNewAnimal(current, previous, animal, newQuestion, newAnswer, previousToCurrentDecisionChoice); + } - private static void addNewAnimal(List questions, String animal, String newQuestion, boolean newAnswer) { - Question lastQuestion = questions.get(questions.size() - 1); - String lastAnimal = lastQuestion.falseAnswer; - lastQuestion.falseAnswer = null; //remove the false option to indicate that there is a next question + private static void addNewAnimal(Node current, + QuestionNode previous, + String animal, + String newQuestion, + boolean newAnswer, + boolean previousToCurrentDecisionChoice) { + var animalNode = new AnimalNode(animal); + var questionNode = new QuestionNode(newQuestion, + newAnswer ? animalNode : current, + !newAnswer ? animalNode : current); - Question newOption; - if (newAnswer) { - newOption = new Question(newQuestion, animal, lastAnimal); - } else { - newOption = new Question(newQuestion, lastAnimal, animal); - } - questions.add(newOption); - } + if (previous != null) { + if (previousToCurrentDecisionChoice) { + previous.setTrueAnswer(questionNode); + } else { + previous.setFalseAnswer(questionNode); + } + } + } - private static boolean askQuestion(Question question, Scanner scanner) { - System.out.printf("%s ? ", question.question); + private static boolean askQuestionAndGetReply(QuestionNode questionNode, Scanner scanner) { + System.out.printf("%s ? ", questionNode.question); + return readYesOrNo(scanner); + } - boolean chosenAnswer = readYesOrNo(scanner); - if (chosenAnswer) { - if (question.trueAnswer != null) { - System.out.printf("IS IT A %s ? ", question.trueAnswer); - return readYesOrNo(scanner); - } - //else go to the next question - } else { - if (question.falseAnswer != null) { - System.out.printf("IS IT A %s ? ", question.falseAnswer); - return readYesOrNo(scanner); - } - //else go to the next question - } - return false; - } + private static boolean readYesOrNo(Scanner scanner) { + boolean validAnswer = false; + Boolean choseAnswer = null; + while (!validAnswer) { + String answer = scanner.nextLine(); + if (answer.toUpperCase(Locale.ROOT).startsWith("Y")) { + validAnswer = true; + choseAnswer = true; + } else if (answer.toUpperCase(Locale.ROOT).startsWith("N")) { + validAnswer = true; + choseAnswer = false; + } + } + return choseAnswer; + } - private static boolean readYesOrNo(Scanner scanner) { - boolean validAnswer = false; - Boolean choseAnswer = null; - while (!validAnswer) { - String answer = scanner.nextLine(); - if (answer.toUpperCase(Locale.ROOT).startsWith("Y")) { - validAnswer = true; - choseAnswer = true; - } else if (answer.toUpperCase(Locale.ROOT).startsWith("N")) { - validAnswer = true; - choseAnswer = false; - } - } - return choseAnswer; - } + private static void printKnownAnimals(Node root) { + System.out.println("\nANIMALS I ALREADY KNOW ARE:"); - private static void printKnownAnimals(List questions) { - System.out.println("\nANIMALS I ALREADY KNOW ARE:"); - List animals = new ArrayList<>(); - questions.forEach(q -> { - if (q.trueAnswer != null) { - animals.add(q.trueAnswer); - } - if (q.falseAnswer != null) { - animals.add(q.falseAnswer); - } - }); - System.out.println(String.join("\t\t", animals)); - } + List leafNodes = collectLeafNodes(root); + String allAnimalsString = leafNodes.stream().map(AnimalNode::getAnimal).collect(Collectors.joining("\t\t")); - private static String readMainChoice(Scanner scan) { - System.out.print("ARE YOU THINKING OF AN ANIMAL ? "); - return scan.nextLine(); - } + System.out.println(allAnimalsString); + } - private static void printIntro() { - System.out.println(" ANIMAL"); - System.out.println(" CREATIVE COMPUTING MORRISTOWN, NEW JERSEY"); - System.out.println("\n\n"); - System.out.println("PLAY 'GUESS THE ANIMAL'"); - System.out.println("\n"); - System.out.println("THINK OF AN ANIMAL AND THE COMPUTER WILL TRY TO GUESS IT."); - } + //Traverse the tree and collect all the leaf nodes, which basically have all the animals. + private static List collectLeafNodes(Node root) { + List collectedNodes = new ArrayList<>(); + if (root instanceof AnimalNode) { + collectedNodes.add((AnimalNode) root); + } else { + var q = (QuestionNode) root; + collectedNodes.addAll(collectLeafNodes(q.getTrueAnswer())); + collectedNodes.addAll(collectLeafNodes(q.getFalseAnswer())); + } + return collectedNodes; + } + + private static String readMainChoice(Scanner scan) { + System.out.print("ARE YOU THINKING OF AN ANIMAL ? "); + return scan.nextLine(); + } + + private static void printIntro() { + System.out.println(" ANIMAL"); + System.out.println(" CREATIVE COMPUTING MORRISTOWN, NEW JERSEY"); + System.out.println("\n\n"); + System.out.println("PLAY 'GUESS THE ANIMAL'"); + System.out.println("\n"); + System.out.println("THINK OF AN ANIMAL AND THE COMPUTER WILL TRY TO GUESS IT."); + } + + //Based on https://stackoverflow.com/a/8948691/74057 + private static void printTree(Node root) { + StringBuilder buffer = new StringBuilder(50); + print(root, buffer, "", ""); + System.out.println(buffer); + } + + private static void print(Node root, StringBuilder buffer, String prefix, String childrenPrefix) { + buffer.append(prefix); + buffer.append(root.toString()); + buffer.append('\n'); + + if (root instanceof QuestionNode) { + var questionNode = (QuestionNode) root; + print(questionNode.getTrueAnswer(), buffer, childrenPrefix + "├─Y─ ", childrenPrefix + "│ "); + print(questionNode.getFalseAnswer(), buffer, childrenPrefix + "└─N─ ", childrenPrefix + " "); + } + } - public static class Question { - String question; - String trueAnswer; - String falseAnswer; + /** + * Base interface for all nodes in our question tree + */ + private interface Node { + } - public Question(String question, String trueAnswer, String falseAnswer) { - this.question = question; - this.trueAnswer = trueAnswer; - this.falseAnswer = falseAnswer; - } - } + private static class QuestionNode implements Node { + private final String question; + private Node trueAnswer; + private Node falseAnswer; + + public QuestionNode(String question, Node trueAnswer, Node falseAnswer) { + this.question = question; + this.trueAnswer = trueAnswer; + this.falseAnswer = falseAnswer; + } + + public String getQuestion() { + return question; + } + + public Node getTrueAnswer() { + return trueAnswer; + } + + public void setTrueAnswer(Node trueAnswer) { + this.trueAnswer = trueAnswer; + } + + public Node getFalseAnswer() { + return falseAnswer; + } + + public void setFalseAnswer(Node falseAnswer) { + this.falseAnswer = falseAnswer; + } + + @Override + public String toString() { + return "Question{'" + question + "'}"; + } + } + + private static class AnimalNode implements Node { + private final String animal; + + public AnimalNode(String animal) { + this.animal = animal; + } + + public String getAnimal() { + return animal; + } + + @Override + public String toString() { + return "Animal{'" + animal + "'}"; + } + } } diff --git a/03_Animal/vbnet/Animal.Tests/Animal.Tests.vbproj b/03_Animal/vbnet/Animal.Tests/Animal.Tests.vbproj new file mode 100644 index 00000000..62a341e9 --- /dev/null +++ b/03_Animal/vbnet/Animal.Tests/Animal.Tests.vbproj @@ -0,0 +1,27 @@ + + + + Animal.Tests + net6.0 + false + On + + + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + + + + + + diff --git a/03_Animal/vbnet/Animal.Tests/MockConsole.vb b/03_Animal/vbnet/Animal.Tests/MockConsole.vb new file mode 100644 index 00000000..a78dc50f --- /dev/null +++ b/03_Animal/vbnet/Animal.Tests/MockConsole.vb @@ -0,0 +1,65 @@ +Imports System.IO + +Public Class MockConsole + Inherits ConsoleAdapterBase + + Private inputs As Queue(Of String) + Public ReadOnly Lines As New List(Of (line As String, centered As Boolean)) From { + ("", False) + } + + ' TODO it's possible to clear all the lines, and we'd have to check once again in WriteString and WriteCenteredLine if there are any lines + + Sub New(Inputs As IEnumerable(Of String)) + Me.inputs = New Queue(Of String)(Inputs) + End Sub + + Private Sub CheckLinesInitialized() + If Lines.Count = 0 Then Lines.Add(("", False)) + End Sub + + Private Sub WriteString(s As String, Optional centered As Boolean = False) + If s Is Nothing Then Return + CheckLinesInitialized() + s.Split(Environment.NewLine).ForEach(Sub(line, index) + If index = 0 Then + Dim currentLast = Lines(Lines.Count - 1) + ' centered should never come from the current last line + ' if WriteCenteredLine is called, it immediately creates a new line + Lines(Lines.Count - 1) = (currentLast.line + line, centered) + Else + Lines.Add((line, centered)) + End If + End Sub) + End Sub + + Public Overrides Sub Write(value As Object) + WriteString(value?.ToString) + End Sub + + Public Overrides Sub WriteLine(value As Object) + WriteString(value?.ToString) + WriteLine() + End Sub + + Public Overrides Sub WriteLine() + Lines.Add(("", False)) + End Sub + + Public Overrides Sub WriteCenteredLine(value As Object) + If Lines.Count = 0 Then Lines.Add(("", False)) + Dim currentLast = Lines(Lines.Count - 1).line + If currentLast.Length > 0 Then Throw New InvalidOperationException("Can only write centered line if cursor is at start of line.") + WriteString(value?.ToString, True) + WriteLine() + End Sub + + Public Overrides Function ReadLine() As String + ' Indicates the end of a test run, for programs which loop endlessly + If inputs.Count = 0 Then Throw New EndOfStreamException("End of inputs") + + Dim nextInput = inputs.Dequeue.Trim + WriteLine(nextInput) + Return nextInput + End Function +End Class diff --git a/03_Animal/vbnet/Animal.Tests/TestContainer.vb b/03_Animal/vbnet/Animal.Tests/TestContainer.vb new file mode 100644 index 00000000..3aed862a --- /dev/null +++ b/03_Animal/vbnet/Animal.Tests/TestContainer.vb @@ -0,0 +1,80 @@ +Imports Xunit +Imports Animal +Imports System.IO + +Public Class TestContainer + Private Shared Function ResponseVariantExpander(src As IEnumerable(Of String)) As TheoryData(Of String) + Dim theoryData = New TheoryData(Of String) + src. + SelectMany(Function(x) {x, x.Substring(0, 1)}). + SelectMany(Function(x) { + x, + x.ToUpperInvariant, + x.ToLowerInvariant, + x.ToTitleCase, + x.ToReverseCase + }). + Distinct. + ForEach(Sub(x) theoryData.Add(x)) + Return theoryData + End Function + Private Shared YesVariantsThepryData As TheoryData(Of String) = ResponseVariantExpander({"yes", "true", "1"}) + Private Shared Function YesVariants() As TheoryData(Of String) + Return YesVariantsThepryData + End Function + Private Shared NoVariantsThepryData As TheoryData(Of String) = ResponseVariantExpander({"no", "false", "0"}) + Private Shared Function NoVariants() As TheoryData(Of String) + Return NoVariantsThepryData + End Function + + '''

Test LIST variants + + + + + + Sub List(listResponse As String) + Dim console As New MockConsole({listResponse}) + Dim game As New Game(console) + Assert.Throws(Of EndOfStreamException)(Sub() game.BeginLoop()) + Assert.Equal( + { + "ANIMALS I ALREADY KNOW ARE:", + "FISH BIRD " + }, + console.Lines.Slice(-4, -2).Select(Function(x) x.line) + ) + End Sub + + '' Test YES variants + + + Sub YesVariant(yesVariant As String) + Dim console As New MockConsole({yesVariant}) + Dim game As New Game(console) + Assert.Throws(Of EndOfStreamException)(Sub() game.BeginLoop()) + Assert.Equal( + { + $"ARE YOU THINKING OF AN ANIMAL? {yesVariant}", + "DOES IT SWIM? " + }, + console.Lines.Slice(-2, 0).Select(Function(x) x.line) + ) + End Sub + + '' Test NO variants + + + Sub NoVariant(noVariant As String) + Dim console As New MockConsole({"y", noVariant}) + Dim game As New Game(console) + Assert.Throws(Of EndOfStreamException)(Sub() game.BeginLoop()) + Assert.Equal( + { + $"DOES IT SWIM? {noVariant}", + "IS IT A BIRD? " + }, + console.Lines.Slice(-2, 0).Select(Function(x) x.line) + ) + End Sub +End Class diff --git a/03_Animal/vbnet/Animal.sln b/03_Animal/vbnet/Animal.sln new file mode 100644 index 00000000..f3b48076 --- /dev/null +++ b/03_Animal/vbnet/Animal.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.0.32112.339 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "Animal", "Animal\Animal.vbproj", "{5517E4CE-BCF9-4D1F-9A17-B620C1B96B0D}" +EndProject +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Animal.Tests", "Animal.Tests\Animal.Tests.vbproj", "{3986C6A2-77D4-4F00-B3CF-F5736C623B1E}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {5517E4CE-BCF9-4D1F-9A17-B620C1B96B0D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5517E4CE-BCF9-4D1F-9A17-B620C1B96B0D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5517E4CE-BCF9-4D1F-9A17-B620C1B96B0D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5517E4CE-BCF9-4D1F-9A17-B620C1B96B0D}.Release|Any CPU.Build.0 = Release|Any CPU + {3986C6A2-77D4-4F00-B3CF-F5736C623B1E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3986C6A2-77D4-4F00-B3CF-F5736C623B1E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3986C6A2-77D4-4F00-B3CF-F5736C623B1E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3986C6A2-77D4-4F00-B3CF-F5736C623B1E}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {88469A47-E30C-4763-A325-074101D16608} + EndGlobalSection +EndGlobal diff --git a/03_Animal/vbnet/Animal/Animal.vbproj b/03_Animal/vbnet/Animal/Animal.vbproj new file mode 100644 index 00000000..f01d7b62 --- /dev/null +++ b/03_Animal/vbnet/Animal/Animal.vbproj @@ -0,0 +1,9 @@ + + + Exe + Animal + net6.0 + 16.9 + On + + diff --git a/03_Animal/vbnet/Animal/Branch.vb b/03_Animal/vbnet/Animal/Branch.vb new file mode 100644 index 00000000..4af369bb --- /dev/null +++ b/03_Animal/vbnet/Animal/Branch.vb @@ -0,0 +1,29 @@ +Public Class Branch + Public Property Text As String + + Public ReadOnly Property IsEnd As Boolean + Get + Return Yes Is Nothing AndAlso No Is Nothing + End Get + End Property + + Public Property Yes As Branch + Public Property No As Branch + + ' Allows walking all the descendants recursively + Public Iterator Function DescendantTexts() As IEnumerable(Of String) + If Yes IsNot Nothing Then + Yield Yes.Text + For Each childText In Yes.DescendantTexts + Yield childText + Next + End If + + If No IsNot Nothing Then + Yield No.Text + For Each childText In No.DescendantTexts + Yield childText + Next + End If + End Function +End Class diff --git a/03_Animal/vbnet/Animal/Game.vb b/03_Animal/vbnet/Animal/Game.vb new file mode 100644 index 00000000..bca72005 --- /dev/null +++ b/03_Animal/vbnet/Animal/Game.vb @@ -0,0 +1,152 @@ +Option Compare Text + +Public Class Game + ' This Dictionary holds the corresponding value for each of the variants of "YES" and "NO" we accept + ' Note that the Dictionary is case-insensitive, meaning it maps "YES", "yes" and even "yEs" to True + Private Shared ReadOnly YesNoResponses As New Dictionary(Of String, Boolean)(StringComparer.InvariantCultureIgnoreCase) From { + {"yes", True}, + {"y", True}, + {"true", True}, + {"t", True}, + {"1", True}, + {"no", False}, + {"n", False}, + {"false", False}, + {"f", False}, + {"0", False} + } + + ReadOnly console As ConsoleAdapterBase + + ' The pre-initialized root branch + ReadOnly root As New Branch With { + .Text = "DOES IT SWIM?", + .Yes = New Branch With {.Text = "FISH"}, + .No = New Branch With {.Text = "BIRD"} + } + + ''' Reduces a string or console input to True, False or Nothing. Case-insensitive. + ''' Optional String to reduce via the same logic. If not passed in, will use console.ReadLine + ''' + ''' Returns True for a "yes" response (yes, y, true, t, 1) and False for a "no" response (no, n, false, f, 0).
+ ''' Returns Nothing if the response doesn't match any of these. + '''
+ Private Function GetYesNo(Optional s As String = Nothing) As Boolean? + s = If(s, console.ReadLine) + Dim ret As Boolean + If YesNoResponses.TryGetValue(s, ret) Then Return ret + Return Nothing + End Function + + Sub New(console As ConsoleAdapterBase) + If console Is Nothing Then Throw New ArgumentNullException(NameOf(console)) + Me.console = console + End Sub + + + Sub BeginLoop() + ' Print the program heading + console.WriteCenteredLine("ANIMAL") + console.WriteCenteredLine("CREATIVE COMPUTING MORRISTOWN, NEW JERSEY") + console.Write( +" + + +PLAY 'GUESS THE ANIMAL' + +THINK OF AN ANIMAL AND THE COMPUTER WILL TRY TO GUESS IT. + +") + + Do + console.Write("ARE YOU THINKING OF AN ANIMAL? ") + + Dim response = console.ReadLine + If response = "list" Then + ' List all the stored animals + console.WriteLine( +" +ANIMALS I ALREADY KNOW ARE:") + + ' We're using a ForEach extension method instead of the regular For Each loop to provide the index alongside the text + root.DescendantTexts.ForEach(Sub(text, index) + ' We want to move to the next line after every four animals + ' But for the first animal, where the index is 0, 0 Mod 4 will also return 0 + ' So we have to explicitly exclude the first animal + If index > 0 AndAlso index Mod 4 = 0 Then console.WriteLine() + console.Write($"{text.MaxLength(15),-15}") + End Sub) + console.WriteLine( +" +") + Continue Do + End If + + Dim ynResponse = GetYesNo(response) + If ynResponse Is Nothing OrElse Not ynResponse Then Continue Do + + Dim currentBranch = root + Do While Not currentBranch.IsEnd + ' Branches can either be questions, or end branches + ' We have to walk the questions, prompting each time for "yes" or "no" + console.Write($"{currentBranch.Text} ") + Do + ynResponse = GetYesNo() + Loop While ynResponse Is Nothing + + ' Depending on the answer, we'll follow either the branch at "Yes" or "No" + currentBranch = If( + ynResponse, + currentBranch.Yes, + currentBranch.No + ) + Loop + + ' Now we're at an end branch + console.Write($"IS IT A {currentBranch.Text}? ") + ynResponse = GetYesNo() + If ynResponse Then ' Only if ynResponse = True will we go into this If Then + console.WriteLine("WHY NOT TRY ANOTHER ANIMAL?") + Continue Do + End If + + ' Get the new animal + console.Write("THE ANIMAL YOU WERE THINKING OF WAS A ? ") + Dim newAnimal = console.ReadLine + + ' Get the question used to distinguish the new animal from the current end branch + console.WriteLine( +$"PLEASE TYPE IN A QUESTION THAT WOULD DISTINGUISH A +{newAnimal} FROM A {currentBranch.Text}") + Dim newQuestion = console.ReadLine + + ' Get the answer to that question, for the new animal + ' for the old animal, the answer would be the opposite + console.Write( +$"FOR A {newAnimal} THE ANSWER WOULD BE ? ") + Do + ynResponse = GetYesNo() + Loop While ynResponse Is Nothing + + ' Create the new end branch for the new animal + Dim newBranch = New Branch With {.Text = newAnimal} + + ' Copy over the current animal to another new end branch + Dim currentBranchCopy = New Branch With {.Text = currentBranch.Text} + + ' Make the current branch into the distinguishing question + currentBranch.Text = newQuestion + + ' Set the Yes and No branches of the current branch according to the answer + If ynResponse Then + currentBranch.Yes = newBranch + currentBranch.No = currentBranchCopy + Else + currentBranch.No = newBranch + currentBranch.Yes = currentBranchCopy + End If + + ' TODO how do we exit? + Loop + End Sub +End Class diff --git a/03_Animal/vbnet/Animal/Program.vb b/03_Animal/vbnet/Animal/Program.vb new file mode 100644 index 00000000..adb34932 --- /dev/null +++ b/03_Animal/vbnet/Animal/Program.vb @@ -0,0 +1,6 @@ +Module Program + Sub Main() + Dim game As New Game(New ConsoleAdapter) + game.BeginLoop() + End Sub +End Module diff --git a/03_Animal/vbnet/Animal/Shared/ConsoleAdapter.vb b/03_Animal/vbnet/Animal/Shared/ConsoleAdapter.vb new file mode 100644 index 00000000..f49394e0 --- /dev/null +++ b/03_Animal/vbnet/Animal/Shared/ConsoleAdapter.vb @@ -0,0 +1,29 @@ +Public Class ConsoleAdapter + Inherits ConsoleAdapterBase + + Public Overrides Sub Write(value As Object) + Console.Write(value) + End Sub + + Public Overrides Sub WriteLine(value As Object) + Console.WriteLine(value) + End Sub + + Public Overrides Sub WriteLine() + Console.WriteLine() + End Sub + + Public Overrides Sub WriteCenteredLine(value As Object) + If Console.CursorLeft <> 0 Then Throw New InvalidOperationException("Can only write centered line if cursor is at start of line.") + Dim toWrite = If(value?.ToString, "") + Console.WriteLine($"{Space((Console.WindowWidth - toWrite.Length) \ 2)}{toWrite}") + End Sub + + Public Overrides Function ReadLine() As String + Dim response As String + Do + response = Console.ReadLine + Loop While response Is Nothing + Return response.Trim + End Function +End Class diff --git a/03_Animal/vbnet/Animal/Shared/ConsoleAdapterBase.vb b/03_Animal/vbnet/Animal/Shared/ConsoleAdapterBase.vb new file mode 100644 index 00000000..4c9166bf --- /dev/null +++ b/03_Animal/vbnet/Animal/Shared/ConsoleAdapterBase.vb @@ -0,0 +1,9 @@ +Public MustInherit Class ConsoleAdapterBase + Public MustOverride Sub Write(value As Object) + Public MustOverride Sub WriteLine(value As Object) + Public MustOverride Sub WriteLine() + Public MustOverride Sub WriteCenteredLine(value As Object) + + ''' Implementations should always return a String without leading or trailing whitespace, never Nothng + Public MustOverride Function ReadLine() As String +End Class diff --git a/03_Animal/vbnet/Animal/Shared/Extensions.vb b/03_Animal/vbnet/Animal/Shared/Extensions.vb new file mode 100644 index 00000000..e10df441 --- /dev/null +++ b/03_Animal/vbnet/Animal/Shared/Extensions.vb @@ -0,0 +1,50 @@ +Imports System.Runtime.CompilerServices + +Public Module Extensions + Public Sub ForEach(Of T)(src As IEnumerable(Of T), action As Action(Of T)) + For Each x In src + action(x) + Next + End Sub + Public Sub ForEach(Of T)(src As IEnumerable(Of T), action As Action(Of T, Integer)) + Dim index As Integer + For Each x In src + action(x, index) + index += 1 + Next + End Sub + + Public Function MaxLength(s As String, value As Integer) As String + If s Is Nothing Then Return Nothing + Return s.Substring(0, Math.Min(s.Length, value)) + End Function + + Public Function ForceEndsWith(s As String, toAppend As String) As String + If Not s.EndsWith(toAppend, StringComparison.OrdinalIgnoreCase) Then s += toAppend + Return s + End Function + + Public Function ToTitleCase(s As String) As String + If s Is Nothing Then Return Nothing + Return Char.ToUpperInvariant(s(0)) + s.Substring(1).ToUpperInvariant + End Function + + ' https://stackoverflow.com/a/3681580/111794 + Public Function ToReverseCase(s As String) As String + If s Is Nothing Then Return Nothing + Return New String(s.Select(Function(c) If( + Not Char.IsLetter(c), + c, + If( + Char.IsUpper(c), Char.ToLowerInvariant(c), Char.ToUpperInvariant(c) + ) + )).ToArray) + End Function + + ' https://stackoverflow.com/a/58132204/111794 + Public Function Slice(Of T)(lst As IList(Of T), start As Integer, [end] As Integer) As T() + start = If(start >= 0, start, lst.Count + start) + [end] = If([end] > 0, [end], lst.Count + [end]) + Return lst.Skip(start).Take([end] - start).ToArray + End Function +End Module diff --git a/04_Awari/csharp/csharp.csproj b/04_Awari/csharp/Awari.csproj similarity index 100% rename from 04_Awari/csharp/csharp.csproj rename to 04_Awari/csharp/Awari.csproj diff --git a/04_Awari/csharp/Awari.sln b/04_Awari/csharp/Awari.sln new file mode 100644 index 00000000..492aa580 --- /dev/null +++ b/04_Awari/csharp/Awari.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.0.32014.148 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Awari", "Awari.csproj", "{DD161F58-D90F-481A-8275-96E01D229A70}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {DD161F58-D90F-481A-8275-96E01D229A70}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DD161F58-D90F-481A-8275-96E01D229A70}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DD161F58-D90F-481A-8275-96E01D229A70}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DD161F58-D90F-481A-8275-96E01D229A70}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {7F5C288A-A6C6-4AC0-96E3-6A3B482A0947} + EndGlobalSection +EndGlobal diff --git a/04_Awari/vbnet/Awari.sln b/04_Awari/vbnet/Awari.sln new file mode 100644 index 00000000..ef0fd0cf --- /dev/null +++ b/04_Awari/vbnet/Awari.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Awari", "Awari.vbproj", "{718AECEB-CC24-49C8-B620-B2F93E021C51}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {718AECEB-CC24-49C8-B620-B2F93E021C51}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {718AECEB-CC24-49C8-B620-B2F93E021C51}.Debug|Any CPU.Build.0 = Debug|Any CPU + {718AECEB-CC24-49C8-B620-B2F93E021C51}.Release|Any CPU.ActiveCfg = Release|Any CPU + {718AECEB-CC24-49C8-B620-B2F93E021C51}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/04_Awari/vbnet/Awari.vbproj b/04_Awari/vbnet/Awari.vbproj new file mode 100644 index 00000000..368d6f02 --- /dev/null +++ b/04_Awari/vbnet/Awari.vbproj @@ -0,0 +1,8 @@ + + + Exe + Awari + net6.0 + 16.9 + + diff --git a/05_Bagels/csharp/Bagels.csproj b/05_Bagels/csharp/Bagels.csproj index 68fa11ec..54cdbe42 100644 --- a/05_Bagels/csharp/Bagels.csproj +++ b/05_Bagels/csharp/Bagels.csproj @@ -3,7 +3,6 @@ Exe net5.0 - BasicComputerGames.Bagels diff --git a/05_Bagels/csharp/Bagels.sln b/05_Bagels/csharp/Bagels.sln new file mode 100644 index 00000000..3aaa718b --- /dev/null +++ b/05_Bagels/csharp/Bagels.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bagels", "Bagels.csproj", "{2FC5F33F-2C4B-4707-94E5-3C9B2B633EFE}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {2FC5F33F-2C4B-4707-94E5-3C9B2B633EFE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2FC5F33F-2C4B-4707-94E5-3C9B2B633EFE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2FC5F33F-2C4B-4707-94E5-3C9B2B633EFE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2FC5F33F-2C4B-4707-94E5-3C9B2B633EFE}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/05_Bagels/vbnet/Bagels.sln b/05_Bagels/vbnet/Bagels.sln new file mode 100644 index 00000000..ab6fa275 --- /dev/null +++ b/05_Bagels/vbnet/Bagels.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Bagels", "Bagels.vbproj", "{913FE7A8-B481-4EB3-8938-566BEAD5B0F2}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {913FE7A8-B481-4EB3-8938-566BEAD5B0F2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {913FE7A8-B481-4EB3-8938-566BEAD5B0F2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {913FE7A8-B481-4EB3-8938-566BEAD5B0F2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {913FE7A8-B481-4EB3-8938-566BEAD5B0F2}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/05_Bagels/vbnet/Bagels.vbproj b/05_Bagels/vbnet/Bagels.vbproj new file mode 100644 index 00000000..c0d9d2d0 --- /dev/null +++ b/05_Bagels/vbnet/Bagels.vbproj @@ -0,0 +1,8 @@ + + + Exe + Bagels + net6.0 + 16.9 + + diff --git a/06_Banner/csharp/banner.sln b/06_Banner/csharp/banner.sln index 34f63984..9beeb9b3 100644 --- a/06_Banner/csharp/banner.sln +++ b/06_Banner/csharp/banner.sln @@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 16 VisualStudioVersion = 16.0.31321.278 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "banner", "banner.csproj", "{9E24FA30-F2AC-4BF3-ADFB-92D3F796561C}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Banner", "Banner.csproj", "{7E8612AB-AFFD-4F72-855F-8172786F28FD}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -11,10 +11,10 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {9E24FA30-F2AC-4BF3-ADFB-92D3F796561C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {9E24FA30-F2AC-4BF3-ADFB-92D3F796561C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {9E24FA30-F2AC-4BF3-ADFB-92D3F796561C}.Release|Any CPU.ActiveCfg = Release|Any CPU - {9E24FA30-F2AC-4BF3-ADFB-92D3F796561C}.Release|Any CPU.Build.0 = Release|Any CPU + {7E8612AB-AFFD-4F72-855F-8172786F28FD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7E8612AB-AFFD-4F72-855F-8172786F28FD}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7E8612AB-AFFD-4F72-855F-8172786F28FD}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7E8612AB-AFFD-4F72-855F-8172786F28FD}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/06_Banner/vbnet/banner.sln b/06_Banner/vbnet/banner.sln index 5fdc8737..8a782a2f 100644 --- a/06_Banner/vbnet/banner.sln +++ b/06_Banner/vbnet/banner.sln @@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 16 VisualStudioVersion = 16.0.31321.278 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "banner", "banner.vbproj", "{1738D297-A04C-4E6E-8219-D9E72982C39D}" +Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "Banner", "Banner.vbproj", "{091ABE13-3E70-4848-B836-592F725915A3}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -11,10 +11,10 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {1738D297-A04C-4E6E-8219-D9E72982C39D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {1738D297-A04C-4E6E-8219-D9E72982C39D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {1738D297-A04C-4E6E-8219-D9E72982C39D}.Release|Any CPU.ActiveCfg = Release|Any CPU - {1738D297-A04C-4E6E-8219-D9E72982C39D}.Release|Any CPU.Build.0 = Release|Any CPU + {091ABE13-3E70-4848-B836-592F725915A3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {091ABE13-3E70-4848-B836-592F725915A3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {091ABE13-3E70-4848-B836-592F725915A3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {091ABE13-3E70-4848-B836-592F725915A3}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/06_Banner/vbnet/banner.vbproj b/06_Banner/vbnet/banner.vbproj index 659fea7b..e825a636 100644 --- a/06_Banner/vbnet/banner.vbproj +++ b/06_Banner/vbnet/banner.vbproj @@ -2,8 +2,9 @@ Exe - banner + Banner netcoreapp3.1 + 16.9 diff --git a/07_Basketball/csharp/Basketball.csproj b/07_Basketball/csharp/Basketball.csproj new file mode 100644 index 00000000..d3fe4757 --- /dev/null +++ b/07_Basketball/csharp/Basketball.csproj @@ -0,0 +1,9 @@ + + + Exe + net6.0 + 10 + enable + enable + + diff --git a/07_Basketball/csharp/Basketball.sln b/07_Basketball/csharp/Basketball.sln new file mode 100644 index 00000000..92f2de05 --- /dev/null +++ b/07_Basketball/csharp/Basketball.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Basketball", "Basketball.csproj", "{00D03FB3-B485-480F-B14D-746371BDE08B}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {00D03FB3-B485-480F-B14D-746371BDE08B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {00D03FB3-B485-480F-B14D-746371BDE08B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {00D03FB3-B485-480F-B14D-746371BDE08B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {00D03FB3-B485-480F-B14D-746371BDE08B}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/07_Basketball/vbnet/Basketball.sln b/07_Basketball/vbnet/Basketball.sln new file mode 100644 index 00000000..b32c954f --- /dev/null +++ b/07_Basketball/vbnet/Basketball.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Basketball", "Basketball.vbproj", "{09C533F2-4874-4BA4-9F80-BBE9E8E17456}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {09C533F2-4874-4BA4-9F80-BBE9E8E17456}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {09C533F2-4874-4BA4-9F80-BBE9E8E17456}.Debug|Any CPU.Build.0 = Debug|Any CPU + {09C533F2-4874-4BA4-9F80-BBE9E8E17456}.Release|Any CPU.ActiveCfg = Release|Any CPU + {09C533F2-4874-4BA4-9F80-BBE9E8E17456}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/07_Basketball/vbnet/Basketball.vbproj b/07_Basketball/vbnet/Basketball.vbproj new file mode 100644 index 00000000..6d9f101f --- /dev/null +++ b/07_Basketball/vbnet/Basketball.vbproj @@ -0,0 +1,8 @@ + + + Exe + Basketball + net6.0 + 16.9 + + diff --git a/08_Batnum/vbnet/batnum.sln b/08_Batnum/vbnet/batnum.sln index b3f63f59..ca05e41b 100644 --- a/08_Batnum/vbnet/batnum.sln +++ b/08_Batnum/vbnet/batnum.sln @@ -1,9 +1,9 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.31321.278 +# Visual Studio Version 17 +VisualStudioVersion = 17.0.32014.148 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "batnum", "batnum.vbproj", "{D577E429-F84D-4E84-86E7-E6526CFD5FD9}" +Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "Batnum", "Batnum.vbproj", "{D577E429-F84D-4E84-86E7-E6526CFD5FD9}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/08_Batnum/vbnet/batnum.vbproj b/08_Batnum/vbnet/batnum.vbproj index 3c21499c..aad6e218 100644 --- a/08_Batnum/vbnet/batnum.vbproj +++ b/08_Batnum/vbnet/batnum.vbproj @@ -2,8 +2,9 @@ Exe - batnum + Batnum netcoreapp3.1 + 16.9 diff --git a/09_Battle/python/battle.py b/09_Battle/python/battle.py new file mode 100644 index 00000000..d9449b77 --- /dev/null +++ b/09_Battle/python/battle.py @@ -0,0 +1,167 @@ +#!/usr/bin/env python3 +from random import randrange +from typing import List, Tuple + +PointType = Tuple[int, int] +VectorType = PointType +SeaType = Tuple[List[int], ...] + +SEA_WIDTH = 6 +DESTROYER_LENGTH = 2 +CRUISER_LENGTH = 3 +AIRCRAFT_CARRIER_LENGTH = 4 + + +def random_vector() -> Tuple[int, int]: + while True: + vector = (randrange(-1, 2), randrange(-1, 2)) + + if vector == (0, 0): + # We can't have a zero vector, so try again + continue + + return vector + + +def add_vector(point: PointType, vector: VectorType) -> PointType: + return (point[0] + vector[0], point[1] + vector[1]) + + +def place_ship(sea: SeaType, size: int, code: int) -> None: + while True: + start = (randrange(1, SEA_WIDTH + 1), randrange(1, SEA_WIDTH + 1)) + vector = random_vector() + + # Get potential ship points + point = start + points = [] + + for _ in range(size): + point = add_vector(point, vector) + points.append(point) + + if (not all([is_within_sea(point, sea) for point in points]) or + any([value_at(point, sea) for point in points])): + # ship out of bounds or crosses other ship, trying again + continue + + # We found a valid spot, so actually place it now + for point in points: + set_value_at(code, point, sea) + + break + + +def print_encoded_sea(sea: SeaType) -> None: + for x in range(len(sea)): + print(' '.join([str(sea[y][x]) for y in range(len(sea) - 1, -1, -1)])) + + +def is_within_sea(point: PointType, sea: SeaType) -> bool: + return (1 <= point[0] <= len(sea)) and (1 <= point[1] <= len(sea)) + + +def has_ship(sea: SeaType, code: int) -> bool: + return any(code in row for row in sea) + + +def count_sunk(sea: SeaType, *codes: int) -> int: + return sum(not has_ship(sea, code) for code in codes) + + +def value_at(point: PointType, sea: SeaType) -> int: + return sea[point[1] - 1][point[0] -1] + + +def set_value_at(value: int, point: PointType, sea: SeaType) -> None: + sea[point[1] - 1][point[0] -1] = value + + +def get_next_target(sea: SeaType) -> PointType: + while True: + try: + guess = input('? ') + point = guess.split(',') + + if len(point) != 2: + raise ValueError() + + point = (int(point[0]), int(point[1])) + + if not is_within_sea(point, sea): + raise ValueError() + + return point + except ValueError: + print(f'INVALID. SPECIFY TWO NUMBERS FROM 1 TO {len(sea)}, SEPARATED BY A COMMA.') + + +def setup_ships(sea: SeaType): + place_ship(sea, DESTROYER_LENGTH, 1) + place_ship(sea, DESTROYER_LENGTH, 2) + place_ship(sea, CRUISER_LENGTH, 3) + place_ship(sea, CRUISER_LENGTH, 4) + place_ship(sea, AIRCRAFT_CARRIER_LENGTH, 5) + place_ship(sea, AIRCRAFT_CARRIER_LENGTH, 6) + + +def main() -> None: + sea = tuple(([0 for _ in range(SEA_WIDTH)] for _ in range(SEA_WIDTH))) + setup_ships(sea) + print(f''' + BATTLE +CREATIVE COMPUTING MORRISTOWN, NEW JERSEY + +THE FOLLOWING CODE OF THE BAD GUYS' FLEET DISPOSITION +HAS BEEN CAPTURED BUT NOT DECODED: + +''') + print_encoded_sea(sea) + print(''' + +DE-CODE IT AND USE IT IF YOU CAN +BUT KEEP THE DE-CODING METHOD A SECRET. + +START GAME''') + splashes = 0 + hits = 0 + + while True: + target = get_next_target(sea) + target_value = value_at(target, sea) + + if target_value < 0: + print(f'YOU ALREADY PUT A HOLE IN SHIP NUMBER {abs(target_value)} AT THAT POINT.') + + if target_value <= 0: + print('SPLASH! TRY AGAIN.') + splashes += 1 + continue + + print(f'A DIRECT HIT ON SHIP NUMBER {target_value}') + hits += 1 + set_value_at(-target_value, target, sea) + + if not has_ship(sea, target_value): + print('AND YOU SUNK IT. HURRAH FOR THE GOOD GUYS.') + print('SO FAR, THE BAD GUYS HAVE LOST') + print(f'{count_sunk(sea, 1, 2)} DESTROYER(S),', + f'{count_sunk(sea, 3, 4)} CRUISER(S),', + f'AND {count_sunk(sea, 5, 6)} AIRCRAFT CARRIER(S).') + + if any(has_ship(sea, code) for code in range(1, 7)): + print(f'YOUR CURRENT SPLASH/HIT RATIO IS {splashes}/{hits}') + continue + + print('YOU HAVE TOTALLY WIPED OUT THE BAD GUYS\' FLEET ' + f'WITH A FINAL SPLASH/HIT RATIO OF {splashes}/{hits}') + + if not splashes: + print('CONGRATULATIONS -- A DIRECT HIT EVERY TIME.') + + print("\n****************************") + break + + +if __name__ == "__main__": + main() diff --git a/09_Battle/python/battle_oo.py b/09_Battle/python/battle_oo.py new file mode 100644 index 00000000..dc35efa6 --- /dev/null +++ b/09_Battle/python/battle_oo.py @@ -0,0 +1,203 @@ +#!/usr/bin/env python3 +from dataclasses import dataclass +from random import randrange + + +DESTROYER_LENGTH = 2 +CRUISER_LENGTH = 3 +AIRCRAFT_CARRIER_LENGTH = 4 + + +@dataclass(frozen=True) +class Point: + x: int + y: int + + @classmethod + def random(cls, start: int, stop: int) -> 'Point': + return Point(randrange(start, stop), randrange(start, stop)) + + def __add__(self, vector: 'Vector') -> 'Point': + return Point(self.x + vector.x, self.y + vector.y) + + +@dataclass(frozen=True) +class Vector: + x: int + y: int + + @staticmethod + def random() -> 'Vector': + return Vector(randrange(-1, 2, 2), randrange(-1, 2, 2)) + + def __mul__(self, factor: int) -> 'Vector': + return Vector(self.x * factor, self.y * factor) + + +class Sea: + WIDTH = 6 + + def __init__(self): + self._graph = tuple(([0 for _ in range(self.WIDTH)] for _ in range(self.WIDTH))) + + def _validate_item_indices(self, point: Point) -> None: + if not isinstance(point, Point): + raise ValueError(f'Sea indices must be Points, not {type(point).__name__}') + + if not((1 <= point.x <= self.WIDTH) and (1 <= point.y <= self.WIDTH)): + raise IndexError('Sea index out of range') + + # Allows us to get the value using a point as a key, for example, `sea[Point(3,2)]` + def __getitem__(self, point: Point) -> int: + self._validate_item_indices(point) + + return self._graph[point.y - 1][point.x -1] + + # Allows us to get the value using a point as a key, for example, `sea[Point(3,2)] = 3` + def __setitem__(self, point: Point, value: int) -> None: + self._validate_item_indices(point) + self._graph[point.y - 1][point.x -1] = value + + # Allows us to check if a point exists in the sea for example, `if Point(3,2) in sea:` + def __contains__(self, point: Point) -> bool: + try: + self._validate_item_indices(point) + except IndexError: + return False + + return True + + # Redefines how python will render this object when asked as a str + def __str__(self): + # Display it encoded + return "\n".join([' '.join([str(self._graph[y][x]) + for y in range(self.WIDTH - 1, -1, -1)]) + for x in range(self.WIDTH)]) + + def has_ship(self, ship_code: int) -> bool: + return any(ship_code in row for row in self._graph) + + def count_sunk(self, *ship_codes: int) -> int: + return sum(not self.has_ship(ship_code) for ship_code in ship_codes) + + +class Battle: + def __init__(self) -> None: + self.sea = Sea() + self.place_ship(DESTROYER_LENGTH, 1) + self.place_ship(DESTROYER_LENGTH, 2) + self.place_ship(CRUISER_LENGTH, 3) + self.place_ship(CRUISER_LENGTH, 4) + self.place_ship(AIRCRAFT_CARRIER_LENGTH, 5) + self.place_ship(AIRCRAFT_CARRIER_LENGTH, 6) + self.splashes = 0 + self.hits = 0 + + def _next_target(self) -> Point: + while True: + try: + guess = input('? ') + coordinates = guess.split(',') + + if len(coordinates) != 2: + raise ValueError() + + point = Point(int(coordinates[0]), int(coordinates[1])) + + if point not in self.sea: + raise ValueError() + + return point + except ValueError: + print(f'INVALID. SPECIFY TWO NUMBERS FROM 1 TO {Sea.WIDTH}, SEPARATED BY A COMMA.') + + @property + def splash_hit_ratio(self) -> str: + return f'{self.splashes}/{self.hits}' + + @property + def _is_finished(self) -> bool: + return self.sea.count_sunk(*(i for i in range(1, 7))) == 6 + + def place_ship(self, size: int, ship_code: int) -> None: + while True: + start = Point.random(1, self.sea.WIDTH + 1) + vector = Vector.random() + # Get potential ship points + points = [start + vector * i for i in range(size)] + + if not (all([point in self.sea for point in points]) and + not any([self.sea[point] for point in points])): + # ship out of bounds or crosses other ship, trying again + continue + + # We found a valid spot, so actually place it now + for point in points: + self.sea[point] = ship_code + + break + + + def loop(self): + while True: + target = self._next_target() + target_value = self.sea[target] + + if target_value < 0: + print(f'YOU ALREADY PUT A HOLE IN SHIP NUMBER {abs(target_value)} AT THAT POINT.') + + if target_value <= 0: + print('SPLASH! TRY AGAIN.') + self.splashes += 1 + continue + + print(f'A DIRECT HIT ON SHIP NUMBER {target_value}') + self.hits += 1 + self.sea[target] = -target_value + + if not self.sea.has_ship(target_value): + print('AND YOU SUNK IT. HURRAH FOR THE GOOD GUYS.') + self._display_sunk_report() + + if self._is_finished: + self._display_game_end() + break + + print(f'YOUR CURRENT SPLASH/HIT RATIO IS {self.splash_hit_ratio}') + + def _display_sunk_report(self): + print('SO FAR, THE BAD GUYS HAVE LOST', + f'{self.sea.count_sunk(1, 2)} DESTROYER(S),', + f'{self.sea.count_sunk(3, 4)} CRUISER(S),', + f'AND {self.sea.count_sunk(5, 6)} AIRCRAFT CARRIER(S).') + + def _display_game_end(self): + print('YOU HAVE TOTALLY WIPED OUT THE BAD GUYS\' FLEET ' + f'WITH A FINAL SPLASH/HIT RATIO OF {self.splash_hit_ratio}') + + if not self.splashes: + print('CONGRATULATIONS -- A DIRECT HIT EVERY TIME.') + + print("\n****************************") + + +def main() -> None: + game = Battle() + print(f''' + BATTLE +CREATIVE COMPUTING MORRISTOWN, NEW JERSEY + +THE FOLLOWING CODE OF THE BAD GUYS' FLEET DISPOSITION +HAS BEEN CAPTURED BUT NOT DECODED: + +{game.sea} + +DE-CODE IT AND USE IT IF YOU CAN +BUT KEEP THE DE-CODING METHOD A SECRET. + +START GAME''') + game.loop() + + +if __name__ == "__main__": + main() diff --git a/09_Battle/vbnet/Battle.sln b/09_Battle/vbnet/Battle.sln new file mode 100644 index 00000000..bf92bf39 --- /dev/null +++ b/09_Battle/vbnet/Battle.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Battle", "Battle.vbproj", "{D8475464-CB9B-448F-89A7-5BA15193C495}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {D8475464-CB9B-448F-89A7-5BA15193C495}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D8475464-CB9B-448F-89A7-5BA15193C495}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D8475464-CB9B-448F-89A7-5BA15193C495}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D8475464-CB9B-448F-89A7-5BA15193C495}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/09_Battle/vbnet/Battle.vbproj b/09_Battle/vbnet/Battle.vbproj new file mode 100644 index 00000000..dc5c5908 --- /dev/null +++ b/09_Battle/vbnet/Battle.vbproj @@ -0,0 +1,8 @@ + + + Exe + Battle + net6.0 + 16.9 + + diff --git a/10_Blackjack/csharp/Blackjack.sln b/10_Blackjack/csharp/Blackjack.sln new file mode 100644 index 00000000..1a01fb8b --- /dev/null +++ b/10_Blackjack/csharp/Blackjack.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Blackjack", "Blackjack.csproj", "{83253F48-9CCD-475C-A990-8703F1A2E31C}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {83253F48-9CCD-475C-A990-8703F1A2E31C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {83253F48-9CCD-475C-A990-8703F1A2E31C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {83253F48-9CCD-475C-A990-8703F1A2E31C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {83253F48-9CCD-475C-A990-8703F1A2E31C}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/10_Blackjack/vbnet/Blackjack.sln b/10_Blackjack/vbnet/Blackjack.sln new file mode 100644 index 00000000..2610b4a7 --- /dev/null +++ b/10_Blackjack/vbnet/Blackjack.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Blackjack", "Blackjack.vbproj", "{B112CA5F-142B-46E9-92CB-5E3A84816AAE}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {B112CA5F-142B-46E9-92CB-5E3A84816AAE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B112CA5F-142B-46E9-92CB-5E3A84816AAE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B112CA5F-142B-46E9-92CB-5E3A84816AAE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B112CA5F-142B-46E9-92CB-5E3A84816AAE}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/10_Blackjack/vbnet/Blackjack.vbproj b/10_Blackjack/vbnet/Blackjack.vbproj new file mode 100644 index 00000000..bc1d8eed --- /dev/null +++ b/10_Blackjack/vbnet/Blackjack.vbproj @@ -0,0 +1,8 @@ + + + Exe + Blackjack + net6.0 + 16.9 + + diff --git a/11_Bombardment/csharp/Bombardment.sln b/11_Bombardment/csharp/Bombardment.sln new file mode 100644 index 00000000..a401c67e --- /dev/null +++ b/11_Bombardment/csharp/Bombardment.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bombardment", "Bombardment.csproj", "{1DCFD283-9300-405B-A2B4-231F30265730}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {1DCFD283-9300-405B-A2B4-231F30265730}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1DCFD283-9300-405B-A2B4-231F30265730}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1DCFD283-9300-405B-A2B4-231F30265730}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1DCFD283-9300-405B-A2B4-231F30265730}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/11_Bombardment/vbnet/Bombardment.sln b/11_Bombardment/vbnet/Bombardment.sln new file mode 100644 index 00000000..326fb000 --- /dev/null +++ b/11_Bombardment/vbnet/Bombardment.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Bombardment", "Bombardment.vbproj", "{7C967BC0-101C-413F-92A8-3A8A7D9846FE}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {7C967BC0-101C-413F-92A8-3A8A7D9846FE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7C967BC0-101C-413F-92A8-3A8A7D9846FE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7C967BC0-101C-413F-92A8-3A8A7D9846FE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7C967BC0-101C-413F-92A8-3A8A7D9846FE}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/11_Bombardment/vbnet/Bombardment.vbproj b/11_Bombardment/vbnet/Bombardment.vbproj new file mode 100644 index 00000000..746887ce --- /dev/null +++ b/11_Bombardment/vbnet/Bombardment.vbproj @@ -0,0 +1,8 @@ + + + Exe + Bombardment + net6.0 + 16.9 + + diff --git a/12_Bombs_Away/vbnet/BombsAway.sln b/12_Bombs_Away/vbnet/BombsAway.sln new file mode 100644 index 00000000..124d3943 --- /dev/null +++ b/12_Bombs_Away/vbnet/BombsAway.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "BombsAway", "BombsAway.vbproj", "{7FB28848-EC1C-4594-B823-BA6DB06B34A8}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {7FB28848-EC1C-4594-B823-BA6DB06B34A8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7FB28848-EC1C-4594-B823-BA6DB06B34A8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7FB28848-EC1C-4594-B823-BA6DB06B34A8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7FB28848-EC1C-4594-B823-BA6DB06B34A8}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/12_Bombs_Away/vbnet/BombsAway.vbproj b/12_Bombs_Away/vbnet/BombsAway.vbproj new file mode 100644 index 00000000..da557be9 --- /dev/null +++ b/12_Bombs_Away/vbnet/BombsAway.vbproj @@ -0,0 +1,8 @@ + + + Exe + BombsAway + net6.0 + 16.9 + + diff --git a/13_Bounce/csharp/Bounce.csproj b/13_Bounce/csharp/Bounce.csproj new file mode 100644 index 00000000..d3fe4757 --- /dev/null +++ b/13_Bounce/csharp/Bounce.csproj @@ -0,0 +1,9 @@ + + + Exe + net6.0 + 10 + enable + enable + + diff --git a/13_Bounce/csharp/Bounce.sln b/13_Bounce/csharp/Bounce.sln new file mode 100644 index 00000000..f844a126 --- /dev/null +++ b/13_Bounce/csharp/Bounce.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bounce", "Bounce.csproj", "{4A967985-8CB0-49D2-B322-B2668491CA6E}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {4A967985-8CB0-49D2-B322-B2668491CA6E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4A967985-8CB0-49D2-B322-B2668491CA6E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4A967985-8CB0-49D2-B322-B2668491CA6E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4A967985-8CB0-49D2-B322-B2668491CA6E}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/13_Bounce/vbnet/Bounce.sln b/13_Bounce/vbnet/Bounce.sln new file mode 100644 index 00000000..327f27dc --- /dev/null +++ b/13_Bounce/vbnet/Bounce.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Bounce", "Bounce.vbproj", "{95D84C53-AE4E-4A5A-869A-A49D6FC89618}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {95D84C53-AE4E-4A5A-869A-A49D6FC89618}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {95D84C53-AE4E-4A5A-869A-A49D6FC89618}.Debug|Any CPU.Build.0 = Debug|Any CPU + {95D84C53-AE4E-4A5A-869A-A49D6FC89618}.Release|Any CPU.ActiveCfg = Release|Any CPU + {95D84C53-AE4E-4A5A-869A-A49D6FC89618}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/13_Bounce/vbnet/Bounce.vbproj b/13_Bounce/vbnet/Bounce.vbproj new file mode 100644 index 00000000..33443331 --- /dev/null +++ b/13_Bounce/vbnet/Bounce.vbproj @@ -0,0 +1,8 @@ + + + Exe + Bounce + net6.0 + 16.9 + + diff --git a/14_Bowling/csharp/Bowling.csproj b/14_Bowling/csharp/Bowling.csproj new file mode 100644 index 00000000..d3fe4757 --- /dev/null +++ b/14_Bowling/csharp/Bowling.csproj @@ -0,0 +1,9 @@ + + + Exe + net6.0 + 10 + enable + enable + + diff --git a/14_Bowling/csharp/Bowling.sln b/14_Bowling/csharp/Bowling.sln new file mode 100644 index 00000000..aa48103b --- /dev/null +++ b/14_Bowling/csharp/Bowling.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bowling", "Bowling.csproj", "{9951637A-8D70-42A4-8CB7-315FA414F960}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {9951637A-8D70-42A4-8CB7-315FA414F960}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9951637A-8D70-42A4-8CB7-315FA414F960}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9951637A-8D70-42A4-8CB7-315FA414F960}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9951637A-8D70-42A4-8CB7-315FA414F960}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/14_Bowling/vbnet/Bowling.sln b/14_Bowling/vbnet/Bowling.sln new file mode 100644 index 00000000..98b8a996 --- /dev/null +++ b/14_Bowling/vbnet/Bowling.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Bowling", "Bowling.vbproj", "{DBEB424A-1538-4F14-BA57-BA4E326EF4D8}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {DBEB424A-1538-4F14-BA57-BA4E326EF4D8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DBEB424A-1538-4F14-BA57-BA4E326EF4D8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DBEB424A-1538-4F14-BA57-BA4E326EF4D8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DBEB424A-1538-4F14-BA57-BA4E326EF4D8}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/14_Bowling/vbnet/Bowling.vbproj b/14_Bowling/vbnet/Bowling.vbproj new file mode 100644 index 00000000..36ec929f --- /dev/null +++ b/14_Bowling/vbnet/Bowling.vbproj @@ -0,0 +1,8 @@ + + + Exe + Bowling + net6.0 + 16.9 + + diff --git a/15_Boxing/vbnet/Boxing.sln b/15_Boxing/vbnet/Boxing.sln new file mode 100644 index 00000000..4cca8bb5 --- /dev/null +++ b/15_Boxing/vbnet/Boxing.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Boxing", "Boxing.vbproj", "{8BCEDE01-59A7-4AA3-AE09-8B7FD69A5867}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {8BCEDE01-59A7-4AA3-AE09-8B7FD69A5867}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8BCEDE01-59A7-4AA3-AE09-8B7FD69A5867}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8BCEDE01-59A7-4AA3-AE09-8B7FD69A5867}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8BCEDE01-59A7-4AA3-AE09-8B7FD69A5867}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/15_Boxing/vbnet/Boxing.vbproj b/15_Boxing/vbnet/Boxing.vbproj new file mode 100644 index 00000000..f6774e72 --- /dev/null +++ b/15_Boxing/vbnet/Boxing.vbproj @@ -0,0 +1,8 @@ + + + Exe + Boxing + net6.0 + 16.9 + + diff --git a/16_Bug/csharp/Bug.csproj b/16_Bug/csharp/Bug.csproj new file mode 100644 index 00000000..d3fe4757 --- /dev/null +++ b/16_Bug/csharp/Bug.csproj @@ -0,0 +1,9 @@ + + + Exe + net6.0 + 10 + enable + enable + + diff --git a/16_Bug/csharp/Bug.sln b/16_Bug/csharp/Bug.sln new file mode 100644 index 00000000..9024df5b --- /dev/null +++ b/16_Bug/csharp/Bug.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bug", "Bug.csproj", "{C1929CC1-C366-43E4-9476-AE107231A302}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {C1929CC1-C366-43E4-9476-AE107231A302}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C1929CC1-C366-43E4-9476-AE107231A302}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C1929CC1-C366-43E4-9476-AE107231A302}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C1929CC1-C366-43E4-9476-AE107231A302}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/16_Bug/vbnet/Bug.sln b/16_Bug/vbnet/Bug.sln new file mode 100644 index 00000000..f0ef35a4 --- /dev/null +++ b/16_Bug/vbnet/Bug.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Bug", "Bug.vbproj", "{4F4EA8E5-55A8-4191-BE57-B28638C33609}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {4F4EA8E5-55A8-4191-BE57-B28638C33609}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4F4EA8E5-55A8-4191-BE57-B28638C33609}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4F4EA8E5-55A8-4191-BE57-B28638C33609}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4F4EA8E5-55A8-4191-BE57-B28638C33609}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/01_Acey_Ducey/vbnet/AceyDucy/AceyDucy.vbproj b/16_Bug/vbnet/Bug.vbproj similarity index 68% rename from 01_Acey_Ducey/vbnet/AceyDucy/AceyDucy.vbproj rename to 16_Bug/vbnet/Bug.vbproj index 98a07001..dd4f74e4 100644 --- a/01_Acey_Ducey/vbnet/AceyDucy/AceyDucy.vbproj +++ b/16_Bug/vbnet/Bug.vbproj @@ -1,9 +1,8 @@ - Exe - AceyDucy + Bug net6.0 + 16.9 - diff --git a/17_Bullfight/csharp/src/Action.cs b/17_Bullfight/csharp/Action.cs similarity index 100% rename from 17_Bullfight/csharp/src/Action.cs rename to 17_Bullfight/csharp/Action.cs diff --git a/17_Bullfight/csharp/src/ActionResult.cs b/17_Bullfight/csharp/ActionResult.cs similarity index 100% rename from 17_Bullfight/csharp/src/ActionResult.cs rename to 17_Bullfight/csharp/ActionResult.cs diff --git a/17_Bullfight/csharp/src/BullFight.cs b/17_Bullfight/csharp/BullFight.cs similarity index 100% rename from 17_Bullfight/csharp/src/BullFight.cs rename to 17_Bullfight/csharp/BullFight.cs diff --git a/17_Bullfight/csharp/Game.csproj b/17_Bullfight/csharp/Bullfight.csproj similarity index 100% rename from 17_Bullfight/csharp/Game.csproj rename to 17_Bullfight/csharp/Bullfight.csproj diff --git a/17_Bullfight/csharp/Bullfight.sln b/17_Bullfight/csharp/Bullfight.sln index 29f5276f..8c819db1 100644 --- a/17_Bullfight/csharp/Bullfight.sln +++ b/17_Bullfight/csharp/Bullfight.sln @@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 16 VisualStudioVersion = 16.0.31321.278 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Game", "Game.csproj", "{8F7C450E-5F3A-45BA-9DB9-329744214931}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Bullfight", "Bullfight.csproj", "{502A672C-F7D7-4A85-973A-B5EA8761008A}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -11,10 +11,10 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {8F7C450E-5F3A-45BA-9DB9-329744214931}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {8F7C450E-5F3A-45BA-9DB9-329744214931}.Debug|Any CPU.Build.0 = Debug|Any CPU - {8F7C450E-5F3A-45BA-9DB9-329744214931}.Release|Any CPU.ActiveCfg = Release|Any CPU - {8F7C450E-5F3A-45BA-9DB9-329744214931}.Release|Any CPU.Build.0 = Release|Any CPU + {502A672C-F7D7-4A85-973A-B5EA8761008A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {502A672C-F7D7-4A85-973A-B5EA8761008A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {502A672C-F7D7-4A85-973A-B5EA8761008A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {502A672C-F7D7-4A85-973A-B5EA8761008A}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/17_Bullfight/csharp/src/Controller.cs b/17_Bullfight/csharp/Controller.cs similarity index 100% rename from 17_Bullfight/csharp/src/Controller.cs rename to 17_Bullfight/csharp/Controller.cs diff --git a/17_Bullfight/csharp/src/Events/BullCharging.cs b/17_Bullfight/csharp/Events/BullCharging.cs similarity index 100% rename from 17_Bullfight/csharp/src/Events/BullCharging.cs rename to 17_Bullfight/csharp/Events/BullCharging.cs diff --git a/17_Bullfight/csharp/src/Events/Event.cs b/17_Bullfight/csharp/Events/Event.cs similarity index 100% rename from 17_Bullfight/csharp/src/Events/Event.cs rename to 17_Bullfight/csharp/Events/Event.cs diff --git a/17_Bullfight/csharp/src/Events/MatchCompleted.cs b/17_Bullfight/csharp/Events/MatchCompleted.cs similarity index 100% rename from 17_Bullfight/csharp/src/Events/MatchCompleted.cs rename to 17_Bullfight/csharp/Events/MatchCompleted.cs diff --git a/17_Bullfight/csharp/src/Events/MatchStarted.cs b/17_Bullfight/csharp/Events/MatchStarted.cs similarity index 100% rename from 17_Bullfight/csharp/src/Events/MatchStarted.cs rename to 17_Bullfight/csharp/Events/MatchStarted.cs diff --git a/17_Bullfight/csharp/src/Events/PlayerGored.cs b/17_Bullfight/csharp/Events/PlayerGored.cs similarity index 100% rename from 17_Bullfight/csharp/src/Events/PlayerGored.cs rename to 17_Bullfight/csharp/Events/PlayerGored.cs diff --git a/17_Bullfight/csharp/src/Events/PlayerSurvived.cs b/17_Bullfight/csharp/Events/PlayerSurvived.cs similarity index 100% rename from 17_Bullfight/csharp/src/Events/PlayerSurvived.cs rename to 17_Bullfight/csharp/Events/PlayerSurvived.cs diff --git a/17_Bullfight/csharp/src/Mediator.cs b/17_Bullfight/csharp/Mediator.cs similarity index 100% rename from 17_Bullfight/csharp/src/Mediator.cs rename to 17_Bullfight/csharp/Mediator.cs diff --git a/17_Bullfight/csharp/src/Program.cs b/17_Bullfight/csharp/Program.cs similarity index 100% rename from 17_Bullfight/csharp/src/Program.cs rename to 17_Bullfight/csharp/Program.cs diff --git a/17_Bullfight/csharp/src/Quality.cs b/17_Bullfight/csharp/Quality.cs similarity index 100% rename from 17_Bullfight/csharp/src/Quality.cs rename to 17_Bullfight/csharp/Quality.cs diff --git a/17_Bullfight/csharp/src/Reward.cs b/17_Bullfight/csharp/Reward.cs similarity index 100% rename from 17_Bullfight/csharp/src/Reward.cs rename to 17_Bullfight/csharp/Reward.cs diff --git a/17_Bullfight/csharp/src/RiskLevel.cs b/17_Bullfight/csharp/RiskLevel.cs similarity index 100% rename from 17_Bullfight/csharp/src/RiskLevel.cs rename to 17_Bullfight/csharp/RiskLevel.cs diff --git a/17_Bullfight/csharp/src/View.cs b/17_Bullfight/csharp/View.cs similarity index 100% rename from 17_Bullfight/csharp/src/View.cs rename to 17_Bullfight/csharp/View.cs diff --git a/17_Bullfight/vbnet/Bullfight.sln b/17_Bullfight/vbnet/Bullfight.sln new file mode 100644 index 00000000..9fec219d --- /dev/null +++ b/17_Bullfight/vbnet/Bullfight.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Bullfight", "Bullfight.vbproj", "{38805A6B-C251-4C45-9832-B8E2F3F6436F}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {38805A6B-C251-4C45-9832-B8E2F3F6436F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {38805A6B-C251-4C45-9832-B8E2F3F6436F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {38805A6B-C251-4C45-9832-B8E2F3F6436F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {38805A6B-C251-4C45-9832-B8E2F3F6436F}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/17_Bullfight/vbnet/Bullfight.vbproj b/17_Bullfight/vbnet/Bullfight.vbproj new file mode 100644 index 00000000..016406fa --- /dev/null +++ b/17_Bullfight/vbnet/Bullfight.vbproj @@ -0,0 +1,8 @@ + + + Exe + Bullfight + net6.0 + 16.9 + + diff --git a/18_Bullseye/vbnet/Bullseye.sln b/18_Bullseye/vbnet/Bullseye.sln new file mode 100644 index 00000000..03e2390c --- /dev/null +++ b/18_Bullseye/vbnet/Bullseye.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Bullseye", "Bullseye.vbproj", "{0CFD308F-EB9C-4A05-B742-5EE7C912A5E4}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {0CFD308F-EB9C-4A05-B742-5EE7C912A5E4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0CFD308F-EB9C-4A05-B742-5EE7C912A5E4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0CFD308F-EB9C-4A05-B742-5EE7C912A5E4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0CFD308F-EB9C-4A05-B742-5EE7C912A5E4}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/18_Bullseye/vbnet/Bullseye.vbproj b/18_Bullseye/vbnet/Bullseye.vbproj new file mode 100644 index 00000000..3f13676f --- /dev/null +++ b/18_Bullseye/vbnet/Bullseye.vbproj @@ -0,0 +1,8 @@ + + + Exe + Bullseye + net6.0 + 16.9 + + diff --git a/19_Bunny/csharp/Bunny.csproj b/19_Bunny/csharp/Bunny.csproj new file mode 100644 index 00000000..d3fe4757 --- /dev/null +++ b/19_Bunny/csharp/Bunny.csproj @@ -0,0 +1,9 @@ + + + Exe + net6.0 + 10 + enable + enable + + diff --git a/19_Bunny/csharp/Bunny.sln b/19_Bunny/csharp/Bunny.sln new file mode 100644 index 00000000..c7f9f008 --- /dev/null +++ b/19_Bunny/csharp/Bunny.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bunny", "Bunny.csproj", "{6685F5CF-20F2-4682-B187-50105BD44906}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {6685F5CF-20F2-4682-B187-50105BD44906}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6685F5CF-20F2-4682-B187-50105BD44906}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6685F5CF-20F2-4682-B187-50105BD44906}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6685F5CF-20F2-4682-B187-50105BD44906}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/19_Bunny/vbnet/Bunny.sln b/19_Bunny/vbnet/Bunny.sln new file mode 100644 index 00000000..b5d177ca --- /dev/null +++ b/19_Bunny/vbnet/Bunny.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Bunny", "Bunny.vbproj", "{E9098ADF-4B31-4082-9102-2A5BB8B40C6C}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {E9098ADF-4B31-4082-9102-2A5BB8B40C6C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E9098ADF-4B31-4082-9102-2A5BB8B40C6C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E9098ADF-4B31-4082-9102-2A5BB8B40C6C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E9098ADF-4B31-4082-9102-2A5BB8B40C6C}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/19_Bunny/vbnet/Bunny.vbproj b/19_Bunny/vbnet/Bunny.vbproj new file mode 100644 index 00000000..49bd3df2 --- /dev/null +++ b/19_Bunny/vbnet/Bunny.vbproj @@ -0,0 +1,8 @@ + + + Exe + Bunny + net6.0 + 16.9 + + diff --git a/20_Buzzword/vbnet/Buzzword.sln b/20_Buzzword/vbnet/Buzzword.sln new file mode 100644 index 00000000..2f8a8ef3 --- /dev/null +++ b/20_Buzzword/vbnet/Buzzword.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Buzzword", "Buzzword.vbproj", "{B2BD53F2-82C3-4729-BA82-DB96E18F8666}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {B2BD53F2-82C3-4729-BA82-DB96E18F8666}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B2BD53F2-82C3-4729-BA82-DB96E18F8666}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B2BD53F2-82C3-4729-BA82-DB96E18F8666}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B2BD53F2-82C3-4729-BA82-DB96E18F8666}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/20_Buzzword/vbnet/Buzzword.vbproj b/20_Buzzword/vbnet/Buzzword.vbproj new file mode 100644 index 00000000..945c5a63 --- /dev/null +++ b/20_Buzzword/vbnet/Buzzword.vbproj @@ -0,0 +1,8 @@ + + + Exe + Buzzword + net6.0 + 16.9 + + diff --git a/24_Chemist/csharp/Chemist/Chemist/Chemist.csproj b/21_Calendar/csharp/Calendar.csproj similarity index 100% rename from 24_Chemist/csharp/Chemist/Chemist/Chemist.csproj rename to 21_Calendar/csharp/Calendar.csproj diff --git a/21_Calendar/csharp/21_calendar.sln b/21_Calendar/csharp/Calendar.sln similarity index 64% rename from 21_Calendar/csharp/21_calendar.sln rename to 21_Calendar/csharp/Calendar.sln index d8330a26..8b2be04b 100644 --- a/21_Calendar/csharp/21_calendar.sln +++ b/21_Calendar/csharp/Calendar.sln @@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 16 VisualStudioVersion = 16.0.31613.86 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "21_calendar", "21_calendar.csproj", "{99AB85E1-A42B-4FEF-8BA6-0ED877F05249}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Calendar", "Calendar.csproj", "{1EADFB6C-4496-42C2-A80F-84FEC3F061D1}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -11,10 +11,10 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {99AB85E1-A42B-4FEF-8BA6-0ED877F05249}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {99AB85E1-A42B-4FEF-8BA6-0ED877F05249}.Debug|Any CPU.Build.0 = Debug|Any CPU - {99AB85E1-A42B-4FEF-8BA6-0ED877F05249}.Release|Any CPU.ActiveCfg = Release|Any CPU - {99AB85E1-A42B-4FEF-8BA6-0ED877F05249}.Release|Any CPU.Build.0 = Release|Any CPU + {1EADFB6C-4496-42C2-A80F-84FEC3F061D1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1EADFB6C-4496-42C2-A80F-84FEC3F061D1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1EADFB6C-4496-42C2-A80F-84FEC3F061D1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1EADFB6C-4496-42C2-A80F-84FEC3F061D1}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/21_Calendar/vbnet/Calendar.sln b/21_Calendar/vbnet/Calendar.sln new file mode 100644 index 00000000..c8e5c017 --- /dev/null +++ b/21_Calendar/vbnet/Calendar.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Calendar", "Calendar.vbproj", "{00B21257-3E25-4150-AA6D-266350688663}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {00B21257-3E25-4150-AA6D-266350688663}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {00B21257-3E25-4150-AA6D-266350688663}.Debug|Any CPU.Build.0 = Debug|Any CPU + {00B21257-3E25-4150-AA6D-266350688663}.Release|Any CPU.ActiveCfg = Release|Any CPU + {00B21257-3E25-4150-AA6D-266350688663}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/21_Calendar/vbnet/Calendar.vbproj b/21_Calendar/vbnet/Calendar.vbproj new file mode 100644 index 00000000..ed6bd15a --- /dev/null +++ b/21_Calendar/vbnet/Calendar.vbproj @@ -0,0 +1,8 @@ + + + Exe + Calendar + net6.0 + 16.9 + + diff --git a/22_Change/vbnet/Change.sln b/22_Change/vbnet/Change.sln new file mode 100644 index 00000000..4af8571a --- /dev/null +++ b/22_Change/vbnet/Change.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Change", "Change.vbproj", "{77FC724B-EA88-4419-824B-32366FFE9608}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {77FC724B-EA88-4419-824B-32366FFE9608}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {77FC724B-EA88-4419-824B-32366FFE9608}.Debug|Any CPU.Build.0 = Debug|Any CPU + {77FC724B-EA88-4419-824B-32366FFE9608}.Release|Any CPU.ActiveCfg = Release|Any CPU + {77FC724B-EA88-4419-824B-32366FFE9608}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/22_Change/vbnet/Change.vbproj b/22_Change/vbnet/Change.vbproj new file mode 100644 index 00000000..b6a5e3c1 --- /dev/null +++ b/22_Change/vbnet/Change.vbproj @@ -0,0 +1,8 @@ + + + Exe + Change + net6.0 + 16.9 + + diff --git a/23_Checkers/csharp/Checkers.csproj b/23_Checkers/csharp/Checkers.csproj new file mode 100644 index 00000000..d3fe4757 --- /dev/null +++ b/23_Checkers/csharp/Checkers.csproj @@ -0,0 +1,9 @@ + + + Exe + net6.0 + 10 + enable + enable + + diff --git a/23_Checkers/csharp/Checkers.sln b/23_Checkers/csharp/Checkers.sln new file mode 100644 index 00000000..f7cce0b6 --- /dev/null +++ b/23_Checkers/csharp/Checkers.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Checkers", "Checkers.csproj", "{52D0DDFC-1A0D-4E57-A4FC-428EC717313C}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {52D0DDFC-1A0D-4E57-A4FC-428EC717313C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {52D0DDFC-1A0D-4E57-A4FC-428EC717313C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {52D0DDFC-1A0D-4E57-A4FC-428EC717313C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {52D0DDFC-1A0D-4E57-A4FC-428EC717313C}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/23_Checkers/vbnet/Checkers.sln b/23_Checkers/vbnet/Checkers.sln new file mode 100644 index 00000000..f5409425 --- /dev/null +++ b/23_Checkers/vbnet/Checkers.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Checkers", "Checkers.vbproj", "{92B871EF-4871-40C0-ADDE-406301B937B9}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {92B871EF-4871-40C0-ADDE-406301B937B9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {92B871EF-4871-40C0-ADDE-406301B937B9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {92B871EF-4871-40C0-ADDE-406301B937B9}.Release|Any CPU.ActiveCfg = Release|Any CPU + {92B871EF-4871-40C0-ADDE-406301B937B9}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/23_Checkers/vbnet/Checkers.vbproj b/23_Checkers/vbnet/Checkers.vbproj new file mode 100644 index 00000000..fb77091f --- /dev/null +++ b/23_Checkers/vbnet/Checkers.vbproj @@ -0,0 +1,8 @@ + + + Exe + Checkers + net6.0 + 16.9 + + diff --git a/43_Hammurabi/csharp/Game.csproj b/24_Chemist/csharp/Chemist.csproj similarity index 100% rename from 43_Hammurabi/csharp/Game.csproj rename to 24_Chemist/csharp/Chemist.csproj diff --git a/24_Chemist/csharp/Chemist/Chemist.sln b/24_Chemist/csharp/Chemist.sln similarity index 64% rename from 24_Chemist/csharp/Chemist/Chemist.sln rename to 24_Chemist/csharp/Chemist.sln index 6dc7bfa2..bac78435 100644 --- a/24_Chemist/csharp/Chemist/Chemist.sln +++ b/24_Chemist/csharp/Chemist.sln @@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 16 VisualStudioVersion = 16.0.31005.135 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Chemist", "Chemist\Chemist.csproj", "{8CC70F80-F2D6-47B6-8976-079352AC6C85}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Chemist", "Chemist.csproj", "{C16545E8-E078-4C69-B7CA-9D821C944252}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -11,10 +11,10 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {8CC70F80-F2D6-47B6-8976-079352AC6C85}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {8CC70F80-F2D6-47B6-8976-079352AC6C85}.Debug|Any CPU.Build.0 = Debug|Any CPU - {8CC70F80-F2D6-47B6-8976-079352AC6C85}.Release|Any CPU.ActiveCfg = Release|Any CPU - {8CC70F80-F2D6-47B6-8976-079352AC6C85}.Release|Any CPU.Build.0 = Release|Any CPU + {C16545E8-E078-4C69-B7CA-9D821C944252}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C16545E8-E078-4C69-B7CA-9D821C944252}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C16545E8-E078-4C69-B7CA-9D821C944252}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C16545E8-E078-4C69-B7CA-9D821C944252}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/24_Chemist/csharp/Chemist/Chemist/Program.cs b/24_Chemist/csharp/Program.cs similarity index 100% rename from 24_Chemist/csharp/Chemist/Chemist/Program.cs rename to 24_Chemist/csharp/Program.cs diff --git a/24_Chemist/vbnet/Chemist.sln b/24_Chemist/vbnet/Chemist.sln new file mode 100644 index 00000000..1200eeff --- /dev/null +++ b/24_Chemist/vbnet/Chemist.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Chemist", "Chemist.vbproj", "{25BEFBB8-58A1-4691-9CE6-D8C770F5189D}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {25BEFBB8-58A1-4691-9CE6-D8C770F5189D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {25BEFBB8-58A1-4691-9CE6-D8C770F5189D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {25BEFBB8-58A1-4691-9CE6-D8C770F5189D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {25BEFBB8-58A1-4691-9CE6-D8C770F5189D}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/24_Chemist/vbnet/Chemist.vbproj b/24_Chemist/vbnet/Chemist.vbproj new file mode 100644 index 00000000..7990a9b7 --- /dev/null +++ b/24_Chemist/vbnet/Chemist.vbproj @@ -0,0 +1,8 @@ + + + Exe + Chemist + net6.0 + 16.9 + + diff --git a/25_Chief/csharp/Chief.csproj b/25_Chief/csharp/Chief.csproj new file mode 100644 index 00000000..d3fe4757 --- /dev/null +++ b/25_Chief/csharp/Chief.csproj @@ -0,0 +1,9 @@ + + + Exe + net6.0 + 10 + enable + enable + + diff --git a/25_Chief/csharp/Chief.sln b/25_Chief/csharp/Chief.sln new file mode 100644 index 00000000..036992c3 --- /dev/null +++ b/25_Chief/csharp/Chief.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Chief", "Chief.csproj", "{AE650092-EEF2-4747-91F4-C8311AD16A4B}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {AE650092-EEF2-4747-91F4-C8311AD16A4B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {AE650092-EEF2-4747-91F4-C8311AD16A4B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {AE650092-EEF2-4747-91F4-C8311AD16A4B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {AE650092-EEF2-4747-91F4-C8311AD16A4B}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/25_Chief/vbnet/Chief.sln b/25_Chief/vbnet/Chief.sln new file mode 100644 index 00000000..579b0124 --- /dev/null +++ b/25_Chief/vbnet/Chief.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Chief", "Chief.vbproj", "{9BAA28D9-1DCF-42DA-934A-CD3EC5E26E7C}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {9BAA28D9-1DCF-42DA-934A-CD3EC5E26E7C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9BAA28D9-1DCF-42DA-934A-CD3EC5E26E7C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9BAA28D9-1DCF-42DA-934A-CD3EC5E26E7C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9BAA28D9-1DCF-42DA-934A-CD3EC5E26E7C}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/25_Chief/vbnet/Chief.vbproj b/25_Chief/vbnet/Chief.vbproj new file mode 100644 index 00000000..09c22917 --- /dev/null +++ b/25_Chief/vbnet/Chief.vbproj @@ -0,0 +1,8 @@ + + + Exe + Chief + net6.0 + 16.9 + + diff --git a/26_Chomp/csharp/Chomp.csproj b/26_Chomp/csharp/Chomp.csproj new file mode 100644 index 00000000..d3fe4757 --- /dev/null +++ b/26_Chomp/csharp/Chomp.csproj @@ -0,0 +1,9 @@ + + + Exe + net6.0 + 10 + enable + enable + + diff --git a/26_Chomp/csharp/Chomp.sln b/26_Chomp/csharp/Chomp.sln new file mode 100644 index 00000000..1567eb9d --- /dev/null +++ b/26_Chomp/csharp/Chomp.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Chomp", "Chomp.csproj", "{35863FB3-002D-4618-B993-51A51A586BCC}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {35863FB3-002D-4618-B993-51A51A586BCC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {35863FB3-002D-4618-B993-51A51A586BCC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {35863FB3-002D-4618-B993-51A51A586BCC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {35863FB3-002D-4618-B993-51A51A586BCC}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/26_Chomp/vbnet/Chomp.sln b/26_Chomp/vbnet/Chomp.sln new file mode 100644 index 00000000..3b772010 --- /dev/null +++ b/26_Chomp/vbnet/Chomp.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Chomp", "Chomp.vbproj", "{F7F8E933-9679-4393-94F0-46F47D81B025}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {F7F8E933-9679-4393-94F0-46F47D81B025}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F7F8E933-9679-4393-94F0-46F47D81B025}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F7F8E933-9679-4393-94F0-46F47D81B025}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F7F8E933-9679-4393-94F0-46F47D81B025}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/26_Chomp/vbnet/Chomp.vbproj b/26_Chomp/vbnet/Chomp.vbproj new file mode 100644 index 00000000..a3308b2a --- /dev/null +++ b/26_Chomp/vbnet/Chomp.vbproj @@ -0,0 +1,8 @@ + + + Exe + Chomp + net6.0 + 16.9 + + diff --git a/27_Civil_War/civilwar.bas b/27_Civil_War/civilwar.bas index 63597944..f8fe9701 100644 --- a/27_Civil_War/civilwar.bas +++ b/27_Civil_War/civilwar.bas @@ -216,7 +216,7 @@ 2280 PRINT "CASUALTIES",C5,C6 2290 PRINT "DESERTIONS",INT(E),INT(E2) 2300 PRINT -2310 IF B$ <> "YES" THEN 2350 +2310 IF B$ <> "YES" THEN 2530 2320 PRINT "COMPARED TO THE ACTUAL CASUALTIES AT "C$ 2330 PRINT "CONFEDERATE:"INT(100*(C5/C1)+.5)"% OF THE ORIGINAL" 2340 PRINT "UNION: "INT(100*(C6/C2)+.5)"% OF THE ORIGINAL" diff --git a/27_Civil_War/csharp/CivilWar/CivilWar/Army.cs b/27_Civil_War/csharp/Army.cs similarity index 100% rename from 27_Civil_War/csharp/CivilWar/CivilWar/Army.cs rename to 27_Civil_War/csharp/Army.cs diff --git a/27_Civil_War/csharp/CivilWar/CivilWar/Battle.cs b/27_Civil_War/csharp/Battle.cs similarity index 100% rename from 27_Civil_War/csharp/CivilWar/CivilWar/Battle.cs rename to 27_Civil_War/csharp/Battle.cs diff --git a/27_Civil_War/csharp/CivilWar/CivilWar/CivilWar.csproj b/27_Civil_War/csharp/CivilWar.csproj similarity index 100% rename from 27_Civil_War/csharp/CivilWar/CivilWar/CivilWar.csproj rename to 27_Civil_War/csharp/CivilWar.csproj diff --git a/27_Civil_War/csharp/CivilWar/CivilWar.sln b/27_Civil_War/csharp/CivilWar.sln similarity index 64% rename from 27_Civil_War/csharp/CivilWar/CivilWar.sln rename to 27_Civil_War/csharp/CivilWar.sln index 17da385e..d013f7ed 100644 --- a/27_Civil_War/csharp/CivilWar/CivilWar.sln +++ b/27_Civil_War/csharp/CivilWar.sln @@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 16 VisualStudioVersion = 16.0.31005.135 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CivilWar", "CivilWar\CivilWar.csproj", "{09C22BBE-8480-4B8C-9A07-E2DAA24B692B}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CivilWar", "CivilWar.csproj", "{4EE5EFE7-2D60-464A-9F8D-4BBD2A14AAC7}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -11,10 +11,10 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {09C22BBE-8480-4B8C-9A07-E2DAA24B692B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {09C22BBE-8480-4B8C-9A07-E2DAA24B692B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {09C22BBE-8480-4B8C-9A07-E2DAA24B692B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {09C22BBE-8480-4B8C-9A07-E2DAA24B692B}.Release|Any CPU.Build.0 = Release|Any CPU + {4EE5EFE7-2D60-464A-9F8D-4BBD2A14AAC7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4EE5EFE7-2D60-464A-9F8D-4BBD2A14AAC7}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4EE5EFE7-2D60-464A-9F8D-4BBD2A14AAC7}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4EE5EFE7-2D60-464A-9F8D-4BBD2A14AAC7}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/27_Civil_War/csharp/CivilWar/CivilWar/ConsoleUtils.cs b/27_Civil_War/csharp/ConsoleUtils.cs similarity index 100% rename from 27_Civil_War/csharp/CivilWar/CivilWar/ConsoleUtils.cs rename to 27_Civil_War/csharp/ConsoleUtils.cs diff --git a/27_Civil_War/csharp/CivilWar/CivilWar/GameOptions.cs b/27_Civil_War/csharp/GameOptions.cs similarity index 100% rename from 27_Civil_War/csharp/CivilWar/CivilWar/GameOptions.cs rename to 27_Civil_War/csharp/GameOptions.cs diff --git a/27_Civil_War/csharp/CivilWar/CivilWar/Program.cs b/27_Civil_War/csharp/Program.cs similarity index 100% rename from 27_Civil_War/csharp/CivilWar/CivilWar/Program.cs rename to 27_Civil_War/csharp/Program.cs diff --git a/27_Civil_War/java/.gitignore b/27_Civil_War/java/.gitignore new file mode 100644 index 00000000..a87dc8b2 --- /dev/null +++ b/27_Civil_War/java/.gitignore @@ -0,0 +1,3 @@ +*.class +*.iml +.idea/ \ No newline at end of file diff --git a/27_Civil_War/java/src/CivilWar.java b/27_Civil_War/java/src/CivilWar.java new file mode 100644 index 00000000..042126f6 --- /dev/null +++ b/27_Civil_War/java/src/CivilWar.java @@ -0,0 +1,707 @@ +import java.io.PrintStream; +import java.util.InputMismatchException; +import java.util.List; +import java.util.Scanner; +import java.util.function.Function; +import java.util.function.Predicate; + +import static java.util.stream.Collectors.joining; +import static java.util.stream.IntStream.range; + +@SuppressWarnings("SpellCheckingInspection") +public class CivilWar { + + private final PrintStream out; + private final List data; + + private final BattleResults results; + + private BattleState currentBattle; + private int numGenerals; + private int battleNumber; + private boolean wantBattleDescriptions; + private final int[] strategies; + + private int confedStrategy; + private int unionStrategy; + + private final ArmyPair resources; + private final ArmyPair totalExpectedCasualties; + private final ArmyPair totalCasualties; + private final ArmyPair revenue; + private final ArmyPair inflation; + private final ArmyPair totalExpenditure; + private final ArmyPair totalTroops; + + private boolean excessiveConfederateLosses; + private boolean excessiveUnionLosses; + + private boolean confedSurrender; + private boolean unionSurrender; + + private final static String YES_NO_REMINDER = "(ANSWER YES OR NO)"; + private final static Predicate YES_NO_CHECKER = i -> isYes(i) || isNo(i); + + /** + * ORIGINAL GAME DESIGN: CRAM, GOODIE, HIBBARD LEXINGTON H.S. + * MODIFICATIONS: G. PAUL, R. HESS (TIES), 1973 + */ + public static void main(String[] args) { + var x = new CivilWar(System.out); + x.showCredits(); + + // LET D=RND(-1) ??? + + System.out.print("DO YOU WANT INSTRUCTIONS? "); + + if (isYes(inputString(YES_NO_CHECKER, YES_NO_REMINDER))) { + x.showHelp(); + } + + x.gameLoop(); + } + + private void gameLoop() { + out.println(); + out.println(); + out.println(); + out.print("ARE THERE TWO GENERALS PRESENT (ANSWER YES OR NO)? "); + + if (isYes(inputString(YES_NO_CHECKER, YES_NO_REMINDER))) { + this.numGenerals = 2; + } else { + this.numGenerals = 1; + out.println(); + out.println("YOU ARE THE CONFEDERACY. GOOD LUCK!"); + out.println(); + } + + out.println("SELECT A BATTLE BY TYPING A NUMBER FROM 1 TO 14 ON"); + out.println("REQUEST. TYPE ANY OTHER NUMBER TO END THE SIMULATION."); + out.println("BUT '0' BRINGS BACK EXACT PREVIOUS BATTLE SITUATION"); + out.println("ALLOWING YOU TO REPLAY IT"); + out.println(); + out.println("NOTE: A NEGATIVE FOOD$ ENTRY CAUSES THE PROGRAM TO "); + out.println("USE THE ENTRIES FROM THE PREVIOUS BATTLE"); + out.println(); + + out.print("AFTER REQUESTING A BATTLE, DO YOU WISH BATTLE DESCRIPTIONS (ANSWER YES OR NO)? "); + + this.wantBattleDescriptions = isYes(inputString(YES_NO_CHECKER, YES_NO_REMINDER)); + + while (true) { + var battle = startBattle(); + if (battle == null) { + break; + } + + this.currentBattle = battle; + + offensiveLogic(battle.data); + + calcLosses(battle); + + reset(); + + if (this.confedSurrender) { + out.println("THE CONFEDERACY HAS SURRENDERED"); + } else if (unionSurrender) { // FIXME Is this actually possible? 2850 + out.println("THE UNION HAS SURRENDERED."); + } + } + + complete(); + } + + private BattleState startBattle() { + out.println(); + out.println(); + out.println(); + out.print("WHICH BATTLE DO YOU WISH TO SIMULATE ? "); + + var battleNumber = inputInt(i -> i >= 1 || (i == 0 && this.currentBattle != null), i -> "BATTLE " + i + " NOT ALLOWED."); + + if (battleNumber == 0) { + out.println(this.currentBattle.data.name + " INSTANT REPLAY"); + return this.currentBattle; + } + + if (battleNumber > this.data.size()) { // TYPE ANY OTHER NUMBER TO END THE SIMULATION + return null; + } + + this.battleNumber = battleNumber; + + var battle = this.data.get(this.battleNumber - 1); + var battleState = new BattleState(battle); + + + excessiveConfederateLosses = false; + + // INFLATION CALC + // REM - ONLY IN PRINTOUT IS CONFED INFLATION = I1+15% + inflation.confederate = 10 + (results.union - results.confederate) * 2; + inflation.union = 10 + (results.confederate - results.union) * 2; + + // MONEY AVAILABLE + resources.confederate.budget = 100 * (int) Math.floor((battle.troops.confederate * (100.0 - inflation.confederate) / 2000) * (1 + (revenue.confederate - totalExpenditure.confederate) / (revenue.confederate + 1.0)) + .5); + + // MEN AVAILABLE + battleState.F1 = 5 * battle.troops.confederate / 6.0; + + if (this.numGenerals == 2) { + resources.union.budget = 100 * (int) Math.floor((battle.troops.union * (100.0 - inflation.union) / 2000) * (1 + (revenue.union - totalExpenditure.union) / (revenue.union + 1.0)) + .5); + } else { + resources.union.budget = 100 * (int) Math.floor(battle.troops.union * (100.0 - inflation.union) / 2000 + .5); + } + + out.println(); + out.println(); + out.println(); + out.println(); + out.println(); + out.println("THIS IS THE BATTLE OF " + battle.name); + + if (this.wantBattleDescriptions) { + for (var eachLine : battle.blurb) { + out.println(eachLine); + } + } + + out.println(); + out.println(" CONFEDERACY UNION"); + out.println("MEN " + getConfedTroops(battle) + " " + getUnionTroops(battle)); + out.println("MONEY $ " + resources.confederate.budget + " $ " + resources.union.budget); + out.println("INFLATION " + (inflation.confederate + 15) + "% " + inflation.union + "%"); + + // ONLY IN PRINTOUT IS CONFED INFLATION = I1+15% + // IF TWO GENERALS, INPUT CONFED. FIRST + + var terminalInput = new Scanner(System.in); + + for (int i = 0; i < numGenerals; i++) { + out.println(); + + ArmyResources currentResources; + + if (this.numGenerals == 1 || i == 0) { + out.print("CONFEDERATE GENERAL --- "); + currentResources = resources.confederate; + } else { + out.print("UNION GENERAL --- "); + currentResources = resources.union; + } + + var validInputs = false; + while (!validInputs) { + out.println("HOW MUCH DO YOU WISH TO SPEND FOR"); + out.print("- FOOD...... ? "); + var food = terminalInput.nextInt(); + if (food == 0) { + if (this.revenue.confederate != 0) { + out.println("ASSUME YOU WANT TO KEEP SAME ALLOCATIONS"); + out.println(); + } + } else { + currentResources.food = food; + } + + out.print("- SALARIES.. ? "); + currentResources.salaries = terminalInput.nextInt(); + + out.print("- AMMUNITION ? "); + currentResources.ammunition = terminalInput.nextInt(); // FIXME Retry if -ve + + if (currentResources.getTotal() > currentResources.budget) { + out.println("THINK AGAIN! YOU HAVE ONLY $" + currentResources.budget); + } else { + validInputs = true; + } + } + } + + out.println(); + + // Record Morale + out.println(range(0, numGenerals).mapToObj(i -> moraleForArmy(battleState, i)).collect(joining(", "))); + + out.println(); + + return battleState; + } + + private int getUnionTroops(HistoricalDatum battle) { + return (int) Math.floor(battle.troops.union * (1 + (totalExpectedCasualties.union - totalCasualties.union) / (totalTroops.union + 1.0))); + } + + private int getConfedTroops(HistoricalDatum battle) { + return (int) Math.floor(battle.troops.confederate * (1 + (totalExpectedCasualties.confederate - totalCasualties.confederate) / (totalTroops.confederate + 1.0))); + } + + private String moraleForArmy(BattleState battleState, int armyIdx) { + var builder = new StringBuilder(); + + ArmyResources currentResources; + + if (this.numGenerals == 1 || armyIdx == 0) { + builder.append("CONFEDERATE "); + currentResources = resources.confederate; + } else { + builder.append("UNION "); + currentResources = resources.union; + } + + // FIND MORALE + currentResources.morale = (2 * Math.pow(currentResources.food, 2) + Math.pow(currentResources.salaries, 2)) / Math.pow(battleState.F1, 2) + 1; + if (currentResources.morale >= 10) { + builder.append("MORALE IS HIGH"); + } else if (currentResources.morale >= 5) { + builder.append("MORALE IS FAIR"); + } else { + builder.append("MORALE IS POOR"); + } + + return builder.toString(); + } + + private enum OffensiveStatus { + DEFENSIVE("YOU ARE ON THE DEFENSIVE"), OFFENSIVE("YOU ARE ON THE OFFENSIVE"), BOTH_OFFENSIVE("BOTH SIDES ARE ON THE OFFENSIVE"); + + private final String label; + + OffensiveStatus(String label) { + this.label = label; + } + } + + private void offensiveLogic(HistoricalDatum battle) { + out.print("CONFEDERATE GENERAL---"); + // ACTUAL OFF/DEF BATTLE SITUATION + out.println(battle.offensiveStatus.label); + + // CHOOSE STRATEGIES + + if (numGenerals == 2) { + out.print("CONFEDERATE STRATEGY ? "); + } else { + out.print("YOUR STRATEGY ? "); + } + + confedStrategy = inputInt(i -> i >= 1 && i <= 5, i -> "STRATEGY " + i + " NOT ALLOWED."); + if (confedStrategy == 5) { // 1970 + confedSurrender = true; + } + + if (numGenerals == 2) { + out.print("UNION STRATEGY ? "); + + unionStrategy = inputInt(i -> i >= 1 && i <= 5, i -> "STRATEGY " + i + " NOT ALLOWED."); + if (unionStrategy == 5) { // 1970 + unionSurrender = true; + } + } else { + unionStrategy(); + } + } + + // 2070 REM : SIMULATED LOSSES-NORTH + private UnionLosses simulateUnionLosses(HistoricalDatum battle) { + var losses = (2.0 * battle.expectedCasualties.union / 5) * (1 + 1.0 / (2 * (Math.abs(unionStrategy - confedStrategy) + 1))); + losses = losses * (1.28 + (5.0 * battle.troops.union / 6) / (resources.union.ammunition + 1)); + losses = Math.floor(losses * (1 + 1 / resources.union.morale) + 0.5); + // IF LOSS > MEN PRESENT, RESCALE LOSSES + var moraleFactor = 100 / resources.union.morale; + + if (Math.floor(losses + moraleFactor) >= getUnionTroops(battle)) { + losses = Math.floor(13.0 * getUnionTroops(battle) / 20); + moraleFactor = 7 * losses / 13; + excessiveUnionLosses = true; + } + + return new UnionLosses((int) losses, (int) Math.floor(moraleFactor)); + } + + // 2170: CALCULATE SIMULATED LOSSES + private void calcLosses(BattleState battle) { + // 2190 + out.println(); + out.println(" CONFEDERACY UNION"); + + var C5 = (2 * battle.data.expectedCasualties.confederate / 5) * (1 + 1.0 / (2 * (Math.abs(unionStrategy - confedStrategy) + 1))); + C5 = (int) Math.floor(C5 * (1 + 1.0 / resources.confederate.morale) * (1.28 + battle.F1 / (resources.confederate.ammunition + 1.0)) + .5); + var E = 100 / resources.confederate.morale; + + if (C5 + 100 / resources.confederate.morale >= battle.data.troops.confederate * (1 + (totalExpectedCasualties.confederate - totalCasualties.confederate) / (totalTroops.confederate + 1.0))) { + C5 = (int) Math.floor(13.0 * battle.data.troops.confederate / 20 * (1 + (totalExpectedCasualties.union - totalCasualties.confederate) / (totalTroops.confederate + 1.0))); + E = 7 * C5 / 13.0; + excessiveConfederateLosses = true; + } + + ///// 2270 + + final UnionLosses unionLosses; + + if (this.numGenerals == 1) { + unionLosses = new UnionLosses((int) Math.floor(17.0 * battle.data.expectedCasualties.union * battle.data.expectedCasualties.confederate / (C5 * 20)), (int) Math.floor(5 * resources.confederate.morale)); + } else { + unionLosses = simulateUnionLosses(battle.data); + } + + out.println("CASUALTIES: " + rightAlignInt(C5) + " " + rightAlignInt(unionLosses.losses)); + out.println("DESERTIONS: " + rightAlignInt(E) + " " + rightAlignInt(unionLosses.desertions)); + out.println(); + + if (numGenerals == 2) { + out.println("COMPARED TO THE ACTUAL CASUALTIES AT " + battle.data.name); + out.println("CONFEDERATE: " + (int) Math.floor(100 * (C5 / (double) battle.data.expectedCasualties.confederate) + 0.5) + " % OF THE ORIGINAL"); + out.println("UNION: " + (int) Math.floor(100 * (unionLosses.losses / (double) battle.data.expectedCasualties.union) + 0.5) + " % OF THE ORIGINAL"); + + out.println(); + + // REM - 1 WHO WON + var winner = findWinner(C5 + E, unionLosses.losses + unionLosses.desertions); + switch (winner) { + case UNION -> { + out.println("THE UNION WINS " + battle.data.name); + results.union++; + } + case CONFED -> { + out.println("THE CONFEDERACY WINS " + battle.data.name); + results.confederate++; + } + case INDECISIVE -> { + out.println("BATTLE OUTCOME UNRESOLVED"); + results.indeterminate++; + } + } + } else { + out.println("YOUR CASUALTIES WERE " + Math.floor(100 * (C5 / (double) battle.data.expectedCasualties.confederate) + 0.5) + "% OF THE ACTUAL CASUALTIES AT " + battle.data.name); + + // FIND WHO WON + + if (excessiveConfederateLosses) { + out.println("YOU LOSE " + battle.data.name); + + if (this.battleNumber != 0) { + results.union++; + } + } else { + out.println("YOU WIN " + battle.data.name); + // CUMULATIVE BATTLE FACTORS WHICH ALTER HISTORICAL RESOURCES AVAILABLE.IF A REPLAY DON'T UPDATE. + results.confederate++; + } + } + + if (this.battleNumber != 0) { + totalCasualties.confederate += (int) (C5 + E); + totalCasualties.union += unionLosses.losses + unionLosses.desertions; + totalExpectedCasualties.confederate += battle.data.expectedCasualties.confederate; + totalExpectedCasualties.union += battle.data.expectedCasualties.union; + totalExpenditure.confederate += resources.confederate.getTotal(); + totalExpenditure.union += resources.union.getTotal(); + revenue.confederate += battle.data.troops.confederate * (100 - inflation.confederate) / 20; + revenue.union += battle.data.troops.union * (100 - inflation.union) / 20; + totalTroops.confederate += battle.data.troops.confederate; + totalTroops.union += battle.data.troops.union; + + updateStrategies(this.confedStrategy); + } + } + + // 2790 + private void reset() { + excessiveConfederateLosses = excessiveUnionLosses = false; + + out.println("---------------"); + } + + // 2820 REM------FINISH OFF + private void complete() { + out.println(); + out.println(); + out.println(); + out.println(); + out.println(); + out.println(); + out.println("THE CONFEDERACY HAS WON " + results.confederate + " BATTLES AND LOST " + results.union); + + if (this.unionStrategy == 5) { + out.println("THE CONFEDERACY HAS WON THE WAR"); + } + + if (this.confedStrategy == 5 || results.confederate <= results.union) { + out.println("THE UNION HAS WON THE WAR"); + } + + out.println(); + + // FIXME 2960 IF R1=0 THEN 3100 + + out.println("FOR THE " + results.getTotal() + " BATTLES FOUGHT (EXCLUDING RERUNS)"); + out.println(" CONFEDERACY UNION"); + out.println("HISTORICAL LOSSES " + (int) Math.floor(totalExpectedCasualties.confederate + .5) + " " + (int) Math.floor(totalExpectedCasualties.union + .5)); + out.println("SIMULATED LOSSES " + (int) Math.floor(totalCasualties.confederate + .5) + " " + (int) Math.floor(totalCasualties.union + .5)); + out.println(); + out.println(" % OF ORIGINAL " + (int) Math.floor(100 * ((double) totalCasualties.confederate / totalExpectedCasualties.confederate) + .5) + " " + (int) Math.floor(100 * ((double) totalCasualties.union / totalExpectedCasualties.union) + .5)); + + if (this.numGenerals == 1) { + out.println(); + out.println("UNION INTELLIGENCE SUGGESTS THAT THE SOUTH USED "); + out.println("STRATEGIES 1, 2, 3, 4 IN THE FOLLOWING PERCENTAGES"); + out.println(this.strategies[0] + "," + this.strategies[1] + "," + this.strategies[2] + "," + this.strategies[3]); + } + } + + private Winner findWinner(double confLosses, double unionLosses) { + if (this.excessiveConfederateLosses && this.excessiveUnionLosses) { + return Winner.INDECISIVE; + } + + if (this.excessiveConfederateLosses) { + return Winner.UNION; + } + + if (this.excessiveUnionLosses || confLosses < unionLosses) { + return Winner.CONFED; + } + + if (confLosses == unionLosses) { + return Winner.INDECISIVE; + } + + return Winner.UNION; // FIXME Really? 2400-2420 ? + } + + private enum Winner { + CONFED, UNION, INDECISIVE + } + + private void unionStrategy() { + // 3130 ... so you can only input / override Union strategy on re-run?? + if (this.battleNumber == 0) { + out.print("UNION STRATEGY ? "); + var terminalInput = new Scanner(System.in); + unionStrategy = terminalInput.nextInt(); + if (unionStrategy < 0) { + out.println("ENTER 1, 2, 3, OR 4 (USUALLY PREVIOUS UNION STRATEGY)"); + // FIXME Retry Y2 input !!! + } + + if (unionStrategy < 5) { // 3155 + return; + } + } + + var S0 = 0; + var r = 100 * Math.random(); + + for (unionStrategy = 1; unionStrategy <= 4; unionStrategy++) { + S0 += this.strategies[unionStrategy - 1]; + // IF ACTUAL STRATEGY INFO IS IN PROGRAM DATA STATEMENTS THEN R-100 IS EXTRA WEIGHT GIVEN TO THAT STATEGY. + if (r < S0) { + break; + } + } + // IF ACTUAL STRAT. IN,THEN HERE IS Y2= HIST. STRAT. + out.println("UNION STRATEGY IS " + unionStrategy); + } + + public CivilWar(PrintStream out) { + this.out = out; + + this.results = new BattleResults(); + + this.totalCasualties = new ArmyPair<>(0, 0); + this.totalExpectedCasualties = new ArmyPair<>(0, 0); + this.totalExpenditure = new ArmyPair<>(0, 0); + this.totalTroops = new ArmyPair<>(0, 0); + + this.revenue = new ArmyPair<>(0, 0); + this.inflation = new ArmyPair<>(0, 0); + + this.resources = new ArmyPair<>(new ArmyResources(), new ArmyResources()); + + // UNION INFO ON LIKELY CONFEDERATE STRATEGY + this.strategies = new int[]{25, 25, 25, 25}; + + // READ HISTORICAL DATA. + // HISTORICAL DATA...CAN ADD MORE (STRAT.,ETC) BY INSERTING DATA STATEMENTS AFTER APPRO. INFO, AND ADJUSTING READ + this.data = List.of( + new HistoricalDatum("BULL RUN", new ArmyPair<>(18000, 18500), new ArmyPair<>(1967, 2708), OffensiveStatus.DEFENSIVE, new String[]{"JULY 21, 1861. GEN. BEAUREGARD, COMMANDING THE SOUTH, MET", "UNION FORCES WITH GEN. MCDOWELL IN A PREMATURE BATTLE AT", "BULL RUN. GEN. JACKSON HELPED PUSH BACK THE UNION ATTACK."}), + new HistoricalDatum("SHILOH", new ArmyPair<>(40000, 44894), new ArmyPair<>(10699, 13047), OffensiveStatus.OFFENSIVE, new String[]{"APRIL 6-7, 1862. THE CONFEDERATE SURPRISE ATTACK AT", "SHILOH FAILED DUE TO POOR ORGANIZATION."}), + new HistoricalDatum("SEVEN DAYS", new ArmyPair<>(95000, 115000), new ArmyPair<>(20614, 15849), OffensiveStatus.OFFENSIVE, new String[]{"JUNE 25-JULY 1, 1862. GENERAL LEE (CSA) UPHELD THE", "OFFENSIVE THROUGHOUT THE BATTLE AND FORCED GEN. MCCLELLAN", "AND THE UNION FORCES AWAY FROM RICHMOND."}), + new HistoricalDatum("SECOND BULL RUN", new ArmyPair<>(54000, 63000), new ArmyPair<>(10000, 14000), OffensiveStatus.BOTH_OFFENSIVE, new String[]{"AUG 29-30, 1862. THE COMBINED CONFEDERATE FORCES UNDER", " LEE", "AND JACKSON DROVE THE UNION FORCES BACK INTO WASHINGTON."}), + new HistoricalDatum("ANTIETAM", new ArmyPair<>(40000, 50000), new ArmyPair<>(10000, 12000), OffensiveStatus.OFFENSIVE, new String[]{"SEPT 17, 1862. THE SOUTH FAILED TO INCORPORATE MARYLAND", "INTO THE CONFEDERACY."}), + new HistoricalDatum("FREDERICKSBURG", new ArmyPair<>(75000, 120000), new ArmyPair<>(5377, 12653), OffensiveStatus.DEFENSIVE, new String[]{"DEC 13, 1862. THE CONFEDERACY UNDER LEE SUCCESSFULLY", "REPULSED AN ATTACK BY THE UNION UNDER GEN. BURNSIDE."}), + new HistoricalDatum("MURFREESBORO", new ArmyPair<>(38000, 45000), new ArmyPair<>(11000, 12000), OffensiveStatus.DEFENSIVE, new String[]{"DEC 31, 1862. THE SOUTH UNDER GEN. BRAGG WON A CLOSE BATTLE."}), + new HistoricalDatum("CHANCELLORSVILLE", new ArmyPair<>(32000, 90000), new ArmyPair<>(13000, 17197), OffensiveStatus.BOTH_OFFENSIVE, new String[]{"MAY 1-6, 1863. THE SOUTH HAD A COSTLY VICTORY AND LOST", "ONE OF THEIR OUTSTANDING GENERALS, 'STONEWALL' JACKSON."}), + new HistoricalDatum("VICKSBURG", new ArmyPair<>(50000, 70000), new ArmyPair<>(12000, 19000), OffensiveStatus.DEFENSIVE, new String[]{"JULY 4, 1863. VICKSBURG WAS A COSTLY DEFEAT FOR THE SOUTH", "BECAUSE IT GAVE THE UNION ACCESS TO THE MISSISSIPPI."}), + new HistoricalDatum("GETTYSBURG", new ArmyPair<>(72500, 85000), new ArmyPair<>(20000, 23000), OffensiveStatus.OFFENSIVE, new String[]{"JULY 1-3, 1863. A SOUTHERN MISTAKE BY GEN. LEE AT GETTYSBURG", "COST THEM ONE OF THE MOST CRUCIAL BATTLES OF THE WAR."}), + new HistoricalDatum("CHICKAMAUGA", new ArmyPair<>(66000, 60000), new ArmyPair<>(18000, 16000), OffensiveStatus.BOTH_OFFENSIVE, new String[]{"SEPT. 15, 1863. CONFUSION IN A FOREST NEAR CHICKAMAUGA LED", "TO A COSTLY SOUTHERN VICTORY."}), + new HistoricalDatum("CHATTANOOGA", new ArmyPair<>(37000, 60000), new ArmyPair<>(36700, 5800), OffensiveStatus.BOTH_OFFENSIVE, new String[]{"NOV. 25, 1863. AFTER THE SOUTH HAD SIEGED GEN. ROSENCRANS'", "ARMY FOR THREE MONTHS, GEN. GRANT BROKE THE SIEGE."}), + new HistoricalDatum("SPOTSYLVANIA", new ArmyPair<>(62000, 110000), new ArmyPair<>(17723, 18000), OffensiveStatus.BOTH_OFFENSIVE, new String[]{"MAY 5, 1864. GRANT'S PLAN TO KEEP LEE ISOLATED BEGAN TO", "FAIL HERE, AND CONTINUED AT COLD HARBOR AND PETERSBURG."}), + new HistoricalDatum("ATLANTA", new ArmyPair<>(65000, 100000), new ArmyPair<>(8500, 3700), OffensiveStatus.DEFENSIVE, new String[]{"AUGUST, 1864. SHERMAN AND THREE VETERAN ARMIES CONVERGED", "ON ATLANTA AND DEALT THE DEATH BLOW TO THE CONFEDERACY."}) + ); + } + + private void showCredits() { + out.println(" ".repeat(26) + "CIVIL WAR"); + out.println(" ".repeat(15) + "CREATIVE COMPUTING MORRISTOWN, NEW JERSEY"); + out.println(); + out.println(); + out.println(); + } + + private void updateStrategies(int strategy) { + // REM LEARN PRESENT STRATEGY, START FORGETTING OLD ONES + // REM - PRESENT STRATEGY OF SOUTH GAINS 3*S, OTHERS LOSE S + // REM PROBABILITY POINTS, UNLESS A STRATEGY FALLS BELOW 5%. + + var S = 3; + var S0 = 0; + for (int i = 0; i < 4; i++) { + if (this.strategies[i] <= 5) { + continue; + } + + this.strategies[i] -= S; + S0 += S; + + } + this.strategies[strategy - 1] += S0; + + } + + private void showHelp() { + out.println(); + out.println(); + out.println(); + out.println(); + out.println("THIS IS A CIVIL WAR SIMULATION."); + out.println("TO PLAY TYPE A RESPONSE WHEN THE COMPUTER ASKS."); + out.println("REMEMBER THAT ALL FACTORS ARE INTERRELATED AND THAT YOUR"); + out.println("RESPONSES COULD CHANGE HISTORY. FACTS AND FIGURES USED ARE"); + out.println("BASED ON THE ACTUAL OCCURRENCE. MOST BATTLES TEND TO RESULT"); + out.println("AS THEY DID IN THE CIVIL WAR, BUT IT ALL DEPENDS ON YOU!!"); + out.println(); + out.println("THE OBJECT OF THE GAME IS TO WIN AS MANY BATTLES AS "); + out.println("POSSIBLE."); + out.println(); + out.println("YOUR CHOICES FOR DEFENSIVE STRATEGY ARE:"); + out.println(" (1) ARTILLERY ATTACK"); + out.println(" (2) FORTIFICATION AGAINST FRONTAL ATTACK"); + out.println(" (3) FORTIFICATION AGAINST FLANKING MANEUVERS"); + out.println(" (4) FALLING BACK"); + out.println(" YOUR CHOICES FOR OFFENSIVE STRATEGY ARE:"); + out.println(" (1) ARTILLERY ATTACK"); + out.println(" (2) FRONTAL ATTACK"); + out.println(" (3) FLANKING MANEUVERS"); + out.println(" (4) ENCIRCLEMENT"); + out.println("YOU MAY SURRENDER BY TYPING A '5' FOR YOUR STRATEGY."); + } + + private static final int MAX_NUM_LENGTH = 6; + + private String rightAlignInt(int number) { + var s = String.valueOf(number); + return " ".repeat(MAX_NUM_LENGTH - s.length()) + s; + } + + private String rightAlignInt(double number) { + return rightAlignInt((int) Math.floor(number)); + } + + private static String inputString(Predicate validator, String reminder) { + while (true) { + try { + var input = new Scanner(System.in).nextLine(); + if (validator.test(input)) { + return input; + } + } catch (InputMismatchException e) { + // Ignore + } + System.out.println(reminder); + } + } + + private static int inputInt(Predicate validator, Function reminder) { + while (true) { + try { + var input = new Scanner(System.in).nextInt(); + if (validator.test(input)) { + return input; + } + System.out.println(reminder.apply(input)); + } catch (InputMismatchException e) { + System.out.println(reminder.apply(0)); + } + } + } + + private static boolean isYes(String s) { + if (s == null) { + return false; + } + var uppercase = s.toUpperCase(); + return uppercase.equals("Y") || uppercase.equals("YES"); + } + + private static boolean isNo(String s) { + if (s == null) { + return false; + } + var uppercase = s.toUpperCase(); + return uppercase.equals("N") || uppercase.equals("NO"); + } + + private static class BattleState { + private final HistoricalDatum data; + private double F1; + + public BattleState(HistoricalDatum data) { + this.data = data; + } + } + + private static class ArmyPair { + private T confederate; + private T union; + + public ArmyPair(T confederate, T union) { + this.confederate = confederate; + this.union = union; + } + } + + private static class BattleResults { + private int confederate; + private int union; + private int indeterminate; + + public int getTotal() { + return confederate + union + indeterminate; + } + } + + private static class ArmyResources { + private int food; + private int salaries; + private int ammunition; + private int budget; + + private double morale; // TODO really here? + + public int getTotal() { + return this.food + this.salaries + this.ammunition; + } + } + + private record HistoricalDatum(String name, ArmyPair troops, + ArmyPair expectedCasualties, + OffensiveStatus offensiveStatus, String[] blurb) { + } + + private record UnionLosses(int losses, int desertions) { + } +} \ No newline at end of file diff --git a/27_Civil_War/vbnet/CivilWar.sln b/27_Civil_War/vbnet/CivilWar.sln new file mode 100644 index 00000000..3f696f6f --- /dev/null +++ b/27_Civil_War/vbnet/CivilWar.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "CivilWar", "CivilWar.vbproj", "{D726A817-AF69-43B9-9092-876453960C19}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {D726A817-AF69-43B9-9092-876453960C19}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D726A817-AF69-43B9-9092-876453960C19}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D726A817-AF69-43B9-9092-876453960C19}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D726A817-AF69-43B9-9092-876453960C19}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/27_Civil_War/vbnet/CivilWar.vbproj b/27_Civil_War/vbnet/CivilWar.vbproj new file mode 100644 index 00000000..d132bbbc --- /dev/null +++ b/27_Civil_War/vbnet/CivilWar.vbproj @@ -0,0 +1,8 @@ + + + Exe + CivilWar + net6.0 + 16.9 + + diff --git a/28_Combat/csharp/src/ArmedForces.cs b/28_Combat/csharp/ArmedForces.cs similarity index 100% rename from 28_Combat/csharp/src/ArmedForces.cs rename to 28_Combat/csharp/ArmedForces.cs diff --git a/28_Combat/csharp/src/Ceasefire.cs b/28_Combat/csharp/Ceasefire.cs similarity index 100% rename from 28_Combat/csharp/src/Ceasefire.cs rename to 28_Combat/csharp/Ceasefire.cs diff --git a/28_Combat/csharp/Game.csproj b/28_Combat/csharp/Combat.csproj similarity index 100% rename from 28_Combat/csharp/Game.csproj rename to 28_Combat/csharp/Combat.csproj diff --git a/28_Combat/csharp/Combat.sln b/28_Combat/csharp/Combat.sln index 522b680e..99233316 100644 --- a/28_Combat/csharp/Combat.sln +++ b/28_Combat/csharp/Combat.sln @@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 16 VisualStudioVersion = 16.0.31321.278 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Game", "Game.csproj", "{054A1718-1B7D-4954-81A7-EEA390713439}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Combat", "Combat.csproj", "{F7CEEC00-CF2C-436C-883B-55A20C21AB93}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -11,10 +11,10 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {054A1718-1B7D-4954-81A7-EEA390713439}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {054A1718-1B7D-4954-81A7-EEA390713439}.Debug|Any CPU.Build.0 = Debug|Any CPU - {054A1718-1B7D-4954-81A7-EEA390713439}.Release|Any CPU.ActiveCfg = Release|Any CPU - {054A1718-1B7D-4954-81A7-EEA390713439}.Release|Any CPU.Build.0 = Release|Any CPU + {F7CEEC00-CF2C-436C-883B-55A20C21AB93}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F7CEEC00-CF2C-436C-883B-55A20C21AB93}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F7CEEC00-CF2C-436C-883B-55A20C21AB93}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F7CEEC00-CF2C-436C-883B-55A20C21AB93}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/28_Combat/csharp/src/Controller.cs b/28_Combat/csharp/Controller.cs similarity index 100% rename from 28_Combat/csharp/src/Controller.cs rename to 28_Combat/csharp/Controller.cs diff --git a/28_Combat/csharp/src/FinalCampaign.cs b/28_Combat/csharp/FinalCampaign.cs similarity index 100% rename from 28_Combat/csharp/src/FinalCampaign.cs rename to 28_Combat/csharp/FinalCampaign.cs diff --git a/28_Combat/csharp/src/InitialCampaign.cs b/28_Combat/csharp/InitialCampaign.cs similarity index 100% rename from 28_Combat/csharp/src/InitialCampaign.cs rename to 28_Combat/csharp/InitialCampaign.cs diff --git a/28_Combat/csharp/src/MilitaryBranch.cs b/28_Combat/csharp/MilitaryBranch.cs similarity index 100% rename from 28_Combat/csharp/src/MilitaryBranch.cs rename to 28_Combat/csharp/MilitaryBranch.cs diff --git a/28_Combat/csharp/src/Program.cs b/28_Combat/csharp/Program.cs similarity index 100% rename from 28_Combat/csharp/src/Program.cs rename to 28_Combat/csharp/Program.cs diff --git a/28_Combat/csharp/src/View.cs b/28_Combat/csharp/View.cs similarity index 100% rename from 28_Combat/csharp/src/View.cs rename to 28_Combat/csharp/View.cs diff --git a/28_Combat/csharp/src/WarResult.cs b/28_Combat/csharp/WarResult.cs similarity index 100% rename from 28_Combat/csharp/src/WarResult.cs rename to 28_Combat/csharp/WarResult.cs diff --git a/28_Combat/csharp/src/WarState.cs b/28_Combat/csharp/WarState.cs similarity index 100% rename from 28_Combat/csharp/src/WarState.cs rename to 28_Combat/csharp/WarState.cs diff --git a/28_Combat/vbnet/Combat.sln b/28_Combat/vbnet/Combat.sln new file mode 100644 index 00000000..f06a8366 --- /dev/null +++ b/28_Combat/vbnet/Combat.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Combat", "Combat.vbproj", "{B7C67E0E-1493-4957-9FD9-A384D038F024}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {B7C67E0E-1493-4957-9FD9-A384D038F024}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B7C67E0E-1493-4957-9FD9-A384D038F024}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B7C67E0E-1493-4957-9FD9-A384D038F024}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B7C67E0E-1493-4957-9FD9-A384D038F024}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/28_Combat/vbnet/Combat.vbproj b/28_Combat/vbnet/Combat.vbproj new file mode 100644 index 00000000..19ba1b19 --- /dev/null +++ b/28_Combat/vbnet/Combat.vbproj @@ -0,0 +1,8 @@ + + + Exe + Combat + net6.0 + 16.9 + + diff --git a/29_Craps/csharp/Craps/.gitignore b/29_Craps/csharp/.gitignore similarity index 100% rename from 29_Craps/csharp/Craps/.gitignore rename to 29_Craps/csharp/.gitignore diff --git a/29_Craps/csharp/Craps/Craps.sln b/29_Craps/csharp/Craps.sln similarity index 100% rename from 29_Craps/csharp/Craps/Craps.sln rename to 29_Craps/csharp/Craps.sln diff --git a/29_Craps/csharp/Craps/Craps/Craps.csproj b/29_Craps/csharp/Craps/Craps.csproj similarity index 100% rename from 29_Craps/csharp/Craps/Craps/Craps.csproj rename to 29_Craps/csharp/Craps/Craps.csproj diff --git a/29_Craps/csharp/Craps/Craps/CrapsGame.cs b/29_Craps/csharp/Craps/CrapsGame.cs similarity index 100% rename from 29_Craps/csharp/Craps/Craps/CrapsGame.cs rename to 29_Craps/csharp/Craps/CrapsGame.cs diff --git a/29_Craps/csharp/Craps/Craps/Dice.cs b/29_Craps/csharp/Craps/Dice.cs similarity index 100% rename from 29_Craps/csharp/Craps/Craps/Dice.cs rename to 29_Craps/csharp/Craps/Dice.cs diff --git a/29_Craps/csharp/Craps/Craps/Program.cs b/29_Craps/csharp/Craps/Program.cs similarity index 100% rename from 29_Craps/csharp/Craps/Craps/Program.cs rename to 29_Craps/csharp/Craps/Program.cs diff --git a/29_Craps/csharp/Craps/Craps/UserInterface.cs b/29_Craps/csharp/Craps/UserInterface.cs similarity index 100% rename from 29_Craps/csharp/Craps/Craps/UserInterface.cs rename to 29_Craps/csharp/Craps/UserInterface.cs diff --git a/29_Craps/csharp/Craps/CrapsTester/CrapsTester.csproj b/29_Craps/csharp/CrapsTester/CrapsTester.csproj similarity index 100% rename from 29_Craps/csharp/Craps/CrapsTester/CrapsTester.csproj rename to 29_Craps/csharp/CrapsTester/CrapsTester.csproj diff --git a/29_Craps/csharp/Craps/CrapsTester/CrapsTests.cs b/29_Craps/csharp/CrapsTester/CrapsTests.cs similarity index 100% rename from 29_Craps/csharp/Craps/CrapsTester/CrapsTests.cs rename to 29_Craps/csharp/CrapsTester/CrapsTests.cs diff --git a/29_Craps/perl/craps.pl b/29_Craps/perl/craps.pl new file mode 100644 index 00000000..7dd39856 --- /dev/null +++ b/29_Craps/perl/craps.pl @@ -0,0 +1,113 @@ +#!/usr/bin/perl +# + +my $bank = 0; + +&main; + +sub main { + &print_intro; + my $continue=5; + until ($continue != 5) { + $continue=&game_play; + &print_bank; + } + &final_bank; +} + +sub game_play { + my $point = 0; + my $continue = 1; + print "INPUT THE AMOUNT OF YOUR WAGER.\n"; + chomp(my $wager=); + print "I WILL NOW THROW THE DICE\n"; + until ($continue == 0) { + my $roll = &roll_dice; + $continue = &check_value($roll,$wager); + } + print "IF YOU WANT TO PLAY AGAIN PRINT 5 IF NOT PRINT 2\n"; + chomp(my $ans=); + return $ans; +} + +sub print_bank { + if ($bank < 0) { + print "YOU ARE NOW UNDER \$$bank\n"; + } + elsif ($bank > 0) { + print "YOU ARE NOW AHEAD \$$bank\n"; + } + else { + print "YOU ARE EVEN AT 0\n"; + } +} + +sub final_bank { + if ($bank < 0) { + print "TOO BAD, YOU ARE IN THE HOLE. COME AGAIN\n"; + } + elsif ($bank > 0) { + print "CONGRATULATIONS---YOU CAME OUT A WINNER. COME AGAIN!\n"; + } + else { + print "CONGRATULATIONS---YOU CAME OUT EVEN. NOT BAD FOR AN AMATEUR!\n"; + } +} + +sub check_value { + my $roll = shift; + my $wager = shift; + if ($roll == 7 || $roll == 11) { + print "$roll - NATURAL....A WINNER!!!!\n"; + print "$roll PAYS EVEN MONEY, YOU WIN $wager DOLLARS\n"; + $bank += $wager; + return 0; + } + elsif ($roll == 2 || $roll == 3 || $roll == 12) { + if ($roll == 2) { + print "$roll - SNAKE EYES....YOU LOSE.\n"; + print "YOU LOSE $wager DOLLARS.\n"; + } + else { + print "$roll - CRAPS...YOU LOSE.\n"; + print "YOU LOSE $wager DOLLARS.\n"; + } + $bank -= $wager; + return 0; + } + else { + my $point = $roll; + print "$point IS THE POINT. I WILL ROLL AGAIN\n"; + until (1==2) { + $roll = &roll_dice; + if ($roll == 7) { + print "$roll YOU LOSE $wager\n"; + $bank -= $wager; + return 0; + } + elsif ($roll == $point) { + print "$roll - A WINNER..........CONGRATS!!!!!!!!\n"; + my $payout = $wager * 2; + print "$roll AT 2 TO 1 ODDS PAYS YOU...LET ME SEE...$payout DOLLARS\n"; + $bank += $payout; + return 0; + } + else { + print "$roll - NO POINT. I WILL ROLL AGAIN\n"; + sleep(1); + } + } + } +} + +sub roll_dice { + my $die1 = 1+int rand(6); + my $die2 = 1+int rand(6); + return ($die1 + $die2); +} + +sub print_intro { + print ' ' x 33 . "CRAPS\n"; + print ' ' x 15 . "CREATIVE COMPUTING MORRISTOWN, NEW JERSEY\n\n\n"; + print "2,3,12 ARE LOSERS; 4,5,6,8,9,10 ARE POINTS; 7,11 ARE NATURAL WINNERS.\n"; +} diff --git a/29_Craps/ruby/craps.rb b/29_Craps/ruby/craps.rb new file mode 100644 index 00000000..dc53813b --- /dev/null +++ b/29_Craps/ruby/craps.rb @@ -0,0 +1,125 @@ +class CRAPSGAME + + # class variables start with a double "@" + @@standings = 0 + + def displayHeading + puts "CRAPS".center(80) + puts "CREATIVE COMPUTING MORRISTOWN, NEW JERSEY".center(80) + puts "\n\n\n" + puts "2,3,12 are losers" + puts "4,5,6,8,9,10 are points" + puts "7,11 are natural winners.\n\n" + end + + def displayStanding + if @@standings < 0 + print "you are in the hole by " + elsif @@standings == 0 + print "you currently have " + else + # show how much money we currently have + print "you now have won " + end + # print the absolute value of the amount in the standings + puts @@standings.abs.to_s + " dollars" + end + + # dice can come up 2 through 12 + # so return a minimum of 2 and add 0 through 10 to that + def rollDice + puts "I will now throw the dice" + return rand(5) + rand(5) + 2 + end + + def placeBet + print "How much do you want to wager? " + wager = gets.strip.to_i + return wager + end + + def loseBetBy amount + @@standings -= amount + end + + def winBetBy amount + @@standings += amount + end + + def askQuit? + print "\nDo you want to play again? " + # just the first character, make it uppercase + again = gets.strip.upcase[0] + return again != "Y" + end + + def pointRoll point, wager + while true do + puts " is the point." + puts " I will roll again when you press Enter." + waitForIt = gets + roll = rollDice + print roll.to_s + + # the only critical rolls here are 7 and the previous roll + # if anything else comes up we roll again. + case roll.to_i + when 7 + puts " craps - you lose" + loseBetBy wager + break + when point + puts " is a winner! congrats!" + puts "at 2 to 1 odds pays you " + (2 * wager).to_s + " dollars" + winBetBy 2 * wager + break + else + print " no point - " + point.to_s + end + end + end + + def play + displayHeading + + while true do + wagerAmount = placeBet + roll = rollDice + print roll.to_s + case roll + when 2 + puts " snake eyes - you lose" + loseBetBy wagerAmount + when 3, 12 + puts " craps - you lose" + loseBetBy wagerAmount + when 4, 5, 6, 8, 9, 10 + pointRoll roll, wagerAmount + when 7, 11 + puts " a natural - a winner" + puts "pays even money: " + wagerAmount.to_s + " dollars" + winBetBy wagerAmount + end + displayStanding + if askQuit? + endPlay + end + end + end + + def endPlay + case + when @@standings < 0 + puts "Too bad. You are in the hole " + @@standings.abs.to_s + " dollars. Come again." + when @@standings > 0 + puts "Congratulations --- You came out a winner of " + @@standings.to_s + " dollars. Come again!" + when @@standings == 0 + puts "Congratulations --- You came out even, not bad for an amateur" + end + exit + end +end + +craps = CRAPSGAME.new +craps.play + diff --git a/29_Craps/vbnet/Craps.sln b/29_Craps/vbnet/Craps.sln new file mode 100644 index 00000000..7d564508 --- /dev/null +++ b/29_Craps/vbnet/Craps.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Craps", "Craps.vbproj", "{297AA824-815F-4E2B-948C-BDAD2266C5AF}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {297AA824-815F-4E2B-948C-BDAD2266C5AF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {297AA824-815F-4E2B-948C-BDAD2266C5AF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {297AA824-815F-4E2B-948C-BDAD2266C5AF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {297AA824-815F-4E2B-948C-BDAD2266C5AF}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/29_Craps/vbnet/Craps.vbproj b/29_Craps/vbnet/Craps.vbproj new file mode 100644 index 00000000..a1c6ee27 --- /dev/null +++ b/29_Craps/vbnet/Craps.vbproj @@ -0,0 +1,8 @@ + + + Exe + Craps + net6.0 + 16.9 + + diff --git a/30_Cube/csharp/Cube.csproj b/30_Cube/csharp/Cube.csproj new file mode 100644 index 00000000..d3fe4757 --- /dev/null +++ b/30_Cube/csharp/Cube.csproj @@ -0,0 +1,9 @@ + + + Exe + net6.0 + 10 + enable + enable + + diff --git a/30_Cube/csharp/Cube.sln b/30_Cube/csharp/Cube.sln new file mode 100644 index 00000000..be69dc76 --- /dev/null +++ b/30_Cube/csharp/Cube.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cube", "Cube.csproj", "{CC2F0DBE-EBA0-4275-ACA4-7140E3202889}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {CC2F0DBE-EBA0-4275-ACA4-7140E3202889}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CC2F0DBE-EBA0-4275-ACA4-7140E3202889}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CC2F0DBE-EBA0-4275-ACA4-7140E3202889}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CC2F0DBE-EBA0-4275-ACA4-7140E3202889}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/30_Cube/ruby/cube.rb b/30_Cube/ruby/cube.rb new file mode 100644 index 00000000..a881986e --- /dev/null +++ b/30_Cube/ruby/cube.rb @@ -0,0 +1,261 @@ +$landmines = Array.new + +$currentLocation = "111" + +$standings = 500 # starting amount + +def getYesOrNoResponseTo prompt + print prompt + # strip leading and trailing whitespace from entry + yesno = gets.strip.upcase[0] + yesno == "Y" +end + +def greeting + puts "CUBE".center(80) + puts "CREATIVE COMPUTING MORRISTOWN, NEW JERSEY".center(80) + puts "\n\n\n" + response = getYesOrNoResponseTo "Do you want to see the INSTRUCTIONS?" + if response + puts "This is a game in which you will be playing against the" + puts "random decision of the computer. The field of play is a" + puts "cube of size 3. Any of your 27 locations can be designated" + puts "by inputting three numbers such as 231." + puts "At the start you are automatically at location 1,1,1.\n" + puts "The object of the game is to get to location 3,3,3.\n" + + puts "\nONE MINOR DETAIL:" + puts "The computer will pick five random locations at which it will" + puts "plant land mines. if you hit one of these locations you lose.\n" + + puts "\nONE OTHER DETAIL:" + puts "You may move only one space in one direction each move." + puts "For example: from 1,1,2 you may move to 2,1,2 or 1,1,3." + puts "You may not change more than one number on the same move." + puts "If you make an illegal move, you lose and the computer takes" + puts "the money you may have bet on that round." + puts "" + puts "When stating the amount of a wager, enter only the number" + puts "of dollars (example: 250) You are automatically started with" + puts "500 dollars in your account." + puts + puts "Good luck!" + end +end + +def landMindStringFrom x, y, z + landMine = x.to_s + y.to_s + z.to_s + return landMine +end + +def assignLandMines + $landmines.clear + + # put five unique entries into the landmines array + while $landmines.size < 5 do + a = rand(3)+1 + b = rand(3)+1 + c = rand(3)+1 + landmine = landMindStringFrom(a, b, c) + if !$landmines.include?(landmine) && landmine != "333" +# puts landmine # debugging + $landmines.push landmine + end + end + $currentLocation = "111" +end + +def initializePot + $standings = 500 # starting amount +end + +def startGame + assignLandMines + displayStandings + response = getYesOrNoResponseTo "WANT TO MAKE A WAGER? " + if response + print "HOW MUCH? " + while true do + wager = gets.strip.tr('^0-9', '').to_i + if $standings < wager + puts "TRIED TO FOOL ME; BET AGAIN "; + else + break + end + end + else + wager = 0 + end + + # start at location 1,1,1 + $currentLocation = "111" + return wager +end + +def goodbye + puts "TOUGH LUCK!" + puts "" + puts "GOODBYE." + exit +end + +def bust + puts "YOU BUST." + goodbye +end + +def tryAgain + again = getYesOrNoResponseTo "WANT TO TRY AGAIN? " + if not again + exit + end +end + +def isLegalMove? newLocation + # test for illegal moves + # can only change one variable per move + # newLocation is the proposed new position + # can only move one space from the current position + + moveX = newLocation[0].to_i + moveY = newLocation[1].to_i + moveZ = newLocation[2].to_i + + # currentX, currentY, currentZ contains the current position + currentX = $currentLocation[0].to_i + currentY = $currentLocation[1].to_i + currentZ = $currentLocation[2].to_i + + isLegalMove = true + errorString = "" + # ensure we're not moving off the cube + if not (moveX.between?(1,3) && moveY.between?(1,3) && moveZ.between?(1,3)) + errorString = "You moved off the cube!" + return errorString + end + + # test for only one move from current position + if not moveX.between?(currentX-1,currentX+1) + isLegalMove = false + end + if not moveY.between?(currentY-1,currentY+1) + isLegalMove = false + end + if not moveZ.between?(currentZ-1,currentZ+1) + isLegalMove = false + end + if not isLegalMove + errorString = "You've gone too far" + end + + # only allow change to one variable at a time + if isLegalMove + if moveX != currentX + if moveY != currentY or moveZ != currentZ + isLegalMove = false + end + end + if moveY != currentY + if moveX != currentX or moveZ != currentZ + isLegalMove = false + end + end + if moveZ != currentZ + if moveY != currentY or moveX != currentX + isLegalMove = false + end + end + if not isLegalMove + errorString = "You made too many changes" + end + end + + return errorString +end + +def displayStandings + print "You now have " + $standings.to_s + if $standings > 1 + puts " dollars" + else + puts " dollar" + end +end + +def didWin? location + location == "333" +end + +def youWin amount + $standings += amount + puts "*** You win " + amount.to_s + " dollars! ***\n\n" + displayStandings + tryAgain + assignLandMines + puts "*** new cube ***" + puts "different landmine locations" + puts "starting over at location 111" +end + +def youLose amount + # subtract the bet amount from the standings + if amount > 0 + puts "You lose " + amount.to_s + " dollars!\n\n" + $standings -= amount + end + if $standings <= 0 + # no money left, so end the game + bust + else + displayStandings + end + tryAgain + $currentLocation = "111" + puts "starting over at location 111" +end + +def landMine betAmount + puts "******BANG******" + puts "You hit a land mine at " + $currentLocation + "!" + youLose betAmount +end + +def gameLoop betAmount + while true do + puts "" + print "IT'S YOUR MOVE: " + # allow only integers: strip anything else from input + moveToLocation = gets.strip.tr('^0-9', '') + + # test for illegal moves + # can only change one variable per move + # moveToLocation is the proposed new position + + error = isLegalMove?(moveToLocation) + if error == "" + # assign the new position + $currentLocation = moveToLocation + + # test for win + if didWin?(moveToLocation) + youWin betAmount + end + + # haven't won yet, test the land mines + if $landmines.include? moveToLocation + landMine betAmount + end + + else + puts "Illegal move: " + error + youLose betAmount + end + + end +end + + +greeting +initializePot +gameLoop startGame + diff --git a/30_Cube/vbnet/Cube.sln b/30_Cube/vbnet/Cube.sln new file mode 100644 index 00000000..36f7fc75 --- /dev/null +++ b/30_Cube/vbnet/Cube.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Cube", "Cube.vbproj", "{C4AA207B-37EC-4746-B634-FBFC9522F3F8}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {C4AA207B-37EC-4746-B634-FBFC9522F3F8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C4AA207B-37EC-4746-B634-FBFC9522F3F8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C4AA207B-37EC-4746-B634-FBFC9522F3F8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C4AA207B-37EC-4746-B634-FBFC9522F3F8}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/30_Cube/vbnet/Cube.vbproj b/30_Cube/vbnet/Cube.vbproj new file mode 100644 index 00000000..1cbe484d --- /dev/null +++ b/30_Cube/vbnet/Cube.vbproj @@ -0,0 +1,8 @@ + + + Exe + Cube + net6.0 + 16.9 + + diff --git a/31_Depth_Charge/csharp/src/Controller.cs b/31_Depth_Charge/csharp/Controller.cs similarity index 100% rename from 31_Depth_Charge/csharp/src/Controller.cs rename to 31_Depth_Charge/csharp/Controller.cs diff --git a/31_Depth_Charge/csharp/Game.csproj b/31_Depth_Charge/csharp/DepthCharge.csproj similarity index 100% rename from 31_Depth_Charge/csharp/Game.csproj rename to 31_Depth_Charge/csharp/DepthCharge.csproj diff --git a/31_Depth_Charge/csharp/DepthCharge.sln b/31_Depth_Charge/csharp/DepthCharge.sln index 8d56c717..2f11d18c 100644 --- a/31_Depth_Charge/csharp/DepthCharge.sln +++ b/31_Depth_Charge/csharp/DepthCharge.sln @@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 16 VisualStudioVersion = 16.0.31129.286 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Game", "Game.csproj", "{CBC9D8D9-9EDE-4D34-A20E-C90D929ABF8F}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DepthCharge", "DepthCharge.csproj", "{15CF71F3-72F3-4C81-B54F-139F2A1E3920}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -11,10 +11,10 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {CBC9D8D9-9EDE-4D34-A20E-C90D929ABF8F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {CBC9D8D9-9EDE-4D34-A20E-C90D929ABF8F}.Debug|Any CPU.Build.0 = Debug|Any CPU - {CBC9D8D9-9EDE-4D34-A20E-C90D929ABF8F}.Release|Any CPU.ActiveCfg = Release|Any CPU - {CBC9D8D9-9EDE-4D34-A20E-C90D929ABF8F}.Release|Any CPU.Build.0 = Release|Any CPU + {15CF71F3-72F3-4C81-B54F-139F2A1E3920}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {15CF71F3-72F3-4C81-B54F-139F2A1E3920}.Debug|Any CPU.Build.0 = Debug|Any CPU + {15CF71F3-72F3-4C81-B54F-139F2A1E3920}.Release|Any CPU.ActiveCfg = Release|Any CPU + {15CF71F3-72F3-4C81-B54F-139F2A1E3920}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/31_Depth_Charge/csharp/src/Program.cs b/31_Depth_Charge/csharp/Program.cs similarity index 100% rename from 31_Depth_Charge/csharp/src/Program.cs rename to 31_Depth_Charge/csharp/Program.cs diff --git a/31_Depth_Charge/csharp/src/View.cs b/31_Depth_Charge/csharp/View.cs similarity index 100% rename from 31_Depth_Charge/csharp/src/View.cs rename to 31_Depth_Charge/csharp/View.cs diff --git a/31_Depth_Charge/vbnet/DepthCharge.sln b/31_Depth_Charge/vbnet/DepthCharge.sln new file mode 100644 index 00000000..b042eee0 --- /dev/null +++ b/31_Depth_Charge/vbnet/DepthCharge.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "DepthCharge", "DepthCharge.vbproj", "{7F8404FE-7CF2-46AC-B4D4-2CAB5EF3FB2F}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {7F8404FE-7CF2-46AC-B4D4-2CAB5EF3FB2F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7F8404FE-7CF2-46AC-B4D4-2CAB5EF3FB2F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7F8404FE-7CF2-46AC-B4D4-2CAB5EF3FB2F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7F8404FE-7CF2-46AC-B4D4-2CAB5EF3FB2F}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/31_Depth_Charge/vbnet/DepthCharge.vbproj b/31_Depth_Charge/vbnet/DepthCharge.vbproj new file mode 100644 index 00000000..ee43c035 --- /dev/null +++ b/31_Depth_Charge/vbnet/DepthCharge.vbproj @@ -0,0 +1,8 @@ + + + Exe + DepthCharge + net6.0 + 16.9 + + diff --git a/32_Diamond/csharp/Diamond.csproj b/32_Diamond/csharp/Diamond.csproj new file mode 100644 index 00000000..d3fe4757 --- /dev/null +++ b/32_Diamond/csharp/Diamond.csproj @@ -0,0 +1,9 @@ + + + Exe + net6.0 + 10 + enable + enable + + diff --git a/32_Diamond/csharp/Diamond.sln b/32_Diamond/csharp/Diamond.sln new file mode 100644 index 00000000..2af37dbd --- /dev/null +++ b/32_Diamond/csharp/Diamond.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Diamond", "Diamond.csproj", "{44B406C8-70F0-4183-B19A-5B045A1AEBA4}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {44B406C8-70F0-4183-B19A-5B045A1AEBA4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {44B406C8-70F0-4183-B19A-5B045A1AEBA4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {44B406C8-70F0-4183-B19A-5B045A1AEBA4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {44B406C8-70F0-4183-B19A-5B045A1AEBA4}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/32_Diamond/vbnet/Diamond.sln b/32_Diamond/vbnet/Diamond.sln new file mode 100644 index 00000000..3f05715d --- /dev/null +++ b/32_Diamond/vbnet/Diamond.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Diamond", "Diamond.vbproj", "{87084ED3-F01C-4D7E-8BE7-10C2F3FA148F}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {87084ED3-F01C-4D7E-8BE7-10C2F3FA148F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {87084ED3-F01C-4D7E-8BE7-10C2F3FA148F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {87084ED3-F01C-4D7E-8BE7-10C2F3FA148F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {87084ED3-F01C-4D7E-8BE7-10C2F3FA148F}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/32_Diamond/vbnet/Diamond.vbproj b/32_Diamond/vbnet/Diamond.vbproj new file mode 100644 index 00000000..069fe872 --- /dev/null +++ b/32_Diamond/vbnet/Diamond.vbproj @@ -0,0 +1,8 @@ + + + Exe + Diamond + net6.0 + 16.9 + + diff --git a/33_Dice/csharp/Dice.sln b/33_Dice/csharp/Dice.sln new file mode 100644 index 00000000..738a8c1c --- /dev/null +++ b/33_Dice/csharp/Dice.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dice", "Dice.csproj", "{D136AC51-DDC0-471A-8EAC-D3C772FA7D51}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {D136AC51-DDC0-471A-8EAC-D3C772FA7D51}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D136AC51-DDC0-471A-8EAC-D3C772FA7D51}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D136AC51-DDC0-471A-8EAC-D3C772FA7D51}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D136AC51-DDC0-471A-8EAC-D3C772FA7D51}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/33_Dice/vbnet/Dice.sln b/33_Dice/vbnet/Dice.sln new file mode 100644 index 00000000..afb7b912 --- /dev/null +++ b/33_Dice/vbnet/Dice.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Dice", "Dice.vbproj", "{6410CCD0-0D78-49C9-9B15-70F901A1EB19}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {6410CCD0-0D78-49C9-9B15-70F901A1EB19}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6410CCD0-0D78-49C9-9B15-70F901A1EB19}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6410CCD0-0D78-49C9-9B15-70F901A1EB19}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6410CCD0-0D78-49C9-9B15-70F901A1EB19}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/33_Dice/vbnet/Dice.vbproj b/33_Dice/vbnet/Dice.vbproj new file mode 100644 index 00000000..16929f96 --- /dev/null +++ b/33_Dice/vbnet/Dice.vbproj @@ -0,0 +1,8 @@ + + + Exe + Dice + net6.0 + 16.9 + + diff --git a/34_Digits/csharp/Digits.csproj b/34_Digits/csharp/Digits.csproj new file mode 100644 index 00000000..d3fe4757 --- /dev/null +++ b/34_Digits/csharp/Digits.csproj @@ -0,0 +1,9 @@ + + + Exe + net6.0 + 10 + enable + enable + + diff --git a/34_Digits/csharp/Digits.sln b/34_Digits/csharp/Digits.sln new file mode 100644 index 00000000..04b94496 --- /dev/null +++ b/34_Digits/csharp/Digits.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Digits", "Digits.csproj", "{BB89211D-85FB-4FC0-AF62-715459227D7E}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {BB89211D-85FB-4FC0-AF62-715459227D7E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {BB89211D-85FB-4FC0-AF62-715459227D7E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {BB89211D-85FB-4FC0-AF62-715459227D7E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {BB89211D-85FB-4FC0-AF62-715459227D7E}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/34_Digits/vbnet/Digits.sln b/34_Digits/vbnet/Digits.sln new file mode 100644 index 00000000..2d5733a9 --- /dev/null +++ b/34_Digits/vbnet/Digits.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Digits", "Digits.vbproj", "{837EB2E4-3EE6-447A-8AF7-91CA08841B93}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {837EB2E4-3EE6-447A-8AF7-91CA08841B93}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {837EB2E4-3EE6-447A-8AF7-91CA08841B93}.Debug|Any CPU.Build.0 = Debug|Any CPU + {837EB2E4-3EE6-447A-8AF7-91CA08841B93}.Release|Any CPU.ActiveCfg = Release|Any CPU + {837EB2E4-3EE6-447A-8AF7-91CA08841B93}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/34_Digits/vbnet/Digits.vbproj b/34_Digits/vbnet/Digits.vbproj new file mode 100644 index 00000000..d8f673e1 --- /dev/null +++ b/34_Digits/vbnet/Digits.vbproj @@ -0,0 +1,8 @@ + + + Exe + Digits + net6.0 + 16.9 + + diff --git a/35_Even_Wins/csharp/EvenWins.csproj b/35_Even_Wins/csharp/EvenWins.csproj new file mode 100644 index 00000000..d3fe4757 --- /dev/null +++ b/35_Even_Wins/csharp/EvenWins.csproj @@ -0,0 +1,9 @@ + + + Exe + net6.0 + 10 + enable + enable + + diff --git a/35_Even_Wins/csharp/EvenWins.sln b/35_Even_Wins/csharp/EvenWins.sln new file mode 100644 index 00000000..b384c20c --- /dev/null +++ b/35_Even_Wins/csharp/EvenWins.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EvenWins", "EvenWins.csproj", "{84209510-4089-4147-B220-E41E534A228B}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {84209510-4089-4147-B220-E41E534A228B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {84209510-4089-4147-B220-E41E534A228B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {84209510-4089-4147-B220-E41E534A228B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {84209510-4089-4147-B220-E41E534A228B}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/35_Even_Wins/vbnet/EvenWins.sln b/35_Even_Wins/vbnet/EvenWins.sln new file mode 100644 index 00000000..0714f204 --- /dev/null +++ b/35_Even_Wins/vbnet/EvenWins.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "EvenWins", "EvenWins.vbproj", "{16D44A7A-9C05-4845-8289-3A65A4D978D0}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {16D44A7A-9C05-4845-8289-3A65A4D978D0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {16D44A7A-9C05-4845-8289-3A65A4D978D0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {16D44A7A-9C05-4845-8289-3A65A4D978D0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {16D44A7A-9C05-4845-8289-3A65A4D978D0}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/35_Even_Wins/vbnet/EvenWins.vbproj b/35_Even_Wins/vbnet/EvenWins.vbproj new file mode 100644 index 00000000..7ca1146f --- /dev/null +++ b/35_Even_Wins/vbnet/EvenWins.vbproj @@ -0,0 +1,8 @@ + + + Exe + EvenWins + net6.0 + 16.9 + + diff --git a/36_Flip_Flop/vbnet/FlipFlop.sln b/36_Flip_Flop/vbnet/FlipFlop.sln new file mode 100644 index 00000000..8301941b --- /dev/null +++ b/36_Flip_Flop/vbnet/FlipFlop.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "FlipFlop", "FlipFlop.vbproj", "{4A5887DD-FA0C-47EE-B3A2-E334DCE3544C}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {4A5887DD-FA0C-47EE-B3A2-E334DCE3544C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4A5887DD-FA0C-47EE-B3A2-E334DCE3544C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4A5887DD-FA0C-47EE-B3A2-E334DCE3544C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4A5887DD-FA0C-47EE-B3A2-E334DCE3544C}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/36_Flip_Flop/vbnet/FlipFlop.vbproj b/36_Flip_Flop/vbnet/FlipFlop.vbproj new file mode 100644 index 00000000..388b75c1 --- /dev/null +++ b/36_Flip_Flop/vbnet/FlipFlop.vbproj @@ -0,0 +1,8 @@ + + + Exe + FlipFlop + net6.0 + 16.9 + + diff --git a/37_Football/csharp/Football.csproj b/37_Football/csharp/Football.csproj new file mode 100644 index 00000000..d3fe4757 --- /dev/null +++ b/37_Football/csharp/Football.csproj @@ -0,0 +1,9 @@ + + + Exe + net6.0 + 10 + enable + enable + + diff --git a/37_Football/csharp/Football.sln b/37_Football/csharp/Football.sln new file mode 100644 index 00000000..b0d85b41 --- /dev/null +++ b/37_Football/csharp/Football.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Football", "Football.csproj", "{092442FA-EA04-4A80-AB12-138E18CD480A}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {092442FA-EA04-4A80-AB12-138E18CD480A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {092442FA-EA04-4A80-AB12-138E18CD480A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {092442FA-EA04-4A80-AB12-138E18CD480A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {092442FA-EA04-4A80-AB12-138E18CD480A}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/37_Football/vbnet/Football.sln b/37_Football/vbnet/Football.sln new file mode 100644 index 00000000..2e177718 --- /dev/null +++ b/37_Football/vbnet/Football.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Football", "Football.vbproj", "{5491221D-33D3-4ADF-9E0A-FB58D5C12EE2}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {5491221D-33D3-4ADF-9E0A-FB58D5C12EE2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5491221D-33D3-4ADF-9E0A-FB58D5C12EE2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5491221D-33D3-4ADF-9E0A-FB58D5C12EE2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5491221D-33D3-4ADF-9E0A-FB58D5C12EE2}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/37_Football/vbnet/Football.vbproj b/37_Football/vbnet/Football.vbproj new file mode 100644 index 00000000..ce404640 --- /dev/null +++ b/37_Football/vbnet/Football.vbproj @@ -0,0 +1,8 @@ + + + Exe + Football + net6.0 + 16.9 + + diff --git a/38_Fur_Trader/vbnet/FurTrader.sln b/38_Fur_Trader/vbnet/FurTrader.sln new file mode 100644 index 00000000..cb129718 --- /dev/null +++ b/38_Fur_Trader/vbnet/FurTrader.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "FurTrader", "FurTrader.vbproj", "{D8310FB8-132A-4D43-A654-17E5A267DDBD}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {D8310FB8-132A-4D43-A654-17E5A267DDBD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D8310FB8-132A-4D43-A654-17E5A267DDBD}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D8310FB8-132A-4D43-A654-17E5A267DDBD}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D8310FB8-132A-4D43-A654-17E5A267DDBD}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/38_Fur_Trader/vbnet/FurTrader.vbproj b/38_Fur_Trader/vbnet/FurTrader.vbproj new file mode 100644 index 00000000..61ab6d99 --- /dev/null +++ b/38_Fur_Trader/vbnet/FurTrader.vbproj @@ -0,0 +1,8 @@ + + + Exe + FurTrader + net6.0 + 16.9 + + diff --git a/39_Golf/csharp/Golf.csproj b/39_Golf/csharp/Golf.csproj new file mode 100644 index 00000000..d3fe4757 --- /dev/null +++ b/39_Golf/csharp/Golf.csproj @@ -0,0 +1,9 @@ + + + Exe + net6.0 + 10 + enable + enable + + diff --git a/39_Golf/csharp/Golf.sln b/39_Golf/csharp/Golf.sln new file mode 100644 index 00000000..07c90dde --- /dev/null +++ b/39_Golf/csharp/Golf.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Golf", "Golf.csproj", "{0D91BC87-BADF-445F-876F-38F3A66A3B83}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {0D91BC87-BADF-445F-876F-38F3A66A3B83}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0D91BC87-BADF-445F-876F-38F3A66A3B83}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0D91BC87-BADF-445F-876F-38F3A66A3B83}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0D91BC87-BADF-445F-876F-38F3A66A3B83}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/39_Golf/vbnet/Golf.sln b/39_Golf/vbnet/Golf.sln new file mode 100644 index 00000000..6698c79f --- /dev/null +++ b/39_Golf/vbnet/Golf.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Golf", "Golf.vbproj", "{65A2E065-6541-4E6E-B6F0-9881080B5FFF}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {65A2E065-6541-4E6E-B6F0-9881080B5FFF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {65A2E065-6541-4E6E-B6F0-9881080B5FFF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {65A2E065-6541-4E6E-B6F0-9881080B5FFF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {65A2E065-6541-4E6E-B6F0-9881080B5FFF}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/39_Golf/vbnet/Golf.vbproj b/39_Golf/vbnet/Golf.vbproj new file mode 100644 index 00000000..1a20f831 --- /dev/null +++ b/39_Golf/vbnet/Golf.vbproj @@ -0,0 +1,8 @@ + + + Exe + Golf + net6.0 + 16.9 + + diff --git a/40_Gomoko/csharp/Gomoko.csproj b/40_Gomoko/csharp/Gomoko.csproj new file mode 100644 index 00000000..d3fe4757 --- /dev/null +++ b/40_Gomoko/csharp/Gomoko.csproj @@ -0,0 +1,9 @@ + + + Exe + net6.0 + 10 + enable + enable + + diff --git a/40_Gomoko/csharp/Gomoko.sln b/40_Gomoko/csharp/Gomoko.sln new file mode 100644 index 00000000..84182037 --- /dev/null +++ b/40_Gomoko/csharp/Gomoko.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Gomoko", "Gomoko.csproj", "{558B84AB-2010-436E-B191-00980C6CBA61}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {558B84AB-2010-436E-B191-00980C6CBA61}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {558B84AB-2010-436E-B191-00980C6CBA61}.Debug|Any CPU.Build.0 = Debug|Any CPU + {558B84AB-2010-436E-B191-00980C6CBA61}.Release|Any CPU.ActiveCfg = Release|Any CPU + {558B84AB-2010-436E-B191-00980C6CBA61}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/40_Gomoko/vbnet/Gomoko.sln b/40_Gomoko/vbnet/Gomoko.sln new file mode 100644 index 00000000..fb1c4673 --- /dev/null +++ b/40_Gomoko/vbnet/Gomoko.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Gomoko", "Gomoko.vbproj", "{AEA608B9-083C-4EE7-9DE7-A0AB4FE313A8}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {AEA608B9-083C-4EE7-9DE7-A0AB4FE313A8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {AEA608B9-083C-4EE7-9DE7-A0AB4FE313A8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {AEA608B9-083C-4EE7-9DE7-A0AB4FE313A8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {AEA608B9-083C-4EE7-9DE7-A0AB4FE313A8}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/40_Gomoko/vbnet/Gomoko.vbproj b/40_Gomoko/vbnet/Gomoko.vbproj new file mode 100644 index 00000000..5350e761 --- /dev/null +++ b/40_Gomoko/vbnet/Gomoko.vbproj @@ -0,0 +1,8 @@ + + + Exe + Gomoko + net6.0 + 16.9 + + diff --git a/41_Guess/csharp/Guess.csproj b/41_Guess/csharp/Guess.csproj new file mode 100644 index 00000000..d3fe4757 --- /dev/null +++ b/41_Guess/csharp/Guess.csproj @@ -0,0 +1,9 @@ + + + Exe + net6.0 + 10 + enable + enable + + diff --git a/41_Guess/csharp/Guess.sln b/41_Guess/csharp/Guess.sln new file mode 100644 index 00000000..c6649256 --- /dev/null +++ b/41_Guess/csharp/Guess.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Guess", "Guess.csproj", "{0D116201-33C0-4C86-A8D5-FF7C9CCC638F}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {0D116201-33C0-4C86-A8D5-FF7C9CCC638F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0D116201-33C0-4C86-A8D5-FF7C9CCC638F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0D116201-33C0-4C86-A8D5-FF7C9CCC638F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0D116201-33C0-4C86-A8D5-FF7C9CCC638F}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/41_Guess/ruby/guess.rb b/41_Guess/ruby/guess.rb new file mode 100644 index 00000000..cf2deea2 --- /dev/null +++ b/41_Guess/ruby/guess.rb @@ -0,0 +1,48 @@ +def print_intro + print " " * 31 + "GUESS\n" + print " " * 15 + "CREATIVE COMPUTING MORRISTOWN, NEW JERSEY\n" + print "THIS IS A NUMBER GUESSING GAME. I'LL THINK\nOF A NUMBER BETWEEN 1 AND ANY LIMIT YOU WANT.\nTHEN YOU HAVE TO GUESS WHAT IT IS.\n" +end + +def game_play(limit,choice_limit) + random = rand(limit.to_i)+1 + puts "I'M THINKING OF A NUMBER BETWEEN 1 and #{limit}" + puts "NOW YOU TRY TO GUESS WHAT IT IS." + print "? " + ans=0 + guesses=0 + until ans.to_i == random.to_i + ans = gets.chomp + guesses += 1 + if ans.to_i > random.to_i + puts "TOO HIGH. TRY A SMALLER ANSWER." + print "? " + elsif ans.to_i < random.to_i + puts "TOO LOW. TRY A BIGGER ANSWER." + print "? " + elsif ans.to_i == random.to_i + puts "THAT'S IT! YOU GOT IT IN #{guesses} TRIES." + if guesses.to_i < choice_limit.to_i + puts "VERY GOOD." + elsif guesses.to_i == choice_limit.to_i + puts "GOOD." + else + puts "YOU SHOULD HAVE BEEN ABLE TO GET IT IN ONLY #{choice_limit}" + end + print "\n\n\n\n\n" + end + end +end + + +def main + print_intro + puts "WHAT LIMIT DO YOU WANT" + limit = gets.chomp + choice_limit = (Math.log(limit.to_i)/Math.log(2)+1).to_i + while 1 + game_play(limit,choice_limit) + end +end + +main diff --git a/41_Guess/vbnet/Guess.sln b/41_Guess/vbnet/Guess.sln new file mode 100644 index 00000000..2238b0be --- /dev/null +++ b/41_Guess/vbnet/Guess.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Guess", "Guess.vbproj", "{33AB1024-1609-4163-BEAF-BA02A5D42F8A}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {33AB1024-1609-4163-BEAF-BA02A5D42F8A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {33AB1024-1609-4163-BEAF-BA02A5D42F8A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {33AB1024-1609-4163-BEAF-BA02A5D42F8A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {33AB1024-1609-4163-BEAF-BA02A5D42F8A}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/41_Guess/vbnet/Guess.vbproj b/41_Guess/vbnet/Guess.vbproj new file mode 100644 index 00000000..8a5fe396 --- /dev/null +++ b/41_Guess/vbnet/Guess.vbproj @@ -0,0 +1,8 @@ + + + Exe + Guess + net6.0 + 16.9 + + diff --git a/42_Gunner/csharp/csharp.csproj b/42_Gunner/csharp/Gunner.csproj similarity index 100% rename from 42_Gunner/csharp/csharp.csproj rename to 42_Gunner/csharp/Gunner.csproj diff --git a/42_Gunner/csharp/Gunner.sln b/42_Gunner/csharp/Gunner.sln new file mode 100644 index 00000000..5fadb359 --- /dev/null +++ b/42_Gunner/csharp/Gunner.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Gunner", "Gunner.csproj", "{0279F69D-A69A-49B6-867C-78AA4F4DB962}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {0279F69D-A69A-49B6-867C-78AA4F4DB962}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0279F69D-A69A-49B6-867C-78AA4F4DB962}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0279F69D-A69A-49B6-867C-78AA4F4DB962}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0279F69D-A69A-49B6-867C-78AA4F4DB962}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {09C668DA-38D4-4EF4-9FCA-EB1FF9EF6067} + EndGlobalSection +EndGlobal diff --git a/42_Gunner/vbnet/Gunner.sln b/42_Gunner/vbnet/Gunner.sln new file mode 100644 index 00000000..33d68126 --- /dev/null +++ b/42_Gunner/vbnet/Gunner.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Gunner", "Gunner.vbproj", "{CC347B04-B99C-4F77-BFCF-2DDFBB4A135D}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {CC347B04-B99C-4F77-BFCF-2DDFBB4A135D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CC347B04-B99C-4F77-BFCF-2DDFBB4A135D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CC347B04-B99C-4F77-BFCF-2DDFBB4A135D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CC347B04-B99C-4F77-BFCF-2DDFBB4A135D}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/42_Gunner/vbnet/Gunner.vbproj b/42_Gunner/vbnet/Gunner.vbproj new file mode 100644 index 00000000..19918a80 --- /dev/null +++ b/42_Gunner/vbnet/Gunner.vbproj @@ -0,0 +1,8 @@ + + + Exe + Gunner + net6.0 + 16.9 + + diff --git a/43_Hammurabi/csharp/src/ActionResult.cs b/43_Hammurabi/csharp/ActionResult.cs similarity index 100% rename from 43_Hammurabi/csharp/src/ActionResult.cs rename to 43_Hammurabi/csharp/ActionResult.cs diff --git a/43_Hammurabi/csharp/src/Controller.cs b/43_Hammurabi/csharp/Controller.cs similarity index 100% rename from 43_Hammurabi/csharp/src/Controller.cs rename to 43_Hammurabi/csharp/Controller.cs diff --git a/43_Hammurabi/csharp/src/GameResult.cs b/43_Hammurabi/csharp/GameResult.cs similarity index 100% rename from 43_Hammurabi/csharp/src/GameResult.cs rename to 43_Hammurabi/csharp/GameResult.cs diff --git a/43_Hammurabi/csharp/src/GameState.cs b/43_Hammurabi/csharp/GameState.cs similarity index 100% rename from 43_Hammurabi/csharp/src/GameState.cs rename to 43_Hammurabi/csharp/GameState.cs diff --git a/43_Hammurabi/csharp/src/GreatOffence.cs b/43_Hammurabi/csharp/GreatOffence.cs similarity index 100% rename from 43_Hammurabi/csharp/src/GreatOffence.cs rename to 43_Hammurabi/csharp/GreatOffence.cs diff --git a/46_Hexapawn/csharp/Hexapawn/Hexapawn.csproj b/43_Hammurabi/csharp/Hammurabi.csproj similarity index 100% rename from 46_Hexapawn/csharp/Hexapawn/Hexapawn.csproj rename to 43_Hammurabi/csharp/Hammurabi.csproj diff --git a/43_Hammurabi/csharp/Hammurabi.sln b/43_Hammurabi/csharp/Hammurabi.sln index feeae212..7475f8fd 100644 --- a/43_Hammurabi/csharp/Hammurabi.sln +++ b/43_Hammurabi/csharp/Hammurabi.sln @@ -1,9 +1,9 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.31129.286 +# Visual Studio Version 17 +VisualStudioVersion = 17.0.32014.148 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Game", "Game.csproj", "{20599300-7C6E-48A2-AB24-EC7CCF224A5C}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Hammurabi", "Hammurabi.csproj", "{2C4407AF-5ED6-4C9F-833E-35461DF7DBBB}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -11,10 +11,10 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {20599300-7C6E-48A2-AB24-EC7CCF224A5C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {20599300-7C6E-48A2-AB24-EC7CCF224A5C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {20599300-7C6E-48A2-AB24-EC7CCF224A5C}.Release|Any CPU.ActiveCfg = Release|Any CPU - {20599300-7C6E-48A2-AB24-EC7CCF224A5C}.Release|Any CPU.Build.0 = Release|Any CPU + {2C4407AF-5ED6-4C9F-833E-35461DF7DBBB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2C4407AF-5ED6-4C9F-833E-35461DF7DBBB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2C4407AF-5ED6-4C9F-833E-35461DF7DBBB}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2C4407AF-5ED6-4C9F-833E-35461DF7DBBB}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/43_Hammurabi/csharp/src/PerformanceRating.cs b/43_Hammurabi/csharp/PerformanceRating.cs similarity index 100% rename from 43_Hammurabi/csharp/src/PerformanceRating.cs rename to 43_Hammurabi/csharp/PerformanceRating.cs diff --git a/43_Hammurabi/csharp/src/Program.cs b/43_Hammurabi/csharp/Program.cs similarity index 100% rename from 43_Hammurabi/csharp/src/Program.cs rename to 43_Hammurabi/csharp/Program.cs diff --git a/43_Hammurabi/csharp/src/Rules.cs b/43_Hammurabi/csharp/Rules.cs similarity index 100% rename from 43_Hammurabi/csharp/src/Rules.cs rename to 43_Hammurabi/csharp/Rules.cs diff --git a/43_Hammurabi/csharp/src/View.cs b/43_Hammurabi/csharp/View.cs similarity index 100% rename from 43_Hammurabi/csharp/src/View.cs rename to 43_Hammurabi/csharp/View.cs diff --git a/43_Hammurabi/vbnet/Hammurabi.sln b/43_Hammurabi/vbnet/Hammurabi.sln new file mode 100644 index 00000000..41a13843 --- /dev/null +++ b/43_Hammurabi/vbnet/Hammurabi.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Hammurabi", "Hammurabi.vbproj", "{52BC86C8-4AE8-4F0C-9566-5E0D97BB17BF}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {52BC86C8-4AE8-4F0C-9566-5E0D97BB17BF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {52BC86C8-4AE8-4F0C-9566-5E0D97BB17BF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {52BC86C8-4AE8-4F0C-9566-5E0D97BB17BF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {52BC86C8-4AE8-4F0C-9566-5E0D97BB17BF}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/43_Hammurabi/vbnet/Hammurabi.vbproj b/43_Hammurabi/vbnet/Hammurabi.vbproj new file mode 100644 index 00000000..8f89306c --- /dev/null +++ b/43_Hammurabi/vbnet/Hammurabi.vbproj @@ -0,0 +1,8 @@ + + + Exe + Hammurabi + net6.0 + 16.9 + + diff --git a/44_Hangman/csharp/Hangman/Graphic.cs b/44_Hangman/csharp/Graphic.cs similarity index 100% rename from 44_Hangman/csharp/Hangman/Graphic.cs rename to 44_Hangman/csharp/Graphic.cs diff --git a/44_Hangman/csharp/Hangman/Hangman.csproj b/44_Hangman/csharp/Hangman.csproj similarity index 100% rename from 44_Hangman/csharp/Hangman/Hangman.csproj rename to 44_Hangman/csharp/Hangman.csproj diff --git a/44_Hangman/csharp/Hangman/Hangman.sln b/44_Hangman/csharp/Hangman.sln similarity index 100% rename from 44_Hangman/csharp/Hangman/Hangman.sln rename to 44_Hangman/csharp/Hangman.sln diff --git a/44_Hangman/csharp/Hangman/Program.cs b/44_Hangman/csharp/Program.cs similarity index 100% rename from 44_Hangman/csharp/Hangman/Program.cs rename to 44_Hangman/csharp/Program.cs diff --git a/44_Hangman/vbnet/Hangman.sln b/44_Hangman/vbnet/Hangman.sln new file mode 100644 index 00000000..355c5093 --- /dev/null +++ b/44_Hangman/vbnet/Hangman.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Hangman", "Hangman.vbproj", "{048C4117-70FC-4457-9B1D-BBD1FEDFEB76}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {048C4117-70FC-4457-9B1D-BBD1FEDFEB76}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {048C4117-70FC-4457-9B1D-BBD1FEDFEB76}.Debug|Any CPU.Build.0 = Debug|Any CPU + {048C4117-70FC-4457-9B1D-BBD1FEDFEB76}.Release|Any CPU.ActiveCfg = Release|Any CPU + {048C4117-70FC-4457-9B1D-BBD1FEDFEB76}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/44_Hangman/vbnet/Hangman.vbproj b/44_Hangman/vbnet/Hangman.vbproj new file mode 100644 index 00000000..6ad7969c --- /dev/null +++ b/44_Hangman/vbnet/Hangman.vbproj @@ -0,0 +1,8 @@ + + + Exe + Hangman + net6.0 + 16.9 + + diff --git a/45_Hello/csharp/Hello.csproj b/45_Hello/csharp/Hello.csproj new file mode 100644 index 00000000..d3fe4757 --- /dev/null +++ b/45_Hello/csharp/Hello.csproj @@ -0,0 +1,9 @@ + + + Exe + net6.0 + 10 + enable + enable + + diff --git a/45_Hello/csharp/Hello.sln b/45_Hello/csharp/Hello.sln new file mode 100644 index 00000000..216c70b6 --- /dev/null +++ b/45_Hello/csharp/Hello.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Hello", "Hello.csproj", "{8ECD89E1-D9E1-4FA5-97B6-B1E68FE1CA16}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {8ECD89E1-D9E1-4FA5-97B6-B1E68FE1CA16}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8ECD89E1-D9E1-4FA5-97B6-B1E68FE1CA16}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8ECD89E1-D9E1-4FA5-97B6-B1E68FE1CA16}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8ECD89E1-D9E1-4FA5-97B6-B1E68FE1CA16}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/45_Hello/vbnet/Hello.sln b/45_Hello/vbnet/Hello.sln new file mode 100644 index 00000000..72ecdc64 --- /dev/null +++ b/45_Hello/vbnet/Hello.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Hello", "Hello.vbproj", "{7E2BDA03-A9F7-4DE5-AB8F-222DD87C833D}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {7E2BDA03-A9F7-4DE5-AB8F-222DD87C833D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7E2BDA03-A9F7-4DE5-AB8F-222DD87C833D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7E2BDA03-A9F7-4DE5-AB8F-222DD87C833D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7E2BDA03-A9F7-4DE5-AB8F-222DD87C833D}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/45_Hello/vbnet/Hello.vbproj b/45_Hello/vbnet/Hello.vbproj new file mode 100644 index 00000000..9b55d805 --- /dev/null +++ b/45_Hello/vbnet/Hello.vbproj @@ -0,0 +1,8 @@ + + + Exe + Hello + net6.0 + 16.9 + + diff --git a/46_Hexapawn/csharp/Hexapawn/Board.cs b/46_Hexapawn/csharp/Board.cs similarity index 100% rename from 46_Hexapawn/csharp/Hexapawn/Board.cs rename to 46_Hexapawn/csharp/Board.cs diff --git a/46_Hexapawn/csharp/Hexapawn/Cell.cs b/46_Hexapawn/csharp/Cell.cs similarity index 100% rename from 46_Hexapawn/csharp/Hexapawn/Cell.cs rename to 46_Hexapawn/csharp/Cell.cs diff --git a/46_Hexapawn/csharp/Hexapawn/Computer.cs b/46_Hexapawn/csharp/Computer.cs similarity index 100% rename from 46_Hexapawn/csharp/Hexapawn/Computer.cs rename to 46_Hexapawn/csharp/Computer.cs diff --git a/46_Hexapawn/csharp/Hexapawn/Game.cs b/46_Hexapawn/csharp/Game.cs similarity index 100% rename from 46_Hexapawn/csharp/Hexapawn/Game.cs rename to 46_Hexapawn/csharp/Game.cs diff --git a/46_Hexapawn/csharp/Hexapawn/GameSeries.cs b/46_Hexapawn/csharp/GameSeries.cs similarity index 100% rename from 46_Hexapawn/csharp/Hexapawn/GameSeries.cs rename to 46_Hexapawn/csharp/GameSeries.cs diff --git a/47_Hi-Lo/csharp/hi-lo.csproj b/46_Hexapawn/csharp/Hexapawn.csproj similarity index 100% rename from 47_Hi-Lo/csharp/hi-lo.csproj rename to 46_Hexapawn/csharp/Hexapawn.csproj diff --git a/46_Hexapawn/csharp/Hexapawn.sln b/46_Hexapawn/csharp/Hexapawn.sln index 6cfc8a8f..06e7b32f 100644 --- a/46_Hexapawn/csharp/Hexapawn.sln +++ b/46_Hexapawn/csharp/Hexapawn.sln @@ -1,34 +1,25 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.26124.0 +# Visual Studio Version 17 +VisualStudioVersion = 17.0.32014.148 MinimumVisualStudioVersion = 15.0.26124.0 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Hexapawn", "Hexapawn\Hexapawn.csproj", "{679D95BE-6E0C-4D8C-A2D4-0957576B63F3}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Hexapawn", "Hexapawn.csproj", "{785DA416-2609-4DB1-9F18-63CF6AC9927E}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 Release|Any CPU = Release|Any CPU - Release|x64 = Release|x64 - Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {785DA416-2609-4DB1-9F18-63CF6AC9927E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {785DA416-2609-4DB1-9F18-63CF6AC9927E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {785DA416-2609-4DB1-9F18-63CF6AC9927E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {785DA416-2609-4DB1-9F18-63CF6AC9927E}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {679D95BE-6E0C-4D8C-A2D4-0957576B63F3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {679D95BE-6E0C-4D8C-A2D4-0957576B63F3}.Debug|Any CPU.Build.0 = Debug|Any CPU - {679D95BE-6E0C-4D8C-A2D4-0957576B63F3}.Debug|x64.ActiveCfg = Debug|Any CPU - {679D95BE-6E0C-4D8C-A2D4-0957576B63F3}.Debug|x64.Build.0 = Debug|Any CPU - {679D95BE-6E0C-4D8C-A2D4-0957576B63F3}.Debug|x86.ActiveCfg = Debug|Any CPU - {679D95BE-6E0C-4D8C-A2D4-0957576B63F3}.Debug|x86.Build.0 = Debug|Any CPU - {679D95BE-6E0C-4D8C-A2D4-0957576B63F3}.Release|Any CPU.ActiveCfg = Release|Any CPU - {679D95BE-6E0C-4D8C-A2D4-0957576B63F3}.Release|Any CPU.Build.0 = Release|Any CPU - {679D95BE-6E0C-4D8C-A2D4-0957576B63F3}.Release|x64.ActiveCfg = Release|Any CPU - {679D95BE-6E0C-4D8C-A2D4-0957576B63F3}.Release|x64.Build.0 = Release|Any CPU - {679D95BE-6E0C-4D8C-A2D4-0957576B63F3}.Release|x86.ActiveCfg = Release|Any CPU - {679D95BE-6E0C-4D8C-A2D4-0957576B63F3}.Release|x86.Build.0 = Release|Any CPU + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {D662AD9F-88B1-4AC9-83AD-DBFC08F384A8} EndGlobalSection EndGlobal diff --git a/46_Hexapawn/csharp/Hexapawn/Human.cs b/46_Hexapawn/csharp/Human.cs similarity index 100% rename from 46_Hexapawn/csharp/Hexapawn/Human.cs rename to 46_Hexapawn/csharp/Human.cs diff --git a/46_Hexapawn/csharp/Hexapawn/IPlayer.cs b/46_Hexapawn/csharp/IPlayer.cs similarity index 100% rename from 46_Hexapawn/csharp/Hexapawn/IPlayer.cs rename to 46_Hexapawn/csharp/IPlayer.cs diff --git a/46_Hexapawn/csharp/Hexapawn/Input.cs b/46_Hexapawn/csharp/Input.cs similarity index 100% rename from 46_Hexapawn/csharp/Hexapawn/Input.cs rename to 46_Hexapawn/csharp/Input.cs diff --git a/46_Hexapawn/csharp/Hexapawn/Move.cs b/46_Hexapawn/csharp/Move.cs similarity index 100% rename from 46_Hexapawn/csharp/Hexapawn/Move.cs rename to 46_Hexapawn/csharp/Move.cs diff --git a/46_Hexapawn/csharp/Hexapawn/Pawn.cs b/46_Hexapawn/csharp/Pawn.cs similarity index 100% rename from 46_Hexapawn/csharp/Hexapawn/Pawn.cs rename to 46_Hexapawn/csharp/Pawn.cs diff --git a/46_Hexapawn/csharp/Hexapawn/Program.cs b/46_Hexapawn/csharp/Program.cs similarity index 100% rename from 46_Hexapawn/csharp/Hexapawn/Program.cs rename to 46_Hexapawn/csharp/Program.cs diff --git a/46_Hexapawn/vbnet/Hexapawn.sln b/46_Hexapawn/vbnet/Hexapawn.sln new file mode 100644 index 00000000..5aff142b --- /dev/null +++ b/46_Hexapawn/vbnet/Hexapawn.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Hexapawn", "Hexapawn.vbproj", "{83C2A51C-6014-4CC7-A4AF-81004B5F721F}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {83C2A51C-6014-4CC7-A4AF-81004B5F721F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {83C2A51C-6014-4CC7-A4AF-81004B5F721F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {83C2A51C-6014-4CC7-A4AF-81004B5F721F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {83C2A51C-6014-4CC7-A4AF-81004B5F721F}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/46_Hexapawn/vbnet/Hexapawn.vbproj b/46_Hexapawn/vbnet/Hexapawn.vbproj new file mode 100644 index 00000000..4ed34b92 --- /dev/null +++ b/46_Hexapawn/vbnet/Hexapawn.vbproj @@ -0,0 +1,8 @@ + + + Exe + Hexapawn + net6.0 + 16.9 + + diff --git a/73_Reverse/csharp/Reverse/Reverse/Reverse.csproj b/47_Hi-Lo/csharp/HiLo.csproj similarity index 100% rename from 73_Reverse/csharp/Reverse/Reverse/Reverse.csproj rename to 47_Hi-Lo/csharp/HiLo.csproj diff --git a/47_Hi-Lo/csharp/HiLo.sln b/47_Hi-Lo/csharp/HiLo.sln new file mode 100644 index 00000000..225235b8 --- /dev/null +++ b/47_Hi-Lo/csharp/HiLo.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HiLo", "HiLo.csproj", "{C4D0FAB6-056D-4DD2-827D-3383BE0AA382}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {C4D0FAB6-056D-4DD2-827D-3383BE0AA382}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C4D0FAB6-056D-4DD2-827D-3383BE0AA382}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C4D0FAB6-056D-4DD2-827D-3383BE0AA382}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C4D0FAB6-056D-4DD2-827D-3383BE0AA382}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {BF77DB59-426B-4A01-A8AC-09AAF42DA633} + EndGlobalSection +EndGlobal diff --git a/47_Hi-Lo/csharp/hi-lo.cs b/47_Hi-Lo/csharp/Program.cs similarity index 100% rename from 47_Hi-Lo/csharp/hi-lo.cs rename to 47_Hi-Lo/csharp/Program.cs diff --git a/47_Hi-Lo/vbnet/HiLo.sln b/47_Hi-Lo/vbnet/HiLo.sln new file mode 100644 index 00000000..fbd97f94 --- /dev/null +++ b/47_Hi-Lo/vbnet/HiLo.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "HiLo", "HiLo.vbproj", "{B93E0994-AEC4-4FC9-93C2-FC708368B32F}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {B93E0994-AEC4-4FC9-93C2-FC708368B32F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B93E0994-AEC4-4FC9-93C2-FC708368B32F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B93E0994-AEC4-4FC9-93C2-FC708368B32F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B93E0994-AEC4-4FC9-93C2-FC708368B32F}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/47_Hi-Lo/vbnet/HiLo.vbproj b/47_Hi-Lo/vbnet/HiLo.vbproj new file mode 100644 index 00000000..634099d3 --- /dev/null +++ b/47_Hi-Lo/vbnet/HiLo.vbproj @@ -0,0 +1,8 @@ + + + Exe + HiLo + net6.0 + 16.9 + + diff --git a/48_High_IQ/csharp/HighIQ.csproj b/48_High_IQ/csharp/HighIQ.csproj new file mode 100644 index 00000000..d3fe4757 --- /dev/null +++ b/48_High_IQ/csharp/HighIQ.csproj @@ -0,0 +1,9 @@ + + + Exe + net6.0 + 10 + enable + enable + + diff --git a/48_High_IQ/csharp/HighIQ.sln b/48_High_IQ/csharp/HighIQ.sln new file mode 100644 index 00000000..2cdbddc4 --- /dev/null +++ b/48_High_IQ/csharp/HighIQ.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HighIQ", "HighIQ.csproj", "{B334E0AD-4A84-4F93-85FB-E6370BC8B71A}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {B334E0AD-4A84-4F93-85FB-E6370BC8B71A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B334E0AD-4A84-4F93-85FB-E6370BC8B71A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B334E0AD-4A84-4F93-85FB-E6370BC8B71A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B334E0AD-4A84-4F93-85FB-E6370BC8B71A}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/48_High_IQ/vbnet/HighIQ.sln b/48_High_IQ/vbnet/HighIQ.sln new file mode 100644 index 00000000..ca1f79c5 --- /dev/null +++ b/48_High_IQ/vbnet/HighIQ.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "HighIQ", "HighIQ.vbproj", "{18AA4FCA-2733-4BBC-B65F-68C37B8CFDAF}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {18AA4FCA-2733-4BBC-B65F-68C37B8CFDAF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {18AA4FCA-2733-4BBC-B65F-68C37B8CFDAF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {18AA4FCA-2733-4BBC-B65F-68C37B8CFDAF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {18AA4FCA-2733-4BBC-B65F-68C37B8CFDAF}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/48_High_IQ/vbnet/HighIQ.vbproj b/48_High_IQ/vbnet/HighIQ.vbproj new file mode 100644 index 00000000..c37eb8db --- /dev/null +++ b/48_High_IQ/vbnet/HighIQ.vbproj @@ -0,0 +1,8 @@ + + + Exe + HighIQ + net6.0 + 16.9 + + diff --git a/49_Hockey/csharp/Hockey.csproj b/49_Hockey/csharp/Hockey.csproj new file mode 100644 index 00000000..d3fe4757 --- /dev/null +++ b/49_Hockey/csharp/Hockey.csproj @@ -0,0 +1,9 @@ + + + Exe + net6.0 + 10 + enable + enable + + diff --git a/49_Hockey/csharp/Hockey.sln b/49_Hockey/csharp/Hockey.sln new file mode 100644 index 00000000..d2ca8d36 --- /dev/null +++ b/49_Hockey/csharp/Hockey.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Hockey", "Hockey.csproj", "{98E2914A-41D4-4931-B17F-4EAD3C98CFE1}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {98E2914A-41D4-4931-B17F-4EAD3C98CFE1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {98E2914A-41D4-4931-B17F-4EAD3C98CFE1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {98E2914A-41D4-4931-B17F-4EAD3C98CFE1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {98E2914A-41D4-4931-B17F-4EAD3C98CFE1}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/49_Hockey/vbnet/Hockey.sln b/49_Hockey/vbnet/Hockey.sln new file mode 100644 index 00000000..396cfe92 --- /dev/null +++ b/49_Hockey/vbnet/Hockey.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Hockey", "Hockey.vbproj", "{9ED23BC7-7C12-4B48-8E85-F21E310813D5}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {9ED23BC7-7C12-4B48-8E85-F21E310813D5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9ED23BC7-7C12-4B48-8E85-F21E310813D5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9ED23BC7-7C12-4B48-8E85-F21E310813D5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9ED23BC7-7C12-4B48-8E85-F21E310813D5}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/49_Hockey/vbnet/Hockey.vbproj b/49_Hockey/vbnet/Hockey.vbproj new file mode 100644 index 00000000..59df31bf --- /dev/null +++ b/49_Hockey/vbnet/Hockey.vbproj @@ -0,0 +1,8 @@ + + + Exe + Hockey + net6.0 + 16.9 + + diff --git a/50_Horserace/csharp/Horserace.csproj b/50_Horserace/csharp/Horserace.csproj new file mode 100644 index 00000000..d3fe4757 --- /dev/null +++ b/50_Horserace/csharp/Horserace.csproj @@ -0,0 +1,9 @@ + + + Exe + net6.0 + 10 + enable + enable + + diff --git a/50_Horserace/csharp/Horserace.sln b/50_Horserace/csharp/Horserace.sln new file mode 100644 index 00000000..17d7fae3 --- /dev/null +++ b/50_Horserace/csharp/Horserace.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Horserace", "Horserace.csproj", "{B1CD8505-43BA-4C2C-A458-54E14539DB35}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {B1CD8505-43BA-4C2C-A458-54E14539DB35}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B1CD8505-43BA-4C2C-A458-54E14539DB35}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B1CD8505-43BA-4C2C-A458-54E14539DB35}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B1CD8505-43BA-4C2C-A458-54E14539DB35}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/50_Horserace/vbnet/Horserace.sln b/50_Horserace/vbnet/Horserace.sln new file mode 100644 index 00000000..63adf310 --- /dev/null +++ b/50_Horserace/vbnet/Horserace.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Horserace", "Horserace.vbproj", "{B44BF36F-DF93-4374-A3A0-C6D447B4D0A7}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {B44BF36F-DF93-4374-A3A0-C6D447B4D0A7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B44BF36F-DF93-4374-A3A0-C6D447B4D0A7}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B44BF36F-DF93-4374-A3A0-C6D447B4D0A7}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B44BF36F-DF93-4374-A3A0-C6D447B4D0A7}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/50_Horserace/vbnet/Horserace.vbproj b/50_Horserace/vbnet/Horserace.vbproj new file mode 100644 index 00000000..245d9098 --- /dev/null +++ b/50_Horserace/vbnet/Horserace.vbproj @@ -0,0 +1,8 @@ + + + Exe + Horserace + net6.0 + 16.9 + + diff --git a/51_Hurkle/csharp/src/hurkle/CardinalDirection.cs b/51_Hurkle/csharp/CardinalDirection.cs similarity index 100% rename from 51_Hurkle/csharp/src/hurkle/CardinalDirection.cs rename to 51_Hurkle/csharp/CardinalDirection.cs diff --git a/51_Hurkle/csharp/src/hurkle/ConsoleHurkleView.cs b/51_Hurkle/csharp/ConsoleHurkleView.cs similarity index 100% rename from 51_Hurkle/csharp/src/hurkle/ConsoleHurkleView.cs rename to 51_Hurkle/csharp/ConsoleHurkleView.cs diff --git a/51_Hurkle/csharp/src/hurkle/FailedGuessViewModel.cs b/51_Hurkle/csharp/FailedGuessViewModel.cs similarity index 100% rename from 51_Hurkle/csharp/src/hurkle/FailedGuessViewModel.cs rename to 51_Hurkle/csharp/FailedGuessViewModel.cs diff --git a/51_Hurkle/csharp/src/hurkle/GamePoint.cs b/51_Hurkle/csharp/GamePoint.cs similarity index 100% rename from 51_Hurkle/csharp/src/hurkle/GamePoint.cs rename to 51_Hurkle/csharp/GamePoint.cs diff --git a/51_Hurkle/csharp/src/hurkle/GuessViewModel.cs b/51_Hurkle/csharp/GuessViewModel.cs similarity index 100% rename from 51_Hurkle/csharp/src/hurkle/GuessViewModel.cs rename to 51_Hurkle/csharp/GuessViewModel.cs diff --git a/76_Russian_Roulette/csharp/RussianRoulette/RussianRoulette.csproj b/51_Hurkle/csharp/Hurkle.csproj similarity index 100% rename from 76_Russian_Roulette/csharp/RussianRoulette/RussianRoulette.csproj rename to 51_Hurkle/csharp/Hurkle.csproj diff --git a/51_Hurkle/csharp/Hurkle.sln b/51_Hurkle/csharp/Hurkle.sln new file mode 100644 index 00000000..d1a6fb25 --- /dev/null +++ b/51_Hurkle/csharp/Hurkle.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Hurkle", "Hurkle.csproj", "{BE321D5B-93BD-4F91-A875-564DC9D4094F}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {BE321D5B-93BD-4F91-A875-564DC9D4094F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {BE321D5B-93BD-4F91-A875-564DC9D4094F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {BE321D5B-93BD-4F91-A875-564DC9D4094F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {BE321D5B-93BD-4F91-A875-564DC9D4094F}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {42DC6AE5-5127-4B1B-BD5E-F3B1CCDC3822} + EndGlobalSection +EndGlobal diff --git a/51_Hurkle/csharp/src/hurkle/HurkleGame.cs b/51_Hurkle/csharp/HurkleGame.cs similarity index 100% rename from 51_Hurkle/csharp/src/hurkle/HurkleGame.cs rename to 51_Hurkle/csharp/HurkleGame.cs diff --git a/51_Hurkle/csharp/src/hurkle/IHurkleView.cs b/51_Hurkle/csharp/IHurkleView.cs similarity index 100% rename from 51_Hurkle/csharp/src/hurkle/IHurkleView.cs rename to 51_Hurkle/csharp/IHurkleView.cs diff --git a/51_Hurkle/csharp/src/hurkle/LossViewModel.cs b/51_Hurkle/csharp/LossViewModel.cs similarity index 100% rename from 51_Hurkle/csharp/src/hurkle/LossViewModel.cs rename to 51_Hurkle/csharp/LossViewModel.cs diff --git a/51_Hurkle/csharp/src/hurkle/Program.cs b/51_Hurkle/csharp/Program.cs similarity index 97% rename from 51_Hurkle/csharp/src/hurkle/Program.cs rename to 51_Hurkle/csharp/Program.cs index 148308d1..e5c3f6af 100644 --- a/51_Hurkle/csharp/src/hurkle/Program.cs +++ b/51_Hurkle/csharp/Program.cs @@ -1,64 +1,64 @@ -using System; - -namespace hurkle -{ - class Program - { - static void Main(string[] args) - { - /* - Original source transscription - 10 PRINT TAB(33);"HURKLE" - 20 PRINT TAB(15);"CREATIVE COMPUTING NORRISTOWN, NEW JERSEY" - 30 PRINT;PRINT;PRINT - */ - Console.WriteLine(new string(' ', 33) + @"HURKLE"); - Console.WriteLine(new string(' ', 15) + @"CREATIVE COMPUTING NORRISTOWN, NEW JERSEY"); - /* - 110 N=5 - 120 G=10 - */ - var N=5; - var G=10; - /* - 210 PRINT - 220 PRINT "A HURKLE IS HIDING ON A";G;"BY";G;"GRID. HOMEBASE" - 230 PRINT "ON THE GRID IS POINT 0,0 AND ANY GRIDPOINT IS A" - 240 PRINT "PAIR OF WHOLE NUMBERS SEPERATED BY A COMMA. TRY TO" - 250 PRINT "GUESS THE HURKLE'S GRIDPOINT. YOU GET";N;"TRIES." - 260 PRINT "AFTER EACH TRY, I WILL TELL YOU THE APPROXIMATE" - 270 PRINT "DIRECTION TO GO TO LOOK FOR THE HURKLE." - 280 PRINT - */ - // Using string formatting via the '$' string - Console.WriteLine(); - Console.WriteLine($"A HURKLE IS HIDING ON A {G} BY {G} GRID. HOMEBASE"); - Console.WriteLine(@"ON THE GRID IS POINT 0,0 AND ANY GRIDPOINT IS A"); - Console.WriteLine(@"PAIR OF WHOLE NUMBERS SEPERATED BY A COMMA. TRY TO"); - Console.WriteLine($"GUESS THE HURKLE'S GRIDPOINT. YOU GET {N} TRIES."); - Console.WriteLine(@"AFTER EACH TRY, I WILL TELL YOU THE APPROXIMATE"); - Console.WriteLine(@"DIRECTION TO GO TO LOOK FOR THE HURKLE."); - Console.WriteLine(); - - var view = new ConsoleHurkleView(); - var hurkle = new HurkleGame(N,G, view); - while(true) - { - hurkle.PlayGame(); - - Console.WriteLine("PLAY AGAIN? (Y)ES/(N)O"); - var playAgainResponse = Console.ReadLine(); - if(playAgainResponse.Trim().StartsWith("y", StringComparison.InvariantCultureIgnoreCase)) - { - Console.WriteLine(); - Console.WriteLine("LET'S PLAY AGAIN. HURKLE IS HIDING"); - Console.WriteLine(); - }else{ - Console.WriteLine("THANKS FOR PLAYING!"); - break; - } - - } - } - } -} +using System; + +namespace hurkle +{ + class Program + { + static void Main(string[] args) + { + /* + Original source transscription + 10 PRINT TAB(33);"HURKLE" + 20 PRINT TAB(15);"CREATIVE COMPUTING NORRISTOWN, NEW JERSEY" + 30 PRINT;PRINT;PRINT + */ + Console.WriteLine(new string(' ', 33) + @"HURKLE"); + Console.WriteLine(new string(' ', 15) + @"CREATIVE COMPUTING NORRISTOWN, NEW JERSEY"); + /* + 110 N=5 + 120 G=10 + */ + var N=5; + var G=10; + /* + 210 PRINT + 220 PRINT "A HURKLE IS HIDING ON A";G;"BY";G;"GRID. HOMEBASE" + 230 PRINT "ON THE GRID IS POINT 0,0 AND ANY GRIDPOINT IS A" + 240 PRINT "PAIR OF WHOLE NUMBERS SEPERATED BY A COMMA. TRY TO" + 250 PRINT "GUESS THE HURKLE'S GRIDPOINT. YOU GET";N;"TRIES." + 260 PRINT "AFTER EACH TRY, I WILL TELL YOU THE APPROXIMATE" + 270 PRINT "DIRECTION TO GO TO LOOK FOR THE HURKLE." + 280 PRINT + */ + // Using string formatting via the '$' string + Console.WriteLine(); + Console.WriteLine($"A HURKLE IS HIDING ON A {G} BY {G} GRID. HOMEBASE"); + Console.WriteLine(@"ON THE GRID IS POINT 0,0 AND ANY GRIDPOINT IS A"); + Console.WriteLine(@"PAIR OF WHOLE NUMBERS SEPERATED BY A COMMA. TRY TO"); + Console.WriteLine($"GUESS THE HURKLE'S GRIDPOINT. YOU GET {N} TRIES."); + Console.WriteLine(@"AFTER EACH TRY, I WILL TELL YOU THE APPROXIMATE"); + Console.WriteLine(@"DIRECTION TO GO TO LOOK FOR THE HURKLE."); + Console.WriteLine(); + + var view = new ConsoleHurkleView(); + var hurkle = new HurkleGame(N,G, view); + while(true) + { + hurkle.PlayGame(); + + Console.WriteLine("PLAY AGAIN? (Y)ES/(N)O"); + var playAgainResponse = Console.ReadLine(); + if(playAgainResponse.Trim().StartsWith("y", StringComparison.InvariantCultureIgnoreCase)) + { + Console.WriteLine(); + Console.WriteLine("LET'S PLAY AGAIN. HURKLE IS HIDING"); + Console.WriteLine(); + }else{ + Console.WriteLine("THANKS FOR PLAYING!"); + break; + } + + } + } + } +} diff --git a/51_Hurkle/csharp/src/hurkle/VictoryViewModel.cs b/51_Hurkle/csharp/VictoryViewModel.cs similarity index 100% rename from 51_Hurkle/csharp/src/hurkle/VictoryViewModel.cs rename to 51_Hurkle/csharp/VictoryViewModel.cs diff --git a/51_Hurkle/vbnet/Hurkle.sln b/51_Hurkle/vbnet/Hurkle.sln new file mode 100644 index 00000000..dda01502 --- /dev/null +++ b/51_Hurkle/vbnet/Hurkle.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Hurkle", "Hurkle.vbproj", "{63674AC0-0FE6-467F-B2D0-016105155ADE}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {63674AC0-0FE6-467F-B2D0-016105155ADE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {63674AC0-0FE6-467F-B2D0-016105155ADE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {63674AC0-0FE6-467F-B2D0-016105155ADE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {63674AC0-0FE6-467F-B2D0-016105155ADE}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/51_Hurkle/vbnet/Hurkle.vbproj b/51_Hurkle/vbnet/Hurkle.vbproj new file mode 100644 index 00000000..9d93e823 --- /dev/null +++ b/51_Hurkle/vbnet/Hurkle.vbproj @@ -0,0 +1,8 @@ + + + Exe + Hurkle + net6.0 + 16.9 + + diff --git a/52_Kinema/csharp/Kinema.csproj b/52_Kinema/csharp/Kinema.csproj new file mode 100644 index 00000000..d3fe4757 --- /dev/null +++ b/52_Kinema/csharp/Kinema.csproj @@ -0,0 +1,9 @@ + + + Exe + net6.0 + 10 + enable + enable + + diff --git a/52_Kinema/csharp/Kinema.sln b/52_Kinema/csharp/Kinema.sln new file mode 100644 index 00000000..ddd98662 --- /dev/null +++ b/52_Kinema/csharp/Kinema.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Kinema", "Kinema.csproj", "{FD7FF20E-F7A8-4372-BF7C-6898BDEF53D7}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {FD7FF20E-F7A8-4372-BF7C-6898BDEF53D7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FD7FF20E-F7A8-4372-BF7C-6898BDEF53D7}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FD7FF20E-F7A8-4372-BF7C-6898BDEF53D7}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FD7FF20E-F7A8-4372-BF7C-6898BDEF53D7}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/52_Kinema/vbnet/Kinema.sln b/52_Kinema/vbnet/Kinema.sln new file mode 100644 index 00000000..a669536c --- /dev/null +++ b/52_Kinema/vbnet/Kinema.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Kinema", "Kinema.vbproj", "{C929831F-0B1C-4EE4-9BAA-001BE5CCC2E2}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {C929831F-0B1C-4EE4-9BAA-001BE5CCC2E2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C929831F-0B1C-4EE4-9BAA-001BE5CCC2E2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C929831F-0B1C-4EE4-9BAA-001BE5CCC2E2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C929831F-0B1C-4EE4-9BAA-001BE5CCC2E2}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/52_Kinema/vbnet/Kinema.vbproj b/52_Kinema/vbnet/Kinema.vbproj new file mode 100644 index 00000000..b779698b --- /dev/null +++ b/52_Kinema/vbnet/Kinema.vbproj @@ -0,0 +1,8 @@ + + + Exe + Kinema + net6.0 + 16.9 + + diff --git a/53_King/csharp/King.csproj b/53_King/csharp/King.csproj new file mode 100644 index 00000000..d3fe4757 --- /dev/null +++ b/53_King/csharp/King.csproj @@ -0,0 +1,9 @@ + + + Exe + net6.0 + 10 + enable + enable + + diff --git a/53_King/csharp/King.sln b/53_King/csharp/King.sln new file mode 100644 index 00000000..94eb4d7d --- /dev/null +++ b/53_King/csharp/King.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "King", "King.csproj", "{6CB6A32F-FFC7-4839-AAE2-4091D349BD34}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {6CB6A32F-FFC7-4839-AAE2-4091D349BD34}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6CB6A32F-FFC7-4839-AAE2-4091D349BD34}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6CB6A32F-FFC7-4839-AAE2-4091D349BD34}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6CB6A32F-FFC7-4839-AAE2-4091D349BD34}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/53_King/vbnet/King.sln b/53_King/vbnet/King.sln new file mode 100644 index 00000000..c5bdb50c --- /dev/null +++ b/53_King/vbnet/King.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "King", "King.vbproj", "{043D7CC7-1FFC-438E-BB00-31CB467BEB73}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {043D7CC7-1FFC-438E-BB00-31CB467BEB73}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {043D7CC7-1FFC-438E-BB00-31CB467BEB73}.Debug|Any CPU.Build.0 = Debug|Any CPU + {043D7CC7-1FFC-438E-BB00-31CB467BEB73}.Release|Any CPU.ActiveCfg = Release|Any CPU + {043D7CC7-1FFC-438E-BB00-31CB467BEB73}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/53_King/vbnet/King.vbproj b/53_King/vbnet/King.vbproj new file mode 100644 index 00000000..62bef191 --- /dev/null +++ b/53_King/vbnet/King.vbproj @@ -0,0 +1,8 @@ + + + Exe + King + net6.0 + 16.9 + + diff --git a/54_Letter/csharp/Letter.csproj b/54_Letter/csharp/Letter.csproj new file mode 100644 index 00000000..d3fe4757 --- /dev/null +++ b/54_Letter/csharp/Letter.csproj @@ -0,0 +1,9 @@ + + + Exe + net6.0 + 10 + enable + enable + + diff --git a/54_Letter/csharp/Letter.sln b/54_Letter/csharp/Letter.sln new file mode 100644 index 00000000..3f567521 --- /dev/null +++ b/54_Letter/csharp/Letter.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Letter", "Letter.csproj", "{8BE20DCF-A729-46ED-92EA-55866844EB93}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {8BE20DCF-A729-46ED-92EA-55866844EB93}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8BE20DCF-A729-46ED-92EA-55866844EB93}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8BE20DCF-A729-46ED-92EA-55866844EB93}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8BE20DCF-A729-46ED-92EA-55866844EB93}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/54_Letter/vbnet/Letter.sln b/54_Letter/vbnet/Letter.sln new file mode 100644 index 00000000..e2896128 --- /dev/null +++ b/54_Letter/vbnet/Letter.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Letter", "Letter.vbproj", "{15392FFC-0EBB-4CA3-970F-8AC32DE84724}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {15392FFC-0EBB-4CA3-970F-8AC32DE84724}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {15392FFC-0EBB-4CA3-970F-8AC32DE84724}.Debug|Any CPU.Build.0 = Debug|Any CPU + {15392FFC-0EBB-4CA3-970F-8AC32DE84724}.Release|Any CPU.ActiveCfg = Release|Any CPU + {15392FFC-0EBB-4CA3-970F-8AC32DE84724}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/54_Letter/vbnet/Letter.vbproj b/54_Letter/vbnet/Letter.vbproj new file mode 100644 index 00000000..0c55e2e6 --- /dev/null +++ b/54_Letter/vbnet/Letter.vbproj @@ -0,0 +1,8 @@ + + + Exe + Letter + net6.0 + 16.9 + + diff --git a/55_Life/perl/life.pl b/55_Life/perl/life.pl new file mode 100644 index 00000000..972cb322 --- /dev/null +++ b/55_Life/perl/life.pl @@ -0,0 +1,95 @@ +#!/usr/bin/perl +#use strict; + +print ' 'x 34 . "LIFE\n"; +print ' 'x 15 . "CREATIVE COMPUTING MORRISTOWN, NEW JERSEY\n"; +print "\n"; print "\n"; print "\n"; +print "ENTER YOUR PATTERN; \n"; +$X1=1; $Y1=1; $X2=24; $Y2=70; +@A; +$C=1; + +@B; +Line30: +print "? "; chomp($B[$C] = uc()); +if ($B[$C] eq "DONE") { $B[$C]=""; goto Line80; } +$B[$C]=~ s/\./ /g; +$C=$C+1; +goto Line30; + + +Line80: + +$C=$C-1; $L=0; $G=0; +for ($X=1; $X<=$C-1; $X++) { + if (length($B[$X])>$L) { $L=length($B[$X]); } + } + +$X1=11-$C/2; +$Y1=33-$L/2; +for ($X=1; $X<=$C; $X++) { + for ($Y=1; $Y<=length($B[$X]); $Y++) { + if (substr($B[$X],$Y-1,1) ne " ") { $A[$X1+$X][$Y1+$Y]=1; $P=$P+1; } + } + } +print "\n"; print "\n"; print "\n"; + +Line210: +print "GENERATION: ".$G."\t\tPOPULATION: ".$P; if ($I9) { print "\tINVALID!"; } +print "\n"; +$X3=24; $Y3=70; $X4=1; $Y4=1; $P=0; +$G=$G+1; +for ($X=1; $X<=$X1-1; $X++) { print "\n"; } +for ($X=$X1; $X<=$X2; $X++) { + $Row= " "x 80; + for ($Y=$Y1; $Y<=$Y2; $Y++) { + if ($A[$X][$Y]==2) { $A[$X][$Y]=0; goto Line270; } + if ($A[$X][$Y]==3) { $A[$X][$Y]=1; goto Line261; } + if ($A[$X][$Y]!=1) { goto Line270; } + + Line261: + substr($Row, $Y, 1, "*"); + if ($X<$X3) { $X3=$X; } + if ($X>$X4) { $X4=$X; } + if ($Y<$Y3) { $Y3=$Y; } + if ($Y>$Y4) { $Y4=$Y; } + + Line270: + } + print "$Row\n"; + } + +for ($X=$X2+1; $X<=24; $X++) { print "\n"; } +$X1=$X3; $X2=$X4; $Y1=$Y3; $Y2=$Y4; +if ($X1<3) { $X1=3; $I9=-1; } +if ($X2>22) { $X2=22; $I9=-1; } +if ($Y1<3) { $Y1=3; $I9=-1; } +if ($Y2>68) { $Y2=68; $I9=-1; } +$P=0; + +for ($X=$X1-1; $X<=$X2+1; $X++) { + for ($Y=$Y1-1; $Y<=$Y2+1; $Y++) { + $C=0; + for ($I=$X-1; $I<=$X+1; $I++) { + for ($J=$Y-1; $J<=$Y+1; $J++) { + if ($A[$I][$J]==1 || $A[$I][$J]==2) { $C=$C+1; } + } + } + if ($A[$X][$Y]==0) { goto Line610; } + if ($C<3 || $C>4) { $A[$X][$Y]=2; goto Line600; } + $P=$P+1; + + Line600: + goto Line620; + + Line610: + if ($C==3) { $A[$X][$Y]=3; $P=$P+1; } + + Line620: + } + } +$X1=$X1-1; $Y1=$Y1-1; $X2=$X2+1; $Y2=$Y2+1; +goto Line210; +exit; + + diff --git a/55_Life/vbnet/Life.sln b/55_Life/vbnet/Life.sln new file mode 100644 index 00000000..8feae175 --- /dev/null +++ b/55_Life/vbnet/Life.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Life", "Life.vbproj", "{05455AEE-3BE0-4DDD-A59E-89F862EF68AE}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {05455AEE-3BE0-4DDD-A59E-89F862EF68AE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {05455AEE-3BE0-4DDD-A59E-89F862EF68AE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {05455AEE-3BE0-4DDD-A59E-89F862EF68AE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {05455AEE-3BE0-4DDD-A59E-89F862EF68AE}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/55_Life/vbnet/Life.vbproj b/55_Life/vbnet/Life.vbproj new file mode 100644 index 00000000..5d62487f --- /dev/null +++ b/55_Life/vbnet/Life.vbproj @@ -0,0 +1,8 @@ + + + Exe + Life + net6.0 + 16.9 + + diff --git a/56_Life_for_Two/csharp/LifeforTwo.csproj b/56_Life_for_Two/csharp/LifeforTwo.csproj new file mode 100644 index 00000000..d3fe4757 --- /dev/null +++ b/56_Life_for_Two/csharp/LifeforTwo.csproj @@ -0,0 +1,9 @@ + + + Exe + net6.0 + 10 + enable + enable + + diff --git a/56_Life_for_Two/csharp/LifeforTwo.sln b/56_Life_for_Two/csharp/LifeforTwo.sln new file mode 100644 index 00000000..7a5585cb --- /dev/null +++ b/56_Life_for_Two/csharp/LifeforTwo.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LifeforTwo", "LifeforTwo.csproj", "{B2BFE429-A4BC-4CEA-881E-32382182EA32}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {B2BFE429-A4BC-4CEA-881E-32382182EA32}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B2BFE429-A4BC-4CEA-881E-32382182EA32}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B2BFE429-A4BC-4CEA-881E-32382182EA32}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B2BFE429-A4BC-4CEA-881E-32382182EA32}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/56_Life_for_Two/vbnet/LifeforTwo.sln b/56_Life_for_Two/vbnet/LifeforTwo.sln new file mode 100644 index 00000000..2d5167d3 --- /dev/null +++ b/56_Life_for_Two/vbnet/LifeforTwo.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "LifeforTwo", "LifeforTwo.vbproj", "{571A55BD-86BA-4DD2-9769-B258E7654586}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {571A55BD-86BA-4DD2-9769-B258E7654586}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {571A55BD-86BA-4DD2-9769-B258E7654586}.Debug|Any CPU.Build.0 = Debug|Any CPU + {571A55BD-86BA-4DD2-9769-B258E7654586}.Release|Any CPU.ActiveCfg = Release|Any CPU + {571A55BD-86BA-4DD2-9769-B258E7654586}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/56_Life_for_Two/vbnet/LifeforTwo.vbproj b/56_Life_for_Two/vbnet/LifeforTwo.vbproj new file mode 100644 index 00000000..31087af1 --- /dev/null +++ b/56_Life_for_Two/vbnet/LifeforTwo.vbproj @@ -0,0 +1,8 @@ + + + Exe + LifeforTwo + net6.0 + 16.9 + + diff --git a/57_Literature_Quiz/csharp/LiteratureQuiz.csproj b/57_Literature_Quiz/csharp/LiteratureQuiz.csproj new file mode 100644 index 00000000..d3fe4757 --- /dev/null +++ b/57_Literature_Quiz/csharp/LiteratureQuiz.csproj @@ -0,0 +1,9 @@ + + + Exe + net6.0 + 10 + enable + enable + + diff --git a/57_Literature_Quiz/csharp/LiteratureQuiz.sln b/57_Literature_Quiz/csharp/LiteratureQuiz.sln new file mode 100644 index 00000000..8ba67c92 --- /dev/null +++ b/57_Literature_Quiz/csharp/LiteratureQuiz.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LiteratureQuiz", "LiteratureQuiz.csproj", "{1B77EECB-5ECC-41E5-BD12-519CA4C745AE}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {1B77EECB-5ECC-41E5-BD12-519CA4C745AE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1B77EECB-5ECC-41E5-BD12-519CA4C745AE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1B77EECB-5ECC-41E5-BD12-519CA4C745AE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1B77EECB-5ECC-41E5-BD12-519CA4C745AE}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/57_Literature_Quiz/vbnet/LiteratureQuiz.sln b/57_Literature_Quiz/vbnet/LiteratureQuiz.sln new file mode 100644 index 00000000..67ca803d --- /dev/null +++ b/57_Literature_Quiz/vbnet/LiteratureQuiz.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "LiteratureQuiz", "LiteratureQuiz.vbproj", "{7897F5C5-055B-449D-9BD5-1F631DA87D06}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {7897F5C5-055B-449D-9BD5-1F631DA87D06}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7897F5C5-055B-449D-9BD5-1F631DA87D06}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7897F5C5-055B-449D-9BD5-1F631DA87D06}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7897F5C5-055B-449D-9BD5-1F631DA87D06}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/57_Literature_Quiz/vbnet/LiteratureQuiz.vbproj b/57_Literature_Quiz/vbnet/LiteratureQuiz.vbproj new file mode 100644 index 00000000..32c35664 --- /dev/null +++ b/57_Literature_Quiz/vbnet/LiteratureQuiz.vbproj @@ -0,0 +1,8 @@ + + + Exe + LiteratureQuiz + net6.0 + 16.9 + + diff --git a/58_Love/csharp/Love/Input.cs b/58_Love/csharp/Input.cs similarity index 100% rename from 58_Love/csharp/Love/Input.cs rename to 58_Love/csharp/Input.cs diff --git a/58_Love/csharp/Love/Love.csproj b/58_Love/csharp/Love.csproj similarity index 100% rename from 58_Love/csharp/Love/Love.csproj rename to 58_Love/csharp/Love.csproj diff --git a/58_Love/csharp/Love.sln b/58_Love/csharp/Love.sln index a89fd1d8..813af0f2 100644 --- a/58_Love/csharp/Love.sln +++ b/58_Love/csharp/Love.sln @@ -1,34 +1,25 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.26124.0 +# Visual Studio Version 17 +VisualStudioVersion = 17.0.32014.148 MinimumVisualStudioVersion = 15.0.26124.0 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Love", "Love\Love.csproj", "{FC74E025-A50D-4E19-9337-87F2E4A9F83E}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Love", "Love.csproj", "{1C02A3CA-615B-42CF-B696-4514770CA67F}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 Release|Any CPU = Release|Any CPU - Release|x64 = Release|x64 - Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {1C02A3CA-615B-42CF-B696-4514770CA67F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1C02A3CA-615B-42CF-B696-4514770CA67F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1C02A3CA-615B-42CF-B696-4514770CA67F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1C02A3CA-615B-42CF-B696-4514770CA67F}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {FC74E025-A50D-4E19-9337-87F2E4A9F83E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {FC74E025-A50D-4E19-9337-87F2E4A9F83E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {FC74E025-A50D-4E19-9337-87F2E4A9F83E}.Debug|x64.ActiveCfg = Debug|Any CPU - {FC74E025-A50D-4E19-9337-87F2E4A9F83E}.Debug|x64.Build.0 = Debug|Any CPU - {FC74E025-A50D-4E19-9337-87F2E4A9F83E}.Debug|x86.ActiveCfg = Debug|Any CPU - {FC74E025-A50D-4E19-9337-87F2E4A9F83E}.Debug|x86.Build.0 = Debug|Any CPU - {FC74E025-A50D-4E19-9337-87F2E4A9F83E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {FC74E025-A50D-4E19-9337-87F2E4A9F83E}.Release|Any CPU.Build.0 = Release|Any CPU - {FC74E025-A50D-4E19-9337-87F2E4A9F83E}.Release|x64.ActiveCfg = Release|Any CPU - {FC74E025-A50D-4E19-9337-87F2E4A9F83E}.Release|x64.Build.0 = Release|Any CPU - {FC74E025-A50D-4E19-9337-87F2E4A9F83E}.Release|x86.ActiveCfg = Release|Any CPU - {FC74E025-A50D-4E19-9337-87F2E4A9F83E}.Release|x86.Build.0 = Release|Any CPU + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {F9C55508-108B-4EA1-ADD7-4BA8EC915E68} EndGlobalSection EndGlobal diff --git a/58_Love/csharp/Love/LovePattern.cs b/58_Love/csharp/LovePattern.cs similarity index 100% rename from 58_Love/csharp/Love/LovePattern.cs rename to 58_Love/csharp/LovePattern.cs diff --git a/58_Love/csharp/Love/Program.cs b/58_Love/csharp/Program.cs similarity index 100% rename from 58_Love/csharp/Love/Program.cs rename to 58_Love/csharp/Program.cs diff --git a/58_Love/csharp/Love/SourceCharacters.cs b/58_Love/csharp/SourceCharacters.cs similarity index 100% rename from 58_Love/csharp/Love/SourceCharacters.cs rename to 58_Love/csharp/SourceCharacters.cs diff --git a/58_Love/csharp/Love/Strings/Intro.txt b/58_Love/csharp/Strings/Intro.txt similarity index 100% rename from 58_Love/csharp/Love/Strings/Intro.txt rename to 58_Love/csharp/Strings/Intro.txt diff --git a/58_Love/vbnet/Love.sln b/58_Love/vbnet/Love.sln new file mode 100644 index 00000000..44ae6e7f --- /dev/null +++ b/58_Love/vbnet/Love.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Love", "Love.vbproj", "{440AD3C3-D842-4717-BB4D-C54463F59ECA}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {440AD3C3-D842-4717-BB4D-C54463F59ECA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {440AD3C3-D842-4717-BB4D-C54463F59ECA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {440AD3C3-D842-4717-BB4D-C54463F59ECA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {440AD3C3-D842-4717-BB4D-C54463F59ECA}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/58_Love/vbnet/Love.vbproj b/58_Love/vbnet/Love.vbproj new file mode 100644 index 00000000..444df2a3 --- /dev/null +++ b/58_Love/vbnet/Love.vbproj @@ -0,0 +1,8 @@ + + + Exe + Love + net6.0 + 16.9 + + diff --git a/59_Lunar_LEM_Rocket/csharp/LunarLEMRocket.csproj b/59_Lunar_LEM_Rocket/csharp/LunarLEMRocket.csproj new file mode 100644 index 00000000..d3fe4757 --- /dev/null +++ b/59_Lunar_LEM_Rocket/csharp/LunarLEMRocket.csproj @@ -0,0 +1,9 @@ + + + Exe + net6.0 + 10 + enable + enable + + diff --git a/59_Lunar_LEM_Rocket/csharp/LunarLEMRocket.sln b/59_Lunar_LEM_Rocket/csharp/LunarLEMRocket.sln new file mode 100644 index 00000000..4f74244d --- /dev/null +++ b/59_Lunar_LEM_Rocket/csharp/LunarLEMRocket.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LunarLEMRocket", "LunarLEMRocket.csproj", "{12D3D8F6-5468-49BD-BDD6-E9B4D5954496}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {12D3D8F6-5468-49BD-BDD6-E9B4D5954496}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {12D3D8F6-5468-49BD-BDD6-E9B4D5954496}.Debug|Any CPU.Build.0 = Debug|Any CPU + {12D3D8F6-5468-49BD-BDD6-E9B4D5954496}.Release|Any CPU.ActiveCfg = Release|Any CPU + {12D3D8F6-5468-49BD-BDD6-E9B4D5954496}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/59_Lunar_LEM_Rocket/vbnet/LunarLEMRocket.sln b/59_Lunar_LEM_Rocket/vbnet/LunarLEMRocket.sln new file mode 100644 index 00000000..a77348e6 --- /dev/null +++ b/59_Lunar_LEM_Rocket/vbnet/LunarLEMRocket.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "LunarLEMRocket", "LunarLEMRocket.vbproj", "{6145C5DF-CFFB-42B8-9025-913D9D4A8B10}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {6145C5DF-CFFB-42B8-9025-913D9D4A8B10}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6145C5DF-CFFB-42B8-9025-913D9D4A8B10}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6145C5DF-CFFB-42B8-9025-913D9D4A8B10}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6145C5DF-CFFB-42B8-9025-913D9D4A8B10}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/59_Lunar_LEM_Rocket/vbnet/LunarLEMRocket.vbproj b/59_Lunar_LEM_Rocket/vbnet/LunarLEMRocket.vbproj new file mode 100644 index 00000000..553bdcd5 --- /dev/null +++ b/59_Lunar_LEM_Rocket/vbnet/LunarLEMRocket.vbproj @@ -0,0 +1,8 @@ + + + Exe + LunarLEMRocket + net6.0 + 16.9 + + diff --git a/60_Mastermind/csharp/Game/src/Code.cs b/60_Mastermind/csharp/Code.cs similarity index 100% rename from 60_Mastermind/csharp/Game/src/Code.cs rename to 60_Mastermind/csharp/Code.cs diff --git a/60_Mastermind/csharp/Game/src/CodeFactory.cs b/60_Mastermind/csharp/CodeFactory.cs similarity index 100% rename from 60_Mastermind/csharp/Game/src/CodeFactory.cs rename to 60_Mastermind/csharp/CodeFactory.cs diff --git a/60_Mastermind/csharp/Game/src/ColorInfo.cs b/60_Mastermind/csharp/ColorInfo.cs similarity index 100% rename from 60_Mastermind/csharp/Game/src/ColorInfo.cs rename to 60_Mastermind/csharp/ColorInfo.cs diff --git a/60_Mastermind/csharp/Game/src/Colors.cs b/60_Mastermind/csharp/Colors.cs similarity index 100% rename from 60_Mastermind/csharp/Game/src/Colors.cs rename to 60_Mastermind/csharp/Colors.cs diff --git a/60_Mastermind/csharp/Game/src/Command.cs b/60_Mastermind/csharp/Command.cs similarity index 100% rename from 60_Mastermind/csharp/Game/src/Command.cs rename to 60_Mastermind/csharp/Command.cs diff --git a/60_Mastermind/csharp/Game/src/Controller.cs b/60_Mastermind/csharp/Controller.cs similarity index 100% rename from 60_Mastermind/csharp/Game/src/Controller.cs rename to 60_Mastermind/csharp/Controller.cs diff --git a/60_Mastermind/csharp/Game/src/EnumerableExtensions.cs b/60_Mastermind/csharp/EnumerableExtensions.cs similarity index 100% rename from 60_Mastermind/csharp/Game/src/EnumerableExtensions.cs rename to 60_Mastermind/csharp/EnumerableExtensions.cs diff --git a/60_Mastermind/csharp/Game/Game.csproj b/60_Mastermind/csharp/Mastermind.csproj similarity index 100% rename from 60_Mastermind/csharp/Game/Game.csproj rename to 60_Mastermind/csharp/Mastermind.csproj diff --git a/60_Mastermind/csharp/Mastermind.sln b/60_Mastermind/csharp/Mastermind.sln index c3827fb7..0da53b6d 100644 --- a/60_Mastermind/csharp/Mastermind.sln +++ b/60_Mastermind/csharp/Mastermind.sln @@ -1,9 +1,9 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.31321.278 +# Visual Studio Version 17 +VisualStudioVersion = 17.0.32014.148 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Game", "Game\Game.csproj", "{E8D63140-971D-4FBF-8138-964E54CCB7DD}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Mastermind", "Mastermind.csproj", "{AEC839CD-C6D3-4476-AA85-79B160AF78BE}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -11,10 +11,10 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {E8D63140-971D-4FBF-8138-964E54CCB7DD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {E8D63140-971D-4FBF-8138-964E54CCB7DD}.Debug|Any CPU.Build.0 = Debug|Any CPU - {E8D63140-971D-4FBF-8138-964E54CCB7DD}.Release|Any CPU.ActiveCfg = Release|Any CPU - {E8D63140-971D-4FBF-8138-964E54CCB7DD}.Release|Any CPU.Build.0 = Release|Any CPU + {AEC839CD-C6D3-4476-AA85-79B160AF78BE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {AEC839CD-C6D3-4476-AA85-79B160AF78BE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {AEC839CD-C6D3-4476-AA85-79B160AF78BE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {AEC839CD-C6D3-4476-AA85-79B160AF78BE}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/60_Mastermind/csharp/Game/src/Program.cs b/60_Mastermind/csharp/Program.cs similarity index 100% rename from 60_Mastermind/csharp/Game/src/Program.cs rename to 60_Mastermind/csharp/Program.cs diff --git a/60_Mastermind/csharp/Game/src/TurnResult.cs b/60_Mastermind/csharp/TurnResult.cs similarity index 100% rename from 60_Mastermind/csharp/Game/src/TurnResult.cs rename to 60_Mastermind/csharp/TurnResult.cs diff --git a/60_Mastermind/csharp/Game/src/View.cs b/60_Mastermind/csharp/View.cs similarity index 100% rename from 60_Mastermind/csharp/Game/src/View.cs rename to 60_Mastermind/csharp/View.cs diff --git a/60_Mastermind/vbnet/Mastermind.sln b/60_Mastermind/vbnet/Mastermind.sln new file mode 100644 index 00000000..5ea0a369 --- /dev/null +++ b/60_Mastermind/vbnet/Mastermind.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Mastermind", "Mastermind.vbproj", "{B32A8054-8790-4810-93A8-CD0C740CEBD5}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {B32A8054-8790-4810-93A8-CD0C740CEBD5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B32A8054-8790-4810-93A8-CD0C740CEBD5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B32A8054-8790-4810-93A8-CD0C740CEBD5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B32A8054-8790-4810-93A8-CD0C740CEBD5}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/60_Mastermind/vbnet/Mastermind.vbproj b/60_Mastermind/vbnet/Mastermind.vbproj new file mode 100644 index 00000000..dc0b7890 --- /dev/null +++ b/60_Mastermind/vbnet/Mastermind.vbproj @@ -0,0 +1,8 @@ + + + Exe + Mastermind + net6.0 + 16.9 + + diff --git a/61_Math_Dice/ruby/mathdice.rb b/61_Math_Dice/ruby/mathdice.rb new file mode 100644 index 00000000..60853d45 --- /dev/null +++ b/61_Math_Dice/ruby/mathdice.rb @@ -0,0 +1,115 @@ +def intro + puts " MATH DICE + CREATIVE COMPUTING MORRISTOWN, NEW JERSEY + +THIS PROGRAM GENERATES SUCCESSIVE PICTURES OF TWO DICE. +WHEN TWO DICE AND AN EQUAL SIGN FOLLOWED BY A QUESTION +MARK HAVE BEEN PRINTED, TYPE YOUR ANSWER AND THE RETURN KEY. +TO CONCLUDE THE LESSON, TYPE '0' AS YOUR ANSWER. +" +end + +def game_play + num = 0 + sum = 0 + tries = 0 + until num == 2 do + num+=1 + roll = rand(6) + 1 + print_dice(roll) + sum = sum + roll + if num == 1 + print "\n +\n\n" + end + if num == 2 + print "\n =? " + ans = gets.chomp + if ans.to_i == 0 + #END GAME + exit(0) + elsif ans.to_i == sum + puts "RIGHT!" + puts "THE DICE ROLL AGAIN" + else + puts "NO, COUNT THE SPOTS AND GIVE ANOTHER ANSWER" + print "\n =? " + ans = gets.chomp + if ans.to_i == sum + puts "RIGHT!" + puts "THE DICE ROLL AGAIN" + elsif ans.to_i == 0 + exit(0) + else + puts "NO, THE ANSWER IS #{sum}" + end + end + end + end +end + + + +def print_dice(roll) + puts " -----" + if roll == 1 + print_blank + print_one_mid + print_blank + elsif roll == 2 + print_one_left + print_blank + print_one_right + elsif roll == 3 + print_one_left + print_one_mid + print_one_right + elsif roll == 4 + print_two + print_blank + print_two + elsif roll == 5 + print_two + print_one_mid + print_two + elsif roll == 6 + print_two + print_two + print_two + else + puts "not a legit dice roll" + end + puts " -----" +end + + +def print_one_left + puts "I * I" +end + +def print_one_mid + puts "I * I" +end + +def print_one_right + puts "I * I" +end + +def print_two + puts "I * * I" +end + +def print_blank + puts "I I" +end + + + +def main + intro + #Continue playing forever until it terminates with exit in game_play + while 1 == 1 do + game_play + end +end + +main diff --git a/61_Math_Dice/vbnet/MathDice.sln b/61_Math_Dice/vbnet/MathDice.sln new file mode 100644 index 00000000..4fe58a59 --- /dev/null +++ b/61_Math_Dice/vbnet/MathDice.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "MathDice", "MathDice.vbproj", "{1341C416-E919-4262-B378-113A6B6317DD}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {1341C416-E919-4262-B378-113A6B6317DD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1341C416-E919-4262-B378-113A6B6317DD}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1341C416-E919-4262-B378-113A6B6317DD}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1341C416-E919-4262-B378-113A6B6317DD}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/61_Math_Dice/vbnet/MathDice.vbproj b/61_Math_Dice/vbnet/MathDice.vbproj new file mode 100644 index 00000000..dd19501b --- /dev/null +++ b/61_Math_Dice/vbnet/MathDice.vbproj @@ -0,0 +1,8 @@ + + + Exe + MathDice + net6.0 + 16.9 + + diff --git a/62_Mugwump/csharp/Mugwump/Game.cs b/62_Mugwump/csharp/Game.cs similarity index 100% rename from 62_Mugwump/csharp/Mugwump/Game.cs rename to 62_Mugwump/csharp/Game.cs diff --git a/62_Mugwump/csharp/Mugwump/Grid.cs b/62_Mugwump/csharp/Grid.cs similarity index 100% rename from 62_Mugwump/csharp/Mugwump/Grid.cs rename to 62_Mugwump/csharp/Grid.cs diff --git a/62_Mugwump/csharp/Mugwump/Input.cs b/62_Mugwump/csharp/Input.cs similarity index 100% rename from 62_Mugwump/csharp/Mugwump/Input.cs rename to 62_Mugwump/csharp/Input.cs diff --git a/62_Mugwump/csharp/Mugwump/Mugwump.cs b/62_Mugwump/csharp/Mugwump.cs similarity index 100% rename from 62_Mugwump/csharp/Mugwump/Mugwump.cs rename to 62_Mugwump/csharp/Mugwump.cs diff --git a/62_Mugwump/csharp/Mugwump/Mugwump.csproj b/62_Mugwump/csharp/Mugwump.csproj similarity index 100% rename from 62_Mugwump/csharp/Mugwump/Mugwump.csproj rename to 62_Mugwump/csharp/Mugwump.csproj diff --git a/62_Mugwump/csharp/Mugwump.sln b/62_Mugwump/csharp/Mugwump.sln index bc3cfbff..ab99858a 100644 --- a/62_Mugwump/csharp/Mugwump.sln +++ b/62_Mugwump/csharp/Mugwump.sln @@ -1,34 +1,25 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.26124.0 +# Visual Studio Version 17 +VisualStudioVersion = 17.0.32014.148 MinimumVisualStudioVersion = 15.0.26124.0 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mugwump", "Mugwump\Mugwump.csproj", "{83F42802-4E7C-49B5-A022-DB9B6A65F2C6}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Mugwump", "Mugwump.csproj", "{DB23BDB0-10A4-4771-B942-E646A1A5C416}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 Release|Any CPU = Release|Any CPU - Release|x64 = Release|x64 - Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {DB23BDB0-10A4-4771-B942-E646A1A5C416}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DB23BDB0-10A4-4771-B942-E646A1A5C416}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DB23BDB0-10A4-4771-B942-E646A1A5C416}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DB23BDB0-10A4-4771-B942-E646A1A5C416}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {83F42802-4E7C-49B5-A022-DB9B6A65F2C6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {83F42802-4E7C-49B5-A022-DB9B6A65F2C6}.Debug|Any CPU.Build.0 = Debug|Any CPU - {83F42802-4E7C-49B5-A022-DB9B6A65F2C6}.Debug|x64.ActiveCfg = Debug|Any CPU - {83F42802-4E7C-49B5-A022-DB9B6A65F2C6}.Debug|x64.Build.0 = Debug|Any CPU - {83F42802-4E7C-49B5-A022-DB9B6A65F2C6}.Debug|x86.ActiveCfg = Debug|Any CPU - {83F42802-4E7C-49B5-A022-DB9B6A65F2C6}.Debug|x86.Build.0 = Debug|Any CPU - {83F42802-4E7C-49B5-A022-DB9B6A65F2C6}.Release|Any CPU.ActiveCfg = Release|Any CPU - {83F42802-4E7C-49B5-A022-DB9B6A65F2C6}.Release|Any CPU.Build.0 = Release|Any CPU - {83F42802-4E7C-49B5-A022-DB9B6A65F2C6}.Release|x64.ActiveCfg = Release|Any CPU - {83F42802-4E7C-49B5-A022-DB9B6A65F2C6}.Release|x64.Build.0 = Release|Any CPU - {83F42802-4E7C-49B5-A022-DB9B6A65F2C6}.Release|x86.ActiveCfg = Release|Any CPU - {83F42802-4E7C-49B5-A022-DB9B6A65F2C6}.Release|x86.Build.0 = Release|Any CPU + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {1FE34948-9066-4F57-A4C1-423293A430C5} EndGlobalSection EndGlobal diff --git a/62_Mugwump/csharp/Mugwump/Offset.cs b/62_Mugwump/csharp/Offset.cs similarity index 100% rename from 62_Mugwump/csharp/Mugwump/Offset.cs rename to 62_Mugwump/csharp/Offset.cs diff --git a/62_Mugwump/csharp/Mugwump/Position.cs b/62_Mugwump/csharp/Position.cs similarity index 100% rename from 62_Mugwump/csharp/Mugwump/Position.cs rename to 62_Mugwump/csharp/Position.cs diff --git a/62_Mugwump/csharp/Mugwump/Program.cs b/62_Mugwump/csharp/Program.cs similarity index 100% rename from 62_Mugwump/csharp/Mugwump/Program.cs rename to 62_Mugwump/csharp/Program.cs diff --git a/62_Mugwump/csharp/Mugwump/Strings/Intro.txt b/62_Mugwump/csharp/Strings/Intro.txt similarity index 100% rename from 62_Mugwump/csharp/Mugwump/Strings/Intro.txt rename to 62_Mugwump/csharp/Strings/Intro.txt diff --git a/62_Mugwump/vbnet/Mugwump.sln b/62_Mugwump/vbnet/Mugwump.sln new file mode 100644 index 00000000..49f0dd09 --- /dev/null +++ b/62_Mugwump/vbnet/Mugwump.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Mugwump", "Mugwump.vbproj", "{5A0B0AE7-4148-42CB-8010-5A0683E3CF3A}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {5A0B0AE7-4148-42CB-8010-5A0683E3CF3A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5A0B0AE7-4148-42CB-8010-5A0683E3CF3A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5A0B0AE7-4148-42CB-8010-5A0683E3CF3A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5A0B0AE7-4148-42CB-8010-5A0683E3CF3A}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/62_Mugwump/vbnet/Mugwump.vbproj b/62_Mugwump/vbnet/Mugwump.vbproj new file mode 100644 index 00000000..50f8a0a1 --- /dev/null +++ b/62_Mugwump/vbnet/Mugwump.vbproj @@ -0,0 +1,8 @@ + + + Exe + Mugwump + net6.0 + 16.9 + + diff --git a/63_Name/vbnet/Name.sln b/63_Name/vbnet/Name.sln new file mode 100644 index 00000000..29b92356 --- /dev/null +++ b/63_Name/vbnet/Name.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Name", "Name.vbproj", "{178E4E2F-5264-47A1-9BC6-2B724E7DCC79}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {178E4E2F-5264-47A1-9BC6-2B724E7DCC79}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {178E4E2F-5264-47A1-9BC6-2B724E7DCC79}.Debug|Any CPU.Build.0 = Debug|Any CPU + {178E4E2F-5264-47A1-9BC6-2B724E7DCC79}.Release|Any CPU.ActiveCfg = Release|Any CPU + {178E4E2F-5264-47A1-9BC6-2B724E7DCC79}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/63_Name/vbnet/Name.vbproj b/63_Name/vbnet/Name.vbproj new file mode 100644 index 00000000..a06d78f3 --- /dev/null +++ b/63_Name/vbnet/Name.vbproj @@ -0,0 +1,8 @@ + + + Exe + Name + net6.0 + 16.9 + + diff --git a/64_Nicomachus/csharp/Nicomachus.csproj b/64_Nicomachus/csharp/Nicomachus.csproj new file mode 100644 index 00000000..d3fe4757 --- /dev/null +++ b/64_Nicomachus/csharp/Nicomachus.csproj @@ -0,0 +1,9 @@ + + + Exe + net6.0 + 10 + enable + enable + + diff --git a/64_Nicomachus/csharp/Nicomachus.sln b/64_Nicomachus/csharp/Nicomachus.sln new file mode 100644 index 00000000..5287cabf --- /dev/null +++ b/64_Nicomachus/csharp/Nicomachus.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Nicomachus", "Nicomachus.csproj", "{AC3B6DDA-13CE-40FC-B9E0-4246390DFC20}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {AC3B6DDA-13CE-40FC-B9E0-4246390DFC20}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {AC3B6DDA-13CE-40FC-B9E0-4246390DFC20}.Debug|Any CPU.Build.0 = Debug|Any CPU + {AC3B6DDA-13CE-40FC-B9E0-4246390DFC20}.Release|Any CPU.ActiveCfg = Release|Any CPU + {AC3B6DDA-13CE-40FC-B9E0-4246390DFC20}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/64_Nicomachus/vbnet/Nicomachus.sln b/64_Nicomachus/vbnet/Nicomachus.sln new file mode 100644 index 00000000..bea341c4 --- /dev/null +++ b/64_Nicomachus/vbnet/Nicomachus.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Nicomachus", "Nicomachus.vbproj", "{B4987617-A235-4CBA-A158-A668B6C36FE1}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {B4987617-A235-4CBA-A158-A668B6C36FE1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B4987617-A235-4CBA-A158-A668B6C36FE1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B4987617-A235-4CBA-A158-A668B6C36FE1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B4987617-A235-4CBA-A158-A668B6C36FE1}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/64_Nicomachus/vbnet/Nicomachus.vbproj b/64_Nicomachus/vbnet/Nicomachus.vbproj new file mode 100644 index 00000000..404fd9d9 --- /dev/null +++ b/64_Nicomachus/vbnet/Nicomachus.vbproj @@ -0,0 +1,8 @@ + + + Exe + Nicomachus + net6.0 + 16.9 + + diff --git a/65_Nim/csharp/Nim.csproj b/65_Nim/csharp/Nim.csproj new file mode 100644 index 00000000..d3fe4757 --- /dev/null +++ b/65_Nim/csharp/Nim.csproj @@ -0,0 +1,9 @@ + + + Exe + net6.0 + 10 + enable + enable + + diff --git a/65_Nim/csharp/Nim.sln b/65_Nim/csharp/Nim.sln new file mode 100644 index 00000000..dd324894 --- /dev/null +++ b/65_Nim/csharp/Nim.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Nim", "Nim.csproj", "{00B15B50-9CB1-46B1-8066-5877F972EE88}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {00B15B50-9CB1-46B1-8066-5877F972EE88}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {00B15B50-9CB1-46B1-8066-5877F972EE88}.Debug|Any CPU.Build.0 = Debug|Any CPU + {00B15B50-9CB1-46B1-8066-5877F972EE88}.Release|Any CPU.ActiveCfg = Release|Any CPU + {00B15B50-9CB1-46B1-8066-5877F972EE88}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/65_Nim/vbnet/Nim.sln b/65_Nim/vbnet/Nim.sln new file mode 100644 index 00000000..17c6bf86 --- /dev/null +++ b/65_Nim/vbnet/Nim.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Nim", "Nim.vbproj", "{224F08AA-BE60-4B49-877F-36F239C56F6F}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {224F08AA-BE60-4B49-877F-36F239C56F6F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {224F08AA-BE60-4B49-877F-36F239C56F6F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {224F08AA-BE60-4B49-877F-36F239C56F6F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {224F08AA-BE60-4B49-877F-36F239C56F6F}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/65_Nim/vbnet/Nim.vbproj b/65_Nim/vbnet/Nim.vbproj new file mode 100644 index 00000000..f551edd0 --- /dev/null +++ b/65_Nim/vbnet/Nim.vbproj @@ -0,0 +1,8 @@ + + + Exe + Nim + net6.0 + 16.9 + + diff --git a/66_Number/csharp/Number.csproj b/66_Number/csharp/Number.csproj new file mode 100644 index 00000000..d3fe4757 --- /dev/null +++ b/66_Number/csharp/Number.csproj @@ -0,0 +1,9 @@ + + + Exe + net6.0 + 10 + enable + enable + + diff --git a/66_Number/csharp/Number.sln b/66_Number/csharp/Number.sln new file mode 100644 index 00000000..f42e7e2a --- /dev/null +++ b/66_Number/csharp/Number.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Number", "Number.csproj", "{F39E3DE8-3564-424C-AD89-D47478FD6E47}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {F39E3DE8-3564-424C-AD89-D47478FD6E47}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F39E3DE8-3564-424C-AD89-D47478FD6E47}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F39E3DE8-3564-424C-AD89-D47478FD6E47}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F39E3DE8-3564-424C-AD89-D47478FD6E47}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/66_Number/vbnet/Number.sln b/66_Number/vbnet/Number.sln new file mode 100644 index 00000000..d0838e1a --- /dev/null +++ b/66_Number/vbnet/Number.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Number", "Number.vbproj", "{FEF524F1-E940-43AF-A7EF-4D0DEB1E3F1E}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {FEF524F1-E940-43AF-A7EF-4D0DEB1E3F1E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FEF524F1-E940-43AF-A7EF-4D0DEB1E3F1E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FEF524F1-E940-43AF-A7EF-4D0DEB1E3F1E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FEF524F1-E940-43AF-A7EF-4D0DEB1E3F1E}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/66_Number/vbnet/Number.vbproj b/66_Number/vbnet/Number.vbproj new file mode 100644 index 00000000..ad922daf --- /dev/null +++ b/66_Number/vbnet/Number.vbproj @@ -0,0 +1,8 @@ + + + Exe + Number + net6.0 + 16.9 + + diff --git a/67_One_Check/csharp/OneCheck.csproj b/67_One_Check/csharp/OneCheck.csproj new file mode 100644 index 00000000..d3fe4757 --- /dev/null +++ b/67_One_Check/csharp/OneCheck.csproj @@ -0,0 +1,9 @@ + + + Exe + net6.0 + 10 + enable + enable + + diff --git a/67_One_Check/csharp/OneCheck.sln b/67_One_Check/csharp/OneCheck.sln new file mode 100644 index 00000000..f6a550c7 --- /dev/null +++ b/67_One_Check/csharp/OneCheck.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OneCheck", "OneCheck.csproj", "{3964167F-17D8-44FB-A9F7-EA2DB1C5DA3F}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {3964167F-17D8-44FB-A9F7-EA2DB1C5DA3F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3964167F-17D8-44FB-A9F7-EA2DB1C5DA3F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3964167F-17D8-44FB-A9F7-EA2DB1C5DA3F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3964167F-17D8-44FB-A9F7-EA2DB1C5DA3F}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/67_One_Check/vbnet/OneCheck.sln b/67_One_Check/vbnet/OneCheck.sln new file mode 100644 index 00000000..d641e964 --- /dev/null +++ b/67_One_Check/vbnet/OneCheck.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "OneCheck", "OneCheck.vbproj", "{E19E8AE0-06FE-4EB5-9F24-7FF74D65F55A}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {E19E8AE0-06FE-4EB5-9F24-7FF74D65F55A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E19E8AE0-06FE-4EB5-9F24-7FF74D65F55A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E19E8AE0-06FE-4EB5-9F24-7FF74D65F55A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E19E8AE0-06FE-4EB5-9F24-7FF74D65F55A}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/67_One_Check/vbnet/OneCheck.vbproj b/67_One_Check/vbnet/OneCheck.vbproj new file mode 100644 index 00000000..2b36f16f --- /dev/null +++ b/67_One_Check/vbnet/OneCheck.vbproj @@ -0,0 +1,8 @@ + + + Exe + OneCheck + net6.0 + 16.9 + + diff --git a/68_Orbit/csharp/Orbit.csproj b/68_Orbit/csharp/Orbit.csproj new file mode 100644 index 00000000..d3fe4757 --- /dev/null +++ b/68_Orbit/csharp/Orbit.csproj @@ -0,0 +1,9 @@ + + + Exe + net6.0 + 10 + enable + enable + + diff --git a/68_Orbit/csharp/Orbit.sln b/68_Orbit/csharp/Orbit.sln new file mode 100644 index 00000000..0ca7e270 --- /dev/null +++ b/68_Orbit/csharp/Orbit.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Orbit", "Orbit.csproj", "{2912E79E-D9A2-488F-B77E-7C348E3347E7}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {2912E79E-D9A2-488F-B77E-7C348E3347E7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2912E79E-D9A2-488F-B77E-7C348E3347E7}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2912E79E-D9A2-488F-B77E-7C348E3347E7}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2912E79E-D9A2-488F-B77E-7C348E3347E7}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/68_Orbit/vbnet/Orbit.sln b/68_Orbit/vbnet/Orbit.sln new file mode 100644 index 00000000..b2b021d1 --- /dev/null +++ b/68_Orbit/vbnet/Orbit.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Orbit", "Orbit.vbproj", "{4EC039CE-66F1-46ED-97B1-9DB2A2B8A648}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {4EC039CE-66F1-46ED-97B1-9DB2A2B8A648}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4EC039CE-66F1-46ED-97B1-9DB2A2B8A648}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4EC039CE-66F1-46ED-97B1-9DB2A2B8A648}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4EC039CE-66F1-46ED-97B1-9DB2A2B8A648}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/68_Orbit/vbnet/Orbit.vbproj b/68_Orbit/vbnet/Orbit.vbproj new file mode 100644 index 00000000..29be1358 --- /dev/null +++ b/68_Orbit/vbnet/Orbit.vbproj @@ -0,0 +1,8 @@ + + + Exe + Orbit + net6.0 + 16.9 + + diff --git a/69_Pizza/csharp/Pizza/CustomerMap.cs b/69_Pizza/csharp/CustomerMap.cs similarity index 100% rename from 69_Pizza/csharp/Pizza/CustomerMap.cs rename to 69_Pizza/csharp/CustomerMap.cs diff --git a/69_Pizza/csharp/Pizza/Pizza.csproj b/69_Pizza/csharp/Pizza.csproj similarity index 100% rename from 69_Pizza/csharp/Pizza/Pizza.csproj rename to 69_Pizza/csharp/Pizza.csproj diff --git a/69_Pizza/csharp/Pizza/Pizza.sln b/69_Pizza/csharp/Pizza.sln similarity index 100% rename from 69_Pizza/csharp/Pizza/Pizza.sln rename to 69_Pizza/csharp/Pizza.sln diff --git a/69_Pizza/csharp/Pizza/PizzaGame.cs b/69_Pizza/csharp/PizzaGame.cs similarity index 100% rename from 69_Pizza/csharp/Pizza/PizzaGame.cs rename to 69_Pizza/csharp/PizzaGame.cs diff --git a/69_Pizza/csharp/Pizza/Program.cs b/69_Pizza/csharp/Program.cs similarity index 100% rename from 69_Pizza/csharp/Pizza/Program.cs rename to 69_Pizza/csharp/Program.cs diff --git a/69_Pizza/csharp/Pizza/StringBuilderExtensions.cs b/69_Pizza/csharp/StringBuilderExtensions.cs similarity index 100% rename from 69_Pizza/csharp/Pizza/StringBuilderExtensions.cs rename to 69_Pizza/csharp/StringBuilderExtensions.cs diff --git a/69_Pizza/vbnet/Pizza.sln b/69_Pizza/vbnet/Pizza.sln new file mode 100644 index 00000000..8fc145ee --- /dev/null +++ b/69_Pizza/vbnet/Pizza.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Pizza", "Pizza.vbproj", "{395C3162-11F0-459B-9027-45A8ED6E4E8E}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {395C3162-11F0-459B-9027-45A8ED6E4E8E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {395C3162-11F0-459B-9027-45A8ED6E4E8E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {395C3162-11F0-459B-9027-45A8ED6E4E8E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {395C3162-11F0-459B-9027-45A8ED6E4E8E}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/69_Pizza/vbnet/Pizza.vbproj b/69_Pizza/vbnet/Pizza.vbproj new file mode 100644 index 00000000..db16f023 --- /dev/null +++ b/69_Pizza/vbnet/Pizza.vbproj @@ -0,0 +1,8 @@ + + + Exe + Pizza + net6.0 + 16.9 + + diff --git a/70_Poetry/csharp/Poetry.csproj b/70_Poetry/csharp/Poetry.csproj new file mode 100644 index 00000000..d3fe4757 --- /dev/null +++ b/70_Poetry/csharp/Poetry.csproj @@ -0,0 +1,9 @@ + + + Exe + net6.0 + 10 + enable + enable + + diff --git a/70_Poetry/csharp/Poetry.sln b/70_Poetry/csharp/Poetry.sln new file mode 100644 index 00000000..f62c6d2b --- /dev/null +++ b/70_Poetry/csharp/Poetry.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Poetry", "Poetry.csproj", "{965EE29C-4FEC-4A31-92C9-55FBA8FDB0CB}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {965EE29C-4FEC-4A31-92C9-55FBA8FDB0CB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {965EE29C-4FEC-4A31-92C9-55FBA8FDB0CB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {965EE29C-4FEC-4A31-92C9-55FBA8FDB0CB}.Release|Any CPU.ActiveCfg = Release|Any CPU + {965EE29C-4FEC-4A31-92C9-55FBA8FDB0CB}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/70_Poetry/vbnet/Poetry.sln b/70_Poetry/vbnet/Poetry.sln new file mode 100644 index 00000000..8e235514 --- /dev/null +++ b/70_Poetry/vbnet/Poetry.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Poetry", "Poetry.vbproj", "{422855D5-5841-40E0-AF1E-993FB25DE7B3}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {422855D5-5841-40E0-AF1E-993FB25DE7B3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {422855D5-5841-40E0-AF1E-993FB25DE7B3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {422855D5-5841-40E0-AF1E-993FB25DE7B3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {422855D5-5841-40E0-AF1E-993FB25DE7B3}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/70_Poetry/vbnet/Poetry.vbproj b/70_Poetry/vbnet/Poetry.vbproj new file mode 100644 index 00000000..fc71a15e --- /dev/null +++ b/70_Poetry/vbnet/Poetry.vbproj @@ -0,0 +1,8 @@ + + + Exe + Poetry + net6.0 + 16.9 + + diff --git a/71_Poker/csharp/Poker.csproj b/71_Poker/csharp/Poker.csproj new file mode 100644 index 00000000..d3fe4757 --- /dev/null +++ b/71_Poker/csharp/Poker.csproj @@ -0,0 +1,9 @@ + + + Exe + net6.0 + 10 + enable + enable + + diff --git a/71_Poker/csharp/Poker.sln b/71_Poker/csharp/Poker.sln new file mode 100644 index 00000000..5dd63fff --- /dev/null +++ b/71_Poker/csharp/Poker.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Poker", "Poker.csproj", "{CAEDA88F-1585-41AA-8213-40012B044FA9}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {CAEDA88F-1585-41AA-8213-40012B044FA9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CAEDA88F-1585-41AA-8213-40012B044FA9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CAEDA88F-1585-41AA-8213-40012B044FA9}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CAEDA88F-1585-41AA-8213-40012B044FA9}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/71_Poker/vbnet/Poker.sln b/71_Poker/vbnet/Poker.sln new file mode 100644 index 00000000..f1514e74 --- /dev/null +++ b/71_Poker/vbnet/Poker.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Poker", "Poker.vbproj", "{107C29F8-C499-4E4A-B162-324CA17AA57F}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {107C29F8-C499-4E4A-B162-324CA17AA57F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {107C29F8-C499-4E4A-B162-324CA17AA57F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {107C29F8-C499-4E4A-B162-324CA17AA57F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {107C29F8-C499-4E4A-B162-324CA17AA57F}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/71_Poker/vbnet/Poker.vbproj b/71_Poker/vbnet/Poker.vbproj new file mode 100644 index 00000000..5e1a61a3 --- /dev/null +++ b/71_Poker/vbnet/Poker.vbproj @@ -0,0 +1,8 @@ + + + Exe + Poker + net6.0 + 16.9 + + diff --git a/72_Queen/csharp/Queen.csproj b/72_Queen/csharp/Queen.csproj new file mode 100644 index 00000000..d3fe4757 --- /dev/null +++ b/72_Queen/csharp/Queen.csproj @@ -0,0 +1,9 @@ + + + Exe + net6.0 + 10 + enable + enable + + diff --git a/72_Queen/csharp/Queen.sln b/72_Queen/csharp/Queen.sln new file mode 100644 index 00000000..b4d865ab --- /dev/null +++ b/72_Queen/csharp/Queen.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Queen", "Queen.csproj", "{34BFC22A-4459-416E-B271-1E276689AC29}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {34BFC22A-4459-416E-B271-1E276689AC29}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {34BFC22A-4459-416E-B271-1E276689AC29}.Debug|Any CPU.Build.0 = Debug|Any CPU + {34BFC22A-4459-416E-B271-1E276689AC29}.Release|Any CPU.ActiveCfg = Release|Any CPU + {34BFC22A-4459-416E-B271-1E276689AC29}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/72_Queen/vbnet/Queen.sln b/72_Queen/vbnet/Queen.sln new file mode 100644 index 00000000..33f87b9a --- /dev/null +++ b/72_Queen/vbnet/Queen.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Queen", "Queen.vbproj", "{9FCBF8AB-8E16-4E1A-AA05-D64B475D36FC}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {9FCBF8AB-8E16-4E1A-AA05-D64B475D36FC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9FCBF8AB-8E16-4E1A-AA05-D64B475D36FC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9FCBF8AB-8E16-4E1A-AA05-D64B475D36FC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9FCBF8AB-8E16-4E1A-AA05-D64B475D36FC}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/72_Queen/vbnet/Queen.vbproj b/72_Queen/vbnet/Queen.vbproj new file mode 100644 index 00000000..19b46d90 --- /dev/null +++ b/72_Queen/vbnet/Queen.vbproj @@ -0,0 +1,8 @@ + + + Exe + Queen + net6.0 + 16.9 + + diff --git a/73_Reverse/csharp/Reverse/Reverse.Tests/Generators/PositiveIntegerGenerator.cs b/73_Reverse/csharp/Reverse.Tests/Generators/PositiveIntegerGenerator.cs similarity index 100% rename from 73_Reverse/csharp/Reverse/Reverse.Tests/Generators/PositiveIntegerGenerator.cs rename to 73_Reverse/csharp/Reverse.Tests/Generators/PositiveIntegerGenerator.cs diff --git a/73_Reverse/csharp/Reverse/Reverse.Tests/Reverse.Tests.csproj b/73_Reverse/csharp/Reverse.Tests/Reverse.Tests.csproj similarity index 100% rename from 73_Reverse/csharp/Reverse/Reverse.Tests/Reverse.Tests.csproj rename to 73_Reverse/csharp/Reverse.Tests/Reverse.Tests.csproj diff --git a/73_Reverse/csharp/Reverse/Reverse.Tests/ReverserTests.cs b/73_Reverse/csharp/Reverse.Tests/ReverserTests.cs similarity index 100% rename from 73_Reverse/csharp/Reverse/Reverse.Tests/ReverserTests.cs rename to 73_Reverse/csharp/Reverse.Tests/ReverserTests.cs diff --git a/73_Reverse/csharp/Reverse/Reverse.Tests/TestReverser.cs b/73_Reverse/csharp/Reverse.Tests/TestReverser.cs similarity index 100% rename from 73_Reverse/csharp/Reverse/Reverse.Tests/TestReverser.cs rename to 73_Reverse/csharp/Reverse.Tests/TestReverser.cs diff --git a/73_Reverse/csharp/Reverse/Reverse.sln b/73_Reverse/csharp/Reverse.sln similarity index 100% rename from 73_Reverse/csharp/Reverse/Reverse.sln rename to 73_Reverse/csharp/Reverse.sln diff --git a/73_Reverse/csharp/Reverse/Reverse/Program.cs b/73_Reverse/csharp/Reverse/Program.cs similarity index 100% rename from 73_Reverse/csharp/Reverse/Reverse/Program.cs rename to 73_Reverse/csharp/Reverse/Program.cs diff --git a/78_Sine_Wave/csharp/SineWave/SineWave/SineWave.csproj b/73_Reverse/csharp/Reverse/Reverse.csproj similarity index 100% rename from 78_Sine_Wave/csharp/SineWave/SineWave/SineWave.csproj rename to 73_Reverse/csharp/Reverse/Reverse.csproj diff --git a/73_Reverse/csharp/Reverse/Reverse/Reverser.cs b/73_Reverse/csharp/Reverse/Reverser.cs similarity index 100% rename from 73_Reverse/csharp/Reverse/Reverse/Reverser.cs rename to 73_Reverse/csharp/Reverse/Reverser.cs diff --git a/73_Reverse/vbnet/Reverse.sln b/73_Reverse/vbnet/Reverse.sln new file mode 100644 index 00000000..8e8fa1ee --- /dev/null +++ b/73_Reverse/vbnet/Reverse.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Reverse", "Reverse.vbproj", "{8C9839D4-D0FD-47C2-B54D-429C55F1C6D0}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {8C9839D4-D0FD-47C2-B54D-429C55F1C6D0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8C9839D4-D0FD-47C2-B54D-429C55F1C6D0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8C9839D4-D0FD-47C2-B54D-429C55F1C6D0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8C9839D4-D0FD-47C2-B54D-429C55F1C6D0}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/73_Reverse/vbnet/Reverse.vbproj b/73_Reverse/vbnet/Reverse.vbproj new file mode 100644 index 00000000..978b4e56 --- /dev/null +++ b/73_Reverse/vbnet/Reverse.vbproj @@ -0,0 +1,8 @@ + + + Exe + Reverse + net6.0 + 16.9 + + diff --git a/74_Rock_Scissors_Paper/csharp/RockScissorsPaper.sln b/74_Rock_Scissors_Paper/csharp/RockScissorsPaper.sln new file mode 100644 index 00000000..5c563dd8 --- /dev/null +++ b/74_Rock_Scissors_Paper/csharp/RockScissorsPaper.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RockScissorsPaper", "RockScissorsPaper.csproj", "{162F12A7-72D0-44C8-9854-EA50C707690F}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {162F12A7-72D0-44C8-9854-EA50C707690F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {162F12A7-72D0-44C8-9854-EA50C707690F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {162F12A7-72D0-44C8-9854-EA50C707690F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {162F12A7-72D0-44C8-9854-EA50C707690F}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/74_Rock_Scissors_Paper/vbnet/RockScissorsPaper.sln b/74_Rock_Scissors_Paper/vbnet/RockScissorsPaper.sln new file mode 100644 index 00000000..481f3105 --- /dev/null +++ b/74_Rock_Scissors_Paper/vbnet/RockScissorsPaper.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "RockScissorsPaper", "RockScissorsPaper.vbproj", "{05C592E9-1A74-4812-88CF-3B078A315378}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {05C592E9-1A74-4812-88CF-3B078A315378}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {05C592E9-1A74-4812-88CF-3B078A315378}.Debug|Any CPU.Build.0 = Debug|Any CPU + {05C592E9-1A74-4812-88CF-3B078A315378}.Release|Any CPU.ActiveCfg = Release|Any CPU + {05C592E9-1A74-4812-88CF-3B078A315378}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/74_Rock_Scissors_Paper/vbnet/RockScissorsPaper.vbproj b/74_Rock_Scissors_Paper/vbnet/RockScissorsPaper.vbproj new file mode 100644 index 00000000..e6cf95c5 --- /dev/null +++ b/74_Rock_Scissors_Paper/vbnet/RockScissorsPaper.vbproj @@ -0,0 +1,8 @@ + + + Exe + RockScissorsPaper + net6.0 + 16.9 + + diff --git a/75_Roulette/csharp/Roulette.csproj b/75_Roulette/csharp/Roulette.csproj new file mode 100644 index 00000000..d3fe4757 --- /dev/null +++ b/75_Roulette/csharp/Roulette.csproj @@ -0,0 +1,9 @@ + + + Exe + net6.0 + 10 + enable + enable + + diff --git a/75_Roulette/csharp/Roulette.sln b/75_Roulette/csharp/Roulette.sln new file mode 100644 index 00000000..de44173b --- /dev/null +++ b/75_Roulette/csharp/Roulette.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Roulette", "Roulette.csproj", "{9FC3EC1F-2052-4D08-901C-5184E17740FC}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {9FC3EC1F-2052-4D08-901C-5184E17740FC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9FC3EC1F-2052-4D08-901C-5184E17740FC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9FC3EC1F-2052-4D08-901C-5184E17740FC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9FC3EC1F-2052-4D08-901C-5184E17740FC}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/75_Roulette/vbnet/Roulette.sln b/75_Roulette/vbnet/Roulette.sln new file mode 100644 index 00000000..a9db1b6e --- /dev/null +++ b/75_Roulette/vbnet/Roulette.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Roulette", "Roulette.vbproj", "{B2D2B22C-D332-4153-8ACF-E8136283FBC7}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {B2D2B22C-D332-4153-8ACF-E8136283FBC7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B2D2B22C-D332-4153-8ACF-E8136283FBC7}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B2D2B22C-D332-4153-8ACF-E8136283FBC7}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B2D2B22C-D332-4153-8ACF-E8136283FBC7}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/75_Roulette/vbnet/Roulette.vbproj b/75_Roulette/vbnet/Roulette.vbproj new file mode 100644 index 00000000..d5c17f88 --- /dev/null +++ b/75_Roulette/vbnet/Roulette.vbproj @@ -0,0 +1,8 @@ + + + Exe + Roulette + net6.0 + 16.9 + + diff --git a/76_Russian_Roulette/csharp/RussianRoulette/Program.cs b/76_Russian_Roulette/csharp/Program.cs similarity index 100% rename from 76_Russian_Roulette/csharp/RussianRoulette/Program.cs rename to 76_Russian_Roulette/csharp/Program.cs diff --git a/82_Stars/csharp/Stars/Stars.csproj b/76_Russian_Roulette/csharp/RussianRoulette.csproj similarity index 100% rename from 82_Stars/csharp/Stars/Stars.csproj rename to 76_Russian_Roulette/csharp/RussianRoulette.csproj diff --git a/76_Russian_Roulette/csharp/RussianRoulette/RussianRoulette.sln b/76_Russian_Roulette/csharp/RussianRoulette.sln similarity index 100% rename from 76_Russian_Roulette/csharp/RussianRoulette/RussianRoulette.sln rename to 76_Russian_Roulette/csharp/RussianRoulette.sln diff --git a/76_Russian_Roulette/vbnet/RussianRoulette.sln b/76_Russian_Roulette/vbnet/RussianRoulette.sln new file mode 100644 index 00000000..8a87ebbb --- /dev/null +++ b/76_Russian_Roulette/vbnet/RussianRoulette.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "RussianRoulette", "RussianRoulette.vbproj", "{19A2F0DB-9F77-4E3A-9346-4FDDAF0A457F}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {19A2F0DB-9F77-4E3A-9346-4FDDAF0A457F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {19A2F0DB-9F77-4E3A-9346-4FDDAF0A457F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {19A2F0DB-9F77-4E3A-9346-4FDDAF0A457F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {19A2F0DB-9F77-4E3A-9346-4FDDAF0A457F}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/76_Russian_Roulette/vbnet/RussianRoulette.vbproj b/76_Russian_Roulette/vbnet/RussianRoulette.vbproj new file mode 100644 index 00000000..dbfebdae --- /dev/null +++ b/76_Russian_Roulette/vbnet/RussianRoulette.vbproj @@ -0,0 +1,8 @@ + + + Exe + RussianRoulette + net6.0 + 16.9 + + diff --git a/77_Salvo/csharp/Salvo.csproj b/77_Salvo/csharp/Salvo.csproj new file mode 100644 index 00000000..d3fe4757 --- /dev/null +++ b/77_Salvo/csharp/Salvo.csproj @@ -0,0 +1,9 @@ + + + Exe + net6.0 + 10 + enable + enable + + diff --git a/77_Salvo/csharp/Salvo.sln b/77_Salvo/csharp/Salvo.sln new file mode 100644 index 00000000..290237a3 --- /dev/null +++ b/77_Salvo/csharp/Salvo.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Salvo", "Salvo.csproj", "{F3AFBC83-22A7-4837-9DA3-F3EE854DD8CA}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {F3AFBC83-22A7-4837-9DA3-F3EE854DD8CA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F3AFBC83-22A7-4837-9DA3-F3EE854DD8CA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F3AFBC83-22A7-4837-9DA3-F3EE854DD8CA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F3AFBC83-22A7-4837-9DA3-F3EE854DD8CA}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/77_Salvo/vbnet/Salvo.sln b/77_Salvo/vbnet/Salvo.sln new file mode 100644 index 00000000..3acb9449 --- /dev/null +++ b/77_Salvo/vbnet/Salvo.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Salvo", "Salvo.vbproj", "{849885BF-24BD-4FEB-A224-A9502742D4B0}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {849885BF-24BD-4FEB-A224-A9502742D4B0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {849885BF-24BD-4FEB-A224-A9502742D4B0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {849885BF-24BD-4FEB-A224-A9502742D4B0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {849885BF-24BD-4FEB-A224-A9502742D4B0}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/77_Salvo/vbnet/Salvo.vbproj b/77_Salvo/vbnet/Salvo.vbproj new file mode 100644 index 00000000..90ec0e38 --- /dev/null +++ b/77_Salvo/vbnet/Salvo.vbproj @@ -0,0 +1,8 @@ + + + Exe + Salvo + net6.0 + 16.9 + + diff --git a/78_Sine_Wave/csharp/SineWave/SineWave/Program.cs b/78_Sine_Wave/csharp/Program.cs similarity index 100% rename from 78_Sine_Wave/csharp/SineWave/SineWave/Program.cs rename to 78_Sine_Wave/csharp/Program.cs diff --git a/87_3-D_Plot/csharp/Plot/Plot.csproj b/78_Sine_Wave/csharp/SineWave.csproj similarity index 100% rename from 87_3-D_Plot/csharp/Plot/Plot.csproj rename to 78_Sine_Wave/csharp/SineWave.csproj diff --git a/78_Sine_Wave/csharp/SineWave/SineWave.sln b/78_Sine_Wave/csharp/SineWave.sln similarity index 64% rename from 78_Sine_Wave/csharp/SineWave/SineWave.sln rename to 78_Sine_Wave/csharp/SineWave.sln index f32a06cd..adcc993f 100644 --- a/78_Sine_Wave/csharp/SineWave/SineWave.sln +++ b/78_Sine_Wave/csharp/SineWave.sln @@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 16 VisualStudioVersion = 16.0.31005.135 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SineWave", "SineWave\SineWave.csproj", "{B316DD7F-5755-4216-AFDC-D83720F8ACA2}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SineWave", "SineWave.csproj", "{730FA2CC-5AA5-4BE2-8DF9-8E55FDC8FB30}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -11,10 +11,10 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {B316DD7F-5755-4216-AFDC-D83720F8ACA2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B316DD7F-5755-4216-AFDC-D83720F8ACA2}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B316DD7F-5755-4216-AFDC-D83720F8ACA2}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B316DD7F-5755-4216-AFDC-D83720F8ACA2}.Release|Any CPU.Build.0 = Release|Any CPU + {730FA2CC-5AA5-4BE2-8DF9-8E55FDC8FB30}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {730FA2CC-5AA5-4BE2-8DF9-8E55FDC8FB30}.Debug|Any CPU.Build.0 = Debug|Any CPU + {730FA2CC-5AA5-4BE2-8DF9-8E55FDC8FB30}.Release|Any CPU.ActiveCfg = Release|Any CPU + {730FA2CC-5AA5-4BE2-8DF9-8E55FDC8FB30}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/78_Sine_Wave/vbnet/SineWave.sln b/78_Sine_Wave/vbnet/SineWave.sln new file mode 100644 index 00000000..37f4bf7e --- /dev/null +++ b/78_Sine_Wave/vbnet/SineWave.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "SineWave", "SineWave.vbproj", "{204DD0CD-1DA5-4B4B-992F-1C3ED089A147}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {204DD0CD-1DA5-4B4B-992F-1C3ED089A147}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {204DD0CD-1DA5-4B4B-992F-1C3ED089A147}.Debug|Any CPU.Build.0 = Debug|Any CPU + {204DD0CD-1DA5-4B4B-992F-1C3ED089A147}.Release|Any CPU.ActiveCfg = Release|Any CPU + {204DD0CD-1DA5-4B4B-992F-1C3ED089A147}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/78_Sine_Wave/vbnet/SineWave.vbproj b/78_Sine_Wave/vbnet/SineWave.vbproj new file mode 100644 index 00000000..610c360f --- /dev/null +++ b/78_Sine_Wave/vbnet/SineWave.vbproj @@ -0,0 +1,8 @@ + + + Exe + SineWave + net6.0 + 16.9 + + diff --git a/79_Slalom/csharp/Slalom.csproj b/79_Slalom/csharp/Slalom.csproj new file mode 100644 index 00000000..d3fe4757 --- /dev/null +++ b/79_Slalom/csharp/Slalom.csproj @@ -0,0 +1,9 @@ + + + Exe + net6.0 + 10 + enable + enable + + diff --git a/79_Slalom/csharp/Slalom.sln b/79_Slalom/csharp/Slalom.sln new file mode 100644 index 00000000..c1621f2e --- /dev/null +++ b/79_Slalom/csharp/Slalom.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Slalom", "Slalom.csproj", "{6D0607CF-B01C-4E17-A4DE-D15514AE5F84}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {6D0607CF-B01C-4E17-A4DE-D15514AE5F84}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6D0607CF-B01C-4E17-A4DE-D15514AE5F84}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6D0607CF-B01C-4E17-A4DE-D15514AE5F84}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6D0607CF-B01C-4E17-A4DE-D15514AE5F84}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/79_Slalom/vbnet/Slalom.sln b/79_Slalom/vbnet/Slalom.sln new file mode 100644 index 00000000..daa61623 --- /dev/null +++ b/79_Slalom/vbnet/Slalom.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Slalom", "Slalom.vbproj", "{9A7FDEAB-071F-404C-BBA4-91D77E797DF1}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {9A7FDEAB-071F-404C-BBA4-91D77E797DF1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9A7FDEAB-071F-404C-BBA4-91D77E797DF1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9A7FDEAB-071F-404C-BBA4-91D77E797DF1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9A7FDEAB-071F-404C-BBA4-91D77E797DF1}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/79_Slalom/vbnet/Slalom.vbproj b/79_Slalom/vbnet/Slalom.vbproj new file mode 100644 index 00000000..0622bcd9 --- /dev/null +++ b/79_Slalom/vbnet/Slalom.vbproj @@ -0,0 +1,8 @@ + + + Exe + Slalom + net6.0 + 16.9 + + diff --git a/80_Slots/csharp/Slots.csproj b/80_Slots/csharp/Slots.csproj new file mode 100644 index 00000000..d3fe4757 --- /dev/null +++ b/80_Slots/csharp/Slots.csproj @@ -0,0 +1,9 @@ + + + Exe + net6.0 + 10 + enable + enable + + diff --git a/80_Slots/csharp/Slots.sln b/80_Slots/csharp/Slots.sln new file mode 100644 index 00000000..60f90046 --- /dev/null +++ b/80_Slots/csharp/Slots.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Slots", "Slots.csproj", "{D855ECF3-DF8C-46DD-8BEF-2ADFF3AE7817}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {D855ECF3-DF8C-46DD-8BEF-2ADFF3AE7817}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D855ECF3-DF8C-46DD-8BEF-2ADFF3AE7817}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D855ECF3-DF8C-46DD-8BEF-2ADFF3AE7817}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D855ECF3-DF8C-46DD-8BEF-2ADFF3AE7817}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/80_Slots/vbnet/Slots.sln b/80_Slots/vbnet/Slots.sln new file mode 100644 index 00000000..1f493198 --- /dev/null +++ b/80_Slots/vbnet/Slots.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Slots", "Slots.vbproj", "{F64CB361-215F-4984-B154-304FF663A60C}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {F64CB361-215F-4984-B154-304FF663A60C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F64CB361-215F-4984-B154-304FF663A60C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F64CB361-215F-4984-B154-304FF663A60C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F64CB361-215F-4984-B154-304FF663A60C}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/80_Slots/vbnet/Slots.vbproj b/80_Slots/vbnet/Slots.vbproj new file mode 100644 index 00000000..04f381a3 --- /dev/null +++ b/80_Slots/vbnet/Slots.vbproj @@ -0,0 +1,8 @@ + + + Exe + Slots + net6.0 + 16.9 + + diff --git a/81_Splat/csharp/Splat.csproj b/81_Splat/csharp/Splat.csproj new file mode 100644 index 00000000..d3fe4757 --- /dev/null +++ b/81_Splat/csharp/Splat.csproj @@ -0,0 +1,9 @@ + + + Exe + net6.0 + 10 + enable + enable + + diff --git a/81_Splat/csharp/Splat.sln b/81_Splat/csharp/Splat.sln new file mode 100644 index 00000000..d7184859 --- /dev/null +++ b/81_Splat/csharp/Splat.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Splat", "Splat.csproj", "{95640CEE-A1A6-4824-A2C7-CF72CADA40FB}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {95640CEE-A1A6-4824-A2C7-CF72CADA40FB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {95640CEE-A1A6-4824-A2C7-CF72CADA40FB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {95640CEE-A1A6-4824-A2C7-CF72CADA40FB}.Release|Any CPU.ActiveCfg = Release|Any CPU + {95640CEE-A1A6-4824-A2C7-CF72CADA40FB}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/81_Splat/vbnet/Splat.sln b/81_Splat/vbnet/Splat.sln new file mode 100644 index 00000000..b132583d --- /dev/null +++ b/81_Splat/vbnet/Splat.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Splat", "Splat.vbproj", "{62FD7167-97B2-4EA7-8BC8-CBC5765DF721}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {62FD7167-97B2-4EA7-8BC8-CBC5765DF721}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {62FD7167-97B2-4EA7-8BC8-CBC5765DF721}.Debug|Any CPU.Build.0 = Debug|Any CPU + {62FD7167-97B2-4EA7-8BC8-CBC5765DF721}.Release|Any CPU.ActiveCfg = Release|Any CPU + {62FD7167-97B2-4EA7-8BC8-CBC5765DF721}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/81_Splat/vbnet/Splat.vbproj b/81_Splat/vbnet/Splat.vbproj new file mode 100644 index 00000000..daf6de3c --- /dev/null +++ b/81_Splat/vbnet/Splat.vbproj @@ -0,0 +1,8 @@ + + + Exe + Splat + net6.0 + 16.9 + + diff --git a/82_Stars/csharp/Stars/Game.cs b/82_Stars/csharp/Game.cs similarity index 100% rename from 82_Stars/csharp/Stars/Game.cs rename to 82_Stars/csharp/Game.cs diff --git a/82_Stars/csharp/Stars/Input.cs b/82_Stars/csharp/Input.cs similarity index 100% rename from 82_Stars/csharp/Stars/Input.cs rename to 82_Stars/csharp/Input.cs diff --git a/82_Stars/csharp/Stars/Program.cs b/82_Stars/csharp/Program.cs similarity index 100% rename from 82_Stars/csharp/Stars/Program.cs rename to 82_Stars/csharp/Program.cs diff --git a/51_Hurkle/csharp/src/hurkle/hurkle.csproj b/82_Stars/csharp/Stars.csproj similarity index 95% rename from 51_Hurkle/csharp/src/hurkle/hurkle.csproj rename to 82_Stars/csharp/Stars.csproj index 1d2d39a9..20827042 100644 --- a/51_Hurkle/csharp/src/hurkle/hurkle.csproj +++ b/82_Stars/csharp/Stars.csproj @@ -1,8 +1,8 @@ - - - - Exe - net5.0 - - - + + + + Exe + net5.0 + + + diff --git a/82_Stars/csharp/Stars.sln b/82_Stars/csharp/Stars.sln index 5f85e6b7..19c3a265 100644 --- a/82_Stars/csharp/Stars.sln +++ b/82_Stars/csharp/Stars.sln @@ -1,34 +1,25 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.26124.0 +# Visual Studio Version 17 +VisualStudioVersion = 17.0.32014.148 MinimumVisualStudioVersion = 15.0.26124.0 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Stars", "Stars\Stars.csproj", "{5832C21C-4DE5-475E-893D-745DA15F1AAC}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Stars", "Stars.csproj", "{F03C19DA-0F5D-45F4-B85E-E3ABCA197D4B}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 Release|Any CPU = Release|Any CPU - Release|x64 = Release|x64 - Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {F03C19DA-0F5D-45F4-B85E-E3ABCA197D4B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F03C19DA-0F5D-45F4-B85E-E3ABCA197D4B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F03C19DA-0F5D-45F4-B85E-E3ABCA197D4B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F03C19DA-0F5D-45F4-B85E-E3ABCA197D4B}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {5832C21C-4DE5-475E-893D-745DA15F1AAC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {5832C21C-4DE5-475E-893D-745DA15F1AAC}.Debug|Any CPU.Build.0 = Debug|Any CPU - {5832C21C-4DE5-475E-893D-745DA15F1AAC}.Debug|x64.ActiveCfg = Debug|Any CPU - {5832C21C-4DE5-475E-893D-745DA15F1AAC}.Debug|x64.Build.0 = Debug|Any CPU - {5832C21C-4DE5-475E-893D-745DA15F1AAC}.Debug|x86.ActiveCfg = Debug|Any CPU - {5832C21C-4DE5-475E-893D-745DA15F1AAC}.Debug|x86.Build.0 = Debug|Any CPU - {5832C21C-4DE5-475E-893D-745DA15F1AAC}.Release|Any CPU.ActiveCfg = Release|Any CPU - {5832C21C-4DE5-475E-893D-745DA15F1AAC}.Release|Any CPU.Build.0 = Release|Any CPU - {5832C21C-4DE5-475E-893D-745DA15F1AAC}.Release|x64.ActiveCfg = Release|Any CPU - {5832C21C-4DE5-475E-893D-745DA15F1AAC}.Release|x64.Build.0 = Release|Any CPU - {5832C21C-4DE5-475E-893D-745DA15F1AAC}.Release|x86.ActiveCfg = Release|Any CPU - {5832C21C-4DE5-475E-893D-745DA15F1AAC}.Release|x86.Build.0 = Release|Any CPU + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {0752CA22-85F0-43AE-8B79-7A611531CAF7} EndGlobalSection EndGlobal diff --git a/82_Stars/vbnet/Stars.sln b/82_Stars/vbnet/Stars.sln new file mode 100644 index 00000000..edb5e587 --- /dev/null +++ b/82_Stars/vbnet/Stars.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Stars", "Stars.vbproj", "{181B70F5-C2CB-4A73-9982-30C16DE89240}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {181B70F5-C2CB-4A73-9982-30C16DE89240}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {181B70F5-C2CB-4A73-9982-30C16DE89240}.Debug|Any CPU.Build.0 = Debug|Any CPU + {181B70F5-C2CB-4A73-9982-30C16DE89240}.Release|Any CPU.ActiveCfg = Release|Any CPU + {181B70F5-C2CB-4A73-9982-30C16DE89240}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/82_Stars/vbnet/Stars.vbproj b/82_Stars/vbnet/Stars.vbproj new file mode 100644 index 00000000..caad7d6e --- /dev/null +++ b/82_Stars/vbnet/Stars.vbproj @@ -0,0 +1,8 @@ + + + Exe + Stars + net6.0 + 16.9 + + diff --git a/83_Stock_Market/csharp/src/Assets.cs b/83_Stock_Market/csharp/Assets.cs similarity index 100% rename from 83_Stock_Market/csharp/src/Assets.cs rename to 83_Stock_Market/csharp/Assets.cs diff --git a/83_Stock_Market/csharp/src/Broker.cs b/83_Stock_Market/csharp/Broker.cs similarity index 100% rename from 83_Stock_Market/csharp/src/Broker.cs rename to 83_Stock_Market/csharp/Broker.cs diff --git a/83_Stock_Market/csharp/src/Company.cs b/83_Stock_Market/csharp/Company.cs similarity index 100% rename from 83_Stock_Market/csharp/src/Company.cs rename to 83_Stock_Market/csharp/Company.cs diff --git a/83_Stock_Market/csharp/src/Controller.cs b/83_Stock_Market/csharp/Controller.cs similarity index 100% rename from 83_Stock_Market/csharp/src/Controller.cs rename to 83_Stock_Market/csharp/Controller.cs diff --git a/83_Stock_Market/csharp/src/Extensions/EnumerableExtensions.cs b/83_Stock_Market/csharp/Extensions/EnumerableExtensions.cs similarity index 100% rename from 83_Stock_Market/csharp/src/Extensions/EnumerableExtensions.cs rename to 83_Stock_Market/csharp/Extensions/EnumerableExtensions.cs diff --git a/83_Stock_Market/csharp/src/Extensions/ImmutableArrayExtensions.cs b/83_Stock_Market/csharp/Extensions/ImmutableArrayExtensions.cs similarity index 100% rename from 83_Stock_Market/csharp/src/Extensions/ImmutableArrayExtensions.cs rename to 83_Stock_Market/csharp/Extensions/ImmutableArrayExtensions.cs diff --git a/83_Stock_Market/csharp/src/Extensions/RandomExtensions.cs b/83_Stock_Market/csharp/Extensions/RandomExtensions.cs similarity index 100% rename from 83_Stock_Market/csharp/src/Extensions/RandomExtensions.cs rename to 83_Stock_Market/csharp/Extensions/RandomExtensions.cs diff --git a/83_Stock_Market/csharp/src/Program.cs b/83_Stock_Market/csharp/Program.cs similarity index 100% rename from 83_Stock_Market/csharp/src/Program.cs rename to 83_Stock_Market/csharp/Program.cs diff --git a/83_Stock_Market/csharp/src/StockMarket.cs b/83_Stock_Market/csharp/StockMarket.cs similarity index 100% rename from 83_Stock_Market/csharp/src/StockMarket.cs rename to 83_Stock_Market/csharp/StockMarket.cs diff --git a/83_Stock_Market/csharp/Game.csproj b/83_Stock_Market/csharp/StockMarket.csproj similarity index 100% rename from 83_Stock_Market/csharp/Game.csproj rename to 83_Stock_Market/csharp/StockMarket.csproj diff --git a/83_Stock_Market/csharp/StockMarket.sln b/83_Stock_Market/csharp/StockMarket.sln index 5bfb67aa..ab159a5b 100644 --- a/83_Stock_Market/csharp/StockMarket.sln +++ b/83_Stock_Market/csharp/StockMarket.sln @@ -1,9 +1,9 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.31321.278 +# Visual Studio Version 17 +VisualStudioVersion = 17.0.32014.148 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Game", "Game.csproj", "{BADD262D-D540-431F-8803-2A6F80C22033}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StockMarket", "StockMarket.csproj", "{B4C15C31-EB2D-4AAF-8380-5F2EBC0DD9D0}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -11,10 +11,10 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {BADD262D-D540-431F-8803-2A6F80C22033}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {BADD262D-D540-431F-8803-2A6F80C22033}.Debug|Any CPU.Build.0 = Debug|Any CPU - {BADD262D-D540-431F-8803-2A6F80C22033}.Release|Any CPU.ActiveCfg = Release|Any CPU - {BADD262D-D540-431F-8803-2A6F80C22033}.Release|Any CPU.Build.0 = Release|Any CPU + {B4C15C31-EB2D-4AAF-8380-5F2EBC0DD9D0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B4C15C31-EB2D-4AAF-8380-5F2EBC0DD9D0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B4C15C31-EB2D-4AAF-8380-5F2EBC0DD9D0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B4C15C31-EB2D-4AAF-8380-5F2EBC0DD9D0}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/83_Stock_Market/csharp/src/TradingDay.cs b/83_Stock_Market/csharp/TradingDay.cs similarity index 100% rename from 83_Stock_Market/csharp/src/TradingDay.cs rename to 83_Stock_Market/csharp/TradingDay.cs diff --git a/83_Stock_Market/csharp/src/TransactionResult.cs b/83_Stock_Market/csharp/TransactionResult.cs similarity index 100% rename from 83_Stock_Market/csharp/src/TransactionResult.cs rename to 83_Stock_Market/csharp/TransactionResult.cs diff --git a/83_Stock_Market/csharp/src/View.cs b/83_Stock_Market/csharp/View.cs similarity index 100% rename from 83_Stock_Market/csharp/src/View.cs rename to 83_Stock_Market/csharp/View.cs diff --git a/83_Stock_Market/vbnet/StockMarket.sln b/83_Stock_Market/vbnet/StockMarket.sln new file mode 100644 index 00000000..00c39242 --- /dev/null +++ b/83_Stock_Market/vbnet/StockMarket.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "StockMarket", "StockMarket.vbproj", "{BF9F62B1-4F0E-40F0-AE76-D1055F0A2F31}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {BF9F62B1-4F0E-40F0-AE76-D1055F0A2F31}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {BF9F62B1-4F0E-40F0-AE76-D1055F0A2F31}.Debug|Any CPU.Build.0 = Debug|Any CPU + {BF9F62B1-4F0E-40F0-AE76-D1055F0A2F31}.Release|Any CPU.ActiveCfg = Release|Any CPU + {BF9F62B1-4F0E-40F0-AE76-D1055F0A2F31}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/83_Stock_Market/vbnet/StockMarket.vbproj b/83_Stock_Market/vbnet/StockMarket.vbproj new file mode 100644 index 00000000..1404eb48 --- /dev/null +++ b/83_Stock_Market/vbnet/StockMarket.vbproj @@ -0,0 +1,8 @@ + + + Exe + StockMarket + net6.0 + 16.9 + + diff --git a/84_Super_Star_Trek/superstartrek.bas b/84_Super_Star_Trek/superstartrek.bas index 74300763..efd74cb0 100644 --- a/84_Super_Star_Trek/superstartrek.bas +++ b/84_Super_Star_Trek/superstartrek.bas @@ -21,12 +21,12 @@ 210 REM *** BY USING "?" INSTEAD OF "PRINT" WHEN ENTERING LINES 215 REM *** 220 PRINT:PRINT:PRINT:PRINT:PRINT:PRINT:PRINT:PRINT:PRINT:PRINT:PRINT -221 PRINT" ,------*------," -222 PRINT" ,------------- '--- ------'" -223 PRINT" '-------- --' / /" -224 PRINT" ,---' '-------/ /--," -225 PRINT" '----------------'":PRINT -226 PRINT" THE USS ENTERPRISE --- NCC-1701" +221 PRINT " ,------*------," +222 PRINT " ,------------- '--- ------'" +223 PRINT " '-------- --' / /" +224 PRINT " ,---' '-------/ /--," +225 PRINT " '----------------'":PRINT +226 PRINT " THE USS ENTERPRISE --- NCC-1701" 227 PRINT:PRINT:PRINT:PRINT:PRINT 260 REM CLEAR 600 270 Z$=" " @@ -37,353 +37,353 @@ 475 DEF FNR(R)=INT(RND(R)*7.98+1.01) 480 REM INITIALIZE ENTERPRIZE'S POSITION 490 Q1=FNR(1):Q2=FNR(1):S1=FNR(1):S2=FNR(1) -530 FORI=1TO9:C(I,1)=0:C(I,2)=0:NEXTI +530 FOR I=1 TO 9:C(I,1)=0:C(I,2)=0:NEXT I 540 C(3,1)=-1:C(2,1)=-1:C(4,1)=-1:C(4,2)=-1:C(5,2)=-1:C(6,2)=-1 600 C(1,2)=1:C(2,2)=1:C(6,1)=1:C(7,1)=1:C(8,1)=1:C(8,2)=1:C(9,2)=1 -670 FORI=1TO8:D(I)=0:NEXTI +670 FOR I=1 TO 8:D(I)=0:NEXT I 710 A1$="NAVSRSLRSPHATORSHEDAMCOMXXX" 810 REM SETUP WHAT EXHISTS IN GALAXY . . . 815 REM K3= # KLINGONS B3= # STARBASES S3 = # STARS -820 FORI=1TO8:FORJ=1TO8:K3=0:Z(I,J)=0:R1=RND(1) -850 IFR1>.98THENK3=3:K9=K9+3:GOTO980 -860 IFR1>.95THENK3=2:K9=K9+2:GOTO980 -870 IFR1>.80THENK3=1:K9=K9+1 -980 B3=0:IFRND(1)>.96THENB3=1:B9=B9+1 -1040 G(I,J)=K3*100+B3*10+FNR(1):NEXTJ:NEXTI:IFK9>T9THENT9=K9+1 -1100 IFB9<>0THEN1200 -1150 IFG(Q1,Q2)<200THENG(Q1,Q2)=G(Q1,Q2)+120:K9=K9+1 +820 FOR I=1 TO 8:FOR J=1 TO 8:K3=0:Z(I,J)=0:R1=RND(1) +850 IF R1>.98 THEN K3=3:K9=K9+3:GOTO 980 +860 IF R1>.95 THEN K3=2:K9=K9+2:GOTO 980 +870 IF R1>.80 THEN K3=1:K9=K9+1 +980 B3=0:IF RND(1)>.96 THEN B3=1:B9=B9+1 +1040 G(I,J)=K3*100+B3*10+FNR(1):NEXT J:NEXT I:IF K9>T9 THEN T9=K9+1 +1100 IF B9<>0 THEN 1200 +1150 IF G(Q1,Q2)<200 THEN G(Q1,Q2)=G(Q1,Q2)+120:K9=K9+1 1160 B9=1:G(Q1,Q2)=G(Q1,Q2)+10:Q1=FNR(1):Q2=FNR(1) -1200 K7=K9:IFB9<>1THENX$="S":X0$=" ARE " -1230 PRINT"YOUR ORDERS ARE AS FOLLOWS:" -1240 PRINT" DESTROY THE";K9;"KLINGON WARSHIPS WHICH HAVE INVADED" -1252 PRINT" THE GALAXY BEFORE THEY CAN ATTACK FEDERATION HEADQUARTERS" -1260 PRINT" ON STARDATE";T0+T9;" THIS GIVES YOU";T9;"DAYS. THERE";X0$ -1272 PRINT" ";B9;"STARBASE";X$;" IN THE GALAXY FOR RESUPPLYING YOUR SHIP" -1280 PRINT:REM PRINT"HIT ANY KEY EXCEPT RETURN WHEN READY TO ACCEPT COMMAND" +1200 K7=K9:IF B9<>1 THEN X$="S":X0$=" ARE " +1230 PRINT "YOUR ORDERS ARE AS FOLLOWS:" +1240 PRINT " DESTROY THE";K9;"KLINGON WARSHIPS WHICH HAVE INVADED" +1252 PRINT " THE GALAXY BEFORE THEY CAN ATTACK FEDERATION HEADQUARTERS" +1260 PRINT " ON STARDATE";T0+T9;" THIS GIVES YOU";T9;"DAYS. THERE";X0$ +1272 PRINT " ";B9;"STARBASE";X$;" IN THE GALAXY FOR RESUPPLYING YOUR SHIP" +1280 PRINT:REM PRINT "HIT ANY KEY EXCEPT RETURN WHEN READY TO ACCEPT COMMAND" 1300 I=RND(1):REM IF INP(1)=13 THEN 1300 1310 REM HERE ANY TIME NEW QUADRANT ENTERED 1320 Z4=Q1:Z5=Q2:K3=0:B3=0:S3=0:G5=0:D4=.5*RND(1):Z(Q1,Q2)=G(Q1,Q2) -1390 IFQ1<1ORQ1>8ORQ2<1ORQ2>8THEN1600 +1390 IF Q1<1 OR Q1>8 OR Q2<1 OR Q2>8 THEN 1600 1430 GOSUB 9030:PRINT:IF T0<>T THEN 1490 -1460 PRINT"YOUR MISSION BEGINS WITH YOUR STARSHIP LOCATED" -1470 PRINT"IN THE GALACTIC QUADRANT, '";G2$;"'.":GOTO 1500 -1490 PRINT"NOW ENTERING ";G2$;" QUADRANT . . ." +1460 PRINT "YOUR MISSION BEGINS WITH YOUR STARSHIP LOCATED" +1470 PRINT "IN THE GALACTIC QUADRANT, '";G2$;"'.":GOTO 1500 +1490 PRINT "NOW ENTERING ";G2$;" QUADRANT . . ." 1500 PRINT:K3=INT(G(Q1,Q2)*.01):B3=INT(G(Q1,Q2)*.1)-10*K3 -1540 S3=G(Q1,Q2)-100*K3-10*B3:IFK3=0THEN1590 -1560 PRINT"COMBAT AREA CONDITION RED":IFS>200THEN1590 -1580 PRINT" SHIELDS DANGEROUSLY LOW" -1590 FORI=1TO3:K(I,1)=0:K(I,2)=0:NEXTI -1600 FORI=1TO3:K(I,3)=0:NEXTI:Q$=Z$+Z$+Z$+Z$+Z$+Z$+Z$+LEFT$(Z$,17) +1540 S3=G(Q1,Q2)-100*K3-10*B3:IF K3=0 THEN 1590 +1560 PRINT "COMBAT AREA CONDITION RED":IF S>200 THEN 1590 +1580 PRINT " SHIELDS DANGEROUSLY LOW" +1590 FOR I=1 TO 3:K(I,1)=0:K(I,2)=0:NEXT I +1600 FOR I=1 TO 3:K(I,3)=0:NEXT I:Q$=Z$+Z$+Z$+Z$+Z$+Z$+Z$+LEFT$(Z$,17) 1660 REM POSITION ENTERPRISE IN QUADRANT, THEN PLACE "K3" KLINGONS, & 1670 REM "B3" STARBASES, & "S3" STARS ELSEWHERE. -1680 A$="<*>":Z1=S1:Z2=S2:GOSUB8670:IFK3<1THEN1820 -1720 FORI=1TOK3:GOSUB8590:A$="+K+":Z1=R1:Z2=R2 -1780 GOSUB8670:K(I,1)=R1:K(I,2)=R2:K(I,3)=S9*(0.5+RND(1)):NEXTI -1820 IFB3<1THEN1910 -1880 GOSUB8590:A$=">!<":Z1=R1:B4=R1:Z2=R2:B5=R2:GOSUB8670 -1910 FORI=1TOS3:GOSUB8590:A$=" * ":Z1=R1:Z2=R2:GOSUB8670:NEXTI -1980 GOSUB6430 -1990 IFS+E>10THENIFE>10ORD(7)=0THEN2060 -2020 PRINT:PRINT"** FATAL ERROR ** YOU'VE JUST STRANDED YOUR SHIP IN " -2030 PRINT"SPACE":PRINT"YOU HAVE INSUFFICIENT MANEUVERING ENERGY,"; -2040 PRINT" AND SHIELD CONTROL":PRINT"IS PRESENTLY INCAPABLE OF CROSS"; -2050 PRINT"-CIRCUITING TO ENGINE ROOM!!":GOTO6220 +1680 A$="<*>":Z1=S1:Z2=S2:GOSUB 8670:IF K3<1 THEN 1820 +1720 FOR I=1 TO K3:GOSUB 8590:A$="+K+":Z1=R1:Z2=R2 +1780 GOSUB 8670:K(I,1)=R1:K(I,2)=R2:K(I,3)=S9*(0.5+RND(1)):NEXT I +1820 IF B3<1 THEN 1910 +1880 GOSUB 8590:A$=">!<":Z1=R1:B4=R1:Z2=R2:B5=R2:GOSUB 8670 +1910 FOR I=1 TO S3:GOSUB 8590:A$=" * ":Z1=R1:Z2=R2:GOSUB 8670:NEXT I +1980 GOSUB 6430 +1990 IF S+E>10 THEN IF E>10 OR D(7)=0 THEN 2060 +2020 PRINT:PRINT "** FATAL ERROR ** YOU'VE JUST STRANDED YOUR SHIP IN " +2030 PRINT "SPACE":PRINT "YOU HAVE INSUFFICIENT MANEUVERING ENERGY,"; +2040 PRINT " AND SHIELD CONTROL":PRINT "IS PRESENTLY INCAPABLE OF CROSS"; +2050 PRINT "-CIRCUITING TO ENGINE ROOM!!":GOTO 6220 2060 INPUT"COMMAND";A$ -2080 FORI=1TO9:IFLEFT$(A$,3)<>MID$(A1$,3*I-2,3)THEN2160 -2140 ONIGOTO2300,1980,4000,4260,4700,5530,5690,7290,6270 -2160 NEXTI:PRINT"ENTER ONE OF THE FOLLOWING:" -2180 PRINT" NAV (TO SET COURSE)" -2190 PRINT" SRS (FOR SHORT RANGE SENSOR SCAN)" -2200 PRINT" LRS (FOR LONG RANGE SENSOR SCAN)" -2210 PRINT" PHA (TO FIRE PHASERS)" -2220 PRINT" TOR (TO FIRE PHOTON TORPEDOES)" -2230 PRINT" SHE (TO RAISE OR LOWER SHIELDS)" -2240 PRINT" DAM (FOR DAMAGE CONTROL REPORTS)" -2250 PRINT" COM (TO CALL ON LIBRARY-COMPUTER)" -2260 PRINT" XXX (TO RESIGN YOUR COMMAND)":PRINT:GOTO 1990 +2080 FOR I=1 TO 9:IF LEFT$(A$,3)<>MID$(A1$,3*I-2,3) THEN 2160 +2140 ON I GOTO 2300,1980,4000,4260,4700,5530,5690,7290,6270 +2160 NEXT I:PRINT "ENTER ONE OF THE FOLLOWING:" +2180 PRINT " NAV (TO SET COURSE)" +2190 PRINT " SRS (FOR SHORT RANGE SENSOR SCAN)" +2200 PRINT " LRS (FOR LONG RANGE SENSOR SCAN)" +2210 PRINT " PHA (TO FIRE PHASERS)" +2220 PRINT " TOR (TO FIRE PHOTON TORPEDOES)" +2230 PRINT " SHE (TO RAISE OR LOWER SHIELDS)" +2240 PRINT " DAM (FOR DAMAGE CONTROL REPORTS)" +2250 PRINT " COM (TO CALL ON LIBRARY-COMPUTER)" +2260 PRINT " XXX (TO RESIGN YOUR COMMAND)":PRINT:GOTO 1990 2290 REM COURSE CONTROL BEGINS HERE -2300 INPUT"COURSE (0-9)";C1:IFC1=9THENC1=1 -2310 IFC1>=1ANDC1<9THEN2350 -2330 PRINT" LT. SULU REPORTS, 'INCORRECT COURSE DATA, SIR!'":GOTO1990 -2350 X$="8":IFD(1)<0THENX$="0.2" -2360 PRINT"WARP FACTOR (0-";X$;")";:INPUTW1:IFD(1)<0ANDW1>.2THEN2470 -2380 IFW1>0ANDW1<=8THEN2490 -2390 IFW1=0THEN1990 -2420 PRINT" CHIEF ENGINEER SCOTT REPORTS 'THE ENGINES WON'T TAKE"; -2430 PRINT" WARP ";W1;"!'":GOTO1990 -2470 PRINT"WARP ENGINES ARE DAMAGED. MAXIUM SPEED = WARP 0.2":GOTO1990 -2490 N=INT(W1*8+.5):IFE-N>=0THEN2590 -2500 PRINT"ENGINEERING REPORTS 'INSUFFICIENT ENERGY AVAILABLE" -2510 PRINT" FOR MANEUVERING AT WARP";W1;"!'" -2530 IFS=1 AND C1<9 THEN 2350 +2330 PRINT " LT. SULU REPORTS, 'INCORRECT COURSE DATA, SIR!'":GOTO 1990 +2350 X$="8":IF D(1)<0 THEN X$="0.2" +2360 PRINT "WARP FACTOR (0-";X$;")";:INPUT W1:IF D(1)<0 AND W1>.2 THEN 2470 +2380 IF W1>0 AND W1<=8 THEN 2490 +2390 IF W1=0 THEN 1990 +2420 PRINT " CHIEF ENGINEER SCOTT REPORTS 'THE ENGINES WON'T TAKE"; +2430 PRINT " WARP ";W1;"!'":GOTO 1990 +2470 PRINT "WARP ENGINES ARE DAMAGED. MAXIUM SPEED = WARP 0.2":GOTO 1990 +2490 N=INT(W1*8+.5):IF E-N>=0 THEN 2590 +2500 PRINT "ENGINEERING REPORTS 'INSUFFICIENT ENERGY AVAILABLE" +2510 PRINT " FOR MANEUVERING AT WARP";W1;"!'" +2530 IF S=1THEND6=1 -2770 FORI=1TO8:IFD(I)>=0THEN2880 -2790 D(I)=D(I)+D6:IFD(I)>-.1ANDD(I)<0THEND(I)=-.1:GOTO2880 -2800 IFD(I)<0THEN2880 -2810 IFD1<>1THEND1=1:PRINT"DAMAGE CONTROL REPORT: "; -2840 PRINTTAB(8);:R1=I:GOSUB8790:PRINTG2$;" REPAIR COMPLETED." -2880 NEXTI:IFRND(1)>.2THEN3070 -2910 R1=FNR(1):IFRND(1)>=.6THEN3000 -2930 D(R1)=D(R1)-(RND(1)*5+1):PRINT"DAMAGE CONTROL REPORT: "; -2960 GOSUB8790:PRINTG2$;" DAMAGED":PRINT:GOTO3070 -3000 D(R1)=D(R1)+RND(1)*3+1:PRINT"DAMAGE CONTROL REPORT: "; -3030 GOSUB8790:PRINTG2$;" STATE OF REPAIR IMPROVED":PRINT +2590 FOR I=1 TO K3:IF K(I,3)=0 THEN 2700 +2610 A$=" ":Z1=K(I,1):Z2=K(I,2):GOSUB 8670:GOSUB 8590 +2660 K(I,1)=Z1:K(I,2)=Z2:A$="+K+":GOSUB 8670 +2700 NEXT I:GOSUB 6000:D1=0:D6=W1:IF W1>=1 THEN D6=1 +2770 FOR I=1 TO 8:IF D(I)>=0 THEN 2880 +2790 D(I)=D(I)+D6:IF D(I)>-.1 AND D(I)<0 THEN D(I)=-.1:GOTO 2880 +2800 IF D(I)<0 THEN 2880 +2810 IF D1<>1 THEN D1=1:PRINT "DAMAGE CONTROL REPORT: "; +2840 PRINT TAB(8);:R1=I:GOSUB 8790:PRINT G2$;" REPAIR COMPLETED." +2880 NEXT I:IF RND(1)>.2 THEN 3070 +2910 R1=FNR(1):IF RND(1)>=.6 THEN 3000 +2930 D(R1)=D(R1)-(RND(1)*5+1):PRINT "DAMAGE CONTROL REPORT: "; +2960 GOSUB 8790:PRINT G2$;" DAMAGED":PRINT:GOTO 3070 +3000 D(R1)=D(R1)+RND(1)*3+1:PRINT "DAMAGE CONTROL REPORT: "; +3030 GOSUB 8790:PRINT G2$;" STATE OF REPAIR IMPROVED":PRINT 3060 REM BEGIN MOVING STARSHIP -3070 A$=" ":Z1=INT(S1):Z2=INT(S2):GOSUB8670 +3070 A$=" ":Z1=INT(S1):Z2=INT(S2):GOSUB 8670 3110 X1=C(C1,1)+(C(C1+1,1)-C(C1,1))*(C1-INT(C1)):X=S1:Y=S2 3140 X2=C(C1,2)+(C(C1+1,2)-C(C1,2))*(C1-INT(C1)):Q4=Q1:Q5=Q2 -3170 FORI=1TON:S1=S1+X1:S2=S2+X2:IFS1<1ORS1>=9ORS2<1ORS2>=9THEN3500 -3240 S8=INT(S1)*24+INT(S2)*3-26:IFMID$(Q$,S8,2)=" "THEN3360 -3320 S1=INT(S1-X1):S2=INT(S2-X2):PRINT"WARP ENGINES SHUT DOWN AT "; -3350 PRINT"SECTOR";S1;",";S2;"DUE TO BAD NAVAGATION":GOTO3370 -3360 NEXTI:S1=INT(S1):S2=INT(S2) -3370 A$="<*>":Z1=INT(S1):Z2=INT(S2):GOSUB8670:GOSUB3910:T8=1 -3430 IFW1<1THENT8=.1*INT(10*W1) -3450 T=T+T8:IFT>T0+T9THEN6220 +3170 FOR I=1 TO N:S1=S1+X1:S2=S2+X2:IF S1<1 OR S1>=9 OR S2<1 OR S2>=9 THEN 3500 +3240 S8=INT(S1)*24+INT(S2)*3-26:IF MID$(Q$,S8,2)=" " THEN 3360 +3320 S1=INT(S1-X1):S2=INT(S2-X2):PRINT "WARP ENGINES SHUT DOWN AT "; +3350 PRINT "SECTOR";S1;",";S2;"DUE TO BAD NAVAGATION":GOTO 3370 +3360 NEXT I:S1=INT(S1):S2=INT(S2) +3370 A$="<*>":Z1=INT(S1):Z2=INT(S2):GOSUB 8670:GOSUB 3910:T8=1 +3430 IF W1<1 THEN T8=.1*INT(10*W1) +3450 T=T+T8:IF T>T0+T9 THEN 6220 3470 REM SEE IF DOCKED, THEN GET COMMAND -3480 GOTO1980 +3480 GOTO 1980 3490 REM EXCEEDED QUADRANT LIMITS 3500 X=8*Q1+X+N*X1:Y=8*Q2+Y+N*X2:Q1=INT(X/8):Q2=INT(Y/8):S1=INT(X-Q1*8) -3550 S2=INT(Y-Q2*8):IFS1=0THENQ1=Q1-1:S1=8 -3590 IFS2=0THENQ2=Q2-1:S2=8 -3620 X5=0:IFQ1<1THENX5=1:Q1=1:S1=1 -3670 IFQ1>8THENX5=1:Q1=8:S1=8 -3710 IFQ2<1THENX5=1:Q2=1:S2=1 -3750 IFQ2>8THENX5=1:Q2=8:S2=8 -3790 IFX5=0THEN3860 -3800 PRINT"LT. UHURA REPORTS MESSAGE FROM STARFLEET COMMAND:" -3810 PRINT" 'PERMISSION TO ATTEMPT CROSSING OF GALACTIC PERIMETER" -3820 PRINT" IS HEREBY *DENIED*. SHUT DOWN YOUR ENGINES.'" -3830 PRINT"CHIEF ENGINEER SCOTT REPORTS 'WARP ENGINES SHUT DOWN" -3840 PRINT" AT SECTOR";S1;",";S2;"OF QUADRANT";Q1;",";Q2;".'" -3850 IFT>T0+T9THEN6220 -3860 IF8*Q1+Q2=8*Q4+Q5THEN3370 -3870 T=T+1:GOSUB3910:GOTO1320 +3550 S2=INT(Y-Q2*8):IF S1=0 THEN Q1=Q1-1:S1=8 +3590 IF S2=0 THEN Q2=Q2-1:S2=8 +3620 X5=0:IF Q1<1 THEN X5=1:Q1=1:S1=1 +3670 IF Q1>8 THEN X5=1:Q1=8:S1=8 +3710 IF Q2<1 THEN X5=1:Q2=1:S2=1 +3750 IF Q2>8 THEN X5=1:Q2=8:S2=8 +3790 IF X5=0 THEN 3860 +3800 PRINT "LT. UHURA REPORTS MESSAGE FROM STARFLEET COMMAND:" +3810 PRINT " 'PERMISSION TO ATTEMPT CROSSING OF GALACTIC PERIMETER" +3820 PRINT " IS HEREBY *DENIED*. SHUT DOWN YOUR ENGINES.'" +3830 PRINT "CHIEF ENGINEER SCOTT REPORTS 'WARP ENGINES SHUT DOWN" +3840 PRINT " AT SECTOR";S1;",";S2;"OF QUADRANT";Q1;",";Q2;".'" +3850 IF T>T0+T9 THEN 6220 +3860 IF 8*Q1+Q2=8*Q4+Q5 THEN 3370 +3870 T=T+1:GOSUB 3910:GOTO 1320 3900 REM MANEUVER ENERGY S/R ** -3910 E=E-N-10:IFE>=0THENRETURN -3930 PRINT"SHIELD CONTROL SUPPLIES ENERGY TO COMPLETE THE MANEUVER." -3940 S=S+E:E=0:IFS<=0THENS=0 +3910 E=E-N-10:IF E>=0 THEN RETURN +3930 PRINT "SHIELD CONTROL SUPPLIES ENERGY TO COMPLETE THE MANEUVER." +3940 S=S+E:E=0:IF S<=0 THEN S=0 3980 RETURN 3990 REM LONG RANGE SENSOR SCAN CODE -4000 IFD(3)<0THENPRINT"LONG RANGE SENSORS ARE INOPERABLE":GOTO1990 -4030 PRINT"LONG RANGE SCAN FOR QUADRANT";Q1;",";Q2 -4040 O1$="-------------------":PRINTO1$ -4060 FORI=Q1-1TOQ1+1:N(1)=-1:N(2)=-2:N(3)=-3:FORJ=Q2-1TOQ2+1 -4120 IFI>0ANDI<9ANDJ>0ANDJ<9THENN(J-Q2+2)=G(I,J):Z(I,J)=G(I,J) -4180 NEXTJ:FORL=1TO3:PRINT": ";:IFN(L)<0THENPRINT"*** ";:GOTO4230 -4210 PRINTRIGHT$(STR$(N(L)+1000),3);" "; -4230 NEXTL:PRINT":":PRINTO1$:NEXTI:GOTO1990 +4000 IF D(3)<0 THEN PRINT "LONG RANGE SENSORS ARE INOPERABLE":GOTO 1990 +4030 PRINT "LONG RANGE SCAN FOR QUADRANT";Q1;",";Q2 +4040 O1$="-------------------":PRINT O1$ +4060 FOR I=Q1-1TOQ1+1:N(1)=-1:N(2)=-2:N(3)=-3:FOR J=Q2-1TOQ2+1 +4120 IF I>0 AND I<9 AND J>0 AND J<9 THEN N(J-Q2+2)=G(I,J):Z(I,J)=G(I,J) +4180 NEXT J:FOR L=1 TO 3:PRINT ": ";:IF N(L)<0 THEN PRINT "*** ";:GOTO 4230 +4210 PRINT RIGHT$(STR$(N(L)+1000),3);" "; +4230 NEXT L:PRINT ":":PRINT O1$:NEXT I:GOTO 1990 4250 REM PHASER CONTROL CODE BEGINS HERE -4260 IFD(4)<0THENPRINT"PHASERS INOPERATIVE":GOTO1990 -4265 IFK3>0THEN4330 -4270 PRINT"SCIENCE OFFICER SPOCK REPORTS 'SENSORS SHOW NO ENEMY SHIPS" -4280 PRINT" IN THIS QUADRANT'":GOTO1990 -4330 IFD(8)<0THENPRINT"COMPUTER FAILURE HAMPERS ACCURACY" -4350 PRINT"PHASERS LOCKED ON TARGET; "; -4360 PRINT"ENERGY AVAILABLE =";E;"UNITS" -4370 INPUT"NUMBER OF UNITS TO FIRE";X:IFX<=0THEN1990 -4400 IFE-X<0THEN4360 -4410 E=E-X:IFD(7)<0THENX=X*RND(1) -4450 H1=INT(X/K3):FORI=1TO3:IFK(I,3)<=0THEN4670 -4480 H=INT((H1/FND(0))*(RND(1)+2)):IFH>.15*K(I,3)THEN4530 -4500 PRINT"SENSORS SHOW NO DAMAGE TO ENEMY AT ";K(I,1);",";K(I,2):GOTO4670 -4530 K(I,3)=K(I,3)-H:PRINTH;"UNIT HIT ON KLINGON AT SECTOR";K(I,1);","; -4550 PRINTK(I,2):IFK(I,3)<=0THENPRINT"*** KLINGON DESTROYED ***":GOTO4580 -4560 PRINT" (SENSORS SHOW";K(I,3);"UNITS REMAINING)":GOTO4670 -4580 K3=K3-1:K9=K9-1:Z1=K(I,1):Z2=K(I,2):A$=" ":GOSUB8670 -4650 K(I,3)=0:G(Q1,Q2)=G(Q1,Q2)-100:Z(Q1,Q2)=G(Q1,Q2):IFK9<=0THEN6370 -4670 NEXTI:GOSUB6000:GOTO1990 +4260 IF D(4)<0 THEN PRINT "PHASERS INOPERATIVE":GOTO 1990 +4265 IF K3>0 THEN 4330 +4270 PRINT "SCIENCE OFFICER SPOCK REPORTS 'SENSORS SHOW NO ENEMY SHIPS" +4280 PRINT " IN THIS QUADRANT'":GOTO 1990 +4330 IF D(8)<0 THEN PRINT "COMPUTER FAILURE HAMPERS ACCURACY" +4350 PRINT "PHASERS LOCKED ON TARGET; "; +4360 PRINT "ENERGY AVAILABLE =";E;"UNITS" +4370 INPUT"NUMBER OF UNITS TO FIRE";X:IF X<=0 THEN 1990 +4400 IF E-X<0 THEN 4360 +4410 E=E-X:IF D(7)<0 THEN X=X*RND(1) +4450 H1=INT(X/K3):FOR I=1TO3:IF K(I,3)<=0 THEN 4670 +4480 H=INT((H1/FND(0))*(RND(1)+2)):IF H>.15*K(I,3) THEN 4530 +4500 PRINT "SENSORS SHOW NO DAMAGE TO ENEMY AT ";K(I,1);",";K(I,2):GOTO 4670 +4530 K(I,3)=K(I,3)-H:PRINT H;"UNIT HIT ON KLINGON AT SECTOR";K(I,1);","; +4550 PRINT K(I,2):IF K(I,3)<=0 THEN PRINT "*** KLINGON DESTROYED ***":GOTO 4580 +4560 PRINT " (SENSORS SHOW";K(I,3);"UNITS REMAINING)":GOTO 4670 +4580 K3=K3-1:K9=K9-1:Z1=K(I,1):Z2=K(I,2):A$=" ":GOSUB 8670 +4650 K(I,3)=0:G(Q1,Q2)=G(Q1,Q2)-100:Z(Q1,Q2)=G(Q1,Q2):IF K9<=0 THEN 6370 +4670 NEXT I:GOSUB 6000:GOTO 1990 4690 REM PHOTON TORPEDO CODE BEGINS HERE -4700 IFP<=0THENPRINT"ALL PHOTON TORPEDOES EXPENDED":GOTO 1990 -4730 IFD(5)<0THENPRINT"PHOTON TUBES ARE NOT OPERATIONAL":GOTO1990 -4760 INPUT"PHOTON TORPEDO COURSE (1-9)";C1:IFC1=9THENC1=1 -4780 IFC1>=1ANDC1<9THEN4850 -4790 PRINT"ENSIGN CHEKOV REPORTS, 'INCORRECT COURSE DATA, SIR!'" -4800 GOTO1990 +4700 IF P<=0 THEN PRINT "ALL PHOTON TORPEDOES EXPENDED":GOTO 1990 +4730 IF D(5)<0 THEN PRINT "PHOTON TUBES ARE NOT OPERATIONAL":GOTO 1990 +4760 INPUT"PHOTON TORPEDO COURSE (1-9)";C1:IF C1=9 THEN C1=1 +4780 IF C1>=1ANDC1<9 THEN 4850 +4790 PRINT "ENSIGN CHEKOV REPORTS, 'INCORRECT COURSE DATA, SIR!'" +4800 GOTO 1990 4850 X1=C(C1,1)+(C(C1+1,1)-C(C1,1))*(C1-INT(C1)):E=E-2:P=P-1 4860 X2=C(C1,2)+(C(C1+1,2)-C(C1,2))*(C1-INT(C1)):X=S1:Y=S2 -4910 PRINT"TORPEDO TRACK:" +4910 PRINT "TORPEDO TRACK:" 4920 X=X+X1:Y=Y+X2:X3=INT(X+.5):Y3=INT(Y+.5) -4960 IFX3<1ORX3>8ORY3<1ORY3>8THEN5490 -5000 PRINT" ";X3;",";Y3:A$=" ":Z1=X:Z2=Y:GOSUB8830 -5050 IFZ3<>0THEN4920 -5060 A$="+K+":Z1=X:Z2=Y:GOSUB8830:IFZ3=0THEN5210 -5110 PRINT"*** KLINGON DESTROYED ***":K3=K3-1:K9=K9-1:IFK9<=0THEN6370 -5150 FORI=1TO3:IFX3=K(I,1)ANDY3=K(I,2)THEN5190 -5180 NEXTI:I=3 -5190 K(I,3)=0:GOTO5430 -5210 A$=" * ":Z1=X:Z2=Y:GOSUB8830:IFZ3=0THEN5280 -5260 PRINT"STAR AT";X3;",";Y3;"ABSORBED TORPEDO ENERGY.":GOSUB6000:GOTO1990 -5280 A$=">!<":Z1=X:Z2=Y:GOSUB8830:IFZ3=0THEN4760 -5330 PRINT"*** STARBASE DESTROYED ***":B3=B3-1:B9=B9-1 -5360 IFB9>0ORK9>T-T0-T9THEN5400 -5370 PRINT"THAT DOES IT, CAPTAIN!! YOU ARE HEREBY RELIEVED OF COMMAND" -5380 PRINT"AND SENTENCED TO 99 STARDATES AT HARD LABOR ON CYGNUS 12!!" +4960 IF X3<1 OR X3>8 OR Y3<1 OR Y3>8 THEN 5490 +5000 PRINT " ";X3;",";Y3:A$=" ":Z1=X:Z2=Y:GOSUB 8830 +5050 IF Z3<>0 THEN 4920 +5060 A$="+K+":Z1=X:Z2=Y:GOSUB 8830:IF Z3=0 THEN 5210 +5110 PRINT "*** KLINGON DESTROYED ***":K3=K3-1:K9=K9-1:IF K9<=0 THEN 6370 +5150 FOR I=1TO3:IF X3=K(I,1) AND Y3=K(I,2) THEN 5190 +5180 NEXT I:I=3 +5190 K(I,3)=0:GOTO 5430 +5210 A$=" * ":Z1=X:Z2=Y:GOSUB 8830:IF Z3=0 THEN 5280 +5260 PRINT "STAR AT";X3;",";Y3;"ABSORBED TORPEDO ENERGY.":GOSUB 6000:GOTO 1990 +5280 A$=">!<":Z1=X:Z2=Y:GOSUB 8830:IF Z3=0 THEN 4760 +5330 PRINT "*** STARBASE DESTROYED ***":B3=B3-1:B9=B9-1 +5360 IF B9>0 OR K9>T-T0-T9 THEN 5400 +5370 PRINT "THAT DOES IT, CAPTAIN!! YOU ARE HEREBY RELIEVED OF COMMAND" +5380 PRINT "AND SENTENCED TO 99 STARDATES AT HARD LABOR ON CYGNUS 12!!" 5390 GOTO 6270 -5400 PRINT"STARFLEET COMMAND REVIEWING YOUR RECORD TO CONSIDER" -5410 PRINT"COURT MARTIAL!":D0=0 -5430 Z1=X:Z2=Y:A$=" ":GOSUB8670 -5470 G(Q1,Q2)=K3*100+B3*10+S3:Z(Q1,Q2)=G(Q1,Q2):GOSUB6000:GOTO1990 -5490 PRINT"TORPEDO MISSED":GOSUB6000:GOTO1990 +5400 PRINT "STARFLEET COMMAND REVIEWING YOUR RECORD TO CONSIDER" +5410 PRINT "COURT MARTIAL!":D0=0 +5430 Z1=X:Z2=Y:A$=" ":GOSUB 8670 +5470 G(Q1,Q2)=K3*100+B3*10+S3:Z(Q1,Q2)=G(Q1,Q2):GOSUB 6000:GOTO 1990 +5490 PRINT "TORPEDO MISSED":GOSUB 6000:GOTO 1990 5520 REM SHIELD CONTROL -5530 IFD(7)<0THENPRINT"SHIELD CONTROL INOPERABLE":GOTO1990 -5560 PRINT"ENERGY AVAILABLE =";E+S;:INPUT"NUMBER OF UNITS TO SHIELDS";X -5580 IFX<0ORS=XTHENPRINT"":GOTO1990 -5590 IFX<=E+STHEN5630 -5600 PRINT"SHIELD CONTROL REPORTS 'THIS IS NOT THE FEDERATION TREASURY.'" -5610 PRINT"":GOTO1990 -5630 E=E+S-X:S=X:PRINT"DEFLECTOR CONTROL ROOM REPORT:" -5660 PRINT" 'SHIELDS NOW AT";INT(S);"UNITS PER YOUR COMMAND.'":GOTO1990 +5530 IF D(7)<0 THEN PRINT "SHIELD CONTROL INOPERABLE":GOTO 1990 +5560 PRINT "ENERGY AVAILABLE =";E+S;:INPUT"NUMBER OF UNITS TO SHIELDS";X +5580 IF X<0 OR S=X THEN PRINT "":GOTO 1990 +5590 IF X<=E+S THEN 5630 +5600 PRINT "SHIELD CONTROL REPORTS 'THIS IS NOT THE FEDERATION TREASURY.'" +5610 PRINT "":GOTO 1990 +5630 E=E+S-X:S=X:PRINT "DEFLECTOR CONTROL ROOM REPORT:" +5660 PRINT " 'SHIELDS NOW AT";INT(S);"UNITS PER YOUR COMMAND.'":GOTO 1990 5680 REM DAMAGE CONTROL -5690 IFD(6)>=0THEN5910 -5700 PRINT"DAMAGE CONTROL REPORT NOT AVAILABLE":IFD0=0THEN1990 -5720 D3=0:FORI=1TO8:IFD(I)<0THEND3=D3+.1 -5760 NEXTI:IFD3=0THEN1990 -5780 PRINT:D3=D3+D4:IFD3>=1THEND3=.9 -5810 PRINT"TECHNICIANS STANDING BY TO EFFECT REPAIRS TO YOUR SHIP;" -5820 PRINT"ESTIMATED TIME TO REPAIR:";.01*INT(100*D3);"STARDATES" +5690 IF D(6)>=0 THEN 5910 +5700 PRINT "DAMAGE CONTROL REPORT NOT AVAILABLE":IF D0=0 THEN 1990 +5720 D3=0:FOR I=1TO8:IF D(I)<0 THEN D3=D3+.1 +5760 NEXT I:IF D3=0 THEN 1990 +5780 PRINT:D3=D3+D4:IF D3>=1 THEN D3=.9 +5810 PRINT "TECHNICIANS STANDING BY TO EFFECT REPAIRS TO YOUR SHIP;" +5820 PRINT "ESTIMATED TIME TO REPAIR:";.01*INT(100*D3);"STARDATES" 5840 INPUT "WILL YOU AUTHORIZE THE REPAIR ORDER (Y/N)";A$ -5860 IFA$<>"Y"THEN 1990 -5870 FORI=1TO8:IFD(I)<0THEND(I)=0 -5890 NEXTI:T=T+D3+.1 -5910 PRINT:PRINT"DEVICE STATE OF REPAIR":FORR1=1TO8 -5920 GOSUB8790:PRINTG2$;LEFT$(Z$,25-LEN(G2$));INT(D(R1)*100)*.01 -5950 NEXTR1:PRINT:IFD0<>0THEN5720 +5860 IF A$<>"Y" THEN 1990 +5870 FOR I=1TO8:IF D(I)<0 THEN D(I)=0 +5890 NEXT I:T=T+D3+.1 +5910 PRINT:PRINT "DEVICE STATE OF REPAIR":FOR R1=1TO8 +5920 GOSUB 8790:PRINT G2$;LEFT$(Z$,25-LEN(G2$));INT(D(R1)*100)*.01 +5950 NEXT R1:PRINT:IF D0<>0 THEN 5720 5980 GOTO 1990 5990 REM KLINGONS SHOOTING -6000 IFK3<=0THENRETURN -6010 IFD0<>0THENPRINT"STARBASE SHIELDS PROTECT THE ENTERPRISE":RETURN -6040 FORI=1TO3:IFK(I,3)<=0THEN6200 +6000 IF K3<=0 THEN RETURN +6010 IF D0<>0 THEN PRINT "STARBASE SHIELDS PROTECT THE ENTERPRISE":RETURN +6040 FOR I=1TO3:IF K(I,3)<=0 THEN 6200 6060 H=INT((K(I,3)/FND(1))*(2+RND(1))):S=S-H:K(I,3)=K(I,3)/(3+RND(0)) -6080 PRINTH;"UNIT HIT ON ENTERPRISE FROM SECTOR";K(I,1);",";K(I,2) -6090 IFS<=0THEN6240 -6100 PRINT" ":IFH<20THEN6200 -6120 IFRND(1)>.6ORH/S<=.02THEN6200 -6140 R1=FNR(1):D(R1)=D(R1)-H/S-.5*RND(1):GOSUB8790 -6170 PRINT"DAMAGE CONTROL REPORTS ";G2$;" DAMAGED BY THE HIT'" -6200 NEXTI:RETURN +6080 PRINT H;"UNIT HIT ON ENTERPRISE FROM SECTOR";K(I,1);",";K(I,2) +6090 IF S<=0 THEN 6240 +6100 PRINT " ":IF H<20 THEN 6200 +6120 IF RND(1)>.6 OR H/S<=.02 THEN 6200 +6140 R1=FNR(1):D(R1)=D(R1)-H/S-.5*RND(1):GOSUB 8790 +6170 PRINT "DAMAGE CONTROL REPORTS ";G2$;" DAMAGED BY THE HIT'" +6200 NEXT I:RETURN 6210 REM END OF GAME -6220 PRINT"IT IS STARDATE";T:GOTO 6270 -6240 PRINT:PRINT"THE ENTERPRISE HAS BEEN DESTROYED. THEN FEDERATION "; -6250 PRINT"WILL BE CONQUERED":GOTO 6220 -6270 PRINT"THERE WERE";K9;"KLINGON BATTLE CRUISERS LEFT AT" -6280 PRINT"THE END OF YOUR MISSION." -6290 PRINT:PRINT:IFB9=0THEN6360 -6310 PRINT"THE FEDERATION IS IN NEED OF A NEW STARSHIP COMMANDER" -6320 PRINT"FOR A SIMILAR MISSION -- IF THERE IS A VOLUNTEER," -6330 INPUT"LET HIM STEP FORWARD AND ENTER 'AYE'";A$:IFA$="AYE"THEN10 +6220 PRINT "IT IS STARDATE";T:GOTO 6270 +6240 PRINT:PRINT "THE ENTERPRISE HAS BEEN DESTROYED. THEN FEDERATION "; +6250 PRINT "WILL BE CONQUERED":GOTO 6220 +6270 PRINT "THERE WERE";K9;"KLINGON BATTLE CRUISERS LEFT AT" +6280 PRINT "THE END OF YOUR MISSION." +6290 PRINT:PRINT:IF B9=0 THEN 6360 +6310 PRINT "THE FEDERATION IS IN NEED OF A NEW STARSHIP COMMANDER" +6320 PRINT "FOR A SIMILAR MISSION -- IF THERE IS A VOLUNTEER," +6330 INPUT"LET HIM STEP FORWARD AND ENTER 'AYE'";A$:IF A$="AYE" THEN 10 6360 END -6370 PRINT"CONGRULATION, CAPTAIN! THEN LAST KLINGON BATTLE CRUISER" -6380 PRINT"MENACING THE FDERATION HAS BEEN DESTROYED.":PRINT -6400 PRINT"YOUR EFFICIENCY RATING IS";1000*(K7/(T-T0))^2:GOTO6290 +6370 PRINT "CONGRULATION, CAPTAIN! THEN LAST KLINGON BATTLE CRUISER" +6380 PRINT "MENACING THE FDERATION HAS BEEN DESTROYED.":PRINT +6400 PRINT "YOUR EFFICIENCY RATING IS";1000*(K7/(T-T0))^2:GOTO 6290 6420 REM SHORT RANGE SENSOR SCAN & STARTUP SUBROUTINE -6430 FORI=S1-1TOS1+1:FORJ=S2-1TOS2+1 -6450 IFINT(I+.5)<1ORINT(I+.5)>8ORINT(J+.5)<1ORINT(J+.5)>8THEN6540 -6490 A$=">!<":Z1=I:Z2=J:GOSUB8830:IFZ3=1THEN6580 -6540 NEXTJ:NEXTI:D0=0:GOTO6650 +6430 FOR I=S1-1TOS1+1:FOR J=S2-1 TO S2+1 +6450 IF INT(I+.5)<1 OR INT(I+.5)>8 OR INT(J+.5)<1 OR INT(J+.5)>8 THEN 6540 +6490 A$=">!<":Z1=I:Z2=J:GOSUB 8830:IF Z3=1 THEN 6580 +6540 NEXT J:NEXT I:D0=0:GOTO 6650 6580 D0=1:C$="DOCKED":E=E0:P=P0 -6620 PRINT"SHIELDS DROPPED FOR DOCKING PURPOSES":S=0:GOTO6720 -6650 IFK3>0THENC$="*RED*":GOTO6720 -6660 C$="GREEN":IFE=0THEN6770 -6730 PRINT:PRINT"*** SHORT RANGE SENSORS ARE OUT ***":PRINT:RETURN -6770 O1$="---------------------------------":PRINTO1$:FORI=1TO8 -6820 FORJ=(I-1)*24+1TO(I-1)*24+22STEP3:PRINT" ";MID$(Q$,J,3);:NEXTJ -6830 ONIGOTO6850,6900,6960,7020,7070,7120,7180,7240 -6850 PRINT" STARDATE ";INT(T*10)*.1:GOTO7260 -6900 PRINT" CONDITION ";C$:GOTO7260 -6960 PRINT" QUADRANT ";Q1;",";Q2:GOTO7260 -7020 PRINT" SECTOR ";S1;",";S2:GOTO7260 -7070 PRINT" PHOTON TORPEDOES ";INT(P):GOTO7260 -7120 PRINT" TOTAL ENERGY ";INT(E+S):GOTO7260 -7180 PRINT" SHIELDS ";INT(S):GOTO7260 -7240 PRINT" KLINGONS REMAINING";INT(K9) -7260 NEXTI:PRINTO1$:RETURN +6620 PRINT "SHIELDS DROPPED FOR DOCKING PURPOSES":S=0:GOTO 6720 +6650 IF K3>0 THEN C$="*RED*":GOTO 6720 +6660 C$="GREEN":IF E=0 THEN 6770 +6730 PRINT:PRINT "*** SHORT RANGE SENSORS ARE OUT ***":PRINT:RETURN +6770 O1$="---------------------------------":PRINT O1$:FOR I=1 TO 8 +6820 FOR J=(I-1)*24+1 TO (I-1)*24+22STEP3:PRINT " ";MID$(Q$,J,3);:NEXT J +6830 ON I GOTO 6850,6900,6960,7020,7070,7120,7180,7240 +6850 PRINT " STARDATE ";INT(T*10)*.1:GOTO 7260 +6900 PRINT " CONDITION ";C$:GOTO 7260 +6960 PRINT " QUADRANT ";Q1;",";Q2:GOTO 7260 +7020 PRINT " SECTOR ";S1;",";S2:GOTO 7260 +7070 PRINT " PHOTON TORPEDOES ";INT(P):GOTO 7260 +7120 PRINT " TOTAL ENERGY ";INT(E+S):GOTO 7260 +7180 PRINT " SHIELDS ";INT(S):GOTO 7260 +7240 PRINT " KLINGONS REMAINING";INT(K9) +7260 NEXT I:PRINT O1$:RETURN 7280 REM LIBRARY COMPUTER CODE -7290 IFD(8)<0THENPRINT"COMPUTER DISABLED":GOTO1990 -7320 INPUT"COMPUTER ACTIVE AND AWAITING COMMAND";A:IFA<0THEN1990 -7350 PRINT:H8=1:ONA+1GOTO7540,7900,8070,8500,8150,7400 -7360 PRINT"FUNCTIONS AVAILABLE FROM LIBRARY-COMPUTER:" -7370 PRINT" 0 = CUMULATIVE GALACTIC RECORD" -7372 PRINT" 1 = STATUS REPORT" -7374 PRINT" 2 = PHOTON TORPEDO DATA" -7376 PRINT" 3 = STARBASE NAV DATA" -7378 PRINT" 4 = DIRECTION/DISTANCE CALCULATOR" -7380 PRINT" 5 = GALAXY 'REGION NAME' MAP":PRINT:GOTO7320 +7290 IF D(8)<0 THEN PRINT "COMPUTER DISABLED":GOTO 1990 +7320 INPUT"COMPUTER ACTIVE AND AWAITING COMMAND";A:IF A<0 THEN 1990 +7350 PRINT:H8=1:ON A+1 GOTO 7540,7900,8070,8500,8150,7400 +7360 PRINT "FUNCTIONS AVAILABLE FROM LIBRARY-COMPUTER:" +7370 PRINT " 0 = CUMULATIVE GALACTIC RECORD" +7372 PRINT " 1 = STATUS REPORT" +7374 PRINT " 2 = PHOTON TORPEDO DATA" +7376 PRINT " 3 = STARBASE NAV DATA" +7378 PRINT " 4 = DIRECTION/DISTANCE CALCULATOR" +7380 PRINT " 5 = GALAXY 'REGION NAME' MAP":PRINT:GOTO 7320 7390 REM SETUP TO CHANGE CUM GAL RECORD TO GALAXY MAP -7400 H8=0:G5=1:PRINT" THE GALAXY":GOTO7550 +7400 H8=0:G5=1:PRINT " THE GALAXY":GOTO 7550 7530 REM CUM GALACTIC RECORD 7540 REM INPUT"DO YOU WANT A HARDCOPY? IS THE TTY ON (Y/N)";A$ -7542 REM IFA$="Y"THENPOKE1229,2:POKE1237,3:NULL1 -7543 PRINT:PRINT" "; -7544 PRINT"COMPUTER RECORD OF GALAXY FOR QUADRANT";Q1;",";Q2 +7542 REM IF A$="Y" THEN POKE1229,2:POKE1237,3:NULL1 +7543 PRINT:PRINT " "; +7544 PRINT "COMPUTER RECORD OF GALAXY FOR QUADRANT";Q1;",";Q2 7546 PRINT -7550 PRINT" 1 2 3 4 5 6 7 8" +7550 PRINT " 1 2 3 4 5 6 7 8" 7560 O1$=" ----- ----- ----- ----- ----- ----- ----- -----" -7570 PRINTO1$:FORI=1TO8:PRINTI;:IFH8=0THEN7740 -7630 FORJ=1TO8:PRINT" ";:IFZ(I,J)=0THENPRINT"***";:GOTO7720 -7700 PRINTRIGHT$(STR$(Z(I,J)+1000),3); -7720 NEXTJ:GOTO7850 -7740 Z4=I:Z5=1:GOSUB9030:J0=INT(15-.5*LEN(G2$)):PRINTTAB(J0);G2$; -7800 Z5=5:GOSUB 9030:J0=INT(39-.5*LEN(G2$)):PRINTTAB(J0);G2$; -7850 PRINT:PRINTO1$:NEXTI:PRINT:GOTO1990 +7570 PRINT O1$:FOR I=1 TO 8:PRINT I;:IF H8=0 THEN 7740 +7630 FOR J=1 TO 8:PRINT " ";:IF Z(I,J)=0 THEN PRINT "***";:GOTO 7720 +7700 PRINT RIGHT$(STR$(Z(I,J)+1000),3); +7720 NEXT J:GOTO 7850 +7740 Z4=I:Z5=1:GOSUB 9030:J0=INT(15-.5*LEN(G2$)):PRINT TAB(J0);G2$; +7800 Z5=5:GOSUB 9030:J0=INT(39-.5*LEN(G2$)):PRINT TAB(J0);G2$; +7850 PRINT:PRINT O1$:NEXT I:PRINT:GOTO 1990 7890 REM STATUS REPORT -7900 PRINT " STATUS REPORT:":X$="":IFK9>1THENX$="S" -7940 PRINT"KLINGON";X$;" LEFT: ";K9 -7960 PRINT"MISSION MUST BE COMPLETED IN";.1*INT((T0+T9-T)*10);"STARDATES" -7970 X$="S":IFB9<2THENX$="":IFB9<1THEN8010 -7980 PRINT"THE FEDERATION IS MAINTAINING";B9;"STARBASE";X$;" IN THE GALAXY" -7990 GOTO5690 -8010 PRINT"YOUR STUPIDITY HAS LEFT YOU ON YOUR ON IN" -8020 PRINT" THE GALAXY -- YOU HAVE NO STARBASES LEFT!":GOTO5690 +7900 PRINT " STATUS REPORT:":X$="":IF K9>1 THEN X$="S" +7940 PRINT "KLINGON";X$;" LEFT: ";K9 +7960 PRINT "MISSION MUST BE COMPLETED IN";.1*INT((T0+T9-T)*10);"STARDATES" +7970 X$="S":IF B9<2 THEN X$="":IF B9<1 THEN 8010 +7980 PRINT "THE FEDERATION IS MAINTAINING";B9;"STARBASE";X$;" IN THE GALAXY" +7990 GOTO 5690 +8010 PRINT "YOUR STUPIDITY HAS LEFT YOU ON YOUR ON IN" +8020 PRINT " THE GALAXY -- YOU HAVE NO STARBASES LEFT!":GOTO 5690 8060 REM TORPEDO, BASE NAV, D/D CALCULATOR -8070 IFK3<=0THEN4270 -8080 X$="":IFK3>1THENX$="S" -8090 PRINT"FROM ENTERPRISE TO KLINGON BATTLE CRUSER";X$ -8100 H8=0:FORI=1TO3:IFK(I,3)<=0THEN8480 +8070 IF K3<=0 THEN 4270 +8080 X$="":IF K3>1 THEN X$="S" +8090 PRINT "FROM ENTERPRISE TO KLINGON BATTLE CRUSER";X$ +8100 H8=0:FOR I=1 TO 3:IF K(I,3)<=0 THEN 8480 8110 W1=K(I,1):X=K(I,2) -8120 C1=S1:A=S2:GOTO8220 -8150 PRINT"DIRECTION/DISTANCE CALCULATOR:" -8160 PRINT"YOU ARE AT QUADRANT ";Q1;",";Q2;" SECTOR ";S1;",";S2 -8170 PRINT"PLEASE ENTER":INPUT" INITIAL COORDINATES (X,Y)";C1,A +8120 C1=S1:A=S2:GOTO 8220 +8150 PRINT "DIRECTION/DISTANCE CALCULATOR:" +8160 PRINT "YOU ARE AT QUADRANT ";Q1;",";Q2;" SECTOR ";S1;",";S2 +8170 PRINT "PLEASE ENTER":INPUT" INITIAL COORDINATES (X,Y)";C1,A 8200 INPUT" FINAL COORDINATES (X,Y)";W1,X -8220 X=X-A:A=C1-W1:IFX<0THEN8350 -8250 IFA<0THEN8410 -8260 IFX>0THEN8280 -8270 IFA=0THENC1=5:GOTO8290 +8220 X=X-A:A=C1-W1:IF X<0 THEN 8350 +8250 IF A<0 THEN 8410 +8260 IF X>0 THEN 8280 +8270 IF A=0 THEN C1=5:GOTO 8290 8280 C1=1 -8290 IFABS(A)<=ABS(X)THEN8330 -8310 PRINT"DIRECTION =";C1+(((ABS(A)-ABS(X))+ABS(A))/ABS(A)):GOTO8460 -8330 PRINT"DIRECTION =";C1+(ABS(A)/ABS(X)):GOTO8460 -8350 IFA>0THENC1=3:GOTO8420 -8360 IFX<>0THENC1=5:GOTO8290 +8290 IF ABS(A)<=ABS(X) THEN 8330 +8310 PRINT "DIRECTION =";C1+(((ABS(A)-ABS(X))+ABS(A))/ABS(A)):GOTO 8460 +8330 PRINT "DIRECTION =";C1+(ABS(A)/ABS(X)):GOTO 8460 +8350 IF A>0 THEN C1=3:GOTO 8420 +8360 IF X<>0 THEN C1=5:GOTO 8290 8410 C1=7 -8420 IFABS(A)>=ABS(X)THEN8450 -8430 PRINT"DIRECTION =";C1+(((ABS(X)-ABS(A))+ABS(X))/ABS(X)):GOTO8460 -8450 PRINT"DIRECTION =";C1+(ABS(X)/ABS(A)) -8460 PRINT"DISTANCE =";SQR(X^2+A^2):IFH8=1THEN1990 -8480 NEXTI:GOTO1990 -8500 IFB3<>0THENPRINT"FROM ENTERPRISE TO STARBASE:":W1=B4:X=B5:GOTO8120 -8510 PRINT"MR. SPOCK REPORTS, 'SENSORS SHOW NO STARBASES IN THIS"; -8520 PRINT" QUADRANT.'":GOTO1990 +8420 IF ABS(A)>=ABS(X) THEN 8450 +8430 PRINT "DIRECTION =";C1+(((ABS(X)-ABS(A))+ABS(X))/ABS(X)):GOTO 8460 +8450 PRINT "DIRECTION =";C1+(ABS(X)/ABS(A)) +8460 PRINT "DISTANCE =";SQR(X^2+A^2):IF H8=1 THEN 1990 +8480 NEXT I:GOTO 1990 +8500 IF B3<>0 THEN PRINT "FROM ENTERPRISE TO STARBASE:":W1=B4:X=B5:GOTO 8120 +8510 PRINT "MR. SPOCK REPORTS, 'SENSORS SHOW NO STARBASES IN THIS"; +8520 PRINT " QUADRANT.'":GOTO 1990 8580 REM FIND EMPTY PLACE IN QUADRANT (FOR THINGS) -8590 R1=FNR(1):R2=FNR(1):A$=" ":Z1=R1:Z2=R2:GOSUB8830:IFZ3=0THEN8590 +8590 R1=FNR(1):R2=FNR(1):A$=" ":Z1=R1:Z2=R2:GOSUB 8830:IF Z3=0 THEN 8590 8600 RETURN 8660 REM INSERT IN STRING ARRAY FOR QUADRANT 8670 S8=INT(Z2-.5)*3+INT(Z1-.5)*24+1 -8675 IF LEN(A$)<>3THEN PRINT"ERROR":STOP -8680 IFS8=1THENQ$=A$+RIGHT$(Q$,189):RETURN -8690 IFS8=190THENQ$=LEFT$(Q$,189)+A$:RETURN +8675 IF LEN(A$)<>3 THEN PRINT "ERROR":STOP +8680 IF S8=1 THEN Q$=A$+RIGHT$(Q$,189):RETURN +8690 IF S8=190 THEN Q$=LEFT$(Q$,189)+A$:RETURN 8700 Q$=LEFT$(Q$,S8-1)+A$+RIGHT$(Q$,190-S8):RETURN 8780 REM PRINTS DEVICE NAME -8790 ONR1GOTO8792,8794,8796,8798,8800,8802,8804,8806 +8790 ON R1 GOTO 8792,8794,8796,8798,8800,8802,8804,8806 8792 G2$="WARP ENGINES":RETURN 8794 G2$="SHORT RANGE SENSORS":RETURN 8796 G2$="LONG RANGE SENSORS":RETURN @@ -394,30 +394,30 @@ 8806 G2$="LIBRARY-COMPUTER":RETURN 8820 REM STRING COMPARISON IN QUADRANT ARRAY 8830 Z1=INT(Z1+.5):Z2=INT(Z2+.5):S8=(Z2-1)*3+(Z1-1)*24+1:Z3=0 -8890 IFMID$(Q$,S8,3)<>A$THENRETURN +8890 IF MID$(Q$,S8,3)<>A$ THEN RETURN 8900 Z3=1:RETURN 9010 REM QUADRANT NAME IN G2$ FROM Z4,Z5 (=Q1,Q2) 9020 REM CALL WITH G5=1 TO GET REGION NAME ONLY -9030 IFZ5<=4THENONZ4GOTO9040,9050,9060,9070,9080,9090,9100,9110 -9035 GOTO9120 -9040 G2$="ANTARES":GOTO9210 -9050 G2$="RIGEL":GOTO9210 -9060 G2$="PROCYON":GOTO9210 -9070 G2$="VEGA":GOTO9210 -9080 G2$="CANOPUS":GOTO9210 -9090 G2$="ALTAIR":GOTO9210 -9100 G2$="SAGITTARIUS":GOTO9210 -9110 G2$="POLLUX":GOTO9210 -9120 ONZ4GOTO9130,9140,9150,9160,9170,9180,9190,9200 -9130 G2$="SIRIUS":GOTO9210 -9140 G2$="DENEB":GOTO9210 -9150 G2$="CAPELLA":GOTO9210 -9160 G2$="BETELGEUSE":GOTO9210 -9170 G2$="ALDEBARAN":GOTO9210 -9180 G2$="REGULUS":GOTO9210 -9190 G2$="ARCTURUS":GOTO9210 +9030 IF Z5<=4 THEN ON Z4 GOTO 9040,9050,9060,9070,9080,9090,9100,9110 +9035 GOTO 9120 +9040 G2$="ANTARES":GOTO 9210 +9050 G2$="RIGEL":GOTO 9210 +9060 G2$="PROCYON":GOTO 9210 +9070 G2$="VEGA":GOTO 9210 +9080 G2$="CANOPUS":GOTO 9210 +9090 G2$="ALTAIR":GOTO 9210 +9100 G2$="SAGITTARIUS":GOTO 9210 +9110 G2$="POLLUX":GOTO 9210 +9120 ON Z4 GOTO 9130,9140,9150,9160,9170,9180,9190,9200 +9130 G2$="SIRIUS":GOTO 9210 +9140 G2$="DENEB":GOTO 9210 +9150 G2$="CAPELLA":GOTO 9210 +9160 G2$="BETELGEUSE":GOTO 9210 +9170 G2$="ALDEBARAN":GOTO 9210 +9180 G2$="REGULUS":GOTO 9210 +9190 G2$="ARCTURUS":GOTO 9210 9200 G2$="SPICA" -9210 IFG5<>1THENONZ5GOTO9230,9240,9250,9260,9230,9240,9250,9260 +9210 IF G5<>1 THEN ON Z5 GOTO 9230,9240,9250,9260,9230,9240,9250,9260 9220 RETURN 9230 G2$=G2$+" I":RETURN 9240 G2$=G2$+" II":RETURN diff --git a/84_Super_Star_Trek/vbnet/SuperStarTrek.sln b/84_Super_Star_Trek/vbnet/SuperStarTrek.sln new file mode 100644 index 00000000..82633753 --- /dev/null +++ b/84_Super_Star_Trek/vbnet/SuperStarTrek.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "SuperStarTrek", "SuperStarTrek.vbproj", "{92825C31-5966-4E6A-9CB0-5AEEE3D6A2A4}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {92825C31-5966-4E6A-9CB0-5AEEE3D6A2A4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {92825C31-5966-4E6A-9CB0-5AEEE3D6A2A4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {92825C31-5966-4E6A-9CB0-5AEEE3D6A2A4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {92825C31-5966-4E6A-9CB0-5AEEE3D6A2A4}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/84_Super_Star_Trek/vbnet/SuperStarTrek.vbproj b/84_Super_Star_Trek/vbnet/SuperStarTrek.vbproj new file mode 100644 index 00000000..1a4afed5 --- /dev/null +++ b/84_Super_Star_Trek/vbnet/SuperStarTrek.vbproj @@ -0,0 +1,8 @@ + + + Exe + SuperStarTrek + net6.0 + 16.9 + + diff --git a/85_Synonym/csharp/Synonym.csproj b/85_Synonym/csharp/Synonym.csproj new file mode 100644 index 00000000..d3fe4757 --- /dev/null +++ b/85_Synonym/csharp/Synonym.csproj @@ -0,0 +1,9 @@ + + + Exe + net6.0 + 10 + enable + enable + + diff --git a/85_Synonym/csharp/Synonym.sln b/85_Synonym/csharp/Synonym.sln new file mode 100644 index 00000000..69614aff --- /dev/null +++ b/85_Synonym/csharp/Synonym.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Synonym", "Synonym.csproj", "{9CCC22AC-EDF3-4137-8EF7-EBB2F8677CE4}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {9CCC22AC-EDF3-4137-8EF7-EBB2F8677CE4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9CCC22AC-EDF3-4137-8EF7-EBB2F8677CE4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9CCC22AC-EDF3-4137-8EF7-EBB2F8677CE4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9CCC22AC-EDF3-4137-8EF7-EBB2F8677CE4}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/85_Synonym/vbnet/Synonym.sln b/85_Synonym/vbnet/Synonym.sln new file mode 100644 index 00000000..8b55f812 --- /dev/null +++ b/85_Synonym/vbnet/Synonym.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Synonym", "Synonym.vbproj", "{E6BEB53F-F6A3-4AA9-8EB9-68D8238DFAA6}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {E6BEB53F-F6A3-4AA9-8EB9-68D8238DFAA6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E6BEB53F-F6A3-4AA9-8EB9-68D8238DFAA6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E6BEB53F-F6A3-4AA9-8EB9-68D8238DFAA6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E6BEB53F-F6A3-4AA9-8EB9-68D8238DFAA6}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/85_Synonym/vbnet/Synonym.vbproj b/85_Synonym/vbnet/Synonym.vbproj new file mode 100644 index 00000000..8c920a56 --- /dev/null +++ b/85_Synonym/vbnet/Synonym.vbproj @@ -0,0 +1,8 @@ + + + Exe + Synonym + net6.0 + 16.9 + + diff --git a/86_Target/csharp/Target/Angle.cs b/86_Target/csharp/Angle.cs similarity index 100% rename from 86_Target/csharp/Target/Angle.cs rename to 86_Target/csharp/Angle.cs diff --git a/86_Target/csharp/Target/Explosion.cs b/86_Target/csharp/Explosion.cs similarity index 100% rename from 86_Target/csharp/Target/Explosion.cs rename to 86_Target/csharp/Explosion.cs diff --git a/86_Target/csharp/Target/FiringRange.cs b/86_Target/csharp/FiringRange.cs similarity index 100% rename from 86_Target/csharp/Target/FiringRange.cs rename to 86_Target/csharp/FiringRange.cs diff --git a/86_Target/csharp/Target/Game.cs b/86_Target/csharp/Game.cs similarity index 100% rename from 86_Target/csharp/Target/Game.cs rename to 86_Target/csharp/Game.cs diff --git a/86_Target/csharp/Target/Input.cs b/86_Target/csharp/Input.cs similarity index 100% rename from 86_Target/csharp/Target/Input.cs rename to 86_Target/csharp/Input.cs diff --git a/86_Target/csharp/Target/Offset.cs b/86_Target/csharp/Offset.cs similarity index 100% rename from 86_Target/csharp/Target/Offset.cs rename to 86_Target/csharp/Offset.cs diff --git a/86_Target/csharp/Target/Point.cs b/86_Target/csharp/Point.cs similarity index 100% rename from 86_Target/csharp/Target/Point.cs rename to 86_Target/csharp/Point.cs diff --git a/86_Target/csharp/Target/Program.cs b/86_Target/csharp/Program.cs similarity index 100% rename from 86_Target/csharp/Target/Program.cs rename to 86_Target/csharp/Program.cs diff --git a/86_Target/csharp/Target/RandomExtensions.cs b/86_Target/csharp/RandomExtensions.cs similarity index 100% rename from 86_Target/csharp/Target/RandomExtensions.cs rename to 86_Target/csharp/RandomExtensions.cs diff --git a/86_Target/csharp/Target/Strings/TitleAndInstructions.txt b/86_Target/csharp/Strings/TitleAndInstructions.txt similarity index 100% rename from 86_Target/csharp/Target/Strings/TitleAndInstructions.txt rename to 86_Target/csharp/Strings/TitleAndInstructions.txt diff --git a/86_Target/csharp/Target/Target.csproj b/86_Target/csharp/Target.csproj similarity index 100% rename from 86_Target/csharp/Target/Target.csproj rename to 86_Target/csharp/Target.csproj diff --git a/86_Target/csharp/Target.sln b/86_Target/csharp/Target.sln index 3e111702..9aa2c86d 100644 --- a/86_Target/csharp/Target.sln +++ b/86_Target/csharp/Target.sln @@ -1,34 +1,25 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.26124.0 +# Visual Studio Version 17 +VisualStudioVersion = 17.0.32014.148 MinimumVisualStudioVersion = 15.0.26124.0 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Target", "Target\Target.csproj", "{8B0B5114-1D05-4F8D-B328-EA2FB89992E7}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Target", "Target.csproj", "{DF03CFDB-2857-4416-A07A-80D84874F46E}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 Release|Any CPU = Release|Any CPU - Release|x64 = Release|x64 - Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {DF03CFDB-2857-4416-A07A-80D84874F46E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DF03CFDB-2857-4416-A07A-80D84874F46E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DF03CFDB-2857-4416-A07A-80D84874F46E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DF03CFDB-2857-4416-A07A-80D84874F46E}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {8B0B5114-1D05-4F8D-B328-EA2FB89992E7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {8B0B5114-1D05-4F8D-B328-EA2FB89992E7}.Debug|Any CPU.Build.0 = Debug|Any CPU - {8B0B5114-1D05-4F8D-B328-EA2FB89992E7}.Debug|x64.ActiveCfg = Debug|Any CPU - {8B0B5114-1D05-4F8D-B328-EA2FB89992E7}.Debug|x64.Build.0 = Debug|Any CPU - {8B0B5114-1D05-4F8D-B328-EA2FB89992E7}.Debug|x86.ActiveCfg = Debug|Any CPU - {8B0B5114-1D05-4F8D-B328-EA2FB89992E7}.Debug|x86.Build.0 = Debug|Any CPU - {8B0B5114-1D05-4F8D-B328-EA2FB89992E7}.Release|Any CPU.ActiveCfg = Release|Any CPU - {8B0B5114-1D05-4F8D-B328-EA2FB89992E7}.Release|Any CPU.Build.0 = Release|Any CPU - {8B0B5114-1D05-4F8D-B328-EA2FB89992E7}.Release|x64.ActiveCfg = Release|Any CPU - {8B0B5114-1D05-4F8D-B328-EA2FB89992E7}.Release|x64.Build.0 = Release|Any CPU - {8B0B5114-1D05-4F8D-B328-EA2FB89992E7}.Release|x86.ActiveCfg = Release|Any CPU - {8B0B5114-1D05-4F8D-B328-EA2FB89992E7}.Release|x86.Build.0 = Release|Any CPU + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {B49DF932-4DF9-44C3-B63F-FD9443B4DDD2} EndGlobalSection EndGlobal diff --git a/86_Target/vbnet/Target.sln b/86_Target/vbnet/Target.sln new file mode 100644 index 00000000..3b1edd8c --- /dev/null +++ b/86_Target/vbnet/Target.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Target", "Target.vbproj", "{48A62242-16CC-4BFC-B7DB-C2DAE3C13B5A}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {48A62242-16CC-4BFC-B7DB-C2DAE3C13B5A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {48A62242-16CC-4BFC-B7DB-C2DAE3C13B5A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {48A62242-16CC-4BFC-B7DB-C2DAE3C13B5A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {48A62242-16CC-4BFC-B7DB-C2DAE3C13B5A}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/86_Target/vbnet/Target.vbproj b/86_Target/vbnet/Target.vbproj new file mode 100644 index 00000000..21a19379 --- /dev/null +++ b/86_Target/vbnet/Target.vbproj @@ -0,0 +1,8 @@ + + + Exe + Target + net6.0 + 16.9 + + diff --git a/87_3-D_Plot/csharp/Plot/Function.cs b/87_3-D_Plot/csharp/Function.cs similarity index 100% rename from 87_3-D_Plot/csharp/Plot/Function.cs rename to 87_3-D_Plot/csharp/Function.cs diff --git a/21_Calendar/csharp/21_calendar.csproj b/87_3-D_Plot/csharp/Plot.csproj similarity index 77% rename from 21_Calendar/csharp/21_calendar.csproj rename to 87_3-D_Plot/csharp/Plot.csproj index 895f2f3f..20827042 100644 --- a/21_Calendar/csharp/21_calendar.csproj +++ b/87_3-D_Plot/csharp/Plot.csproj @@ -3,7 +3,6 @@ Exe net5.0 - _21_calendar diff --git a/87_3-D_Plot/csharp/Plot.sln b/87_3-D_Plot/csharp/Plot.sln index 1402bc2a..b296ace9 100644 --- a/87_3-D_Plot/csharp/Plot.sln +++ b/87_3-D_Plot/csharp/Plot.sln @@ -1,34 +1,25 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.26124.0 +# Visual Studio Version 17 +VisualStudioVersion = 17.0.32014.148 MinimumVisualStudioVersion = 15.0.26124.0 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Plot", "Plot\Plot.csproj", "{8857AE83-F481-43B0-AA51-D78E1340BD93}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Plot", "Plot.csproj", "{8000A3CF-612D-4FB7-B53D-885BB6E5492B}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 Release|Any CPU = Release|Any CPU - Release|x64 = Release|x64 - Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {8000A3CF-612D-4FB7-B53D-885BB6E5492B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8000A3CF-612D-4FB7-B53D-885BB6E5492B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8000A3CF-612D-4FB7-B53D-885BB6E5492B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8000A3CF-612D-4FB7-B53D-885BB6E5492B}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {8857AE83-F481-43B0-AA51-D78E1340BD93}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {8857AE83-F481-43B0-AA51-D78E1340BD93}.Debug|Any CPU.Build.0 = Debug|Any CPU - {8857AE83-F481-43B0-AA51-D78E1340BD93}.Debug|x64.ActiveCfg = Debug|Any CPU - {8857AE83-F481-43B0-AA51-D78E1340BD93}.Debug|x64.Build.0 = Debug|Any CPU - {8857AE83-F481-43B0-AA51-D78E1340BD93}.Debug|x86.ActiveCfg = Debug|Any CPU - {8857AE83-F481-43B0-AA51-D78E1340BD93}.Debug|x86.Build.0 = Debug|Any CPU - {8857AE83-F481-43B0-AA51-D78E1340BD93}.Release|Any CPU.ActiveCfg = Release|Any CPU - {8857AE83-F481-43B0-AA51-D78E1340BD93}.Release|Any CPU.Build.0 = Release|Any CPU - {8857AE83-F481-43B0-AA51-D78E1340BD93}.Release|x64.ActiveCfg = Release|Any CPU - {8857AE83-F481-43B0-AA51-D78E1340BD93}.Release|x64.Build.0 = Release|Any CPU - {8857AE83-F481-43B0-AA51-D78E1340BD93}.Release|x86.ActiveCfg = Release|Any CPU - {8857AE83-F481-43B0-AA51-D78E1340BD93}.Release|x86.Build.0 = Release|Any CPU + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {5DE8E572-67C9-4DE3-B851-447B78FE983A} EndGlobalSection EndGlobal diff --git a/87_3-D_Plot/csharp/Plot/Program.cs b/87_3-D_Plot/csharp/Program.cs similarity index 100% rename from 87_3-D_Plot/csharp/Plot/Program.cs rename to 87_3-D_Plot/csharp/Program.cs diff --git a/87_3-D_Plot/vbnet/Plot.sln b/87_3-D_Plot/vbnet/Plot.sln new file mode 100644 index 00000000..a0dcbfcb --- /dev/null +++ b/87_3-D_Plot/vbnet/Plot.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "Plot", "Plot.vbproj", "{534355CC-A2C1-4138-9EB5-09D658DD4504}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {534355CC-A2C1-4138-9EB5-09D658DD4504}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {534355CC-A2C1-4138-9EB5-09D658DD4504}.Debug|Any CPU.Build.0 = Debug|Any CPU + {534355CC-A2C1-4138-9EB5-09D658DD4504}.Release|Any CPU.ActiveCfg = Release|Any CPU + {534355CC-A2C1-4138-9EB5-09D658DD4504}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {CAD09CCC-4522-438E-A8C6-514A866D90DE} + EndGlobalSection +EndGlobal diff --git a/87_3-D_Plot/vbnet/Plot.vbproj b/87_3-D_Plot/vbnet/Plot.vbproj new file mode 100644 index 00000000..be687f57 --- /dev/null +++ b/87_3-D_Plot/vbnet/Plot.vbproj @@ -0,0 +1,8 @@ + + + Exe + Plot + net6.0 + 16.9 + + diff --git a/88_3-D_Tic-Tac-Toe/README.md b/88_3-D_Tic-Tac-Toe/README.md index df9cabf4..678bac6b 100644 --- a/88_3-D_Tic-Tac-Toe/README.md +++ b/88_3-D_Tic-Tac-Toe/README.md @@ -6,6 +6,15 @@ Each move is indicated by a 3-digit number (digits not separated by commas), wit This version of 3-D TIC-TAC-TOE is from Dartmouth College. +### Conversion notes + +The AI code for TicTacToe2 depends quite heavily on the non-structured GOTO (I can almost hear Dijkstra now) and translation is quite challenging. This code relies very heavily on GOTOs that bind the code tightly together. Comments explain where that happens in the original. + +There are at least two bugs from the original BASIC: + +1. Code should only allow player to input valid 3D coordinates where every digit is between 1 and 4, but the original code allows any value between 111 and 444 (such as 297, for instance). +2. If the player moves first and the game ends in a draw, the original program will still prompt the player for a move instead of calling for a draw. + --- As published in Basic Computer Games (1978): diff --git a/88_3-D_Tic-Tac-Toe/csharp/Program.cs b/88_3-D_Tic-Tac-Toe/csharp/Program.cs new file mode 100644 index 00000000..12c6ca83 --- /dev/null +++ b/88_3-D_Tic-Tac-Toe/csharp/Program.cs @@ -0,0 +1,10 @@ +namespace ThreeDTicTacToe +{ + class Program + { + static void Main() + { + new Qubic().Run(); + } + } +} diff --git a/88_3-D_Tic-Tac-Toe/csharp/Qubic.cs b/88_3-D_Tic-Tac-Toe/csharp/Qubic.cs new file mode 100644 index 00000000..513651d6 --- /dev/null +++ b/88_3-D_Tic-Tac-Toe/csharp/Qubic.cs @@ -0,0 +1,1192 @@ +using System.Text; + +namespace ThreeDTicTacToe +{ + /// + /// Qubic is a 3D Tic-Tac-Toe game played on a 4x4x4 cube. This code allows + /// a player to compete against a deterministic AI that is surprisingly + /// difficult to beat. + /// + internal class Qubic + { + // The Y variable in the original BASIC. + private static readonly int[] CornersAndCenters = QubicData.CornersAndCenters; + // The M variable in the original BASIC. + private static readonly int[,] RowsByPlane = QubicData.RowsByPlane; + + // Board spaces are filled in with numeric values. A space could be: + // + // - EMPTY: no one has moved here yet. + // - PLAYER: the player moved here. + // - MACHINE: the machine moved here. + // - POTENTIAL: the machine, in the middle of its move, + // might fill a space with a potential move marker, which + // prioritizes the space once it finally chooses where to move. + // + // The numeric values allow the program to determine what moves have + // been made in a row by summing the values in a row. In theory, the + // individual values could be any positive numbers that satisfy the + // following: + // + // - EMPTY = 0 + // - POTENTIAL * 4 < PLAYER + // - PLAYER * 4 < MACHINE + private const double PLAYER = 1.0; + private const double MACHINE = 5.0; + private const double POTENTIAL = 0.125; + private const double EMPTY = 0.0; + + // The X variable in the original BASIC. This is the Qubic board, + // flattened into a 1D array. + private readonly double[] Board = new double[64]; + + // The L variable in the original BASIC. There are 76 unique winning rows + // in the board, so each gets an entry in RowSums. A row sum can be used + // to check what moves have been made to that row in the board. + // + // Example: if RowSums[i] == PLAYER * 4, the player won with row i! + private readonly double[] RowSums = new double[76]; + + public Qubic() { } + + /// + /// Run the Qubic game. + /// + /// Show the title, prompt for instructions, then begin the game loop. + /// + public void Run() + { + Title(); + Instructions(); + Loop(); + } + + /*********************************************************************** + /* Terminal Text/Prompts + /**********************************************************************/ + #region TerminalText + + /// + /// Display title and attribution. + /// + /// Original BASIC: 50-120 + /// + private static void Title() + { + Console.WriteLine( + "\n" + + " QUBIC\n\n" + + " CREATIVE COMPUTING MORRISTOWN, NEW JERSEY\n\n\n" + ); + } + + /// + /// Prompt user for game instructions. + /// + /// Original BASIC: 210-313 + /// + private static void Instructions() + { + Console.Write("DO YOU WANT INSTRUCTIONS? "); + var yes = ReadYesNo(); + + if (yes) + { + Console.WriteLine( + "\n" + + "THE GAME IS TIC-TAC-TOE IN A 4 X 4 X 4 CUBE.\n" + + "EACH MOVE IS INDICATED BY A 3 DIGIT NUMBER, WITH EACH\n" + + "DIGIT BETWEEN 1 AND 4 INCLUSIVE. THE DIGITS INDICATE THE\n" + + "LEVEL, ROW, AND COLUMN, RESPECTIVELY, OF THE OCCUPIED\n" + + "PLACE.\n" + + "\n" + + "TO PRINT THE PLAYING BOARD, TYPE 0 (ZERO) AS YOUR MOVE.\n" + + "THE PROGRAM WILL PRINT THE BOARD WITH YOUR MOVES INDI-\n" + + "CATED WITH A (Y), THE MACHINE'S MOVES WITH AN (M), AND\n" + + "UNUSED SQUARES WITH A ( ). OUTPUT IS ON PAPER.\n" + + "\n" + + "TO STOP THE PROGRAM RUN, TYPE 1 AS YOUR MOVE.\n\n" + ); + } + } + + /// + /// Prompt player for whether they would like to move first, or allow + /// the machine to make the first move. + /// + /// Original BASIC: 440-490 + /// + /// true if the player wants to move first + private static bool PlayerMovePreference() + { + Console.Write("DO YOU WANT TO MOVE FIRST? "); + var result = ReadYesNo(); + Console.WriteLine(); + return result; + } + + /// + /// Run the Qubic program loop. + /// + private void Loop() + { + // The "retry" loop; ends if player quits or chooses not to retry + // after game ends. + while (true) + { + ClearBoard(); + var playerNext = PlayerMovePreference(); + + // The "game" loop; ends if player quits, player/machine wins, + // or game ends in draw. + while (true) + { + if (playerNext) + { + // Player makes a move. + var playerAction = PlayerMove(); + if (playerAction == PlayerAction.Move) + { + playerNext = !playerNext; + } + else + { + return; + } + } + else + { + // Check for wins, if any. + RefreshRowSums(); + if (CheckPlayerWin() || CheckMachineWin()) + { + break; + } + + // Machine makes a move. + var machineAction = MachineMove(); + if (machineAction == MachineAction.Move) + { + playerNext = !playerNext; + } + else if (machineAction == MachineAction.End) + { + break; + } + else + { + throw new Exception("unreachable; machine should always move or end game in game loop"); + } + } + } + + var retry = RetryPrompt(); + + if (!retry) + { + return; + } + } + } + + /// + /// Prompt the user to try another game. + /// + /// Original BASIC: 1490-1560 + /// + /// true if the user wants to play again + private static bool RetryPrompt() + { + Console.Write("DO YOU WANT TO TRY ANOTHER GAME? "); + return ReadYesNo(); + } + + /// + /// Read a yes/no from the terminal. This method accepts anything that + /// starts with N/n as no and Y/y as yes. + /// + /// true if the player answered yes + private static bool ReadYesNo() + { + while (true) + { + var response = Console.ReadLine() ?? " "; + if (response.ToLower().StartsWith("y")) + { + return true; + } + else if (response.ToLower().StartsWith("n")) + { + return false; + } + else + { + Console.Write("INCORRECT ANSWER. PLEASE TYPE 'YES' OR 'NO'. "); + } + } + } + + #endregion + + /*********************************************************************** + /* Player Move + /**********************************************************************/ + #region PlayerMove + + /// + /// Possible actions player has taken after ending their move. This + /// replaces the `GOTO` logic that allowed the player to jump out of + /// the game loop and quit. + /// + private enum PlayerAction + { + /// + /// The player ends the game prematurely. + /// + Quit, + /// + /// The player makes a move on the board. + /// + Move, + } + + /// + /// Make the player's move based on their input. + /// + /// Original BASIC: 500-620 + /// + /// Whether the player moved or quit the program. + private PlayerAction PlayerMove() + { + // Loop until a valid move is inputted. + while (true) + { + var move = ReadMove(); + if (move == 1) + { + return PlayerAction.Quit; + } + else if (move == 0) + { + ShowBoard(); + } + else + { + ClearPotentialMoves(); + if (TryCoordToIndex(move, out int moveIndex)) + { + if (Board[moveIndex] == EMPTY) + { + Board[moveIndex] = PLAYER; + return PlayerAction.Move; + } + else + { + Console.WriteLine("THAT SQUARE IS USED, TRY AGAIN."); + } + } + else + { + Console.WriteLine("INCORRECT MOVE, TRY AGAIN."); + } + } + } + } + + /// + /// Read a player move from the terminal. Move can be any integer. + /// + /// Original BASIC: 510-520 + /// + /// the move inputted + private static int ReadMove() + { + Console.Write("YOUR MOVE? "); + return ReadInteger(); + } + + /// + /// Read an integer from the terminal. + /// + /// Original BASIC: 520 + /// + /// Unlike the basic, this code will not accept any string that starts + /// with a number; only full number strings are allowed. + /// + /// the integer inputted + private static int ReadInteger() + { + while (true) + { + var response = Console.ReadLine() ?? " "; + + if (int.TryParse(response, out var move)) + { + return move; + + } + else + { + Console.Write("!NUMBER EXPECTED - RETRY INPUT LINE--? "); + } + } + } + + /// + /// Display the board to the player. Spaces taken by the player are + /// marked with "Y", while machine spaces are marked with "M". + /// + /// Original BASIC: 2550-2740 + /// + private void ShowBoard() + { + var s = new StringBuilder(new string('\n', 9)); + + for (int i = 1; i <= 4; i++) + { + for (int j = 1; j <= 4; j++) + { + s.Append(' ', 3 * (j + 1)); + for (int k = 1; k <= 4; k++) + { + int q = (16 * i) + (4 * j) + k - 21; + s.Append(Board[q] switch + { + EMPTY or POTENTIAL => "( ) ", + PLAYER => "(Y) ", + MACHINE => "(M) ", + _ => throw new Exception($"invalid space value {Board[q]}"), + }); + } + s.Append("\n\n"); + } + s.Append("\n\n"); + } + + Console.WriteLine(s.ToString()); + } + + #endregion + + /*********************************************************************** + /* Machine Move + /**********************************************************************/ + #region MachineMove + + /// + /// Check all rows for a player win. + /// + /// A row indicates a player win if its sum = PLAYER * 4. + /// + /// Original BASIC: 720-780 + /// + /// whether the player won in any row + private bool CheckPlayerWin() + { + for (int row = 0; row < 76; row++) + { + if (RowSums[row] == (PLAYER * 4)) + { + // Found player win! + Console.WriteLine("YOU WIN AS FOLLOWS"); + DisplayRow(row); + return true; + } + } + + // No player win found. + return false; + } + + /// + /// Check all rows for a row that the machine could move to to win + /// immediately. + /// + /// A row indicates a player could win immediately if it has three + /// machine moves already; that is, sum = MACHINE * 3. + /// + /// Original Basic: 790-920 + /// + /// + private bool CheckMachineWin() + { + for (int row = 0; row < 76; row++) + { + if (RowSums[row] == (MACHINE * 3)) + { + // Found a winning row! + for (int space = 0; space < 4; space++) + { + int move = RowsByPlane[row, space]; + if (Board[move] == EMPTY) + { + // Found empty space in winning row; move there. + Board[move] = MACHINE; + Console.WriteLine($"MACHINE MOVES TO {IndexToCoord(move)} , AND WINS AS FOLLOWS"); + DisplayRow(row); + return true; + } + } + } + } + + // No winning row available. + return false; + } + + /// + /// Display the coordinates of a winning row. + /// + /// index into RowsByPlane data + private void DisplayRow(int row) + { + for (int space = 0; space < 4; space++) + { + Console.Write($" {IndexToCoord(RowsByPlane[row, space])} "); + } + Console.WriteLine(); + } + + /// + /// Possible actions machine can take in a move. This helps replace the + /// complex GOTO logic from the original BASIC, which allowed the + /// program to jump from the machine's action to the end of the game. + /// + private enum MachineAction + { + /// + /// Machine did not take any action. + /// + None, + /// + /// Machine made a move. + /// + Move, + /// + /// Machine either won, conceded, or found a draw. + /// + End, + } + + /// + /// Machine decides where to move on the board, and ends the game if + /// appropriate. + /// + /// The machine's AI tries to take the following actions (in order): + /// + /// 1. If the player has a row that will get them the win on their + /// next turn, block that row. + /// 2. If the machine can trap the player (create two different rows + /// with three machine moves each that cannot be blocked by only a + /// single player move, create such a trap. + /// 3. If the player can create a similar trap for the machine on + /// their next move, block the space where that trap would be + /// created. + /// 4. Find a plane in the board that is well-populated by player + /// moves, and take a space in the first such plane. + /// 5. Find the first open corner or center and move there. + /// 6. Find the first open space and move there. + /// + /// If none of these actions are possible, then the board is entirely + /// full, and the game results in a draw. + /// + /// Original BASIC: start at 930 + /// + /// the action the machine took + private MachineAction MachineMove() + { + // The actions the machine attempts to take, in order. + var actions = new Func[] + { + BlockPlayer, + MakePlayerTrap, + BlockMachineTrap, + MoveByPlane, + MoveCornerOrCenter, + MoveAnyOpenSpace, + }; + + foreach (var action in actions) + { + // Try each action, moving to the next if nothing happens. + var actionResult = action(); + if (actionResult != MachineAction.None) + { + // Not in original BASIC: check for draw after each machine + // move. + if (CheckDraw()) + { + return DrawGame(); + } + return actionResult; + } + } + + // If we got here, all spaces are taken. Draw the game. + return DrawGame(); + } + + /// + /// Block a row with three spaces already taken by the player. + /// + /// Original BASIC: 930-1010 + /// + /// + /// Move if the machine blocked, + /// None otherwise + /// + private MachineAction BlockPlayer() + { + for (int row = 0; row < 76; row++) + { + if (RowSums[row] == (PLAYER * 3)) + { + // Found a row to block on! + for (int space = 0; space < 4; space++) + { + if (Board[RowsByPlane[row, space]] == EMPTY) + { + // Take the remaining empty space. + Board[RowsByPlane[row, space]] = MACHINE; + Console.WriteLine($"NICE TRY. MACHINE MOVES TO {IndexToCoord(RowsByPlane[row, space])}"); + return MachineAction.Move; + } + } + } + } + + // Didn't find a row to block on. + return MachineAction.None; + } + + /// + /// Create a trap for the player if possible. A trap can be created if + /// moving to a space on the board results in two different rows having + /// three MACHINE spaces, with the remaining space not shared between + /// the two rows. The player can only block one of these traps, so the + /// machine will win. + /// + /// If a player trap is not possible, but a row is found that is + /// particularly advantageous for the machine to move to, the machine + /// will try and move to a plane edge in that row. + /// + /// Original BASIC: 1300-1480 + /// + /// Lines 1440/50 of the BASIC call 2360 (MovePlaneEdge). Because it + /// goes to this code only after it has found an open space marked as + /// potential, it cannot reach line 2440 of that code, as that is only + /// reached if an open space failed to be found in the row on which + /// that code was called. + /// + /// + /// Move if a trap was created, + /// End if the machine conceded, + /// None otherwise + /// + private MachineAction MakePlayerTrap() + { + for (int row = 0; row < 76; row++) + { + // Refresh row sum, since new POTENTIALs might have changed it. + var rowSum = RefreshRowSum(row); + + // Machine has moved in this row twice, and player has not moved + // in this row. + if (rowSum >= (MACHINE * 2) && rowSum < (MACHINE * 2) + 1) + { + // Machine has no potential moves yet in this row. + if (rowSum == (MACHINE * 2)) + { + for (int space = 0; space < 4; space++) + { + // Empty space can potentially be used to create a + // trap. + if (Board[RowsByPlane[row, space]] == EMPTY) + { + Board[RowsByPlane[row, space]] = POTENTIAL; + } + } + } + // Machine has already found a potential move in this row, + // so a trap can be created with another row. + else + { + return MakeOrBlockTrap(row); + } + } + } + + // No player traps can be made. + RefreshRowSums(); + + for (int row = 0; row < 76; row++) + { + // A row may be particularly advantageous for the machine to + // move to at this point; this is the case if a row is entirely + // filled with POTENTIAL or has one MACHINE and others + // POTENTIAL. Such rows may help set up trapping opportunities. + if (RowSums[row] == (POTENTIAL * 4) || RowSums[row] == MACHINE + (POTENTIAL * 3)) + { + // Try moving to a plane edge in an advantageous row. + return MovePlaneEdge(row, POTENTIAL); + } + } + + // No spaces found that are particularly advantageous to machine. + ClearPotentialMoves(); + return MachineAction.None; + } + + /// + /// Block a trap that the player could create for the machine on their + /// next turn. + /// + /// If there are no player traps to block, but a row is found that is + /// particularly advantageous for the player to move to, the machine + /// will try and move to a plane edge in that row. + /// + /// Original BASIC: 1030-1190 + /// + /// Lines 1160/1170 of the BASIC call 2360 (MovePlaneEdge). As with + /// MakePlayerTrap, because it goes to this code only after it has + /// found an open space marked as potential, it cannot reach line 2440 + /// of that code, as that is only reached if an open space failed to be + /// found in the row on which that code was called. + /// + /// + /// Move if a trap was created, + /// End if the machine conceded, + /// None otherwise + /// + private MachineAction BlockMachineTrap() + { + for (int i = 0; i < 76; i++) + { + // Refresh row sum, since new POTENTIALs might have changed it. + var rowSum = RefreshRowSum(i); + + // Player has moved in this row twice, and machine has not moved + // in this row. + if (rowSum >= (PLAYER * 2) && rowSum < (PLAYER * 2) + 1) + { + // Machine has no potential moves yet in this row. + if (rowSum == (PLAYER * 2)) + { + for (int j = 0; j < 4; j++) + { + if (Board[RowsByPlane[i, j]] == EMPTY) + { + Board[RowsByPlane[i, j]] = POTENTIAL; + } + } + } + // Machine has already found a potential move in this row, + // so a trap can be created with another row by the player. + // Move to block. + else + { + return MakeOrBlockTrap(i); + } + } + } + + // No player traps to block found. + RefreshRowSums(); + + for (int row = 0; row < 76; row++) + { + // A row may be particularly advantageous for the player to move + // to at this point, indicated by a row containing all POTENTIAL + // moves or one PLAYER and rest POTENTIAL. Such rows may aid in + // in the later creation of traps. + if (RowSums[row] == (POTENTIAL * 4) || RowSums[row] == PLAYER + (POTENTIAL * 3)) + { + // Try moving to a plane edge in an advantageous row. + return MovePlaneEdge(row, POTENTIAL); + } + } + + // No spaces found that are particularly advantageous to the player. + return MachineAction.None; + } + + /// + /// Either make a trap for the player or block a trap the player could + /// create on their next turn. + /// + /// Unclear how this method could possibly end with a concession; it + /// seems it can only be called if the row contains a potential move. + /// + /// Original BASIC: 2230-2350 + /// + /// the row containing the space to move to + /// + /// Move if the machine moved, + /// End if the machine conceded + /// + private MachineAction MakeOrBlockTrap(int row) + { + for (int space = 0; space < 4; space++) + { + if (Board[RowsByPlane[row, space]] == POTENTIAL) + { + Board[RowsByPlane[row, space]] = MACHINE; + + // Row sum indicates we're blocking a player trap. + if (RowSums[row] < MACHINE) + { + Console.Write("YOU FOX. JUST IN THE NICK OF TIME, "); + } + // Row sum indicates we're completing a machine trap. + else + { + Console.Write("LET'S SEE YOU GET OUT OF THIS: "); + } + + Console.WriteLine($"MACHINE MOVES TO {IndexToCoord(RowsByPlane[row, space])}"); + + return MachineAction.Move; + } + } + + // Unclear how this can be reached. + Console.WriteLine("MACHINE CONCEDES THIS GAME."); + return MachineAction.End; + } + + /// + /// Find a satisfactory plane on the board and move to one if that + /// plane's plane edges. + /// + /// A plane on the board is satisfactory if it meets the following + /// conditions: + /// 1. Player has made exactly 4 moves on the plane. + /// 2. Machine has made either 0 or one moves on the plane. + /// Such a plane is one that the player could likely use to form traps. + /// + /// Original BASIC: 1830-2020 + /// + /// Line 1990 of the original basic calls 2370 (MovePlaneEdge). Only on + /// this call to MovePlaneEdge can line 2440 of that method be reached, + /// which surves to help this method iterate through the rows of a + /// plane. + /// + /// + /// Move if a move in a plane was found, + /// None otherwise + /// + private MachineAction MoveByPlane() + { + // For each plane in the cube... + for (int plane = 1; plane <= 18; plane++) + { + double planeSum = PlaneSum(plane); + + // Check that plane sum satisfies condition. + const double P4 = PLAYER * 4; + const double P4_M1 = (PLAYER * 4) + MACHINE; + if ( + (planeSum >= P4 && planeSum < P4 + 1) || + (planeSum >= P4_M1 && planeSum < P4_M1 + 1) + ) + { + // Try to move to plane edges in each row of plane + // First, check for plane edges marked as POTENTIAL. + for (int row = (4 * plane) - 4; row < (4 * plane); row++) + { + var moveResult = MovePlaneEdge(row, POTENTIAL); + if (moveResult != MachineAction.None) + { + return moveResult; + } + } + + // If no POTENTIAL plane edge found, look for an EMPTY one. + for (int row = (4 * plane) - 4; row < (4 * plane); row++) + { + var moveResult = MovePlaneEdge(row, EMPTY); + if (moveResult != MachineAction.None) + { + return moveResult; + } + } + } + } + + // No satisfactory planes with open plane edges found. + ClearPotentialMoves(); + return MachineAction.None; + } + + /// + /// Given a row, move to the first space in that row that: + /// 1. is a plane edge, and + /// 2. has the given value in Board + /// + /// Plane edges are any spaces on a plane with one face exposed. The AI + /// prefers to move to these spaces before others, presumably + /// because they are powerful moves: a plane edge is contained on 3-4 + /// winning rows of the cube. + /// + /// Original BASIC: 2360-2490 + /// + /// In the original BASIC, this code is pointed to from three different + /// locations by GOTOs: + /// - 1440/50, or MakePlayerTrap; + /// - 1160/70, or BlockMachineTrap; and + /// - 1990, or MoveByPlane. + /// At line 2440, this code jumps back to line 2000, which is in + /// MoveByPlane. This makes it appear as though calling MakePlayerTrap + /// or BlockPlayerTrap in the BASIC could jump into the middle of the + /// MoveByPlane method; were this to happen, not all of MoveByPlane's + /// variables would be defined! However, the program logic prevents + /// this from ever occurring; see each method's description for why + /// this is the case. + /// + /// the row to try to move to + /// + /// what value the space to move to should have in Board + /// + /// + /// Move if a plane edge piece in the row with the given spaceValue was + /// found, + /// None otherwise + /// + private MachineAction MovePlaneEdge(int row, double spaceValue) + { + // Given a row, we want to find the plane edge pieces in that row. + // We know that each row is part of a plane, and that the first + // and last rows of the plane are on the plane edge, while the + // other two rows are in the middle. If we know whether a row is an + // edge or middle, we can determine which spaces in that row are + // plane edges. + // + // Below is a birds-eye view of a plane in the cube, with rows + // oriented horizontally: + // + // row 0: ( ) (1) (2) ( ) + // row 1: (0) ( ) ( ) (3) + // row 2: (0) ( ) ( ) (3) + // row 3: ( ) (1) (2) ( ) + // + // The plane edge pieces have their row indices marked. The pattern + // above shows that: + // + // if row == 0 | 3, plane edge spaces = [1, 2] + // if row == 1 | 2, plane edge spaces = [0, 3] + + // The below condition replaces the following BASIC code (2370): + // + // I-(INT(I/4)*4)>1 + // + // which in C# would be: + // + // + // int a = i - (i / 4) * 4 <= 1) + // ? 1 + // : 2; + // + // In the above, i is the one-indexed row in RowsByPlane. + // + // This condition selects a different a value based on whether the + // given row is on the edge or middle of its plane. + int a = (row % 4) switch + { + 0 or 3 => 1, // row is on edge of plane + 1 or 2 => 2, // row is in middle of plane + _ => throw new Exception($"unreachable ({row % 4})"), + }; + + // Iterate through plane edge pieces of the row. + // + // if a = 1 (row is edge), iterate through [0, 3] + // if a = 2 (row is middle), iterate through [1, 2] + for (int space = a - 1; space <= 4 - a; space += 5 - (2 * a)) + { + if (Board[RowsByPlane[row, space]] == spaceValue) + { + // Found a plane edge to take! + Board[RowsByPlane[row, space]] = MACHINE; + Console.WriteLine($"MACHINE TAKES {IndexToCoord(RowsByPlane[row, space])}"); + return MachineAction.Move; + } + } + + // No valid corner edge to take. + return MachineAction.None; + } + + /// + /// Find the first open corner or center in the board and move there. + /// + /// Original BASIC: 1200-1290 + /// + /// This is the only place where the Z variable from the BASIC code is + /// used; here it is implied in the for loop. + /// + /// + /// Move if an open corner/center was found and moved to, + /// None otherwise + /// + private MachineAction MoveCornerOrCenter() + { + foreach (int space in CornersAndCenters) + { + if (Board[space] == EMPTY) + { + Board[space] = MACHINE; + Console.WriteLine($"MACHINE MOVES TO {IndexToCoord(space)}"); + return MachineAction.Move; + } + } + + return MachineAction.None; + } + + /// + /// Find the first open space in the board and move there. + /// + /// Original BASIC: 1720-1800 + /// + /// + /// Move if an open space was found and moved to, + /// None otherwise + /// + private MachineAction MoveAnyOpenSpace() + { + for (int row = 0; row < 64; row++) + { + if (Board[row] == EMPTY) + { + Board[row] = MACHINE; + Console.WriteLine($"MACHINE LIKES {IndexToCoord(row)}"); + return MachineAction.Move; + } + } + return MachineAction.None; + } + + /// + /// Draw the game in the event that there are no open spaces. + /// + /// Original BASIC: 1810-1820 + /// + /// End + private MachineAction DrawGame() + { + Console.WriteLine("THIS GAME IS A DRAW."); + return MachineAction.End; + } + + #endregion + + /*********************************************************************** + /* Helpers + /**********************************************************************/ + #region Helpers + + /// + /// Attempt to transform a cube coordinate to an index into Board. + /// + /// A valid cube coordinate is a three-digit number, where each digit + /// of the number X satisfies 1 <= X <= 4. + /// + /// Examples: + /// 111 -> 0 + /// 444 -> 63 + /// 232 -> 35 + /// + /// If the coord provided is not valid, the transformation fails. + /// + /// The conversion from coordinate to index is essentially a conversion + /// between base 4 and base 10. + /// + /// Original BASIC: 525-580 + /// + /// This method fixes a bug in the original BASIC (525-526), which only + /// checked whether the given coord satisfied 111 <= coord <= 444. This + /// allows invalid coordinates such as 199 and 437, whose individual + /// digits are out of range. + /// + /// cube coordinate (e.g. "111", "342") + /// trasnformation output + /// + /// true if the transformation was successful, false otherwise + /// + private static bool TryCoordToIndex(int coord, out int index) + { + // parse individual digits, subtract 1 to get base 4 number + var hundreds = (coord / 100) - 1; + var tens = ((coord % 100) / 10) - 1; + var ones = (coord % 10) - 1; + + // bounds check for each digit + foreach (int digit in new int[] { hundreds, tens, ones }) + { + if (digit < 0 || digit > 3) + { + index = -1; + return false; + } + } + + // conversion from base 4 to base 10 + index = (16 * hundreds) + (4 * tens) + ones; + return true; + } + + /// + /// Transform a Board index into a valid cube coordinate. + /// + /// Examples: + /// 0 -> 111 + /// 63 -> 444 + /// 35 -> 232 + /// + /// The conversion from index to coordinate is essentially a conversion + /// between base 10 and base 4. + /// + /// Original BASIC: 1570-1610 + /// + /// Board index + /// the corresponding cube coordinate + private static int IndexToCoord(int index) + { + // check that index is valid + if (index < 0 || index > 63) + { + // runtime exception; all uses of this method are with + // indices provided by the program, so this should never fail + throw new Exception($"index {index} is out of range"); + } + + // convert to base 4, add 1 to get cube coordinate + var hundreds = (index / 16) + 1; + var tens = ((index % 16) / 4) + 1; + var ones = (index % 4) + 1; + + // concatenate digits + int coord = (hundreds * 100) + (tens * 10) + ones; + return coord; + } + + /// + /// Refresh the values in RowSums to account for any changes. + /// + /// Original BASIC: 1640-1710 + /// + private void RefreshRowSums() + { + for (var row = 0; row < 76; row++) + { + RefreshRowSum(row); + } + } + + /// + /// Refresh a row in RowSums to reflect changes. + /// + /// row in RowSums to refresh + /// row sum after refresh + private double RefreshRowSum(int row) + { + double rowSum = 0; + for (int space = 0; space < 4; space++) + { + rowSum += Board[RowsByPlane[row, space]]; + } + RowSums[row] = rowSum; + return rowSum; + } + + /// + /// Calculate the sum of spaces in one of the 18 cube planes in RowSums. + /// + /// Original BASIC: 1840-1890 + /// + /// the desired plane + /// sum of spaces in plane + private double PlaneSum(int plane) + { + double planeSum = 0; + for (int row = (4 * (plane - 1)); row < (4 * plane); row++) + { + for (int space = 0; space < 4; space++) + { + planeSum += Board[RowsByPlane[row, space]]; + } + } + return planeSum; + } + + /// + /// Check whether the board is in a draw state, that is all spaces are + /// full and neither the player nor the machine has won. + /// + /// The original BASIC contains a bug that if the player moves first, a + /// draw will go undetected. An example series of player inputs + /// resulting in such a draw (assuming player goes first): + /// + /// 114, 414, 144, 444, 122, 221, 112, 121, + /// 424, 332, 324, 421, 231, 232, 244, 311, + /// 333, 423, 331, 134, 241, 243, 143, 413, + /// 142, 212, 314, 341, 432, 412, 431, 442 + /// + /// whether the game is a draw + private bool CheckDraw() + { + for (var i = 0; i < 64; i++) + { + if (Board[i] != PLAYER && Board[i] != MACHINE) + { + return false; + } + } + + RefreshRowSums(); + + for (int row = 0; row < 76; row++) + { + var rowSum = RowSums[row]; + if (rowSum == PLAYER * 4 || rowSum == MACHINE * 4) + { + return false; + } + } + + + return true; + } + + /// + /// Reset POTENTIAL spaces in Board to EMPTY. + /// + /// Original BASIC: 2500-2540 + /// + private void ClearPotentialMoves() + { + for (var i = 0; i < 64; i++) + { + if (Board[i] == POTENTIAL) + { + Board[i] = EMPTY; + } + } + } + + /// + /// Reset all spaces in Board to EMPTY. + /// + /// Original BASIC: 400-420 + /// + private void ClearBoard() + { + for (var i = 0; i < 64; i++) + { + Board[i] = EMPTY; + } + } + + #endregion + } +} diff --git a/88_3-D_Tic-Tac-Toe/csharp/QubicData.cs b/88_3-D_Tic-Tac-Toe/csharp/QubicData.cs new file mode 100644 index 00000000..298ee933 --- /dev/null +++ b/88_3-D_Tic-Tac-Toe/csharp/QubicData.cs @@ -0,0 +1,559 @@ +namespace ThreeDTicTacToe +{ + /// + /// Data in this class was originally given by the following DATA section in + /// the BASIC program: + /// + /// 2030 DATA 1,49,52,4,13,61,64,16,22,39,23,38,26,42,27,43 + /// 2040 DATA 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20 + /// 2050 DATA 21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38 + /// 2060 DATA 39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56 + /// 2070 DATA 57,58,59,60,61,62,63,64 + /// 2080 DATA 1,17,33,49,5,21,37,53,9,25,41,57,13,29,45,61 + /// 2090 DATA 2,18,34,50,6,22,38,54,10,26,42,58,14,30,46,62 + /// 2100 DATA 3,19,35,51,7,23,39,55,11,27,43,59,15,31,47,63 + /// 2110 DATA 4,20,36,52,8,24,40,56,12,28,44,60,16,32,48,64 + /// 2120 DATA 1,5,9,13,17,21,25,29,33,37,41,45,49,53,57,61 + /// 2130 DATA 2,6,10,14,18,22,26,30,34,38,42,46,50,54,58,62 + /// 2140 DATA 3,7,11,15,19,23,27,31,35,39,43,47,51,55,59,63 + /// 2150 DATA 4,8,12,16,20,24,28,32,36,40,44,48,52,56,60,64 + /// 2160 DATA 1,6,11,16,17,22,27,32,33,38,43,48,49,54,59,64 + /// 2170 DATA 13,10,7,4,29,26,23,20,45,42,39,36,61,58,55,52 + /// 2180 DATA 1,21,41,61,2,22,42,62,3,23,43,63,4,24,44,64 + /// 2190 DATA 49,37,25,13,50,38,26,14,51,39,27,15,52,40,28,16 + /// 2200 DATA 1,18,35,52,5,22,39,56,9,26,43,60,13,30,47,64 + /// 2210 DATA 49,34,19,4,53,38,23,8,57,42,27,12,61,46,31,16 + /// 2220 DATA 1,22,43,64,16,27,38,49,4,23,42,61,13,26,39,52 + /// + /// In short, each number is an index into the board. The data in this class + /// is zero-indexed, as opposed to the original data which was one-indexed. + /// + internal static class QubicData + { + /// + /// The corners and centers of the Qubic board. They correspond to the + /// following coordinates: + /// + /// [ + /// 111, 411, 414, 114, 141, 441, 444, 144, + /// 222, 323, 223, 322, 232, 332, 233, 333 + /// ] + /// + public static readonly int[] CornersAndCenters = new int[16] + { + // (X) ( ) ( ) (X) + // ( ) ( ) ( ) ( ) + // ( ) ( ) ( ) ( ) + // (X) ( ) ( ) (X) + + // ( ) ( ) ( ) ( ) + // ( ) (X) (X) ( ) + // ( ) (X) (X) ( ) + // ( ) ( ) ( ) ( ) + + // ( ) ( ) ( ) ( ) + // ( ) (X) (X) ( ) + // ( ) (X) (X) ( ) + // ( ) ( ) ( ) ( ) + + // (X) ( ) ( ) (X) + // ( ) ( ) ( ) ( ) + // ( ) ( ) ( ) ( ) + // (X) ( ) ( ) (X) + + 0,48,51,3,12,60,63,15,21,38,22,37,25,41,26,42 + }; + + /// + /// A list of all "winning" rows in the Qubic board; that is, sets of + /// four spaces that, if filled entirely by the player (or machine), + /// would result in a win. + /// + /// Each group of four rows in the list corresponds to a plane in the + /// cube, and each plane is organized so that the first and last rows + /// are on the plane's edges, while the second and third rows are in + /// the middle of the plane. The only exception is the last group of + /// rows, which contains the corners and centers rather than a plane. + /// + /// The order of the rows in this list is key to how the Qubic AI + /// decides its next move. + /// + public static readonly int[,] RowsByPlane = new int[76, 4] + { + // (1) (1) (1) (1) + // (2) (2) (2) (2) + // (3) (3) (3) (3) + // (4) (4) (4) (4) + + // ( ) ( ) ( ) ( ) + // ( ) ( ) ( ) ( ) + // ( ) ( ) ( ) ( ) + // ( ) ( ) ( ) ( ) + + // ( ) ( ) ( ) ( ) + // ( ) ( ) ( ) ( ) + // ( ) ( ) ( ) ( ) + // ( ) ( ) ( ) ( ) + + // ( ) ( ) ( ) ( ) + // ( ) ( ) ( ) ( ) + // ( ) ( ) ( ) ( ) + // ( ) ( ) ( ) ( ) + + { 0, 1, 2, 3, }, + { 4, 5, 6, 7, }, + { 8, 9, 10,11, }, + { 12,13,14,15, }, + + // ( ) ( ) ( ) ( ) + // ( ) ( ) ( ) ( ) + // ( ) ( ) ( ) ( ) + // ( ) ( ) ( ) ( ) + + // (1) (1) (1) (1) + // (2) (2) (2) (2) + // (3) (3) (3) (3) + // (4) (4) (4) (4) + + // ( ) ( ) ( ) ( ) + // ( ) ( ) ( ) ( ) + // ( ) ( ) ( ) ( ) + // ( ) ( ) ( ) ( ) + + // ( ) ( ) ( ) ( ) + // ( ) ( ) ( ) ( ) + // ( ) ( ) ( ) ( ) + // ( ) ( ) ( ) ( ) + + { 16,17,18,19, }, + { 20,21,22,23, }, + { 24,25,26,27, }, + { 28,29,30,31, }, + + // ( ) ( ) ( ) ( ) + // ( ) ( ) ( ) ( ) + // ( ) ( ) ( ) ( ) + // ( ) ( ) ( ) ( ) + + // ( ) ( ) ( ) ( ) + // ( ) ( ) ( ) ( ) + // ( ) ( ) ( ) ( ) + // ( ) ( ) ( ) ( ) + + // (1) (1) (1) (1) + // (2) (2) (2) (2) + // (3) (3) (3) (3) + // (4) (4) (4) (4) + + // ( ) ( ) ( ) ( ) + // ( ) ( ) ( ) ( ) + // ( ) ( ) ( ) ( ) + // ( ) ( ) ( ) ( ) + + { 32,33,34,35, }, + { 36,37,38,39, }, + { 40,41,42,43, }, + { 44,45,46,47, }, + + // ( ) ( ) ( ) ( ) + // ( ) ( ) ( ) ( ) + // ( ) ( ) ( ) ( ) + // ( ) ( ) ( ) ( ) + + // ( ) ( ) ( ) ( ) + // ( ) ( ) ( ) ( ) + // ( ) ( ) ( ) ( ) + // ( ) ( ) ( ) ( ) + + // ( ) ( ) ( ) ( ) + // ( ) ( ) ( ) ( ) + // ( ) ( ) ( ) ( ) + // ( ) ( ) ( ) ( ) + + // (1) (1) (1) (1) + // (2) (2) (2) (2) + // (3) (3) (3) (3) + // (4) (4) (4) (4) + + { 48,49,50,51, }, + { 52,53,54,55, }, + { 56,57,58,59, }, + { 60,61,62,63, }, + + // (1) ( ) ( ) ( ) + // (2) ( ) ( ) ( ) + // (3) ( ) ( ) ( ) + // (4) ( ) ( ) ( ) + + // (1) ( ) ( ) ( ) + // (2) ( ) ( ) ( ) + // (3) ( ) ( ) ( ) + // (4) ( ) ( ) ( ) + + // (1) ( ) ( ) ( ) + // (2) ( ) ( ) ( ) + // (3) ( ) ( ) ( ) + // (4) ( ) ( ) ( ) + + // (1) ( ) ( ) ( ) + // (2) ( ) ( ) ( ) + // (3) ( ) ( ) ( ) + // (4) ( ) ( ) ( ) + + { 0, 16,32,48, }, + { 4, 20,36,52, }, + { 8, 24,40,56, }, + { 12,28,44,60, }, + + // ( ) (1) ( ) ( ) + // ( ) (2) ( ) ( ) + // ( ) (3) ( ) ( ) + // ( ) (4) ( ) ( ) + + // ( ) (1) ( ) ( ) + // ( ) (2) ( ) ( ) + // ( ) (3) ( ) ( ) + // ( ) (4) ( ) ( ) + + // ( ) (1) ( ) ( ) + // ( ) (2) ( ) ( ) + // ( ) (3) ( ) ( ) + // ( ) (4) ( ) ( ) + + // ( ) (1) ( ) ( ) + // ( ) (2) ( ) ( ) + // ( ) (3) ( ) ( ) + // ( ) (4) ( ) ( ) + + { 1, 17,33,49, }, + { 5, 21,37,53, }, + { 9, 25,41,57, }, + { 13,29,45,61, }, + + // ( ) ( ) (1) ( ) + // ( ) ( ) (2) ( ) + // ( ) ( ) (3) ( ) + // ( ) ( ) (4) ( ) + + // ( ) ( ) (1) ( ) + // ( ) ( ) (2) ( ) + // ( ) ( ) (3) ( ) + // ( ) ( ) (4) ( ) + + // ( ) ( ) (1) ( ) + // ( ) ( ) (2) ( ) + // ( ) ( ) (3) ( ) + // ( ) ( ) (4) ( ) + + // ( ) ( ) (1) ( ) + // ( ) ( ) (2) ( ) + // ( ) ( ) (3) ( ) + // ( ) ( ) (4) ( ) + + { 2, 18,34,50, }, + { 6, 22,38,54, }, + { 10,26,42,58, }, + { 14,30,46,62, }, + + // ( ) ( ) ( ) (1) + // ( ) ( ) ( ) (2) + // ( ) ( ) ( ) (3) + // ( ) ( ) ( ) (4) + + // ( ) ( ) ( ) (1) + // ( ) ( ) ( ) (2) + // ( ) ( ) ( ) (3) + // ( ) ( ) ( ) (4) + + // ( ) ( ) ( ) (1) + // ( ) ( ) ( ) (2) + // ( ) ( ) ( ) (3) + // ( ) ( ) ( ) (4) + + // ( ) ( ) ( ) (1) + // ( ) ( ) ( ) (2) + // ( ) ( ) ( ) (3) + // ( ) ( ) ( ) (4) + + { 3, 19,35,51, }, + { 7, 23,39,55, }, + { 11,27,43,59, }, + { 15,31,47,63, }, + + // (1) ( ) ( ) ( ) + // (1) ( ) ( ) ( ) + // (1) ( ) ( ) ( ) + // (1) ( ) ( ) ( ) + + // (2) ( ) ( ) ( ) + // (2) ( ) ( ) ( ) + // (2) ( ) ( ) ( ) + // (2) ( ) ( ) ( ) + + // (3) ( ) ( ) ( ) + // (3) ( ) ( ) ( ) + // (3) ( ) ( ) ( ) + // (3) ( ) ( ) ( ) + + // (4) ( ) ( ) ( ) + // (4) ( ) ( ) ( ) + // (4) ( ) ( ) ( ) + // (4) ( ) ( ) ( ) + + { 0, 4, 8, 12, }, + { 16,20,24,28, }, + { 32,36,40,44, }, + { 48,52,56,60, }, + + // ( ) (1) ( ) ( ) + // ( ) (1) ( ) ( ) + // ( ) (1) ( ) ( ) + // ( ) (1) ( ) ( ) + + // ( ) (2) ( ) ( ) + // ( ) (2) ( ) ( ) + // ( ) (2) ( ) ( ) + // ( ) (2) ( ) ( ) + + // ( ) (3) ( ) ( ) + // ( ) (3) ( ) ( ) + // ( ) (3) ( ) ( ) + // ( ) (3) ( ) ( ) + + // ( ) (4) ( ) ( ) + // ( ) (4) ( ) ( ) + // ( ) (4) ( ) ( ) + // ( ) (4) ( ) ( ) + + { 1, 5, 9, 13, }, + { 17,21,25,29, }, + { 33,37,41,45, }, + { 49,53,57,61, }, + + // ( ) ( ) (1) ( ) + // ( ) ( ) (1) ( ) + // ( ) ( ) (1) ( ) + // ( ) ( ) (1) ( ) + + // ( ) ( ) (2) ( ) + // ( ) ( ) (2) ( ) + // ( ) ( ) (2) ( ) + // ( ) ( ) (2) ( ) + + // ( ) ( ) (3) ( ) + // ( ) ( ) (3) ( ) + // ( ) ( ) (3) ( ) + // ( ) ( ) (3) ( ) + + // ( ) ( ) (4) ( ) + // ( ) ( ) (4) ( ) + // ( ) ( ) (4) ( ) + // ( ) ( ) (4) ( ) + + { 2, 6, 10,14, }, + { 18,22,26,30, }, + { 34,38,42,46, }, + { 50,54,58,62, }, + + // ( ) ( ) ( ) (1) + // ( ) ( ) ( ) (1) + // ( ) ( ) ( ) (1) + // ( ) ( ) ( ) (1) + + // ( ) ( ) ( ) (2) + // ( ) ( ) ( ) (2) + // ( ) ( ) ( ) (2) + // ( ) ( ) ( ) (2) + + // ( ) ( ) ( ) (3) + // ( ) ( ) ( ) (3) + // ( ) ( ) ( ) (3) + // ( ) ( ) ( ) (3) + + // ( ) ( ) ( ) (4) + // ( ) ( ) ( ) (4) + // ( ) ( ) ( ) (4) + // ( ) ( ) ( ) (4) + + { 3, 7, 11,15, }, + { 19,23,27,31, }, + { 35,39,43,47, }, + { 51,55,59,63, }, + + // (1) ( ) ( ) ( ) + // ( ) (1) ( ) ( ) + // ( ) ( ) (1) ( ) + // ( ) ( ) ( ) (1) + + // (2) ( ) ( ) ( ) + // ( ) (2) ( ) ( ) + // ( ) ( ) (2) ( ) + // ( ) ( ) ( ) (2) + + // (3) ( ) ( ) ( ) + // ( ) (3) ( ) ( ) + // ( ) ( ) (3) ( ) + // ( ) ( ) ( ) (3) + + // (4) ( ) ( ) ( ) + // ( ) (4) ( ) ( ) + // ( ) ( ) (4) ( ) + // ( ) ( ) ( ) (4) + + { 0, 5, 10,15, }, + { 16,21,26,31, }, + { 32,37,42,47, }, + { 48,53,58,63, }, + + // ( ) ( ) ( ) (1) + // ( ) ( ) (1) ( ) + // ( ) (1) ( ) ( ) + // (1) ( ) ( ) ( ) + + // ( ) ( ) ( ) (2) + // ( ) ( ) (2) ( ) + // ( ) (2) ( ) ( ) + // (2) ( ) ( ) ( ) + + // ( ) ( ) ( ) (3) + // ( ) ( ) (3) ( ) + // ( ) (3) ( ) ( ) + // (3) ( ) ( ) ( ) + + // ( ) ( ) ( ) (4) + // ( ) ( ) (4) ( ) + // ( ) (4) ( ) ( ) + // (4) ( ) ( ) ( ) + + { 12,9, 6, 3, }, + { 28,25,22,19, }, + { 44,41,38,35, }, + { 60,57,54,51, }, + + // (1) (2) (3) (4) + // ( ) ( ) ( ) ( ) + // ( ) ( ) ( ) ( ) + // ( ) ( ) ( ) ( ) + + // ( ) ( ) ( ) ( ) + // (1) (2) (3) (4) + // ( ) ( ) ( ) ( ) + // ( ) ( ) ( ) ( ) + + // ( ) ( ) ( ) ( ) + // ( ) ( ) ( ) ( ) + // (1) (2) (3) (4) + // ( ) ( ) ( ) ( ) + + // ( ) ( ) ( ) ( ) + // ( ) ( ) ( ) ( ) + // ( ) ( ) ( ) ( ) + // (1) (2) (3) (4) + + { 0, 20,40,60, }, + { 1, 21,41,61, }, + { 2, 22,42,62, }, + { 3, 23,43,63, }, + + // ( ) ( ) ( ) ( ) + // ( ) ( ) ( ) ( ) + // ( ) ( ) ( ) ( ) + // (1) (2) (3) (4) + + // ( ) ( ) ( ) ( ) + // ( ) ( ) ( ) ( ) + // (1) (2) (3) (4) + // ( ) ( ) ( ) ( ) + + // ( ) ( ) ( ) ( ) + // (1) (2) (3) (4) + // ( ) ( ) ( ) ( ) + // ( ) ( ) ( ) ( ) + + // (1) (2) (3) (4) + // ( ) ( ) ( ) ( ) + // ( ) ( ) ( ) ( ) + // ( ) ( ) ( ) ( ) + + { 48,36,24,12, }, + { 49,37,25,13, }, + { 50,38,26,14, }, + { 51,39,27,15, }, + + // (1) ( ) ( ) ( ) + // (2) ( ) ( ) ( ) + // (3) ( ) ( ) ( ) + // (4) ( ) ( ) ( ) + + // ( ) (1) ( ) ( ) + // ( ) (2) ( ) ( ) + // ( ) (3) ( ) ( ) + // ( ) (4) ( ) ( ) + + // ( ) ( ) (1) ( ) + // ( ) ( ) (2) ( ) + // ( ) ( ) (3) ( ) + // ( ) ( ) (4) ( ) + + // ( ) ( ) ( ) (1) + // ( ) ( ) ( ) (2) + // ( ) ( ) ( ) (3) + // ( ) ( ) ( ) (4) + + { 0, 17,34,51, }, + { 4, 21,38,55, }, + { 8, 25,42,59, }, + { 12,29,46,63, }, + + // ( ) ( ) ( ) (1) + // ( ) ( ) ( ) (2) + // ( ) ( ) ( ) (3) + // ( ) ( ) ( ) (4) + + // ( ) ( ) (1) ( ) + // ( ) ( ) (2) ( ) + // ( ) ( ) (3) ( ) + // ( ) ( ) (4) ( ) + + // ( ) (1) ( ) ( ) + // ( ) (2) ( ) ( ) + // ( ) (3) ( ) ( ) + // ( ) (4) ( ) ( ) + + // (1) ( ) ( ) ( ) + // (2) ( ) ( ) ( ) + // (3) ( ) ( ) ( ) + // (4) ( ) ( ) ( ) + + { 48,33,18,3, }, + { 52,37,22,7, }, + { 56,41,26,11, }, + { 60,45,30,15, }, + + // (1) ( ) ( ) (3) + // ( ) ( ) ( ) ( ) + // ( ) ( ) ( ) ( ) + // (4) ( ) ( ) (2) + + // ( ) ( ) ( ) ( ) + // ( ) (1) (3) ( ) + // ( ) (4) (2) ( ) + // ( ) ( ) ( ) ( ) + + // ( ) ( ) ( ) ( ) + // ( ) (2) (4) ( ) + // ( ) (3) (1) ( ) + // ( ) ( ) ( ) ( ) + + // (2) ( ) ( ) (4) + // ( ) ( ) ( ) ( ) + // ( ) ( ) ( ) ( ) + // (3) ( ) ( ) (1) + + { 0, 21,42,63, }, + { 15,26,37,48, }, + { 3, 22,41,60, }, + { 12,25,38,51, }, + }; + } +} diff --git a/88_3-D_Tic-Tac-Toe/csharp/ThreeDTicTacToe.csproj b/88_3-D_Tic-Tac-Toe/csharp/ThreeDTicTacToe.csproj new file mode 100644 index 00000000..d3fe4757 --- /dev/null +++ b/88_3-D_Tic-Tac-Toe/csharp/ThreeDTicTacToe.csproj @@ -0,0 +1,9 @@ + + + Exe + net6.0 + 10 + enable + enable + + diff --git a/88_3-D_Tic-Tac-Toe/csharp/ThreeDTicTacToe.sln b/88_3-D_Tic-Tac-Toe/csharp/ThreeDTicTacToe.sln new file mode 100644 index 00000000..0dcb9034 --- /dev/null +++ b/88_3-D_Tic-Tac-Toe/csharp/ThreeDTicTacToe.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ThreeDTicTacToe", "ThreeDTicTacToe.csproj", "{6001B6FB-DF8A-4D59-8E22-BA126C8DA274}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {6001B6FB-DF8A-4D59-8E22-BA126C8DA274}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6001B6FB-DF8A-4D59-8E22-BA126C8DA274}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6001B6FB-DF8A-4D59-8E22-BA126C8DA274}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6001B6FB-DF8A-4D59-8E22-BA126C8DA274}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/88_3-D_Tic-Tac-Toe/vbnet/ThreeDTicTacToe.sln b/88_3-D_Tic-Tac-Toe/vbnet/ThreeDTicTacToe.sln new file mode 100644 index 00000000..6479b013 --- /dev/null +++ b/88_3-D_Tic-Tac-Toe/vbnet/ThreeDTicTacToe.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "ThreeDTicTacToe", "ThreeDTicTacToe.vbproj", "{AD17E9E0-4795-4533-A215-09DD99F7D696}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {AD17E9E0-4795-4533-A215-09DD99F7D696}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {AD17E9E0-4795-4533-A215-09DD99F7D696}.Debug|Any CPU.Build.0 = Debug|Any CPU + {AD17E9E0-4795-4533-A215-09DD99F7D696}.Release|Any CPU.ActiveCfg = Release|Any CPU + {AD17E9E0-4795-4533-A215-09DD99F7D696}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/88_3-D_Tic-Tac-Toe/vbnet/ThreeDTicTacToe.vbproj b/88_3-D_Tic-Tac-Toe/vbnet/ThreeDTicTacToe.vbproj new file mode 100644 index 00000000..d1cd4c2b --- /dev/null +++ b/88_3-D_Tic-Tac-Toe/vbnet/ThreeDTicTacToe.vbproj @@ -0,0 +1,8 @@ + + + Exe + ThreeDTicTacToe + net6.0 + 16.9 + + diff --git a/89_Tic-Tac-Toe/csharp/tictactoe1/Program.cs b/89_Tic-Tac-Toe/csharp/Program.cs similarity index 100% rename from 89_Tic-Tac-Toe/csharp/tictactoe1/Program.cs rename to 89_Tic-Tac-Toe/csharp/Program.cs diff --git a/89_Tic-Tac-Toe/csharp/tictactoe1/tictactoe1.csproj b/89_Tic-Tac-Toe/csharp/TicTacToe.csproj similarity index 100% rename from 89_Tic-Tac-Toe/csharp/tictactoe1/tictactoe1.csproj rename to 89_Tic-Tac-Toe/csharp/TicTacToe.csproj diff --git a/89_Tic-Tac-Toe/csharp/TicTacToe.sln b/89_Tic-Tac-Toe/csharp/TicTacToe.sln new file mode 100644 index 00000000..f334433a --- /dev/null +++ b/89_Tic-Tac-Toe/csharp/TicTacToe.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.0.32014.148 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TicTacToe", "TicTacToe.csproj", "{A318881A-DA1A-499C-8820-69A1BF02B824}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {A318881A-DA1A-499C-8820-69A1BF02B824}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A318881A-DA1A-499C-8820-69A1BF02B824}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A318881A-DA1A-499C-8820-69A1BF02B824}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A318881A-DA1A-499C-8820-69A1BF02B824}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {B5343227-EE3B-4829-AC09-DF6702D24501} + EndGlobalSection +EndGlobal diff --git a/89_Tic-Tac-Toe/vbnet/TicTacToe.sln b/89_Tic-Tac-Toe/vbnet/TicTacToe.sln new file mode 100644 index 00000000..47935624 --- /dev/null +++ b/89_Tic-Tac-Toe/vbnet/TicTacToe.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "TicTacToe", "TicTacToe.vbproj", "{5B43817F-EEF6-4298-BADF-69203BE7D088}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {5B43817F-EEF6-4298-BADF-69203BE7D088}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5B43817F-EEF6-4298-BADF-69203BE7D088}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5B43817F-EEF6-4298-BADF-69203BE7D088}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5B43817F-EEF6-4298-BADF-69203BE7D088}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/89_Tic-Tac-Toe/vbnet/TicTacToe.vbproj b/89_Tic-Tac-Toe/vbnet/TicTacToe.vbproj new file mode 100644 index 00000000..5bac9e9e --- /dev/null +++ b/89_Tic-Tac-Toe/vbnet/TicTacToe.vbproj @@ -0,0 +1,8 @@ + + + Exe + TicTacToe + net6.0 + 16.9 + + diff --git a/90_Tower/csharp/Tower/Game.cs b/90_Tower/csharp/Game.cs similarity index 100% rename from 90_Tower/csharp/Tower/Game.cs rename to 90_Tower/csharp/Game.cs diff --git a/90_Tower/csharp/Tower/Models/Needle.cs b/90_Tower/csharp/Models/Needle.cs similarity index 100% rename from 90_Tower/csharp/Tower/Models/Needle.cs rename to 90_Tower/csharp/Models/Needle.cs diff --git a/90_Tower/csharp/Tower/Models/Towers.cs b/90_Tower/csharp/Models/Towers.cs similarity index 100% rename from 90_Tower/csharp/Tower/Models/Towers.cs rename to 90_Tower/csharp/Models/Towers.cs diff --git a/90_Tower/csharp/Tower/Program.cs b/90_Tower/csharp/Program.cs similarity index 100% rename from 90_Tower/csharp/Tower/Program.cs rename to 90_Tower/csharp/Program.cs diff --git a/90_Tower/csharp/Tower/Resources/Congratulations.txt b/90_Tower/csharp/Resources/Congratulations.txt similarity index 100% rename from 90_Tower/csharp/Tower/Resources/Congratulations.txt rename to 90_Tower/csharp/Resources/Congratulations.txt diff --git a/90_Tower/csharp/Tower/Resources/DiskCountPrompt.txt b/90_Tower/csharp/Resources/DiskCountPrompt.txt similarity index 100% rename from 90_Tower/csharp/Tower/Resources/DiskCountPrompt.txt rename to 90_Tower/csharp/Resources/DiskCountPrompt.txt diff --git a/90_Tower/csharp/Tower/Resources/DiskCountQuit.txt b/90_Tower/csharp/Resources/DiskCountQuit.txt similarity index 100% rename from 90_Tower/csharp/Tower/Resources/DiskCountQuit.txt rename to 90_Tower/csharp/Resources/DiskCountQuit.txt diff --git a/90_Tower/csharp/Tower/Resources/DiskCountRetry.txt b/90_Tower/csharp/Resources/DiskCountRetry.txt similarity index 100% rename from 90_Tower/csharp/Tower/Resources/DiskCountRetry.txt rename to 90_Tower/csharp/Resources/DiskCountRetry.txt diff --git a/90_Tower/csharp/Tower/Resources/DiskNotInPlay.txt b/90_Tower/csharp/Resources/DiskNotInPlay.txt similarity index 100% rename from 90_Tower/csharp/Tower/Resources/DiskNotInPlay.txt rename to 90_Tower/csharp/Resources/DiskNotInPlay.txt diff --git a/90_Tower/csharp/Tower/Resources/DiskPrompt.txt b/90_Tower/csharp/Resources/DiskPrompt.txt similarity index 100% rename from 90_Tower/csharp/Tower/Resources/DiskPrompt.txt rename to 90_Tower/csharp/Resources/DiskPrompt.txt diff --git a/90_Tower/csharp/Tower/Resources/DiskQuit.txt b/90_Tower/csharp/Resources/DiskQuit.txt similarity index 100% rename from 90_Tower/csharp/Tower/Resources/DiskQuit.txt rename to 90_Tower/csharp/Resources/DiskQuit.txt diff --git a/90_Tower/csharp/Tower/Resources/DiskRetry.txt b/90_Tower/csharp/Resources/DiskRetry.txt similarity index 100% rename from 90_Tower/csharp/Tower/Resources/DiskRetry.txt rename to 90_Tower/csharp/Resources/DiskRetry.txt diff --git a/90_Tower/csharp/Tower/Resources/DiskUnavailable.txt b/90_Tower/csharp/Resources/DiskUnavailable.txt similarity index 100% rename from 90_Tower/csharp/Tower/Resources/DiskUnavailable.txt rename to 90_Tower/csharp/Resources/DiskUnavailable.txt diff --git a/90_Tower/csharp/Tower/Resources/IllegalMove.txt b/90_Tower/csharp/Resources/IllegalMove.txt similarity index 100% rename from 90_Tower/csharp/Tower/Resources/IllegalMove.txt rename to 90_Tower/csharp/Resources/IllegalMove.txt diff --git a/90_Tower/csharp/Tower/Resources/Instructions.txt b/90_Tower/csharp/Resources/Instructions.txt similarity index 100% rename from 90_Tower/csharp/Tower/Resources/Instructions.txt rename to 90_Tower/csharp/Resources/Instructions.txt diff --git a/90_Tower/csharp/Tower/Resources/Intro.txt b/90_Tower/csharp/Resources/Intro.txt similarity index 100% rename from 90_Tower/csharp/Tower/Resources/Intro.txt rename to 90_Tower/csharp/Resources/Intro.txt diff --git a/90_Tower/csharp/Tower/Resources/NeedlePrompt.txt b/90_Tower/csharp/Resources/NeedlePrompt.txt similarity index 100% rename from 90_Tower/csharp/Tower/Resources/NeedlePrompt.txt rename to 90_Tower/csharp/Resources/NeedlePrompt.txt diff --git a/90_Tower/csharp/Tower/Resources/NeedleQuit.txt b/90_Tower/csharp/Resources/NeedleQuit.txt similarity index 100% rename from 90_Tower/csharp/Tower/Resources/NeedleQuit.txt rename to 90_Tower/csharp/Resources/NeedleQuit.txt diff --git a/90_Tower/csharp/Tower/Resources/NeedleRetry.txt b/90_Tower/csharp/Resources/NeedleRetry.txt similarity index 100% rename from 90_Tower/csharp/Tower/Resources/NeedleRetry.txt rename to 90_Tower/csharp/Resources/NeedleRetry.txt diff --git a/90_Tower/csharp/Tower/Resources/PlayAgainPrompt.txt b/90_Tower/csharp/Resources/PlayAgainPrompt.txt similarity index 100% rename from 90_Tower/csharp/Tower/Resources/PlayAgainPrompt.txt rename to 90_Tower/csharp/Resources/PlayAgainPrompt.txt diff --git a/90_Tower/csharp/Tower/Resources/Strings.cs b/90_Tower/csharp/Resources/Strings.cs similarity index 100% rename from 90_Tower/csharp/Tower/Resources/Strings.cs rename to 90_Tower/csharp/Resources/Strings.cs diff --git a/90_Tower/csharp/Tower/Resources/TaskFinished.txt b/90_Tower/csharp/Resources/TaskFinished.txt similarity index 100% rename from 90_Tower/csharp/Tower/Resources/TaskFinished.txt rename to 90_Tower/csharp/Resources/TaskFinished.txt diff --git a/90_Tower/csharp/Tower/Resources/Thanks.txt b/90_Tower/csharp/Resources/Thanks.txt similarity index 100% rename from 90_Tower/csharp/Tower/Resources/Thanks.txt rename to 90_Tower/csharp/Resources/Thanks.txt diff --git a/90_Tower/csharp/Tower/Resources/Title.txt b/90_Tower/csharp/Resources/Title.txt similarity index 100% rename from 90_Tower/csharp/Tower/Resources/Title.txt rename to 90_Tower/csharp/Resources/Title.txt diff --git a/90_Tower/csharp/Tower/Resources/TooManyMoves.txt b/90_Tower/csharp/Resources/TooManyMoves.txt similarity index 100% rename from 90_Tower/csharp/Tower/Resources/TooManyMoves.txt rename to 90_Tower/csharp/Resources/TooManyMoves.txt diff --git a/90_Tower/csharp/Tower/Resources/YesNoPrompt.txt b/90_Tower/csharp/Resources/YesNoPrompt.txt similarity index 100% rename from 90_Tower/csharp/Tower/Resources/YesNoPrompt.txt rename to 90_Tower/csharp/Resources/YesNoPrompt.txt diff --git a/90_Tower/csharp/Tower/Tower.csproj b/90_Tower/csharp/Tower.csproj similarity index 100% rename from 90_Tower/csharp/Tower/Tower.csproj rename to 90_Tower/csharp/Tower.csproj diff --git a/90_Tower/csharp/Tower.sln b/90_Tower/csharp/Tower.sln index 2c6e524d..6f87b0b9 100644 --- a/90_Tower/csharp/Tower.sln +++ b/90_Tower/csharp/Tower.sln @@ -1,34 +1,25 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.26124.0 +# Visual Studio Version 17 +VisualStudioVersion = 17.0.32014.148 MinimumVisualStudioVersion = 15.0.26124.0 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tower", "tower\Tower.csproj", "{2E14FCD5-A52C-4292-A7F4-0C7E5780C962}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tower", "Tower.csproj", "{EEED33AD-3DE2-49AA-8AF1-2174C510E128}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 Release|Any CPU = Release|Any CPU - Release|x64 = Release|x64 - Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {EEED33AD-3DE2-49AA-8AF1-2174C510E128}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EEED33AD-3DE2-49AA-8AF1-2174C510E128}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EEED33AD-3DE2-49AA-8AF1-2174C510E128}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EEED33AD-3DE2-49AA-8AF1-2174C510E128}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {2E14FCD5-A52C-4292-A7F4-0C7E5780C962}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {2E14FCD5-A52C-4292-A7F4-0C7E5780C962}.Debug|Any CPU.Build.0 = Debug|Any CPU - {2E14FCD5-A52C-4292-A7F4-0C7E5780C962}.Debug|x64.ActiveCfg = Debug|Any CPU - {2E14FCD5-A52C-4292-A7F4-0C7E5780C962}.Debug|x64.Build.0 = Debug|Any CPU - {2E14FCD5-A52C-4292-A7F4-0C7E5780C962}.Debug|x86.ActiveCfg = Debug|Any CPU - {2E14FCD5-A52C-4292-A7F4-0C7E5780C962}.Debug|x86.Build.0 = Debug|Any CPU - {2E14FCD5-A52C-4292-A7F4-0C7E5780C962}.Release|Any CPU.ActiveCfg = Release|Any CPU - {2E14FCD5-A52C-4292-A7F4-0C7E5780C962}.Release|Any CPU.Build.0 = Release|Any CPU - {2E14FCD5-A52C-4292-A7F4-0C7E5780C962}.Release|x64.ActiveCfg = Release|Any CPU - {2E14FCD5-A52C-4292-A7F4-0C7E5780C962}.Release|x64.Build.0 = Release|Any CPU - {2E14FCD5-A52C-4292-A7F4-0C7E5780C962}.Release|x86.ActiveCfg = Release|Any CPU - {2E14FCD5-A52C-4292-A7F4-0C7E5780C962}.Release|x86.Build.0 = Release|Any CPU + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {BDCB8278-62ED-46E3-92C2-FF572E0E3ED3} EndGlobalSection EndGlobal diff --git a/90_Tower/csharp/Tower/UI/Input.cs b/90_Tower/csharp/UI/Input.cs similarity index 100% rename from 90_Tower/csharp/Tower/UI/Input.cs rename to 90_Tower/csharp/UI/Input.cs diff --git a/90_Tower/csharp/Tower/UI/Prompt.cs b/90_Tower/csharp/UI/Prompt.cs similarity index 100% rename from 90_Tower/csharp/Tower/UI/Prompt.cs rename to 90_Tower/csharp/UI/Prompt.cs diff --git a/90_Tower/csharp/Tower/UI/TowerDisplay.cs b/90_Tower/csharp/UI/TowerDisplay.cs similarity index 100% rename from 90_Tower/csharp/Tower/UI/TowerDisplay.cs rename to 90_Tower/csharp/UI/TowerDisplay.cs diff --git a/90_Tower/vbnet/Tower.sln b/90_Tower/vbnet/Tower.sln new file mode 100644 index 00000000..059a8d70 --- /dev/null +++ b/90_Tower/vbnet/Tower.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Tower", "Tower.vbproj", "{9B62545A-F076-4390-864B-ABE6FC20CC62}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {9B62545A-F076-4390-864B-ABE6FC20CC62}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9B62545A-F076-4390-864B-ABE6FC20CC62}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9B62545A-F076-4390-864B-ABE6FC20CC62}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9B62545A-F076-4390-864B-ABE6FC20CC62}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/90_Tower/vbnet/Tower.vbproj b/90_Tower/vbnet/Tower.vbproj new file mode 100644 index 00000000..d5d8396b --- /dev/null +++ b/90_Tower/vbnet/Tower.vbproj @@ -0,0 +1,8 @@ + + + Exe + Tower + net6.0 + 16.9 + + diff --git a/91_Train/csharp/Train/Train.sln b/91_Train/csharp/Train.sln similarity index 70% rename from 91_Train/csharp/Train/Train.sln rename to 91_Train/csharp/Train.sln index 7735a737..29c49c59 100644 --- a/91_Train/csharp/Train/Train.sln +++ b/91_Train/csharp/Train.sln @@ -3,9 +3,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 16 VisualStudioVersion = 16.0.31129.286 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TrainGame", "Train\TrainGame.csproj", "{42617537-4E7C-4082-A17B-7F18DFA04C35}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TrainGame", "Train\TrainGame.csproj", "{42617537-4E7C-4082-A17B-7F18DFA04C35}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TrainTests", "..\TrainTests\TrainTests\TrainTests.csproj", "{7C740A47-99C6-44E1-BDEE-140086BCFE8B}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TrainTests", "TrainTests\TrainTests.csproj", "{B967AA46-78F2-44F8-A30D-85D35F625991}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -17,10 +17,10 @@ Global {42617537-4E7C-4082-A17B-7F18DFA04C35}.Debug|Any CPU.Build.0 = Debug|Any CPU {42617537-4E7C-4082-A17B-7F18DFA04C35}.Release|Any CPU.ActiveCfg = Release|Any CPU {42617537-4E7C-4082-A17B-7F18DFA04C35}.Release|Any CPU.Build.0 = Release|Any CPU - {7C740A47-99C6-44E1-BDEE-140086BCFE8B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {7C740A47-99C6-44E1-BDEE-140086BCFE8B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {7C740A47-99C6-44E1-BDEE-140086BCFE8B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {7C740A47-99C6-44E1-BDEE-140086BCFE8B}.Release|Any CPU.Build.0 = Release|Any CPU + {B967AA46-78F2-44F8-A30D-85D35F625991}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B967AA46-78F2-44F8-A30D-85D35F625991}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B967AA46-78F2-44F8-A30D-85D35F625991}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B967AA46-78F2-44F8-A30D-85D35F625991}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/91_Train/csharp/Train/Train/TrainGame.cs b/91_Train/csharp/Train/TrainGame.cs similarity index 100% rename from 91_Train/csharp/Train/Train/TrainGame.cs rename to 91_Train/csharp/Train/TrainGame.cs diff --git a/91_Train/csharp/Train/Train/TrainGame.csproj b/91_Train/csharp/Train/TrainGame.csproj similarity index 100% rename from 91_Train/csharp/Train/Train/TrainGame.csproj rename to 91_Train/csharp/Train/TrainGame.csproj diff --git a/91_Train/csharp/TrainTests/TrainTests/TrainGameTests.cs b/91_Train/csharp/TrainTests/TrainGameTests.cs similarity index 100% rename from 91_Train/csharp/TrainTests/TrainTests/TrainGameTests.cs rename to 91_Train/csharp/TrainTests/TrainGameTests.cs diff --git a/91_Train/csharp/TrainTests/TrainTests/TrainTests.csproj b/91_Train/csharp/TrainTests/TrainTests.csproj similarity index 92% rename from 91_Train/csharp/TrainTests/TrainTests/TrainTests.csproj rename to 91_Train/csharp/TrainTests/TrainTests.csproj index a8de6dde..fb6ab9fb 100644 --- a/91_Train/csharp/TrainTests/TrainTests/TrainTests.csproj +++ b/91_Train/csharp/TrainTests/TrainTests.csproj @@ -20,7 +20,7 @@ - + diff --git a/91_Train/vbnet/Train.sln b/91_Train/vbnet/Train.sln new file mode 100644 index 00000000..ea959481 --- /dev/null +++ b/91_Train/vbnet/Train.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Train", "Train.vbproj", "{05F1229A-9138-4B1D-9781-CE8C4F7A6151}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {05F1229A-9138-4B1D-9781-CE8C4F7A6151}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {05F1229A-9138-4B1D-9781-CE8C4F7A6151}.Debug|Any CPU.Build.0 = Debug|Any CPU + {05F1229A-9138-4B1D-9781-CE8C4F7A6151}.Release|Any CPU.ActiveCfg = Release|Any CPU + {05F1229A-9138-4B1D-9781-CE8C4F7A6151}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/91_Train/vbnet/Train.vbproj b/91_Train/vbnet/Train.vbproj new file mode 100644 index 00000000..84f03013 --- /dev/null +++ b/91_Train/vbnet/Train.vbproj @@ -0,0 +1,8 @@ + + + Exe + Train + net6.0 + 16.9 + + diff --git a/92_Trap/csharp/Trap.csproj b/92_Trap/csharp/Trap.csproj new file mode 100644 index 00000000..d3fe4757 --- /dev/null +++ b/92_Trap/csharp/Trap.csproj @@ -0,0 +1,9 @@ + + + Exe + net6.0 + 10 + enable + enable + + diff --git a/92_Trap/csharp/Trap.sln b/92_Trap/csharp/Trap.sln new file mode 100644 index 00000000..6226bef3 --- /dev/null +++ b/92_Trap/csharp/Trap.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Trap", "Trap.csproj", "{4386B4A0-16A9-48E7-8FBA-E35D4C9FEDAA}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {4386B4A0-16A9-48E7-8FBA-E35D4C9FEDAA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4386B4A0-16A9-48E7-8FBA-E35D4C9FEDAA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4386B4A0-16A9-48E7-8FBA-E35D4C9FEDAA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4386B4A0-16A9-48E7-8FBA-E35D4C9FEDAA}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/92_Trap/vbnet/Trap.sln b/92_Trap/vbnet/Trap.sln new file mode 100644 index 00000000..65f0a10d --- /dev/null +++ b/92_Trap/vbnet/Trap.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Trap", "Trap.vbproj", "{BAA7B27D-D52D-4C34-972B-2F357F60B8AB}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {BAA7B27D-D52D-4C34-972B-2F357F60B8AB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {BAA7B27D-D52D-4C34-972B-2F357F60B8AB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {BAA7B27D-D52D-4C34-972B-2F357F60B8AB}.Release|Any CPU.ActiveCfg = Release|Any CPU + {BAA7B27D-D52D-4C34-972B-2F357F60B8AB}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/92_Trap/vbnet/Trap.vbproj b/92_Trap/vbnet/Trap.vbproj new file mode 100644 index 00000000..f9d5a790 --- /dev/null +++ b/92_Trap/vbnet/Trap.vbproj @@ -0,0 +1,8 @@ + + + Exe + Trap + net6.0 + 16.9 + + diff --git a/93_23_Matches/vbnet/TwentyThreeMatches.sln b/93_23_Matches/vbnet/TwentyThreeMatches.sln new file mode 100644 index 00000000..a378cf3f --- /dev/null +++ b/93_23_Matches/vbnet/TwentyThreeMatches.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "TwentyThreeMatches", "TwentyThreeMatches.vbproj", "{DEAA537A-6F73-4C2E-A85C-4B797B3D1900}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {DEAA537A-6F73-4C2E-A85C-4B797B3D1900}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DEAA537A-6F73-4C2E-A85C-4B797B3D1900}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DEAA537A-6F73-4C2E-A85C-4B797B3D1900}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DEAA537A-6F73-4C2E-A85C-4B797B3D1900}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/93_23_Matches/vbnet/TwentyThreeMatches.vbproj b/93_23_Matches/vbnet/TwentyThreeMatches.vbproj new file mode 100644 index 00000000..cf8620c9 --- /dev/null +++ b/93_23_Matches/vbnet/TwentyThreeMatches.vbproj @@ -0,0 +1,8 @@ + + + Exe + TwentyThreeMatches + net6.0 + 16.9 + + diff --git a/94_War/csharp/War/War.sln b/94_War/csharp/War.sln similarity index 100% rename from 94_War/csharp/War/War.sln rename to 94_War/csharp/War.sln diff --git a/94_War/csharp/War/War/Cards.cs b/94_War/csharp/War/Cards.cs similarity index 100% rename from 94_War/csharp/War/War/Cards.cs rename to 94_War/csharp/War/Cards.cs diff --git a/94_War/csharp/War/War/Program.cs b/94_War/csharp/War/Program.cs similarity index 100% rename from 94_War/csharp/War/War/Program.cs rename to 94_War/csharp/War/Program.cs diff --git a/94_War/csharp/War/War/UserInterface.cs b/94_War/csharp/War/UserInterface.cs similarity index 100% rename from 94_War/csharp/War/War/UserInterface.cs rename to 94_War/csharp/War/UserInterface.cs diff --git a/94_War/csharp/War/War/War.csproj b/94_War/csharp/War/War.csproj similarity index 100% rename from 94_War/csharp/War/War/War.csproj rename to 94_War/csharp/War/War.csproj diff --git a/94_War/csharp/War/WarTester/Tests.cs b/94_War/csharp/WarTester/Tests.cs similarity index 100% rename from 94_War/csharp/War/WarTester/Tests.cs rename to 94_War/csharp/WarTester/Tests.cs diff --git a/94_War/csharp/War/WarTester/WarTester.csproj b/94_War/csharp/WarTester/WarTester.csproj similarity index 100% rename from 94_War/csharp/War/WarTester/WarTester.csproj rename to 94_War/csharp/WarTester/WarTester.csproj diff --git a/94_War/d/.gitignore b/94_War/d/.gitignore new file mode 100644 index 00000000..d969f6b2 --- /dev/null +++ b/94_War/d/.gitignore @@ -0,0 +1,2 @@ +*.exe +*.obj diff --git a/94_War/d/README.md b/94_War/d/README.md new file mode 100644 index 00000000..2bc48a12 --- /dev/null +++ b/94_War/d/README.md @@ -0,0 +1,125 @@ +Original source downloaded from [Vintage Basic](http://www.vintage-basic.net/games.html) + +Converted to [D](https://dlang.org/) by [Bastiaan Veelo](https://github.com/veelo). + +## Running the code + +Assuming the reference [dmd](https://dlang.org/download.html#dmd) compiler: +```shell +dmd -preview=dip1000 -run war.d +``` + +[Other compilers](https://dlang.org/download.html) also exist. + +## Specialties explained + +This game code contains some specialties that you might want to know more about. Here goes. + +### Suits + +Most modern consoles are capable of displaying more than just ASCII, and so I have chosen to display the actual ♠, ♥, ♦ +and ♣ instead of substituting them by letters like the BASIC original did. Only the Windows console needs a nudge in +the right direction with these instructions: +```d +SetConsoleOutputCP(CP_UTF8); // Set code page +SetConsoleOutputCP(GetACP); // Restore the default +``` +Instead of cluttering the `main()` function with these lesser important details, we can move them into a +[module constructor and module destructor](https://dlang.org/spec/module.html#staticorder), which run before and after +`main()` respectively. And because order of declaration is irrelevant in a D module, we can push those all the way +down to the bottom of the file. This is of course only necessary on Windows (and won't even work anywhere else) so +we'll need to wrap this in a `version (Windows)` conditional code block: +```d +version (Windows) +{ + import core.sys.windows.windows; + + shared static this() @trusted + { + SetConsoleOutputCP(CP_UTF8); + } + + shared static ~this() @trusted + { + SetConsoleOutputCP(GetACP); + } +} +``` +Although it doesn't matter much in this single-threaded program, the `shared` attribute makes that these +constructors/destructors are run once per program invocation; non-shared module constructors and module destructors are +run for every thread. The `@trusted` annotation is necessary because these are system API calls; The compiler cannot +check these for memory-safety, and so we must indicate that we have reviewed the safety manually. + +### Uniform Function Call Syntax + +In case you wonder why this line works: +```d +if ("Do you want instructions?".yes) + // ... +``` +then it is because this is equivalent to +```d +if (yes("Do you want instructions?")) + // ... +``` +where `yes()` is a Boolean function that is defined below `main()`. This is made possible by the language feature that +is called [uniform function call syntax (UFCS)](https://dlang.org/spec/function.html#pseudo-member). UFCS works by +passing what is in front of the dot as the first parameter to the function, and it was invented to make it possible to +call free functions on objects as if they were member functions. UFCS can also be used to obtain a more natural order +of function calls, such as this line inside `yes()`: +```d +return trustedReadln.strip.toLower.startsWith("y"); +``` +which reads easier than the equivalent +```d +return startsWith(toLower(strip(trustedReadln())), "y"); +``` + +### Type a lot or not? + +It would have been straight forward to define the `cards` array explicitly like so: +```d +const cards = ["2♠", "2♥", "2♦", "2♣", "3♠", "3♥", "3♦", "3♣", + "4♠", "4♥", "4♦", "4♣", "5♠", "5♥", "5♦", "5♣", + "6♠", "6♥", "6♦", "6♣", "7♠", "7♥", "7♦", "7♣", + "8♠", "8♥", "8♦", "8♣", "9♠", "9♥", "9♦", "9♣", + "10♠", "10♥", "10♦", "10♣", "J♥", "J♦", "J♣", "J♣", + "Q♠", "Q♥", "Q♦", "Q♣", "K♠", "K♥", "K♦", "K♣", + "A♠", "A♥", "A♦", "A♣"]; +``` +but that's tedious, difficult to spot errors in (*can you?*) and looks like something a computer can automate. Indeed +it can: +```d +static const cards = cartesianProduct(["2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K", "A"], + ["♠", "♥", "♦", "♣"]).map!(a => a.expand.only.join).array; +``` +The function [`cartesianProduct`](https://dlang.org/phobos/std_algorithm_setops.html#cartesianProduct) takes two +ranges, like the horizontal and vertical headers of a spreadsheet, and fills the table with the combinations that form +the coordinates of the cells. But the output of that function is in the form of an array of +[`Tuple`](https://dlang.org/phobos/std_typecons.html#Tuple)s, which looks like `[Tuple!(string, string)("2", "♠"), +Tuple!(string, string)("2", "♥"), ... etc]`. [`map`](https://dlang.org/phobos/std_algorithm_iteration.html#map) +comes to the rescue, converting each Tuple to a string, by calling +[`expand`](https://dlang.org/phobos/std_typecons.html#.Tuple.expand), then +[`only`](https://dlang.org/phobos/std_range.html#only) and then [`join`](https://dlang.org/phobos/std_array.html#join) +on them. The result is a lazily evaluated range of strings. Finally, +[`array`](https://dlang.org/phobos/std_array.html#array) turns the range into a random access array. The `static` +attribute makes that all this is performed at compile-time, so the result is exactly the same as the manually entered +data, but without the typo's. + +### Shuffle the cards or not? + +The original BASIC code works with a constant array of cards, ordered by increasing numerical value, and indexing it +with indices that have been shuffled. This is efficient because in comparing who wins, the indices can be compared +directly, since a higher index correlates to a card with a higher numerical value (when divided by the number of suits, +4). Some of the other reimplementations in other languages have been written in a lesser efficient way by shuffling the +array of cards itself. This then requires the use of a lookup table or searching for equality in an auxiliary array +when comparing cards. + +I find the original more elegant, so that's what you see here: +```d +const indices = iota(0, cards.length).array.randomShuffle; +``` +[`iota`](https://dlang.org/phobos/std_range.html#iota) produces a range of integers, in this case starting at 0 and +increasing up to the number of cards in the deck (exclusive). [`array`](https://dlang.org/phobos/std_array.html#array) +turns the range into an array, so that [`randomShuffle`](https://dlang.org/phobos/std_random.html#randomShuffle) can +do its work. diff --git a/94_War/d/war.d b/94_War/d/war.d new file mode 100644 index 00000000..d5a453fa --- /dev/null +++ b/94_War/d/war.d @@ -0,0 +1,80 @@ +@safe: // Make @safe the default for this file, enforcing memory-safety. +import std; + +void main() +{ + enum width = 50; + writeln(center("War", width)); + writeln(center("(After Creative Computing Morristown, New Jersey)\n\n", width)); + writeln(wrap("This is the card game of war. Each card is given by suit-# " ~ + "as 7♠ for seven of spades. ", width)); + + if ("Do you want instructions?".yes) + writeln("\n", wrap("The computer gives you and it a 'card'. The higher card " ~ + "(numerically) wins. The game ends when you choose not to " ~ + "continue or when you have finished the pack.\n", width)); + + static const cards = cartesianProduct(["2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K", "A"], + ["♠", "♥", "♦", "♣"]).map!(a => a.expand.only.join).array; + const indices = iota(0, cards.length).array.randomShuffle; + int yourScore = 0, compScore = 0, i = 0; + while (i < indices.length) + { + size_t your = indices[i++], comp = indices[i++]; + writeln("\nYou: ", cards[your].leftJustify(9), "Computer: ", cards[comp]); + your /= 4; comp /= 4; + if (your == comp) + writeln("Tie. No score change."); + else if (your < comp) + writeln("The computer wins!!! You have ", yourScore, + " and the computer has ", ++compScore, "."); + else + writeln("You win. You have ", ++yourScore, + " and the computer has ", compScore, "."); + if (i == indices.length) + writeln("\nWe have run out of cards. Final score: You: ", yourScore, + ", the computer: ", compScore, "."); + else if (!"Do you want to continue?".yes) + break; + } + writeln("\nThanks for playing. It was fun."); +} + +/// Returns whether question was answered positively. +bool yes(string question) +{ + writef!"%s "(question); + try + return trustedReadln.strip.toLower.startsWith("y"); + catch (Exception) // readln throws on I/O and Unicode errors, which we handle here. + return false; +} + +/** An @trusted wrapper around readln. +* +* This is the only function that formally requires manual review for memory-safety. +* [Arguably readln should be safe already](https://forum.dlang.org/post/rab398$1up$1@digitalmars.com) +* which would remove the need to have any @trusted code in this program. +*/ +string trustedReadln() @trusted +{ + return readln; +} + +version (Windows) +{ + // Make the Windows console do a better job at printing UTF-8 strings, + // and restore the default upon termination. + + import core.sys.windows.windows; + + shared static this() @trusted + { + SetConsoleOutputCP(CP_UTF8); + } + + shared static ~this() @trusted + { + SetConsoleOutputCP(GetACP); + } +} diff --git a/94_War/vbnet/War.sln b/94_War/vbnet/War.sln new file mode 100644 index 00000000..3c0895ad --- /dev/null +++ b/94_War/vbnet/War.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "War", "War.vbproj", "{36D070A1-08CB-424E-AB8E-E782B0A6654B}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {36D070A1-08CB-424E-AB8E-E782B0A6654B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {36D070A1-08CB-424E-AB8E-E782B0A6654B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {36D070A1-08CB-424E-AB8E-E782B0A6654B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {36D070A1-08CB-424E-AB8E-E782B0A6654B}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/94_War/vbnet/War.vbproj b/94_War/vbnet/War.vbproj new file mode 100644 index 00000000..e62cda47 --- /dev/null +++ b/94_War/vbnet/War.vbproj @@ -0,0 +1,8 @@ + + + Exe + War + net6.0 + 16.9 + + diff --git a/95_Weekday/csharp/Weekday.csproj b/95_Weekday/csharp/Weekday.csproj new file mode 100644 index 00000000..d3fe4757 --- /dev/null +++ b/95_Weekday/csharp/Weekday.csproj @@ -0,0 +1,9 @@ + + + Exe + net6.0 + 10 + enable + enable + + diff --git a/95_Weekday/csharp/Weekday.sln b/95_Weekday/csharp/Weekday.sln new file mode 100644 index 00000000..4aad7c31 --- /dev/null +++ b/95_Weekday/csharp/Weekday.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Weekday", "Weekday.csproj", "{6E93B1EC-5E19-47DB-821A-D19F1D0DA982}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {6E93B1EC-5E19-47DB-821A-D19F1D0DA982}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6E93B1EC-5E19-47DB-821A-D19F1D0DA982}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6E93B1EC-5E19-47DB-821A-D19F1D0DA982}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6E93B1EC-5E19-47DB-821A-D19F1D0DA982}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/95_Weekday/vbnet/Weekday.sln b/95_Weekday/vbnet/Weekday.sln new file mode 100644 index 00000000..7bbbb17a --- /dev/null +++ b/95_Weekday/vbnet/Weekday.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Weekday", "Weekday.vbproj", "{3BE031BE-D032-477A-A419-48FA7D3C2DD2}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {3BE031BE-D032-477A-A419-48FA7D3C2DD2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3BE031BE-D032-477A-A419-48FA7D3C2DD2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3BE031BE-D032-477A-A419-48FA7D3C2DD2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3BE031BE-D032-477A-A419-48FA7D3C2DD2}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/95_Weekday/vbnet/Weekday.vbproj b/95_Weekday/vbnet/Weekday.vbproj new file mode 100644 index 00000000..dfa9996c --- /dev/null +++ b/95_Weekday/vbnet/Weekday.vbproj @@ -0,0 +1,8 @@ + + + Exe + Weekday + net6.0 + 16.9 + + diff --git a/96_Word/csharp/word.sln b/96_Word/csharp/word.sln index 59bdec97..77360e81 100644 --- a/96_Word/csharp/word.sln +++ b/96_Word/csharp/word.sln @@ -1,9 +1,9 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.31321.278 +# Visual Studio Version 17 +VisualStudioVersion = 17.0.32014.148 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "word", "word.csproj", "{E2CF183B-EBC3-497C-8D34-32EBEE4E2B73}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Word", "Word.csproj", "{E2CF183B-EBC3-497C-8D34-32EBEE4E2B73}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/96_Word/vbnet/word.sln b/96_Word/vbnet/word.sln index 16584104..73674ee4 100644 --- a/96_Word/vbnet/word.sln +++ b/96_Word/vbnet/word.sln @@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 16 VisualStudioVersion = 16.0.31321.278 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "word", "word.vbproj", "{F0D2422C-983F-4DF3-9D17-D2480839DF07}" +Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "Word", "Word.vbproj", "{F0D2422C-983F-4DF3-9D17-D2480839DF07}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/96_Word/vbnet/word.vbproj b/96_Word/vbnet/word.vbproj index 9868dd3e..f80094e4 100644 --- a/96_Word/vbnet/word.vbproj +++ b/96_Word/vbnet/word.vbproj @@ -2,8 +2,9 @@ Exe - word + Word netcoreapp3.1 + 16.9 diff --git a/buildJvm/build_27_Civil_War_java/build.gradle b/buildJvm/build_27_Civil_War_java/build.gradle new file mode 100644 index 00000000..3432056c --- /dev/null +++ b/buildJvm/build_27_Civil_War_java/build.gradle @@ -0,0 +1,19 @@ +plugins { + id 'application' +} + +sourceSets { + main { + java { + srcDirs "../../$gameSource" + } + } +} + +repositories { + mavenCentral() +} + +application { + mainClass = gameMain +} diff --git a/buildJvm/build_27_Civil_War_java/gradle.properties b/buildJvm/build_27_Civil_War_java/gradle.properties new file mode 100644 index 00000000..eaf00ff1 --- /dev/null +++ b/buildJvm/build_27_Civil_War_java/gradle.properties @@ -0,0 +1,2 @@ +gameSource=27_Civil_War/java/src +gameMain=CivilWar diff --git a/buildJvm/settings.gradle b/buildJvm/settings.gradle index e2218806..20e6f813 100644 --- a/buildJvm/settings.gradle +++ b/buildJvm/settings.gradle @@ -30,6 +30,7 @@ include ":build_22_Change_java" include ":build_24_Chemist_java" include ":build_25_Chief_java" include ":build_26_Chomp_java" +include ":build_27_Civil_War_java" include ":build_28_Combat_java" include ":build_29_Craps_java" include ":build_30_Cube_java"