亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? jotto.c

?? 該程序是C語言編寫的
?? C
字號:
/*-							-*- Fundamental -*-
 *
 *  Facility:			jotto(6)
 *
 *  File:			jotto.c
 *
 *  Associated files:		- [ none]
 *
 *  Description:		Plays the game of jotto
 *
 *  Notes:			No rules included.
 *
 *  Portability:		Edited to conform to X/Open Portability Guide,
 *				ed. 3, 1988
 *
 *  Author:			David M. Fogg
 *				2632 N.E. Fremont
 *				Portland, OR 97212
 *
 *  Editor:			Anders Thulin
 *				Rydsvagen 288
 *				S-582 50 Linkoping
 *				SWEDEN
 *
 *
 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 *
 *  Copyright (c) 1981 by David M. Fogg
 *
 *  Permission is herewith granted for noncommercial distribution
 *  through the BDS User's Group; any and all forms of commercial
 *  redistribution are strenuously unwished-for.
 *
 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 *
 *  Edit history :
 *
 *  Vers  Ed   Date	   By		     Comments
 *  ----  ---  ----------  ----------------  -------------------------------
 *   1.0    0  1980-11-13  David M. Fogg     Creation day
 *          1  1980-11-18  David M. Fogg     Creation ... finished
 *          2  1980-11-10  David M. Fogg     Bugwork
 *   1.1    3  1988-10-25  Anders Thulin     Many BDS-isms removed to make
 *					     program K&R compatible. General
 *					     cleanup for portability. Added
 *					     some comments.
 *					
 */

/* - - Configuration options: - - - - - - - - - - - - - - - - - - - - - - - */

/*
 *	
 *  The following environments are supported:
 *
 *	ANSI		ANSI C
 *	BSD		Berkeley UNIX
 *	SV2		AT&T UNIX System V.2
 *	XPG3		X/Open Portability Guide, ed. 3
 *	ZTC205		MS-DOS + Zortech C 2.05
 *
 *  If you have an ANSI C conforming compiler, define ANSI. Otherwise,
 *  use the definition that best matches your environment.
 *
 */
	
#define	ANSI		0	/* 1 -> ANSI C, 0 -> K&R */
#define	BSD		0
#define	SV2		0
#define	XPG2		0
#define ZTC205		1

#if ANSI
# include <ctype.h>
# include <stdio.h>
# include <stdlib.h>
# include <string.h>
# include <time.h>
#endif

#if BSD
# include <ctype.h>
# include <stdio.h>
# include <string.h>
 typedef long  time_t;
 extern void   exit();
 extern int    rand();
 extern void   srand();
 extern time_t time();		
#endif

#if SV2 
# include <ctype.h>
# include <stdio.h>
# include <string.h>
 typedef long  time_t;
 extern void   exit();
 extern int    rand();
 extern void   srand();
 extern time_t time();		
#endif

#if XPG3
# include <ctype.h>
# include <stdio.h>
# include <string.h>
 typedef long  time_t;	/*[???] or should it be time_t from <sys/types.h> ? */
 extern void   exit();
 extern int    rand();
 extern void   srand();
 extern time_t time();	
#endif

#if ZTC205
# include <ctype.h>
# include <stdio.h>
# include <string.h>
 typedef long  time_t;
 extern void   exit();
 extern int    rand();
 extern void   srand();
 extern time_t time();	
#endif

# include <curses.h>

/*
 *  Tweakables:
 *
 *  The reason ALPHA_SIZE has been declared as a macro is that some
 *  compilers handle sizeof("<string>") as a synonym to sizeof(char *),
 *  which is wrong.  ALPHA_SIZE should be defined to be the number
 *  of characters in the string ALPHABET.
 *
 */

#define WORD_FILE	"jotto.wds"	/* default word file */
#define MAXWORDS  	600		/* max nr of words in word file */

#define	ALPHABET	"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
#define	ALPHA_SIZE	26

/* Code for RETURN/ENTER key -- some systems use \r, some \n */

#define RETURN		'\n'

/*
 *  Non-tweakables:
 *
 */

#ifndef TRUE
# define	TRUE	1
# define	FALSE	0
#endif

#define LETS	  5	/* letters/word */
#define ISCORE	  21	/* initial score */

/* screen layout parameters */

#define XTITLE	  40	/* Title loc */
#define YTITLE	  1
#define XPROMPT   33	/* prompt loc */
#define YPROMPT   4
#define XSCORE	  3	/* score col */
#define XGUESS	  10	/* guess col */
#define XMATCH	  17	/* match col */
#define XSTATE	  20	/* status col */
#define YHEAD	  0	/* header row */
#define YFIRST	  2	/* first guess row */
#define XLABELS   33	/* list labels col */
#define XLISTS	  42	/* lists cols */
#define YYES	  6	/* confirmed letters row */
#define YNO	  8	/* eliminated letters row */
#define YPOSS	  10	/* possible letters row */
#define XINST	  30	/* instructions loc */
#define YINST	  13

/*
 *  Global variables
 *
 */

static int  wordok, giveup;
static int  score;
static char word[LETS+3];
static char guess[LETS+1], gots[LETS+1];
static int  count;
static char guesslis[ISCORE+1][LETS+1];
static int  changed;

static char nots[ALPHA_SIZE],
            maybes[ALPHA_SIZE];

static char alphabet[] = ALPHABET;

/*
 *  Local functions:
 *
 */

#ifdef __STDC__
 static void dochange(void);
 static void doguess(void);
 static void doscreen(void);
 static void dostate(int s);
 static int  getlet(void);
 static void getword(char *wd);
 static int  inset(char *string, int ch);
 static void inword(int x, int y, char *p, char *w);
 static void modgot (int old, int new);
 static int  nomore(void);
 static void printset(char *s);
 static void xfer (int l, char *src, char *dest);
#else
 static void dochange();
 static void doguess();
 static void doscreen();
 static void dostate();
 static int  getlet();
 static void getword();
 static int  inset();
 static void inword();
 static void modgot ();
 static void printset();
 static int  nomore();
 static void xfer ();
#endif

/*
 *  Routine:		dochange
 *
 *  Description:	Read change commands from the terminal and
 *			perform the changes.
 *
 */

static void dochange ()
{
   int  ch;
   int sc;
   char let;
   static char legals[] = {'A', '+', '=', '_', 'N', '+', RETURN, '\0'};

   changed = 0;
   wordok = FALSE;

   mvaddstr(YPROMPT, XPROMPT, "Change: "); refresh();
   do {
     if (islower(ch = getch())) {
       ch = toupper(ch);
     }    
   } while (inset(legals, ch) == 0);
   refresh();
   if (ch == 'A')
      return;
   else
      wordok = TRUE;

   while (ch != RETURN && changed < LETS) {
      ++changed;
      switch (ch) {
	 case '=': ch = '+'; break;
	 case '_': ch = '-';
      }
      addch(ch);
      let = getlet(); addch(' ');
      switch (ch) {
	 case '+': modgot(' ', let);        break;
	 case '-': modgot(let, ' ');        break;
	 case 'N': xfer(let, maybes, nots); break;
	 case 'M': xfer(let, nots, maybes); break;
      }
      refresh();
      do {
	 ch = toupper(getch());
      } while (inset(legals, ch) == 0);
      refresh();
   }
   if (changed > 0) {
      move(YPROMPT, XPROMPT); clrtoeol();
      move(YYES, XLISTS); addstr(gots);
      move(YNO, XLISTS); printset(nots);
      move(YPOSS, XLISTS); printset(maybes);
      for (sc = ISCORE; sc >= score ; --sc) dostate(sc);
      dochange();
   }
}

/*
 *  Routine:		doguess
 *
 *  Description:	Input guess from user and process it.
 *
 */

