Last active
August 29, 2015 14:21
-
-
Save robert-wallis/b7faf94976b153923fde to your computer and use it in GitHub Desktop.
8^8 matcher
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdlib.h> | |
#include <stdio.h> | |
#include <time.h> | |
#define EIGHTTOEIGHT 0x00FFFFFF | |
int main(int argc, char** argv) | |
{ | |
srand(time(NULL)); | |
int match = rand() & EIGHTTOEIGHT; | |
for (int i = 0; i < EIGHTTOEIGHT; i++) | |
{ | |
int guess = rand() & EIGHTTOEIGHT; | |
if (guess == match) | |
{ | |
printf("Guessed match! %x at try %d\n", guess, i); | |
} | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment