感谢世外苏子恒同学提供
 
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. HDU 1171 背包

    Big Event in HDU Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others ...

  2. 【59测试】【树】【dp】

    第一题 A : 这棵树由n个节点以及n - 1条有向边构成,每条边都从父亲节点指向儿子节点,保证除了根节点以外的每个节点都有一个唯一的父亲.树上的节点从1到n标号.该树的一棵子树的定义为某个节点以及从 ...

  3. 理解RESTful架构(转载)

    本文转载自:http://www.ruanyifeng.com/blog/2011/09/restful.html 越来越多的人开始意识到,网站即软件,而且是一种新型的软件. 这种"互联网软 ...

  4. 使用squid配置透明代理并对上网行为进行控制

    使用Squid配置透明代理 环境:CentOS 6.4 + squid-3.1.10-20.el6_5.3.x86_64 1.检查squid是否默认安装,没有安装先安装 rpm -qa squid 假 ...

  5. 谈谈eclipse使用技巧二

    上节说道了怎么使用eclipse使您事半功倍.这节告诉您怎么用eclipse练成火眼金睛. ①借你一双火眼金睛让类的层次结构一目了然让你阅读代码如虎添翼 一个好的类的层次结构,让你的类的层次清晰明了, ...

  6. IOS时间传递机制简记

    事件传递顺序:自定义View -- > UIview --> RootViewController --> UIWindow -->UIApplication -->Ap ...

  7. Jmeter—2 http请求—简单的get请求

    发送一个简单的get http请求 1 启动Jmeter,在测试计划上点击鼠标右键>添加>Threads(Users)>线程组 2 线程组界面.可设置线程数,几秒启动所有线程,循环次 ...

  8. Objective-C学习笔记-第一天(3)

    话不多说,学了这么多,写个快速排序先. 除了快排,以后有时间还要加堆排.归并等等. 今天学了有,类.协议.语法. 因为算法类,不止一个算法.所以新建一个Algorithm(算法)协议: #import ...

  9. Notes of learning AutoLayout

    在XCode5中,如果我们添加一个Button或者Label,或者其他的什么标准View,而不设置任何constraints,IB会自动生成constraints,而这些constraints是fix ...

  10. C++ friend keyword

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