static void doguess ()	
{
  int i, j, y;
  char str[LETS+1];

  /*  1.  Get guess from user:  */

  y = YFIRST + ISCORE - score;
  move(y, XSCORE); printw("%4d", score);
  inword(XGUESS-1, y, " ", guess);

  /*  2.  Process guess:  */

  if (strcmp(guess, "?????") == 0) {
    giveup = TRUE;
  } else {
    giveup = FALSE;
    strcpy(str, word); count = 0;
    for (i = 0; i < LETS; ++i) {
      if ((j = inset(str, guess[i])) > 0) {
        ++count;
        str[j-1] = tolower(str[j-1]);
      }
    }
    printw("%3d", count);
    strcpy(guesslis[score], guess);
    dostate(score);
 }
}

/*
 *  Routine:		doscreen
 *
 *  Description:	Clears the screen. Prints guess columns, some
 *			help text and various other stuff.
 *
 */

static void doscreen()
{
  clear();

  mvaddstr(YTITLE, XTITLE, "--> J O T T O  <--");

  mvaddstr(YHEAD,   XSCORE, "Score  Guess  #  STATE");
  mvaddstr(YHEAD+1, XSCORE, "=====  =====  =  =====");

  move(YYES, XLABELS+3);  addstr("YES:");

  move(YNO, XLABELS+4);   addstr("NO:");

  move(YPOSS, XLABELS+1); addstr("MAYBE:");
  move(YPOSS, XLISTS);    printset(maybes);

  mvaddstr(YINST,    XINST, "<????\?> to 'Your word:' gets random word");
  mvaddstr(YINST+1,  XINST, "<????\?> instead of guess aborts game");
  mvaddstr(YINST+2,  XINST, "Change:");
  mvaddstr(YINST+3,  XINST, "  <A> allows re-entry of bad word");
  mvaddstr(YINST+4,  XINST, "  <+X> adds 'X' to YES list");
  mvaddstr(YINST+5,  XINST, "  <-X> takes 'X' off YES list");
  mvaddstr(YINST+6,  XINST, "  <NX> move 'X' MAYBE->NO");
  mvaddstr(YINST+7,  XINST, "  <MX> move 'X' NO->MAYBE");
  mvaddstr(YINST+8,  XINST, "  <RETURN> performs changes (if any)");
  mvaddstr(YINST+10, XINST, "STATE: upcase=YES; locase=maybe; '.'=NO");
}


/*
 *  Routine:		dostate
 *
 *  Description:	Print the 'state' of the guessed word for
 *			score s.
 *
 */

static void dostate (s)
int s;
{
   int i, j;
   char ch;
   char ges[LETS+1], got[LETS+1];

   move(YFIRST + ISCORE - s, XSTATE);
   strcpy(ges, guesslis[s]);
   strcpy(got, gots);

   for (i = 0; i < LETS; ++i) {
      ch = ges[i];
      if ((j = inset(got, ch)) > 0) {
	 addch(ch);
	 strcpy(got+j-1, got+j);
      }
      else
	 addch((inset(nots, ch) > 0) ? '.' : tolower(ch));
   }
}

/*
 *  Routine:		getlet
 *
 *  Description:	Read a valid character from the terminal,
 *			convert it to upper case, and return it.
 *
 *			Non-valid characters are not echoed.
 *
 */

static int getlet()
{
  int ch;

  do {
    ch = getch();
    if (islower(ch)) {
      ch = toupper(ch);
    }
  } while (!isalpha(ch) && ch != '?');

  addch(ch);
  refresh();
  return (ch);
}


/*
 *  Routine:		getword
 *
 *  Parameter:		wd	storage space for word
 *
 *  Description:	Reads a LETS-letter word from terminal.
 *		  
 */

static void getword (wd)
char *wd;
{
  int i;

  refresh();

  for (i = 0; i < LETS; ++i) {
    wd[i] = getlet();
  }

  wd[LETS] = NULL;
}


