Skip to content

Instantly share code, notes, and snippets.

@AlbertVeli
Created July 14, 2013 16:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AlbertVeli/5994777 to your computer and use it in GitHub Desktop.
Save AlbertVeli/5994777 to your computer and use it in GitHub Desktop.
Solver for puzzle found in showcase at Tekniska Museet.
/* https://twitter.com/albertveli/status/356432567106408449/photo/1 */
#include <stdio.h>
void print_rot(char *str, int rot)
{
char c;
while (*str) {
c = *str;
if (c >= 'A' && c <= 'Z') {
/* Rotate A-Z */
printf("%c", ((c - 'A' + rot) % 26) + 'A');
} else {
/* Output the rest without modification */
printf("%c", c);
}
str++;
}
printf("\n");
}
int main(void)
{
char *str = "\"NYY TYäQWR HGNA RTRA Eå FRANCFFVYY V EBGZBF äE RAQNFG XBAFGYNQ TYäQWR\". FNQRF NI ERNYVFGRA GBEFGRA NEAR RUERAZNEX V NAQREFGBECRG. PVGNGRG XBZ GERINAQR SEåA RYVN V AVNA.";
int i;
/* Output all combinations, only 26 so the correct one is easy to spot. */
for (i = 0; i < 26; i++) {
print_rot(str, i);
}
return 0;
}
/**
* Local Variables:
* mode: c
* indent-tabs-mode: nil
* c-basic-offset: 3
* End:
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment