Няшная / Говнокод #27496 Ссылка на оригинал

0

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
  11. 11
  12. 12
  13. 13
  14. 14
  15. 15
  16. 16
  17. 17
  18. 18
  19. 19
  20. 20
  21. 21
  22. 22
  23. 23
  24. 24
  25. 25
  26. 26
  27. 27
  28. 28
  29. 29
  30. 30
  31. 31
  32. 32
  33. 33
  34. 34
  35. 35
  36. 36
  37. 37
  38. 38
  39. 39
  40. 40
  41. 41
  42. 42
  43. 43
  44. 44
  45. 45
  46. 46
  47. 47
  48. 48
  49. 49
  50. 50
  51. 51
  52. 52
  53. 53
  54. 54
  55. 55
  56. 56
  57. 57
  58. 58
  59. 59
  60. 60
  61. 61
  62. 62
  63. 63
  64. 64
  65. 65
  66. 66
  67. 67
  68. 68
  69. 69
  70. 70
  71. 71
  72. 72
  73. 73
  74. 74
  75. 75
  76. 76
  77. 77
  78. 78
  79. 79
  80. 80
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <math.h>

#define width 65
#define height 25

char mas[height][width+1];

typedef struct {
  int x, y, w;
} TRocket;

TRocket racket;

typedef struct {  float x, y;  int ix, iy;  float alfa;  float speed;} TBall;

TBall ball;

int hitCnt = 0;int maxHitCnt = 0;

void init(int level)
{  for(int w=0; w<width; w++)   mas[0][w] = '#';  strncpy(mas[1], mas[0], width)  for(int w=1; w < width-1; w++)   mas[1][w] = ' ';  for(int h=2; h < height; h++)    strncpy(mas[h], mas[1], width);
  if(level == 1)
  {
    for(int w=10; w < width-10; w++)
      mas[5][w] = '#';
  }
}

void show()
{
  for(int x=0; x<height; x++)
  {
    printf("%s", mas[x]);   if(x == 3)
      printf("   hit: %d", hitCnt);
    if(x == 4)     printf("   max: %d", maxHitCnt);
    printf("\n");
  }
}

void initRocket()
{
  racket.w = 7;
  racket.x = (width - racket.w) / 2;
  racket.y = height - 1;
}

void initBall()
{
  moveBall(2.0, 2.0);
  ball.alfa = -1;
  ball.speed = 0.5;
}

void putBall()
{
  mas[ball.iy][ball.ix] = '*';
}

void moveBall(float x, float y)
{
  ball.x = x;
  ball.y = y;
  ball.ix = (int)ball.x;
  ball.iy = (int)ball.y;
}

void autoMoveBall()
{
  if(ball.alfa < 0) ball.alfa += M_PI*2;
  if(ball.alfa > M_PI*2) ball.alfa -= M_PI*2;
  TBall bl = ball;
  moveBall(ball.x + cos(ball.alfa) * ball.speed,
           ball.y + sin(ball.alfa) * ball.speed);
  if(mas[ball.iy][ball.ix] == '#' || mas[ball.iy][ball.ix] == '@')
  {
    if(mas[ball.iy][ball.ix] == '@')

ебаный рот!

Запостил: rom4ik rom4ik, (Updated )

Комментарии (14) RSS

Добавить комментарий

Где здесь C++, guest?!

    А не использовать ли нам bbcode?

    ↑
    8

    ↓