/*
 *  Routine:		inset
 *
 *  Parameters:		str	a reference string
 *			c	a character
 *
 *  Description:	Return the position of the first occurrence of
 *			c in str. 
 *
 *			If c does not appear in str, 0 is returned.
 *
 *  Note:		inset("ABC", 'A') == 1
 *
 */

static int inset(str, c)
char *str;
int   c;
{
  char *p;

  if ((p = strchr(str, c)) == 0) {
    return 0;
  } else {
    return p-str+1;
  }
}

/*
 *  Routine:		inword
 *
 *  Parameters:		x, y	screen coordinates
 *			p	prompt string
 *			w	input word
 *
 *  Description:	Prints a prompt string, and reads one word from
 *			the console. One word contains exactly LETS
 *			letters.
 *
 */

static void inword (x, y, p, w)
int x, y;
char *p, *w;
{
  mvaddstr(y, x, p); getword(w);
}

/*
 *  Routine:		main
 *
 *  Description:	...
 *
 */

int main (ac, av)
int ac;
char *av[];
{
  FILE *wf;
  int numwords;
  char wordlist[MAXWORDS+1][LETS+1];
  char wfil[15];		 /* word file name */

  /*  0.  Read the jotto words:  */

  if (ac < 2)				  /* set wordfile name */
    strcpy(wfil, WORD_FILE);
  else
    strcpy(wfil, av[1]);

  if ((wf = fopen(wfil, "r")) == NULL) {	/* open word file */
    fprintf(stderr, "jotto: failed to open word file '%s'\n", wfil);
    exit(1);
  }

  numwords = 0;			  /* read wordfile */
  while (fgets(word, sizeof(word), wf) != NULL) {
    word[LETS] = '\0';
    strcpy(wordlist[numwords++], word);
  }
  fclose(wf);

  /*  1.  Initialize various things:  */

  initscr();		/* init curses */
  noecho();
  cbreak();

  srand((unsigned int) time((time_t *) 0));

  /*  2.  Main loop:  */
  
  while (TRUE)  {	
    score = ISCORE;
    nots[0] = NULL;
    strcpy(maybes, alphabet);
    strcpy(gots, "     ");

    doscreen();
    inword(XPROMPT, YPROMPT, "Your word: ", word);
    if (strcmp(word, "?????") == 0) {
      strcpy(word, wordlist[rand() % numwords]);
    }
    mvaddstr(YPROMPT, XPROMPT, "                    ");
    do {
      doguess();
      if (strcmp(guess, word) != 0 && !giveup) dochange();
      if (wordok) --score;
    } while (strcmp(guess, word) != 0 && score > 0 && !giveup);
    move(YPROMPT-1, XPROMPT);
    if (strcmp(guess, word))
      printw("The word was: %s.", word);
    else
      printw("Congrats: you got %d points!", ++score);

    if (nomore()) break;
  }

  endwin();	

  return 0;
}

/*
 *  Routine:		modgot
 *
 *  Parameters:		old
 *			new
 *
 *  Description:	if gots[] contains the character old, then
 *			replace it with the character 'new'.
 *
 */

static void modgot (old, new)
char old, new;
{
   int j;

   if ((j = inset(gots, old)) > 0) gots[--j] = new;
}


/*
 *  Routine:		nomore
 *
 *  Description:	Ask if the user wishes another game. 
 *			Return TRUE if he doesn't.
 *
 */

static int nomore ()
{
  int ch;

  mvaddstr(YPROMPT, XPROMPT, "Play again? [y/n] ");

  refresh();

  do {
     if (islower(ch = getch())) {
        ch = toupper(ch);
     }
  } while (ch != 'Y' && ch != 'N');
  addch(ch);

  refresh();

  return (ch == 'N' ? TRUE : FALSE);
}

