Last active
August 29, 2015 14:21
-
-
Save macrat/0654a24322f09e946a09 to your computer and use it in GitHub Desktop.
一行でじゃんけんをしようかと、そんなことを思ったのでした。
This file contains hidden or 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 <stdio.h> | |
int main(int usr, unsigned int cpu, char** hands) | |
{ | |
return printf((0 <= usr && usr <= 2) ? "you: %s\ncpu: %s\n%s\n" : "incorrect input!\n", hands[usr], hands[cpu%3], ((char*[]){"drow :-)", "lose...", "your! win!!!"})[(3+usr-cpu%3)%3], (usr=-1)&&scanf("%d", &usr), printf("jan! ken!! game!!!\nplease your hand(0:%s 1:%s 2:%s):", hands[0]="guu", hands[1]="choki", hands[2]="paa")) == 17; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
tccでコンパイルしたらちゃんと動かなかった。引数の評価順序が違うらしい。
無理にprintfに入れないで&&で繋いでいけばいいのだけれど、おもしろくない。むずかしい。