楼主: bajjio
16012 48

[教与学] Handbook of Game Theory with Economic Applications(Volume 1,2,3) [推广有奖]

11
jacques97(真实交易用户) 发表于 2008-5-2 14:49:00
要做学问,先学基本工具和文献检索。。。阿弥陀佛

12
laoyang199(真实交易用户) 发表于 2008-5-11 05:08:00
我买了,还没看。不过够我用的了。谢谢!
青灯不冷,或明不晦。

13
fanxi_yu(未真实交易用户) 发表于 2008-5-12 16:21:00
多谢!!!

14
james9609(真实交易用户) 发表于 2008-6-2 00:47:00
太谢谢了

15
jiangpinggu(真实交易用户) 发表于 2008-6-4 03:01:00
谢谢!!

16
jiangpinggu(真实交易用户) 发表于 2008-6-4 03:03:00
感谢热心人!!

17
jiangpinggu(真实交易用户) 发表于 2008-6-4 03:06:00

HIGH - LOW: a simple game (SAS program)

--------------------------------------------------------------------------------
These sample files and code examples are provided by SAS Institute Inc. "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and fitness for a particular purpose. Recipients acknowledge and agree that SAS Institute shall not be liable for any damages whatsoever arising out of their use of this material. In addition, SAS Institute will provide no support for the materials contained herein.
This sample is from the SAS Sample Library. For additional information refer to SAS Help and Online Documentation.
--------------------------------------------------------------------------------

 /****************************************************************/
 /*          S A S   S A M P L E   L I B R A R Y                 */
 /*                                                              */
 /*    NAME: SUGIHILO                                            */
 /*   TITLE: HIGH - LOW: A Simple Game                           */
 /* PRODUCT: SAS                                                 */
 /*  SYSTEM: all                                                 */
 /*    KEYS: DUTIL INTER DATASTEP WINDOW DISPLAY DO WHILE        */
 /*          FUNCTION NORMAL                                     */
 /*   PROCS:                                                     */
 /*    DATA:                                                     */
 /*                                                              */
 /* SUPPORT:                             UPDATE:                 */
 /*     REF:                                                     */
 /*    MISC: An enhanced version of HILO, from SUGI85            */
 /*          THIS SHOULD NOT BE RUN IN BATCH.                    */
 /*  UPDATE:                                                     */
 /****************************************************************/

 
 /*  A datastep that plays the bar-game 'hilo':                  */
 /*                                                              */
 /*  Someone (the computer) guesses a number, and the player has */
 /*    to guess what the computer guessed.                       */
 

data _null_ ;
 length more $ 1 chilo $ 6;
 format tries 3.;
 guess=.;number=.;last=.;more='Y';savehi=.;savelo=.;grange=.;

 window rules color=blue rows=24 columns=80 irow=1 icolumn=1
   group=rules
   #1 @32 'The Rules of this game are easy            '    color=yellow
   #2 @32 '*******************************            '    color=red
   #3 @32 '                                           '    color=yellow
   #4 @32 'First, I guess a number...                 '    color=green
   #5 @32 '                                           '    color=yellow
   #6 @32 'Then you try to guess what I guessed       '    color=yellow
   #7 @32 '   while I give you clues as to whether    '    color=yellow
   #8 @32 '   your previous guess was too HIGH or LOW '    color=yellow
   #10 @32 'First Guess?'                                  color=white
      +2 guess                                             color=white
   ;

 window cheat color=blue rows=1 columns=10 irow=19 icolumn=1
   group=cheat
   #1 @1 number protect=yes color=white
   ;

 window high color=black rows=8 columns=28 irow=1 icolumn=1
   group=empty   ' '
   group=guess
   #1 @2 '-->'                        color=yellow
      +2 last                         color=red  protect=yes
   #2 @2 'IS TOO HIGH'                color=yellow attr=blink
   #4 @2 'Next Guess?'                color=green
      +2 guess                        color=yellow
   ;

 window low color=black rows=8  columns=30 irow=17 icolumn=51
   group=empty   ' '
   group=guess
   #1 @2 '-->'                        color=yellow
      +2 last                         color=red  protect=yes
   #2 @2 'IS TOO LOW'                 color=yellow attr=blink
   #4 @2 'Next Guess?'                color=green
      +2 guess                        color=yellow
   ;

 window youwin color=red rows=9 columns=45 irow=14 icolumn=3
   group=youwin
   #2 @9   '... but it took you'         color=white
      +1  tries                       color=white protect=yes
         'attempts,'                  color=white
   #3 @13 'did it not ?'               color=white
   #5 @9  'Another Game?'             color=yellow
      +2  more                        color=yellow
   ;

 window youlose color=yellow rows=11 columns=49 irow=15 icolumn=1
   group=range
   #3 @10 'You guessed'               color=red
      +1  last                        color=red   protect=yes
   #4 @10 '... but I already told you'            color=red
      +1  grange                      color=red   protect=yes
   #5 @14     'was too'               color=red
      +1  chilo                       color=red   protect=yes
   #7 @10 'Another Game?'             color=black
      +2  more                        color=black
   ;

 
  /* Play the game, again and again. */
 
again:
 number=int(1000*normal(0));        /* Choose a number. */
 tries=0;
 guess=.;last=guess;
 savehi=999999;
 savelo=0-999999;
 continue=1;
 do while (guess=.) ;
    display rules.rules blank ;
    end;
 if guess=27511 then display cheat.cheat blank noinput;
 last=guess; guess=.;
                                    /* Yeah, I know that spoils it. */
 *put / 'After First Guess' /_all_;
 do while ( continue=1 );
    tries+1;
    if last=number then continue=0;
    else if last <= savelo then do;
       continue=0-1; grange=savelo; chilo='LOW !'; guess=last;
       end;
    else if last >= savehi then do;
       continue=0-1; grange=savehi; chilo='HIGH !'; guess=last;
       end;
    else if last < number then do;
       savelo=last;
       do while (guess=.);
          display low.guess;
          end;
       display low.empty blank noinput;
       end;
    else if last > number then do;
       savehi=last;
       do while (guess=.);
          display high.guess;
          end;
       display high.empty blank noinput;
       end;

    *put / 'After nth guess' / _all_;
    if guess=27511 then display cheat.cheat blank noinput;
    last=guess; guess=.;
    end; /* of do while(continue=1) */

 *put / 'After do while continue' / _all_;
 if continue=0 then do;
     _msg_='        So, you win again.';
     display youwin.youwin;
 end;
 else do;
     _msg_='         YOU LOSE !!!  (The number was '||
     trim(left(put(number,6.)))||')';
     display youlose.range;
 end;
 if more='Y' or more='y' then goto again;
 stop;
run /* pgm=hilo */;

18
research(真实交易用户) 发表于 2008-6-5 14:41:00
提示: 作者被禁止或删除 内容自动屏蔽

19
guoqingyao(真实交易用户) 发表于 2008-8-3 03:38:00

谢谢啊,如此好的东西,真是物超所值!等待下两卷。

20
weiyu108(未真实交易用户) 发表于 2008-8-20 11:13:00
谢谢!

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
jg-xs1
拉您进交流群
GMT+8, 2025-12-29 14:16