What position is the letter A? Let's use a lookup table!
-
Class A++ I suspect... :~
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
Doing crack, heroin and meths is a stage people go through. Just don't do VB!
veni bibi saltavi
-
Just found this gem hiding in a project I've just inherited. Fortunately it doesn't appear to be used.
public class AlphabetPositionMap
{
private static Dictionary<char, int> alphabet = new Dictionary<char, int>();static AlphabetPositionMap() { alphabet.Add('A', 1); alphabet.Add('B', 2); alphabet.Add('C', 3); alphabet.Add('D', 4); alphabet.Add('E', 5); alphabet.Add('F', 6); alphabet.Add('G', 7); alphabet.Add('H', 8); alphabet.Add('I', 9); alphabet.Add('J', 10); alphabet.Add('K', 11); alphabet.Add('L', 12); alphabet.Add('M', 13); alphabet.Add('N', 14); alphabet.Add('O', 15); alphabet.Add('P', 16); alphabet.Add('Q', 17); alphabet.Add('R', 18); alphabet.Add('S', 19); alphabet.Add('T', 20); alphabet.Add('U', 21); alphabet.Add('V', 22); alphabet.Add('W', 23); alphabet.Add('X', 24); alphabet.Add('Y', 25); alphabet.Add('Z', 26); } public static int Position(char letter) { return alphabet\[letter\]; }
}
Prizes awarded to anyone who can find a more pointless use of a lookup table.
And it gets better... Just noticed the next class on from that one:
public class ZeroBasedAlphabetPositionMap
{
private static Dictionary<char, int> alphabet = new Dictionary<char, int>();static ZeroBasedAlphabetPositionMap() { alphabet.Add('A', 0); alphabet.Add('B', 1); alphabet.Add('C', 2); alphabet.Add('D', 3); alphabet.Add('E', 4); alphabet.Add('F', 5); alphabet.Add('G', 6); alphabet.Add('H', 7); alphabet.Add('I', 8); alphabet.Add('J', 9); alphabet.Add('K', 10); alphabet.Add('L', 11); alphabet.Add('M', 12); alphabet.Add('N', 13); alphabet.Add('O', 14); alphabet.Add('P', 15); alphabet.Add('Q', 16); alphabet.Add('R', 17); alphabet.Add('S', 18); alphabet.Add('T', 19); alphabet.Add('U', 20); alphabet.Add('V', 21); alphabet.Add('W', 22); alphabet.Add('X', 23); alphabet.Add('Y', 24); alphabet.Add('Z', 25); } public static int Position(char letter) { return alphabet\[letter\]; }
}
-
And it gets better... Just noticed the next class on from that one:
public class ZeroBasedAlphabetPositionMap
{
private static Dictionary<char, int> alphabet = new Dictionary<char, int>();static ZeroBasedAlphabetPositionMap() { alphabet.Add('A', 0); alphabet.Add('B', 1); alphabet.Add('C', 2); alphabet.Add('D', 3); alphabet.Add('E', 4); alphabet.Add('F', 5); alphabet.Add('G', 6); alphabet.Add('H', 7); alphabet.Add('I', 8); alphabet.Add('J', 9); alphabet.Add('K', 10); alphabet.Add('L', 11); alphabet.Add('M', 12); alphabet.Add('N', 13); alphabet.Add('O', 14); alphabet.Add('P', 15); alphabet.Add('Q', 16); alphabet.Add('R', 17); alphabet.Add('S', 18); alphabet.Add('T', 19); alphabet.Add('U', 20); alphabet.Add('V', 21); alphabet.Add('W', 22); alphabet.Add('X', 23); alphabet.Add('Y', 24); alphabet.Add('Z', 25); } public static int Position(char letter) { return alphabet\[letter\]; }
}
-
Just found this gem hiding in a project I've just inherited. Fortunately it doesn't appear to be used.
public class AlphabetPositionMap
{
private static Dictionary<char, int> alphabet = new Dictionary<char, int>();static AlphabetPositionMap() { alphabet.Add('A', 1); alphabet.Add('B', 2); alphabet.Add('C', 3); alphabet.Add('D', 4); alphabet.Add('E', 5); alphabet.Add('F', 6); alphabet.Add('G', 7); alphabet.Add('H', 8); alphabet.Add('I', 9); alphabet.Add('J', 10); alphabet.Add('K', 11); alphabet.Add('L', 12); alphabet.Add('M', 13); alphabet.Add('N', 14); alphabet.Add('O', 15); alphabet.Add('P', 16); alphabet.Add('Q', 17); alphabet.Add('R', 18); alphabet.Add('S', 19); alphabet.Add('T', 20); alphabet.Add('U', 21); alphabet.Add('V', 22); alphabet.Add('W', 23); alphabet.Add('X', 24); alphabet.Add('Y', 25); alphabet.Add('Z', 26); } public static int Position(char letter) { return alphabet\[letter\]; }
}
Prizes awarded to anyone who can find a more pointless use of a lookup table.
-
Just found this gem hiding in a project I've just inherited. Fortunately it doesn't appear to be used.
public class AlphabetPositionMap
{
private static Dictionary<char, int> alphabet = new Dictionary<char, int>();static AlphabetPositionMap() { alphabet.Add('A', 1); alphabet.Add('B', 2); alphabet.Add('C', 3); alphabet.Add('D', 4); alphabet.Add('E', 5); alphabet.Add('F', 6); alphabet.Add('G', 7); alphabet.Add('H', 8); alphabet.Add('I', 9); alphabet.Add('J', 10); alphabet.Add('K', 11); alphabet.Add('L', 12); alphabet.Add('M', 13); alphabet.Add('N', 14); alphabet.Add('O', 15); alphabet.Add('P', 16); alphabet.Add('Q', 17); alphabet.Add('R', 18); alphabet.Add('S', 19); alphabet.Add('T', 20); alphabet.Add('U', 21); alphabet.Add('V', 22); alphabet.Add('W', 23); alphabet.Add('X', 24); alphabet.Add('Y', 25); alphabet.Add('Z', 26); } public static int Position(char letter) { return alphabet\[letter\]; }
}
Prizes awarded to anyone who can find a more pointless use of a lookup table.
How about adding another lookup that gets the uppercase equivalent of a lowercase letter?
-
how about :
public class NumberMap
{
private static Dictionary number = new Dictionary();static NumberMap() { number.Add('1', 1); number.Add('2', 2); number.Add('3', 3); number.Add('4', 4); number.Add('5', 5); number.Add('6', 6); number.Add('7', 7); number.Add('8', 8); number.Add('9', 9); number.Add('0', 0); }
}
V.
(MQOTD rules and previous solutions)Even more bonus points for a pointless lookup table for not being able to actually do a lookup :laugh:
If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson
-
How about adding another lookup that gets the uppercase equivalent of a lowercase letter?
AlphabetPositionMap seems to have a brother called ZeroBasedAlphabetPositionMap[^]. Yes, it is missing lowercaps variants, meaning there should at least be four of these methods. And globalization is missed completely. Scheiß drauf.
Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^][](X-Clacks-Overhead: GNU Terry Pratchett)
-
Just found this gem hiding in a project I've just inherited. Fortunately it doesn't appear to be used.
public class AlphabetPositionMap
{
private static Dictionary<char, int> alphabet = new Dictionary<char, int>();static AlphabetPositionMap() { alphabet.Add('A', 1); alphabet.Add('B', 2); alphabet.Add('C', 3); alphabet.Add('D', 4); alphabet.Add('E', 5); alphabet.Add('F', 6); alphabet.Add('G', 7); alphabet.Add('H', 8); alphabet.Add('I', 9); alphabet.Add('J', 10); alphabet.Add('K', 11); alphabet.Add('L', 12); alphabet.Add('M', 13); alphabet.Add('N', 14); alphabet.Add('O', 15); alphabet.Add('P', 16); alphabet.Add('Q', 17); alphabet.Add('R', 18); alphabet.Add('S', 19); alphabet.Add('T', 20); alphabet.Add('U', 21); alphabet.Add('V', 22); alphabet.Add('W', 23); alphabet.Add('X', 24); alphabet.Add('Y', 25); alphabet.Add('Z', 26); } public static int Position(char letter) { return alphabet\[letter\]; }
}
Prizes awarded to anyone who can find a more pointless use of a lookup table.
I thought I had a more useless lookup table, but I was wrong
private static Dictionary alphabet = new Dictionary();
static AlphabetPositionMap()
{
alphabet['A'] = 'A';
alphabet['B'] = 'B';
// you get the idea
}I am wrong because it is only a small step from this code to creating an Enigma machine in software, which I believe had some amount of use a few years back. Failed at being useless :sigh:
-
Even more bonus points for a pointless lookup table for not being able to actually do a lookup :laugh:
If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson
-
Just found this gem hiding in a project I've just inherited. Fortunately it doesn't appear to be used.
public class AlphabetPositionMap
{
private static Dictionary<char, int> alphabet = new Dictionary<char, int>();static AlphabetPositionMap() { alphabet.Add('A', 1); alphabet.Add('B', 2); alphabet.Add('C', 3); alphabet.Add('D', 4); alphabet.Add('E', 5); alphabet.Add('F', 6); alphabet.Add('G', 7); alphabet.Add('H', 8); alphabet.Add('I', 9); alphabet.Add('J', 10); alphabet.Add('K', 11); alphabet.Add('L', 12); alphabet.Add('M', 13); alphabet.Add('N', 14); alphabet.Add('O', 15); alphabet.Add('P', 16); alphabet.Add('Q', 17); alphabet.Add('R', 18); alphabet.Add('S', 19); alphabet.Add('T', 20); alphabet.Add('U', 21); alphabet.Add('V', 22); alphabet.Add('W', 23); alphabet.Add('X', 24); alphabet.Add('Y', 25); alphabet.Add('Z', 26); } public static int Position(char letter) { return alphabet\[letter\]; }
}
Prizes awarded to anyone who can find a more pointless use of a lookup table.
-
how about :
public class NumberMap
{
private static Dictionary number = new Dictionary();static NumberMap() { number.Add('1', 1); number.Add('2', 2); number.Add('3', 3); number.Add('4', 4); number.Add('5', 5); number.Add('6', 6); number.Add('7', 7); number.Add('8', 8); number.Add('9', 9); number.Add('0', 0); }
}
V.
(MQOTD rules and previous solutions)I've noticed that you do not cover lowercase numbers.
“That which can be asserted without evidence, can be dismissed without evidence.”
― Christopher Hitchens
-
I've noticed that you do not cover lowercase numbers.
“That which can be asserted without evidence, can be dismissed without evidence.”
― Christopher Hitchens
-
There is a seperate uppercase number lookup table for that ! :laugh:
V.
(MQOTD rules and previous solutions)I was thinking more of something like
"1".tolower
might work.“That which can be asserted without evidence, can be dismissed without evidence.”
― Christopher Hitchens