From c8f594270558d26f18b50e87319885b1cb229996 Mon Sep 17 00:00:00 2001
From: srk1010 <42843938+srk1010@users.noreply.github.com>
Date: Mon, 6 May 2019 18:32:52 -0400
Subject: [PATCH] Add files via upload
---
SoftWritersOSK.sln | 25 ++++
SoftWritersOSK/App.config | 6 +
SoftWritersOSK/Program.cs | 18 +++
SoftWritersOSK/Properties/AssemblyInfo.cs | 36 ++++++
SoftWritersOSK/README.md | 28 +++++
SoftWritersOSK/SoftWritersOSK.csproj | 57 +++++++++
SoftWritersOSK/Traverse.cs | 113 ++++++++++++++++++
SoftWritersOSK/bin/Debug/SoftWritersOSK.exe | Bin 0 -> 6144 bytes
.../bin/Debug/SoftWritersOSK.exe.config | 6 +
SoftWritersOSK/bin/Debug/SoftWritersOSK.pdb | Bin 0 -> 15872 bytes
SoftWritersOSK/input.txt | 2 +
...gnTimeResolveAssemblyReferencesInput.cache | Bin 0 -> 6941 bytes
...tWritersOSK.csproj.CoreCompileInputs.cache | 1 +
...SoftWritersOSK.csproj.FileListAbsolute.txt | 7 ++
...rsOSK.csprojResolveAssemblyReference.cache | Bin 0 -> 9846 bytes
SoftWritersOSK/obj/Debug/SoftWritersOSK.exe | Bin 0 -> 6144 bytes
SoftWritersOSK/obj/Debug/SoftWritersOSK.pdb | Bin 0 -> 15872 bytes
17 files changed, 299 insertions(+)
create mode 100644 SoftWritersOSK.sln
create mode 100644 SoftWritersOSK/App.config
create mode 100644 SoftWritersOSK/Program.cs
create mode 100644 SoftWritersOSK/Properties/AssemblyInfo.cs
create mode 100644 SoftWritersOSK/README.md
create mode 100644 SoftWritersOSK/SoftWritersOSK.csproj
create mode 100644 SoftWritersOSK/Traverse.cs
create mode 100644 SoftWritersOSK/bin/Debug/SoftWritersOSK.exe
create mode 100644 SoftWritersOSK/bin/Debug/SoftWritersOSK.exe.config
create mode 100644 SoftWritersOSK/bin/Debug/SoftWritersOSK.pdb
create mode 100644 SoftWritersOSK/input.txt
create mode 100644 SoftWritersOSK/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache
create mode 100644 SoftWritersOSK/obj/Debug/SoftWritersOSK.csproj.CoreCompileInputs.cache
create mode 100644 SoftWritersOSK/obj/Debug/SoftWritersOSK.csproj.FileListAbsolute.txt
create mode 100644 SoftWritersOSK/obj/Debug/SoftWritersOSK.csprojResolveAssemblyReference.cache
create mode 100644 SoftWritersOSK/obj/Debug/SoftWritersOSK.exe
create mode 100644 SoftWritersOSK/obj/Debug/SoftWritersOSK.pdb
diff --git a/SoftWritersOSK.sln b/SoftWritersOSK.sln
new file mode 100644
index 0000000..b3c98a5
--- /dev/null
+++ b/SoftWritersOSK.sln
@@ -0,0 +1,25 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 15
+VisualStudioVersion = 15.0.27428.2015
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SoftWritersOSK", "SoftWritersOSK\SoftWritersOSK.csproj", "{F8702A6F-2274-4E82-ADAD-DC00AE710210}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {F8702A6F-2274-4E82-ADAD-DC00AE710210}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {F8702A6F-2274-4E82-ADAD-DC00AE710210}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {F8702A6F-2274-4E82-ADAD-DC00AE710210}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {F8702A6F-2274-4E82-ADAD-DC00AE710210}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {3DCC65CA-DF7B-4527-940E-998939B0AB54}
+ EndGlobalSection
+EndGlobal
diff --git a/SoftWritersOSK/App.config b/SoftWritersOSK/App.config
new file mode 100644
index 0000000..00bfd11
--- /dev/null
+++ b/SoftWritersOSK/App.config
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/SoftWritersOSK/Program.cs b/SoftWritersOSK/Program.cs
new file mode 100644
index 0000000..1724210
--- /dev/null
+++ b/SoftWritersOSK/Program.cs
@@ -0,0 +1,18 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SoftWritersOSK
+{
+ class Program
+ {
+ static void Main(string[] args)
+ {
+ string file = "..\\..\\input.txt";
+ Traverse.TraverseFile(file);
+ Console.ReadLine();
+ }
+ }
+}
diff --git a/SoftWritersOSK/Properties/AssemblyInfo.cs b/SoftWritersOSK/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..7ea6eea
--- /dev/null
+++ b/SoftWritersOSK/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("SoftWritersOSK")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("SoftWritersOSK")]
+[assembly: AssemblyCopyright("Copyright © 2019")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("f8702a6f-2274-4e82-adad-dc00ae710210")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/SoftWritersOSK/README.md b/SoftWritersOSK/README.md
new file mode 100644
index 0000000..4bf5f29
--- /dev/null
+++ b/SoftWritersOSK/README.md
@@ -0,0 +1,28 @@
+# On Screen Keyboard
+---
+The requirement for this program is to script the path for the cursor of an on screen keyboard. The Traverse class in this program provides the following methods to fulfill this requirement;
+
+1. ConvertASCII()
+ * ConvertASCII() takes a char as input, converts it to it's ASCII code, and subtracts the offset of 65 for the characters 'a' through 'z' (case insensitive) so that 'a' would return a value of 0, 'b' of 1, etc. The characters '1' through '9' return the values of 26 through 34, and the character '0' returns the value of 35. These values represent the relative position of each character within the "keyboard".
+
+2. TraverseChar()
+ * TraverseChar() takes two chars as inputs; char a and char b. Char a represents the cursor's current position, or the previously navigated character. Char b represents the char to be navigated to. TraverseChar() calculates the direction of travel by subtracting the cursor location from the target location. If the difference is less than or equal to negative six, then the direction of travel is up. Greater than or equal to positive 6, the direction of travel is down. Between 0 and negative six, the direction of travel is left. Between 0 and positive six, the direction of travel is right. The floors of a/6 and b/6 are also calculated and compared so that left and right operations never attemt to jump "lines", but instead output the proper up and to the right, or down and to the left directions.
+
+3. TraverseString()
+ * TraverseString() takes a string as input and calls TraverseChar() for each character in that string. The cursor path for the entire input string is returned.
+
+4. TraverseFile()
+ * TraverseFile() takes a file path string as input and calls TraverseString() for each line in the file, printing out the cursor path for each line as it goes.
+
+# Limitations
+---
+This program assumes that the on screen keyboard is laid out as follows;
+```
+ABCDEF
+GHIJKL
+MNOPQR
+STUVWX
+YZ1234
+567890
+```
+The characters of the keyboard are calculated mathematically and not stored in any data structure. Changing the layout of the keyboard requires adjusting the math in ConvertASCII() and TraverseChar().
\ No newline at end of file
diff --git a/SoftWritersOSK/SoftWritersOSK.csproj b/SoftWritersOSK/SoftWritersOSK.csproj
new file mode 100644
index 0000000..60d94ad
--- /dev/null
+++ b/SoftWritersOSK/SoftWritersOSK.csproj
@@ -0,0 +1,57 @@
+
+
+
+
+ Debug
+ AnyCPU
+ {F8702A6F-2274-4E82-ADAD-DC00AE710210}
+ Exe
+ SoftWritersOSK
+ SoftWritersOSK
+ v4.6.1
+ 512
+ true
+
+
+ AnyCPU
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ AnyCPU
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/SoftWritersOSK/Traverse.cs b/SoftWritersOSK/Traverse.cs
new file mode 100644
index 0000000..52e3865
--- /dev/null
+++ b/SoftWritersOSK/Traverse.cs
@@ -0,0 +1,113 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SoftWritersOSK
+{
+ /*
+ The Traverse class provides methods for outputting navigation
+ directions between characters in a string
+ */
+ static class Traverse
+ {
+ /*
+ ConvertASCII returns the values 0-25 for the characters A-Z,
+ the values 26-34 for characters 1-9,
+ and the value of 35 for the character 0.
+ These integers are arbitrary "indices" that allow for the
+ calculation of cardinal directions
+ */
+ public static int ConvertASCII(char a)
+ {
+ int aa = (int)a;
+ if (aa <= 57 && aa > 48)
+ aa += 42;
+ if (aa == 48)
+ aa += 52;
+
+ return aa - 65;
+ }
+
+ //TraverseChar provides output for the path between char a and char b
+ public static string TraverseChar(char a, char b)
+ {
+ int aa = ConvertASCII(a);
+ int bb = ConvertASCII(b);
+ string path = "";
+ //Compares the positions of a and b. If b is on the line above a, it moves the "cursor" up
+ while ((bb - aa) <= -6 || (Math.Floor((decimal)aa / 6) > Math.Floor((decimal)bb / 6)))
+ {
+ path += "U,";
+ aa -= 6;
+ }
+ //Compares the positions of a and b. If b is on the line below a, it moves the "cursor" down
+ while ((bb - aa) >= 6 || (Math.Floor((decimal)aa / 6) < Math.Floor((decimal)bb / 6)))
+ {
+ path += "D,";
+ aa += 6;
+ }
+ //Compares the positions of a and b. If b is to the left of a, it moves the "cursor" left
+ while ((bb - aa) <= -1)
+ {
+ path += "L,";
+ aa -= 1;
+ }
+ //Compares the positions of a and b. If b is to the right of a, it moves the "cursor" right
+ while ((bb - aa) >= 1)
+ {
+ path += "R,";
+ aa += 1;
+ }
+ //Checks if the "cursor" is located at the target character, and appends the select character if it is.
+ if (bb == aa)
+ path += "#";
+
+ return path;
+ }
+ /*
+ TraverseString calls TraverseChar for each character in the input string
+ and returns the pathing string for the entire input string
+ */
+ public static string TraverseString(string word)
+ {
+ char current = (char)0;
+ char next = (char)0;
+ char[] wordArray = word.ToUpper().ToCharArray();
+ string path = "";
+ //Cycles through every character in the input string
+ for (int i = 0; i < wordArray.Length; i++)
+ {
+ next = wordArray[i];
+ if ((int)current == 0)
+ current = 'A';
+ if (wordArray[i] == ' ')
+ {
+ path += "S";
+ }
+ else
+ {
+ path += TraverseChar(current, next);
+ current = next;
+ }
+ if (i != wordArray.Length - 1)
+ path += ',';
+ }
+
+ return path;
+ }
+
+ //TraverseFile takes a file path as input and outputs the cursor path for each line of the input file.
+ public static void TraverseFile(string file)
+ {
+ foreach (string line in System.IO.File.ReadLines(file))
+ {
+ System.Console.WriteLine(Traverse.TraverseString(line));
+ }
+ }
+ }
+}
+
+
+
diff --git a/SoftWritersOSK/bin/Debug/SoftWritersOSK.exe b/SoftWritersOSK/bin/Debug/SoftWritersOSK.exe
new file mode 100644
index 0000000000000000000000000000000000000000..288b96c93fc90460cf89321fb45c43aed7e80190
GIT binary patch
literal 6144
zcmeHLYiu0V6+Sb&o?Wl)O*R|bJQ6%vQ|iRt_4)xMUz$3&M<^D-jvli?h?!yPY%>4nDE
z_gs>uU*9voqC0BQw(_=CP_vq8TCSR5s$DWw-Bict(rUrVu|!Kt==O^0BNIf^l8@ee
z{*9%owYMlnO;Qrd!3lcYpAsGaHf8Cgb%hp`bMhg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