/*
 *  Routine:		printset
 *
 *  Parameter:		s 	a string with uppercase letters, not
 *				necessarily in alphabetical order.
 *
 *  Description:	Print the letters in s in alphabetical order
 *			leaving spaces between non-consecutive letters.
 *
 *			Letters in s that also are in gots[] are printed
 *			in upper case. Otherwise in lower case.
 *
 */

static void printset (s)
char *s;
{
  int i;
  char c;

  for (i = 0; i < ALPHA_SIZE; i++) {	
    c = alphabet[i];
    if (inset(s, c)) {
      addch(inset(gots, c) ? c : tolower(c));
    } else {
      addch(' ');
    }
  }
}

/*
 *  Routine:		xfer
 *
 *  Parameters:		l	A character
 *			src	The source string
 *			dest	The destination string
 *
 *  Description:	Remove the character l from src and add it to
 *			dest.
 *
 *			If l does not appear in src, do nothing.
 *
 */

static void xfer (l, src, dest)
char l;
char *src, *dest;
{
  int j;

  if ((j = inset(src, l)) > 0) {
    strcpy(src+j-1, src+j);
    dest[j = strlen(dest)] = l; dest[++j] = NULL;
  }
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩av电影一区| 欧美美女黄视频| 欧美日韩免费在线视频| 久久久久久久综合日本| 亚洲va欧美va国产va天堂影院| 国产成人日日夜夜| 欧美一级黄色大片| 亚洲在线观看免费| aa级大片欧美| 国产日韩欧美电影| 精品中文字幕一区二区| 欧美日韩成人在线一区| 亚洲午夜三级在线| 日本道精品一区二区三区| 亚洲国产精品高清| 高清不卡在线观看| 国产亚洲成av人在线观看导航| 日韩av电影免费观看高清完整版在线观看 | 日本道色综合久久| 国产精品久久久久久久久快鸭| 激情综合五月天| 91精品国产91久久久久久一区二区 | 亚洲国产wwwccc36天堂| 91亚洲男人天堂| 亚洲精品videosex极品| 色丁香久综合在线久综合在线观看| 国产精品久久毛片a| www.亚洲色图| 国产精品美女久久久久aⅴ国产馆| 国产精品亚洲人在线观看| 精品999久久久| 国产精品18久久久久| 国产欧美日韩精品a在线观看| 国产白丝网站精品污在线入口| 久久久久久久久久久电影| 国内一区二区视频| 国产精品免费av| 一本久久精品一区二区| 一区二区三区四区蜜桃| 欧美三电影在线| 久久99精品久久只有精品| 国产婷婷一区二区| 色悠悠久久综合| 天堂一区二区在线| 亚洲精品在线一区二区| 国产高清精品网站| 亚洲男人天堂一区| 欧美精品久久一区二区三区| 经典三级一区二区| av高清久久久| 欧美疯狂性受xxxxx喷水图片| 日本亚洲天堂网| 久久这里只有精品6| 99久久国产综合精品麻豆| 亚洲18色成人| 26uuu精品一区二区在线观看| 成人国产精品免费观看视频| 亚洲国产欧美在线| 2023国产一二三区日本精品2022| 成人午夜av在线| 午夜天堂影视香蕉久久| 久久精子c满五个校花| 一本大道av一区二区在线播放 | 亚洲观看高清完整版在线观看| 91精品国产综合久久久蜜臀图片| 精品一区二区三区在线观看国产 | 国产亚洲精品资源在线26u| www.66久久| 日本怡春院一区二区| 欧美韩国日本不卡| 欧美精品视频www在线观看| 国产伦精品一区二区三区免费| 夜夜精品视频一区二区| 精品对白一区国产伦| 欧美日韩在线直播| 成人精品gif动图一区| 丝瓜av网站精品一区二区| 国产精品日韩成人| 精品免费一区二区三区| 欧美乱熟臀69xxxxxx| 不卡的av电影在线观看| 精品一区二区三区视频| 亚洲成人午夜影院| 日韩一区日韩二区| 亚洲精品一区二区三区99| 欧美伦理影视网| 日本精品视频一区二区| 成人性生交大片免费看视频在线| 日韩制服丝袜av| 亚洲狠狠丁香婷婷综合久久久| 欧美极品美女视频| 2014亚洲片线观看视频免费| 欧美日韩亚洲高清一区二区| 99久久免费国产| 成人在线一区二区三区| 国产一区视频在线看| 奇米精品一区二区三区在线观看| 亚洲精品久久7777| 亚洲日本在线观看| 国产精品久久久久久久岛一牛影视 | 亚洲小说欧美激情另类| 亚洲色图第一区| 亚洲日穴在线视频| 亚洲欧美在线aaa| 久久久精品天堂| 久久综合五月天婷婷伊人| 日韩一级黄色片| 日韩一区二区精品| 欧美日本在线播放| 91精品国产福利在线观看| 欧美日韩精品一区二区在线播放| 在线中文字幕一区二区| 欧美三级韩国三级日本三斤| 欧美三级在线看| 欧美日韩五月天| 91麻豆精品国产| 精品国产区一区| 久久久久久久久久美女| 亚洲国产电影在线观看| 国产精品狼人久久影院观看方式| 亚洲欧美在线视频观看| 亚洲一区二区三区激情| 日韩av一二三| 国产乱码精品一区二区三区av| 国产高清精品网站| 色综合激情久久| 欧美日本一区二区在线观看| 欧美大胆人体bbbb| 欧美激情一区二区三区全黄| 亚洲激情图片小说视频| 午夜精品久久久久| 国产在线精品一区在线观看麻豆| 国产高清成人在线| 91官网在线观看| 日韩免费观看高清完整版| 国产日韩av一区二区| 亚洲卡通动漫在线| 日本亚洲视频在线| 高潮精品一区videoshd| 欧美性猛交xxxx黑人交| 久久亚洲春色中文字幕久久久| 中文字幕免费不卡| 三级久久三级久久久| 国产一区二区三区| 欧美图片一区二区三区| 久久久国产精品午夜一区ai换脸| 亚洲免费成人av| 久久97超碰国产精品超碰| 91美女片黄在线观看91美女| 欧美二区在线观看| 最新久久zyz资源站| 青青草原综合久久大伊人精品优势| 国产精品123| 欧美精品色综合| 亚洲欧洲色图综合| 男人的j进女人的j一区| 91麻豆国产在线观看| 欧美tickle裸体挠脚心vk| 亚洲欧美电影一区二区| 激情综合色播激情啊| 欧美吞精做爰啪啪高潮| 国产精品麻豆欧美日韩ww| 日韩激情视频在线观看| 91久久人澡人人添人人爽欧美| 欧美精品一区二区三区久久久| 亚洲国产成人porn| 91色综合久久久久婷婷| 国产日韩欧美电影| 久久精品国产在热久久| 91成人国产精品| 国产精品传媒入口麻豆| 国产真实乱对白精彩久久| 欧美日韩一区二区欧美激情| 最新国产精品久久精品| 国产成人精品aa毛片| 日韩精品一区二区三区四区| 亚洲一二三四久久| 在线中文字幕不卡| 亚洲三级在线免费观看| 成人国产精品免费网站| 国产三级三级三级精品8ⅰ区| 美国欧美日韩国产在线播放 | 色悠悠亚洲一区二区| 国产精品少妇自拍| 国产精品亚洲视频| 久久只精品国产| 国产精品一区一区三区| 精品国产1区2区3区| 蜜桃视频在线观看一区| 日韩欧美国产小视频| 蜜臀av性久久久久蜜臀av麻豆| 在线91免费看| 手机精品视频在线观看| 欧美丝袜自拍制服另类| 亚洲国产精品尤物yw在线观看| 一本久久综合亚洲鲁鲁五月天| 亚洲男人天堂av| 欧美日韩一区国产| 爽爽淫人综合网网站 | 欧美日韩成人在线一区|