Skip to content

Instantly share code, notes, and snippets.

@ToshihitoKon
Created June 5, 2018 14:59
Show Gist options
  • Save ToshihitoKon/8c49d540796a45845761d15a7aad4e57 to your computer and use it in GitHub Desktop.
Save ToshihitoKon/8c49d540796a45845761d15a7aad4e57 to your computer and use it in GitHub Desktop.
bemybaby...
#include <stdio.h>
#include <stdlib.h>
int main()
{
int seq[4];
char bmbb[4][3] = {"BE","MY","BA","BY"};
for(int i=0;;i++){
seq[i%4] = random() % 4;
printf("%s", bmbb[seq[i%4]]);
fflush(stdout);
switch(seq[i%4]){
case 0: system("paplay be.wav 2>/dev/null"); break;
case 1: system("paplay my.wav 2>/dev/null"); break;
case 2: system("paplay ba.wav 2>/dev/null"); break;
case 3: system("paplay by.wav 2>/dev/null"); break;
}
if( seq[(i-3)%4]==0 &&
seq[(i-2)%4]==1 &&
seq[(i-1)%4]==2 &&
seq[i%4]==3 ){
system("paplay ah.wav 2>/dev/null");
printf("アッフゥン\n");
return 0;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment