感谢世外苏子恒同学提供
 
uses crt;
var
  x,y,xd,yd,xb,yb:shortint;
  k:char;
procedure intro;
begin
  clrscr;
  writeln;
  writeln;
  writeln;
  writeln;
  writeln;
  writeln('Naughty ball-II':48);
  writeln('--by suziheng':47);
  writeln;
  writeln;
  writeln('Use A(left) and D(right) to controll the board"=========="':69);
  writeln;
  writeln;
  writeln('If the ball falls down below the screen, GAMEOVER!':65);
  writeln;
  writeln;
  writeln('Press CTRL+C to exit':50);
  writeln;
  writeln;
  writeln('Press Enter to start':50);
  readln;
end;
 
procedure gameover;
begin
 clrscr;
 writeln;
 writeln;
 writeln;
 writeln;
 writeln('GAME OVER':45);
 writeln;
 writeln;
 writeln('                                   -------------');
 writeln('                               O <  why  didn',chr(39),'t |'); 
 writeln('                                  | you  lift   |');
 writeln('                                  | me  up !!?? |');
 writeln('                                   -------------');
 delay(10000);
 exit;
end;
 
begin
  cursoroff;
  intro;
 
  xb:=1;
  yb:=24;
  xd:=1;
  yd:=1;
  x:=2;
  y:=2;
 
  while true do begin
    clrscr;
    x:=x+xd;
    y:=y+yd;
    gotoxy(x,y);
    write('O');
    if keypressed then begin
      k:=readkey;
      if (k='a') and (xb>10) then xb:=xb-10;
      if (k='d') and (xb<60) then xb:=xb+10;
    end;
    gotoxy(xb,yb);
    write('====================');
 
    delay(100);
    if (x=80) or (x=1) then xd:=-xd;
    if y=1 then yd:=-yd;
    if (y=yb) and ((x>=xb) and (x<=xb+19)) then begin
      sound(1);
      delay(50);
      nosound;
      yd:=-yd;
    end;
    if y=25 then break;
  end;
  gameover;
end.

顽皮的小球II的更多相关文章

  1. Pascal语言(存档)

    数据类型 标准函数 运算符和表达式 输入语句 输出语句 if语句 case语句 for语句 while语句 repeat语句 函数与过程 形参与实参 全局变量与局部变量 数组 字符串 枚举 子界 集合 ...

  2. HTML5CSS3特效-上下跳动的小球-遁地龙卷风

    (-1)写在前面 我用的是chrome49,这个idea是我在stackoverflow上回答问题时看到了,多谢这位同行,加深了我对很多技术点的理解,最近刚到北京,忙碌了一两天,在后续的日子里,会被安 ...

  3. Leetcode 笔记 113 - Path Sum II

    题目链接:Path Sum II | LeetCode OJ Given a binary tree and a sum, find all root-to-leaf paths where each ...

  4. Leetcode 笔记 117 - Populating Next Right Pointers in Each Node II

    题目链接:Populating Next Right Pointers in Each Node II | LeetCode OJ Follow up for problem "Popula ...

  5. 函数式Android编程(II):Kotlin语言的集合操作

    原文标题:Functional Android (II): Collection operations in Kotlin 原文链接:http://antonioleiva.com/collectio ...

  6. 统计分析中Type I Error与Type II Error的区别

    统计分析中Type I Error与Type II Error的区别 在统计分析中,经常提到Type I Error和Type II Error.他们的基本概念是什么?有什么区别? 下面的表格显示 b ...

  7. hdu1032 Train Problem II (卡特兰数)

    题意: 给你一个数n,表示有n辆火车,编号从1到n,入站,问你有多少种出站的可能.    (题于文末) 知识点: ps:百度百科的卡特兰数讲的不错,注意看其参考的博客. 卡特兰数(Catalan):前 ...

  8. [LeetCode] Guess Number Higher or Lower II 猜数字大小之二

    We are playing the Guess Game. The game is as follows: I pick a number from 1 to n. You have to gues ...

  9. [LeetCode] Number of Islands II 岛屿的数量之二

    A 2d grid map of m rows and n columns is initially filled with water. We may perform an addLand oper ...

随机推荐

  1. Vmware workstation 10 NAT功能总是不正常的原因

    原来运行一切正常的VMWARE WORKSTATION 10,突然出现NAT功能不能正常工作的情况. 表现是:如果将虚拟机的网卡设置为NAT模式,可以PING通网关及LAN内的主机,但是PING不通外 ...

  2. IT公司100题-26-左旋转字符串

    问题描述: 给定字符串和左旋的字符数,写程序实现字符串的左旋操作.例如对于字符串”12345678″, 左旋转4个字符后,变成”56781234″.要求时间复杂度为O(n),空间复杂度O(1).   ...

  3. BeanUtil体会

    把字符串(非纯数字组成的字符串,带有字符的那种)拷贝到int属性中,int属性值设为0 把字符串(纯数字组成的),赋值给double类型,可以直接转换,int类型也可以直接转换成double类型 但是 ...

  4. HDU2222

    http://acm.hdu.edu.cn/showproblem.php?pid=2222 注意: 1. keyword可以相同,因此计算时要累计:cur->num++. 2. 同一个keyw ...

  5. C++ friend keyword

    You often need to split a class in half when the two halves will have different numbers of instances ...

  6. 关于asp的运行环境配置

    xp系统的配置方法http://jingyan.baidu.com/article/4f7d571289ac441a201927da.html win7系统的配置方法http://jingyan.ba ...

  7. Java数据结构和算法之链表

    三.链表 链结点 在链表中,每个数据项都被包含在‘点“中,一个点是某个类的对象,这个类可认叫做LINK.因为一个链表中有许多类似的链结点,所以有必要用一个不同于链表的类来表达链结点.每个LINK对象中 ...

  8. xml 解析的四种方式

    =========================================xml文件<?xml version="1.0" encoding="GB2312 ...

  9. VS 2010 编译 Openssl

    VS 2010 编译 Openssl 1. 编译环境: Visual Studio 2010 Windows 7 64 旗舰版 openssl-1.0.1s 2. 下载安装ActivePerl,下载下 ...

  10. 网络数据包收发流程(三):e1000网卡和DMA

    一.硬件布局每个网卡(MAC)都有自己的专用DMA Engine,如上图的 TSEC 和 e1000 网卡intel82546.上图中的红色线就是以太网数据流,DMA与DDR打交道需要其他模块的协助, ...