感谢世外苏子恒同学提供
 
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. iOS开发网络篇—NSURLConnection基本使用

    iOS开发网络篇—NSURLConnection基本使用 一.NSURLConnection的常用类 (1)NSURL:请求地址 (2)NSURLRequest:封装一个请求,保存发给服务器的全部数据 ...

  2. 2015 "BestCoder Cup" Champion

    这场比赛我没有参加,不过就算参加了也估计是被完虐.于是看着题解把大部分题目都搞了一遍. T1:Movie(hdu 5214) 题目大意: 给出N个区间,问能否选出3个互不相交的区间. N<=10 ...

  3. Liquid基础语法

    Output输出 简单输出示例: Hello {{name}} Hello {{user.name}} Hello {{ 'tobi' }} Advanced output: Filters 高级输出 ...

  4. 将HTML文本框设为不可编辑文本框。

    将HTML文本框设为不可编辑文本框. 方法1: onfocus=this.blur() <input type="text" name="input1" ...

  5. Visual Studio 2008打开vs2010解决方案的方法

    一个朋友遇到了个问题:用visual studio 2008软件,无法打开一个asp.net网站的sln解决方案.如下图,原因是此解决方案由vs2010生成的,必须由vs2010运行程序打开. 这样一 ...

  6. javaEE(web)SEO优化 Yahoo军规

    javaEE(web)SEO优化 Yahoo军规 1.尽可能减少HTTP请求数2.使用CDN3.添加Expire/Cache-Control头4.启用Gzip压缩5.将CSS房在页面最上方6.将Scr ...

  7. HDU 3709 Balanced Number

    发现只要Σa[i]*i%Σa[i]==0就可以. #include<iostream> #include<cstdio> #include<cstring> #in ...

  8. python模块之collections

    我们都知道,Python拥有一些内置的数据类型,比如str, int, list, tuple, dict等, collections模块在这些内置数据类型的基础上,提供了几个额外的数据类型: (1) ...

  9. 从零开始学习Node.js例子七 发送HTTP客户端请求并显示响应结果

    wget.js:发送HTTP客户端请求并显示响应的各种结果 options对象描述了将要发出的请求.data事件在数据到达时被触发,error事件在发生错误时被触发.HTTP请求中的数据格式通过MIM ...

  10. 从erase()谈起

    面试中,因为我说自己熟悉C++,就问我一个问题,Vector<int>里, 想把元素为2的节点删除掉.该怎么做. 我已经很久没有用Vector了,但是只有硬着头皮想一下,第一个想起的是re ...