FordGT90Concept
"I go fast!1!11!1!"
- Joined
- Oct 13, 2008
- Messages
- 26,263 (4.41/day)
- Location
- IA, USA
System Name | BY-2021 |
---|---|
Processor | AMD Ryzen 7 5800X (65w eco profile) |
Motherboard | MSI B550 Gaming Plus |
Cooling | Scythe Mugen (rev 5) |
Memory | 2 x Kingston HyperX DDR4-3200 32 GiB |
Video Card(s) | AMD Radeon RX 7900 XT |
Storage | Samsung 980 Pro, Seagate Exos X20 TB 7200 RPM |
Display(s) | Nixeus NX-EDG274K (3840x2160@144 DP) + Samsung SyncMaster 906BW (1440x900@60 HDMI-DVI) |
Case | Coolermaster HAF 932 w/ USB 3.0 5.25" bay + USB 3.2 (A+C) 3.5" bay |
Audio Device(s) | Realtek ALC1150, Micca OriGen+ |
Power Supply | Enermax Platimax 850w |
Mouse | Nixeus REVEL-X |
Keyboard | Tesoro Excalibur |
Software | Windows 10 Home 64-bit |
Benchmark Scores | Faster than the tortoise; slower than the hare. |
I've done something similar before and what I did was create masks...
Step 1: Count the number of unique characters in the string. e.g. "blamo" has five unique characters.
Step 2: Create a "Mask" class or struct which has two definitions in it: 1) A String or char that represents this mask and 2) a String which holds the mask for that character.
Step 3: Create an array of class "mask", one for each unique character. Everything not that character has an underscore. e.g. "b____", "_l___", "__a__" etc.
Step 4: Make a MergeMask class which accepts two masks (or strings) and returns one string. This is a simple for loop where if value not equal to an underscore, copy to the output string. e.g. "b____" and "__a__" returns "b_a__"
Step 5: When they type a character, search your Mask array for a match. If no match, that's a strike against them. If it is a match you use the Step 4 method to make an output value.
I just checked how to get a char from a string:
You could always stick to a byte array too. It's easy to convert from string, to bytes, and back to string.
Step 1: Count the number of unique characters in the string. e.g. "blamo" has five unique characters.
Step 2: Create a "Mask" class or struct which has two definitions in it: 1) A String or char that represents this mask and 2) a String which holds the mask for that character.
Step 3: Create an array of class "mask", one for each unique character. Everything not that character has an underscore. e.g. "b____", "_l___", "__a__" etc.
Step 4: Make a MergeMask class which accepts two masks (or strings) and returns one string. This is a simple for loop where if value not equal to an underscore, copy to the output string. e.g. "b____" and "__a__" returns "b_a__"
Step 5: When they type a character, search your Mask array for a match. If no match, that's a strike against them. If it is a match you use the Step 4 method to make an output value.
I just checked how to get a char from a string:
Code:
String mystring = "blamo";
mystring.charAt(4); // 'o'
mystring.charAt(0); // 'b'
You could always stick to a byte array too. It's easy to convert from string, to bytes, and back to string.
Last edited: