?? snake.cpp
字號(hào):
// the Snake
// Copyright (c)1996 Fredrik Wangel (WaF)
//
#include <dos.h>
#include <conio.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <ctype.h>
#include "snake.h"
void waitretrace(void);
void waitdisplay(void);
int keyhit(void);
void flushkbd(void);
void setborderc(byte color);
void show_display(void);
void hide_display(void);
void draw_score(void);
void fade_to_black(byte start, byte stop, byte steps);
void fade_to_color(byte start, byte stop, byte steps);
#define TRUE '-'/'-'
#define FALSE '-'-'-'
#define KEY_SOUND 'S'
#define KEY_ESC 27
#define KEY_UP 72
#define KEY_DOWN 80
#define KEY_LEFT 75
#define KEY_RIGHT 77
#define SCRSX 80
#define XSIZE 80
#define YSIZE 40
#define BLOCKS 20
#define LX2POS 44
#define LXPOS 1
#define LYPOS YSIZE + 2
#define GP ((YSIZE * BLOCKS) / XSIZE) // Base points
#define ADDSNAKE 15 // random(x) at increase
#define LOOSESNAKE 4 // and decrease respectively
#define BEGINSNAKE 2 // starting length of the snake
#define FROGAMOUNT 5 // number of frogs
#define HI(a) (a & 0xff00) / 0x100
#define LO(a) (a & 0x00ff)
#define FOREVER for(;;)
byte key, firsttime = 1, ljud = 1;
byte grid[XSIZE][YSIZE];
byte frx[FROGAMOUNT], fry[FROGAMOUNT];
int snx[1500], sny[1500];
int length, head, tail;
int grow, decline, frogtime[FROGAMOUNT];
int millifemtio, tid;
long score;
long bestscore = 0;
int besttid = 0, bestlength = 0;
const word Clear = 0x2000 + byte(' ');
const word Frog = 0x2A00 + byte('
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -