KeyFansClub
nemoma - 2008/9/11 10:45:00
最近把寒蝉看完了,话说其英文翻译竟然是WHEN THEY CRY而不是WHEN CICIDAS CRY……某种程度上也算是剧透一种……(顺便说一句CRY这个单词用红颜色字写的……)
50集全部看过以后,发现用一句话和一个BASIC程序就可以做到完全剧透了……
警告!!以下剧透出没注意!!以下程序源代码出没注意!!L5自重![wrap=不怕剧透请猛击]
这不就是两个女生用S/L大法和金手指玩某AVG游戏嘛……只不过是自身也是游戏中的一部分而已……
整个过程的BASIC源代码表达如下:(毕竟是198x年的事了,当时还没JAVA和PHP之类的东西)
[wrap=不怕程序代码者请继续点下去]
- SUB COUNTER
- REM Set up a counter
- LET COUNTER=COUNTER + 1
- GOSUB "SET"
- SUB SET
- REM Set status to all main characters
- DATA (survive_rika, survive_rena, survive_k1, survive_mino, survive_shino, survive_satoko, survive_hanyu)
- READ (1,1,1,1,1,1,0)
- DATA (survive_jiro, survive_kyosuke)
- READ (1,1)
- REM Now setup a random variable
- LET RP=INT(RND) ; REM A integer between 0 and 1 will be created
- IF COUNTER>= 8 THEN GOSUB "SPECIAL" ELSE
- GOSUB "START"
- SUB SPECIAL
- LET RP=1
- LET survive_hanyu=1
- GOSUB "START"
- SUB START
- LET YEAR= 1983
- LET MONTH= 6
- FOR DAY=16 TO 30 STEP 1
- DATA (survive_rena, survive_k1, survive_mino, survive_shino, survive_satoko)
- READ (INT(survive_rena*RP),INT(survive_k1*RP), INT(survive_mino*RP), INT(survive_shino*RP), INT(survive_satoko*RP))
- NEXT DAY
- IF DAY = 30 THEN GOSUB "CONFRONT"
- SUB CONFRONT
- REM According to the series rules, if one of the main characters died before/after the Watanagashi Festival is a GAME OVER. Thus nothing further had been involved.
- IF survive_rena OR survive_k1 OR survive_mino OR survive_shino OR survive_satoko = 0 THEN PRINT "GAME OVER: MAIN CHARACTER DIED" ;GOSUB "COUNTER"
- INPUT "CONTINUE?(Y/N)";C$
- IF C$="N" OR "n" THEN END ELSE
- IF C$="Y" OR "y" THEN GOSUB "COUNTER" ELSE
- RETURN
- REM According to the anime itself, Hanyu is the "Last dim on the board"
- IF survive_hanyu=0 THEN survive_jiro=0 ; survive_kyosuke=0 ELSE GOSUB "LAST WORLD"
- LET survive_rika=0
- PRINT "GAME OVER: RIKA KILLED, 'LAST PROJECT' CARRIED OUT"
- INPUT "CONTINUE?(Y/N)";C$
- IF C$="N" OR "n" THEN END ELSE
- IF C$="Y" OR "y" THEN GOSUB "COUNTER" ELSE
- RETURN
- SUB LAST WORLD
- LET survive_rika=1
- LET MONTH = MONTH +1 ;DAY= 1
- PRINT "GAME OVER : GOOD ENDING"
- PRINT COUNTER + "Time loops had been created by Rika and Hanyu."
- PRINT "THANKS FOR PLAYING!"
- END
复制代码程序编译运行结果:(在QBasic上测试正常)
- GAME OVER: RIKA KILLED, 'LAST PROJECT' CARRIED OUT
- CONTINUE?(Y/N)y
- GAME OVER: MAIN CHARACTER DIED
- CONTINUE?(Y/N)y
- GAME OVER: MAIN CHARACTER DIED
- CONTINUE?(Y/N)y
- GAME OVER: MAIN CHARACTER DIED
- CONTINUE?(Y/N)y
- GAME OVER: RIKA KILLED, 'LAST PROJECT' CARRIED OUT
- CONTINUE?(Y/N)y
- GAME OVER: RIKA KILLED, 'LAST PROJECT' CARRIED OUT
- CONTINUE?(Y/N)y
- GAME OVER: MAIN CHARACTER DIED
- CONTINUE?(Y/N)y
- GAME OVER : GOOD ENDING
- 8 Time loops had been created by Rika and Hanyu.
- THANKS FOR PLAYING!
复制代码其实上还想写一个RP随着COUNTER增加而增加的IF判断的,不过看故事好像这两个变量关系不大……就算了。写出来竟然发现可以顺利编译运行,不过真的要达到和原著完全相同的结果……那就太随机了……
上面只包含了主要的人物……毕竟其他的人物要不生死固定,要不生死和故事无关,就算了。
[/wrap]
[/wrap]
nemoma - 2008/9/11 10:48:00
看不懂程序代码者:(毕竟Qbasic是20多年前的事了)
LET = 赋值语句
DATA...READ = 集体赋值语句
INT=取整函数
RND=随机数函数
IF...THEN...ELSE=判断语句
REM= 注释语句
INPUT=输入
PRINT=输出
SUB....GOSUB= 分支语句
FOR...NEXT = 条件循环语句
PS:貌似发错区了,如果实在不甚和谐就飞土豆吧
Bce - 2008/9/11 10:59:00
话说..........刚看到的时候有用C#重写一边的冲动........
(好吧,我承认我是MS党 XD ......)
飘 - 2008/9/11 11:00:00
召唤C++代码……
其他语言看起来很累……
nemoma - 2008/9/11 11:01:00
别忘了……
寒蝉那个年代没有C#
C好像是有的
请用元祖C语言重写吧……
004307ec - 2008/9/11 12:32:00
= =其实……咱看不懂&……|
请求Java重写……m(_ _)m
飘 - 2008/9/11 12:46:00
嘛,于是翻译完成……- #include <stdio.h>
- #include <stdlib.h>
- #include <memory>
- typedef int BOOL;
- #define TRUE 1
- #define FALSE 0
- static int s_nCounter = 0;
- enum emCharacters
- {
- survive_rika,
- survive_rena,
- survive_k1,
- survive_mino,
- survive_shino,
- survive_satoko,
- survive_hanyu,
- survive_jiro,
- survive_kyosuke,
- characters_size,
- };
- static BOOL s_bArrSurvive[characters_size];
- static bool s_bSp = false;
- // ============================================================================
- // ==============================================================================
- BOOL GetRP(void)
- {
- if (s_bSp) {
- return TRUE;
- }
- //~~~~~~~~~~~~~~~~~~~
- int nRP = rand() % 100;
- //~~~~~~~~~~~~~~~~~~~
- return(nRP > 0 ? TRUE : FALSE);
- }
- void Counter(void);
- void Set(void);
- void Special(void);
- void Start(void);
- void Confront(void);
- void LastWorld(void);
- static int s_nYear = 0;
- static int s_nMonth = 0;
- static int s_nDay = 0;
- // ============================================================================
- // ==============================================================================
- void Result()
- {
- while (true) {
- printf("CONTINUE?(Y/N)");
- //~~~~~~~~~~~~~~~~~~~~
- char cChose = getchar();
- //~~~~~~~~~~~~~~~~~~~~
- getchar();
- if ('N' == cChose || 'n' == cChose) {
- break;;
- } else if ('Y' == cChose || 'y' == cChose) {
- Counter();
- break;
- }
- }
- }
- // ============================================================================
- // ==============================================================================
- void Counter(void)
- {
- ++s_nCounter;
- Set();
- }
- // ============================================================================
- // ==============================================================================
- void Set(void)
- {
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- BOOL bArrSurvive[characters_size] = { 1, 1, 1, 1, 1, 1, 0, 1, 1 };
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- memcpy(s_bArrSurvive, bArrSurvive, sizeof(bArrSurvive));
- if (s_nCounter >= 8) {
- Special();
- } else {
- Start();
- }
- }
- // ============================================================================
- // ==============================================================================
- void Special(void)
- {
- s_bSp = true;
- s_bArrSurvive[survive_hanyu] = 1;
- Start();
- }
- // ============================================================================
- // ==============================================================================
- void Start(void)
- {
- s_nYear = 1983;
- s_nMonth = 6;
- for (s_nDay = 16; s_nDay < 30; ++s_nDay) {
- //~~~~~~~~~~~~
- int nCharSet[] =
- {
- survive_rena, survive_k1, survive_mino, survive_shino,
- survive_satoko
- };
- //~~~~~~~~~~~~
- for (int i = 0; i < sizeof(nCharSet) / sizeof(int); ++i) {
- s_bArrSurvive[nCharSet[i]] *= GetRP();
- }
- }
- if (30 == s_nDay) {
- Confront();
- }
- }
- // ============================================================================
- // ==============================================================================
- void Confront(void)
- {
- //~~~~~~~~~~~~~~~~
- int nMainCharSet[] =
- {
- survive_rena, survive_k1, survive_mino, survive_shino, survive_satoko
- };
- //~~~~~~~~~~~~~~~~
- for (int i = 0; i < sizeof(nMainCharSet) / sizeof(int); ++i) {
- if (FALSE == s_bArrSurvive[nMainCharSet[i]]) {
- printf("GAME OVER: MAIN CHARACTER DIED\n");
- Result();
- return;
- }
- }
- if (FALSE == s_bArrSurvive[survive_hanyu]) {
- s_bArrSurvive[survive_jiro] = FALSE;
- } else {
- LastWorld();
- return;
- }
- s_bArrSurvive[survive_rika] = 0;
- printf("GAME OVER: RIKA KILLED, 'LAST PROJECT' CARRIED OUT\n");
- Result();
- }
- // ============================================================================
- // ==============================================================================
- void LastWorld()
- {
- s_bArrSurvive[survive_rika] = 1;
- ++s_nMonth;
- s_nDay = 1;
- printf("GAME OVER : GOOD ENDING\n");
- printf("%d Time loops had been created by Rika and Hanyu.\n", s_nCounter);
- printf("THANKS FOR PLAYING!\n");
- getchar();
- }
- // ============================================================================
- // ==============================================================================
- int main()
- {
- Counter();
- return 0;
- }
复制代码
nemoma - 2008/9/11 12:48:00
顺便说一句,以上的C语言版本也可以顺利编译运行……
由以上的程序可见……
某人的轮回是多么的M…………
飘 - 2008/9/11 13:06:00
原帖由 nemoma 于 2008-9-11 12:48:00 发表 顺便说一句,以上的C语言版本也可以顺利编译运行……
由以上的程序可见…… 某人的轮回是多么的M………… |
=V=
一些补充
风格上,BOOL/TRUE/FALSE其实是不好的习惯,且不论,至少这样typedef/define不好,不过感觉合适就用了,另外enum中定义用小写显得很猥琐,主要是偷懒了……拷贝方便 XD
尊重原著,基本是完全的句句对译,除了输入那段(Result())
嘛,RP即使100/100,没开金手指一样没有GoodEnd
还我回笼觉时间><
ISWORD - 2008/9/11 13:19:00
你们真有爱……没耐心看完代码的飘过……
nemoma - 2008/9/11 13:30:00
附上某外传的条件
在survive_hanyu=1且RP恒等于1的情况下
由于系统错误(MEMORY OVERLOAD?!)造成金手指RESET
在声明变量survive_rika=1以后
强制重置survive_hanyu=0
这样就构成了True End
见:
这里的反白部分。
声明一下:使用金手指是不对的!
pk王 - 2008/9/11 14:02:00
GAME OVER: MAIN CHARACTER DIED
CONTINUE?(Y/N)y
GAME OVER: RIKA KILLED, 'LAST PROJECT' CARRIED OUT
CONTINUE?(Y/N)y
GAME OVER: MAIN CHARACTER DIED
CONTINUE?(Y/N)y
GAME OVER: MAIN CHARACTER DIED
CONTINUE?(Y/N)y
GAME OVER: RIKA KILLED, 'LAST PROJECT' CARRIED OUT
CONTINUE?(Y/N)y
GAME OVER: RIKA KILLED, 'LAST PROJECT' CARRIED OUT
CONTINUE?(Y/N)y
GAME OVER: MAIN CHARACTER DIED
CONTINUE?(Y/N)y
GAME OVER : GOOD ENDING
8 Time loops had been created by Rika and Hanyu.
THANKS FOR PLAYING!
Miliardo - 2008/9/11 14:03:00
= =C语言似乎不够K&R,标准化时代之前嗯
richter - 2008/9/11 14:18:00
其实剧透半天不过是整体世界观么?
应该还有调用外部程序(外星人),还有调用变量规则程序(例如某些变量最终返回L5的时候,基本返回false……),还有一些外部程序会主动调用一些函数强制使某些变量的结果变成L5等等等等…………
这才是全剧透呢…………
Koori - 2008/9/11 14:21:00
= =|||
与其那叫剧透不如直接就用这个来表达好了,更简单~_~
GAME BEGIN
GOODEND?TRUE:FALSE
GAME END
水羊 - 2008/9/11 14:30:00
嗚阿阿...........
都是代碼阿...........
darkice1_0 - 2008/9/11 16:01:00
…我决定了:去买套教才学C++
粘土火星 - 2008/9/11 16:04:00
原帖由 飘 于 2008-9-11 13:06:00 发表
原帖由 nemoma 于 2008-9-11 12:48:00 发表 顺便说一句,以上的C语言版本也可以顺利编译运行……
由以上的程序可见…… 某人的轮回是多么的M………… |
=V=
一些补充
风格上,BOOL/TRUE/FALSE其实是不好的习惯,且不论,至少这样typedef/define不好 |
orz…………为啥要用那个BOOL。。。。。。
cjhwe15 - 2008/9/11 20:34:00
这都什么跟什么啊
代码完全没耐心看……满来灌灌水好了
無響 聆 - 2008/9/11 21:06:00
看完此貼後頭上冒出?量的?的人自動站出來了...........................
紫色毛毛虫 - 2008/9/11 21:38:00
相信有朝一日我一定看得懂的!!
Koori - 2008/9/11 23:51:00
原帖由 紫色毛毛虫 于 2008-9-11 21:38:00 发表 相信有朝一日我一定看得懂的!! |
= =|||
估计是等不到了= =|||
话说……你即便现在就说一句你看得懂,别人也没法证实的说~~~~
嘛~年轻人阿~~~~~不成熟了吧^_^?= =|||
nemoma - 2008/9/11 23:51:00
不过补充以下……
其实上"survive_hanyu"这个变量名不贴切(好了,本人承认连Survive这单词本人也要^C^V)
按照原著应该是"beseen_hanyu"或者是"joinedteam_hanyu"更适合一点……
再加一个剧透……所谓的50集ED后那个桥段……可以解释成某人拥有了直接更改本程序源代码的权利……联系原著最后一个碎片的内容就直接验证了……
飘 - 2008/9/12 1:41:00
原帖由 Miliardo 于 2008-9-11 14:03:00 发表 = =C语言似乎不够K&R,标准化时代之前嗯 |
嘛,VC6/CPP,不标准(ANSI)习惯了,有些想标准都标准不起来……何况有时候贪C++提供的一些小便宜
话说,DevC++也很那啥……
虽然都离K&R时代很远了吧
原帖由 粘土火星 于 2008-9-11 16:04:00 发表
原帖由 飘 于 2008-9-11 13:06:00 发表
原帖由 nemoma 于 2008-9-11 12:48:00 发表 顺便说一句,以上的C语言版本也可以顺利编译运行……
由以上的程序可见…… 某人的轮回是多么的M………… |
=V=
一些补充
风格上,BOOL/TRUE/FALSE其实是不好的习惯,且不论,至少这样typedef/define不好
|
orz…………为啥要用那个BOOL。。。。。。
|
这个,其实也觉得猥琐,说起来是因为从名字看,应该是是否生存的意思,这样就是bool/BOOL比较合适,然而原著用了RP参与计算,若是转成&&0/&&1或&&ture/false都显得怪异,于是还是保留了计算,用了更合适的BOOL,然后是纠结的typedef甚至#define,掩面……
nemoma - 2008/9/12 1:57:00
当然有RP因素在里面……
艾草歌 - 2008/9/14 17:36:00
:miffy2:
代码虽然是看不懂,那程序编译运行结果倒是很欢乐……
很好很强大……
(N大的思维果然是常人不可理解的)
小水羊 - 2008/9/14 18:15:00
N大又一次把我“杀”【我都不记得这是第几次被这类东西干掉了】了
亡灵之猫 - 2008/9/16 1:47:00
果然还是找个编辑器高亮代码之后再来读要容易些
SPECIAL就是传说中的“金手指”吗?
用survive_hanyu来打破轮回…………
这个明显就是故意设计一个死循环,然后留下一个BUG等着玩家通过修改内存的手段利用BUG结束循环
这个是一场程序员与玩家之间的黑心交易
PS:事实证明,RP不能解决任何问题
nemoma - 2008/9/16 6:32:00
Since I can't type Chinese right now...... Bear with it......
Well, in Computer programming it is true that your luck didn't count into the programming.
What is a Gameshark?
Just a way to change the program, not to increase your luck!
nemoma - 2008/9/19 11:54:00
如果想下载本世界观模拟程序,请访问:
http://ciel.tailslab.cn/Higu_Sim.exe [152KB]
请放心,此程序无毒无广告。
PS:完全版模型搭建中……
1