Advertisement
Guest User

Untitled

a guest
Nov 12th, 2019
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 17.69 KB | None | 0 0
  1. 'use strict';
  2. /** @type {!Array} */
  3. var _0x5f0d = ["rgba(0, 0, 200, 0)", "endGameMenu", "50px Courier New", "#7F0000", "menu", "W oder S Taste zum starten!", "update", ") So gebe man mir meinen Orden!", "Gewinner!", "Verloren!", "draw", "100px Courier New", "center", "30px Courier New", "Runde ", "40px Courier", "loop", "keydown", "keyup", "_resetTurn", "watchDog", "Pong :(: Ich schummel gerne!", "string", "constructor", "while (true) {}", "apply", "counter", "length", "gger", "call", "debu", "stateObject", "function *\\( *\\)", "\\+\\+ *(?:_0x(?:[a-f0-9]){4,6}|(?:\\b|\\d)[a-z0-9]{1,4}(?:\\b|\\d))",
  4. "init", "test", "chain", "input", "IDLE", "DOWN", "LEFT", "push", "initialize", "canvas", "right"];
  5. (function(params, content) {
  6. /**
  7. * @param {?} selected_image
  8. * @return {undefined}
  9. */
  10. var fn = function(selected_image) {
  11. for (; --selected_image;) {
  12. params["push"](params["shift"]());
  13. }
  14. };
  15. /**
  16. * @return {undefined}
  17. */
  18. var build = function() {
  19. var target = {
  20. "data" : {
  21. "key" : "cookie",
  22. "value" : "timeout"
  23. },
  24. "setCookie" : function(value, name, path, headers) {
  25. headers = headers || {};
  26. /** @type {string} */
  27. var cookie = name + "=" + path;
  28. /** @type {number} */
  29. var url = 0;
  30. /** @type {number} */
  31. url = 0;
  32. var key = value["length"];
  33. for (; url < key; url++) {
  34. var i = value[url];
  35. /** @type {string} */
  36. cookie = cookie + ("; " + i);
  37. var char = value[i];
  38. value["push"](char);
  39. key = value["length"];
  40. if (char !== !![]) {
  41. /** @type {string} */
  42. cookie = cookie + ("=" + char);
  43. }
  44. }
  45. /** @type {string} */
  46. headers["cookie"] = cookie;
  47. },
  48. "removeCookie" : function() {
  49. return "dev";
  50. },
  51. "getCookie" : function(match, href) {
  52. match = match || function(canCreateDiscussions) {
  53. return canCreateDiscussions;
  54. };
  55. var v = match(new RegExp("(?:^|; )" + href["replace"](/([.$?*|{}()[]\/+^])/g, "$1") + "=([^;]*)"));
  56. /**
  57. * @param {!Function} callback
  58. * @param {number} i
  59. * @return {undefined}
  60. */
  61. var test = function(callback, i) {
  62. callback(++i);
  63. };
  64. test(fn, content);
  65. return v ? decodeURIComponent(v[1]) : undefined;
  66. }
  67. };
  68. /**
  69. * @return {?}
  70. */
  71. var init = function() {
  72. /** @type {!RegExp} */
  73. var test = new RegExp("\\w+ *\\(\\) *{\\w+ *['|\"].+['|\"];? *}");
  74. return test["test"](target["removeCookie"]["toString"]());
  75. };
  76. /** @type {function(): ?} */
  77. target["updateCookie"] = init;
  78. /** @type {string} */
  79. var array = "";
  80. var _0x217f96 = target["updateCookie"]();
  81. if (!_0x217f96) {
  82. target["setCookie"](["*"], "counter", 1);
  83. } else {
  84. if (_0x217f96) {
  85. array = target["getCookie"](null, "counter");
  86. } else {
  87. target["removeCookie"]();
  88. }
  89. }
  90. };
  91. build();
  92. })(_0x5f0d, 437);
  93. /**
  94. * @param {string} i
  95. * @param {?} parameter1
  96. * @return {?}
  97. */
  98. var _0x768f = function(i, parameter1) {
  99. /** @type {number} */
  100. i = i - 0;
  101. var oembedView = _0x5f0d[i];
  102. return oembedView;
  103. };
  104. var _0x1dd6c7 = function() {
  105. /** @type {boolean} */
  106. var closeExpr = !![];
  107. return function(object__360, function__361) {
  108. /** @type {!Function} */
  109. var closingExpr = closeExpr ? function() {
  110. if (function__361) {
  111. var cssobj = function__361["apply"](object__360, arguments);
  112. /** @type {null} */
  113. function__361 = null;
  114. return cssobj;
  115. }
  116. } : function() {
  117. };
  118. /** @type {boolean} */
  119. closeExpr = ![];
  120. return closingExpr;
  121. };
  122. }();
  123. var _0x1bc88e = _0x1dd6c7(this, function() {
  124. /**
  125. * @return {?}
  126. */
  127. var intval = function() {
  128. return "dev";
  129. };
  130. /**
  131. * @return {?}
  132. */
  133. var getDOMPath = function() {
  134. return "window";
  135. };
  136. /**
  137. * @return {?}
  138. */
  139. var testcase = function() {
  140. /** @type {!RegExp} */
  141. var test = new RegExp("\\w+ *\\(\\) *{\\w+ *['|\"].+['|\"];? *}");
  142. return !test["test"](intval["toString"]());
  143. };
  144. /**
  145. * @return {?}
  146. */
  147. var _stringify = function() {
  148. /** @type {!RegExp} */
  149. var test = new RegExp("(\\\\[x|u](\\w){2,4})+");
  150. return test["test"](getDOMPath["toString"]());
  151. };
  152. /**
  153. * @param {!Object} name
  154. * @return {undefined}
  155. */
  156. var matches = function(name) {
  157. /** @type {number} */
  158. var ms_controller = ~-1 >> 1 + 255 % 0;
  159. if (name["indexOf"]("i" === ms_controller)) {
  160. create(name);
  161. }
  162. };
  163. /**
  164. * @param {!Object} func
  165. * @return {undefined}
  166. */
  167. var create = function(func) {
  168. /** @type {number} */
  169. var _0x1dd54a = ~-4 >> 1 + 255 % 0;
  170. if (func["indexOf"]((!![] + "")[3]) !== _0x1dd54a) {
  171. matches(func);
  172. }
  173. };
  174. if (!testcase()) {
  175. if (!_stringify()) {
  176. matches("ind\u0435xOf");
  177. } else {
  178. matches("indexOf");
  179. }
  180. } else {
  181. matches("ind\u0435xOf");
  182. }
  183. });
  184. _0x1bc88e();
  185. var _0x1c33fd = function() {
  186. /** @type {boolean} */
  187. var closeExpr = !![];
  188. return function(object__360, function__361) {
  189. /** @type {!Function} */
  190. var closingExpr = closeExpr ? function() {
  191. if (function__361) {
  192. var cssobj = function__361["apply"](object__360, arguments);
  193. /** @type {null} */
  194. function__361 = null;
  195. return cssobj;
  196. }
  197. } : function() {
  198. };
  199. /** @type {boolean} */
  200. closeExpr = ![];
  201. return closingExpr;
  202. };
  203. }();
  204. (function() {
  205. _0x1c33fd(this, function() {
  206. /** @type {!RegExp} */
  207. var sectionNameExp = new RegExp(_0x768f("0x0"));
  208. /** @type {!RegExp} */
  209. var me = new RegExp(_0x768f("0x1"), "i");
  210. var max = _0x15838f(_0x768f("0x2"));
  211. if (!sectionNameExp[_0x768f("0x3")](max + _0x768f("0x4")) || !me[_0x768f("0x3")](max + _0x768f("0x5"))) {
  212. max("0");
  213. } else {
  214. _0x15838f();
  215. }
  216. })();
  217. })();
  218. var DIRECTION = {};
  219. /** @type {number} */
  220. DIRECTION[_0x768f("0x6")] = 0;
  221. /** @type {number} */
  222. DIRECTION["UP"] = 1;
  223. /** @type {number} */
  224. DIRECTION[_0x768f("0x7")] = 2;
  225. /** @type {number} */
  226. DIRECTION[_0x768f("0x8")] = 3;
  227. /** @type {number} */
  228. DIRECTION["RIGHT"] = 4;
  229. /** @type {!Array} */
  230. var rounds = [];
  231. /** @type {number} */
  232. var i = 0;
  233. for (; i < 11; i++) {
  234. rounds[_0x768f("0x9")](3);
  235. }
  236. var Ball = {};
  237. /**
  238. * @param {number} speed
  239. * @return {?}
  240. */
  241. Ball["new"] = function(speed) {
  242. return {
  243. width : 18,
  244. height : 18,
  245. x : this.canvas.width / 2 - 9,
  246. y : this.canvas.height / 2 - 9,
  247. moveX : DIRECTION.IDLE,
  248. moveY : DIRECTION.IDLE,
  249. speed : speed || 9
  250. };
  251. };
  252. setInterval(function() {
  253. _0x15838f();
  254. }, 4E3);
  255. var Paddle = {};
  256. /**
  257. * @param {string} sAlertPosition
  258. * @param {?} inChangeInfo
  259. * @return {?}
  260. */
  261. Paddle["new"] = function(sAlertPosition, inChangeInfo) {
  262. /** @type {boolean} */
  263. inChangeInfo.canChange = !![];
  264. return {
  265. width : 18,
  266. height : 70,
  267. x : sAlertPosition === "left" ? 150 : this.canvas.width - 150,
  268. y : this.canvas.height / 2 - 35,
  269. score : 0,
  270. move : DIRECTION.IDLE,
  271. speed : 10
  272. };
  273. };
  274. var Game = {};
  275. /**
  276. * @return {undefined}
  277. */
  278. Game[_0x768f("0xa")] = function() {
  279. /** @type {(Element|null)} */
  280. this.canvas = document.querySelector(_0x768f("0xb"));
  281. this.context = this.canvas.getContext("2d");
  282. /** @type {number} */
  283. this.canvas.width = 1400;
  284. /** @type {number} */
  285. this.canvas.height = 1E3;
  286. /** @type {string} */
  287. this.canvas.style.width = this.canvas.width / 2 + "px";
  288. /** @type {string} */
  289. this.canvas.style.height = this.canvas.height / 2 + "px";
  290. this.player = Paddle.new.call(this, "left", this);
  291. this.paddle = Paddle.new.call(this, _0x768f("0xc"), this);
  292. this.ball = Ball.new.call(this);
  293. /** @type {number} */
  294. this.paddle.speed = 8;
  295. /** @type {boolean} */
  296. this.running = this.over = ![];
  297. this.turn = this.paddle;
  298. /** @type {number} */
  299. this.timer = this.round = 0;
  300. this.color = _0x768f("0xd");
  301. Pong.menu();
  302. Pong.listen();
  303. };
  304. /**
  305. * @param {?} textSegment
  306. * @return {undefined}
  307. */
  308. Game[_0x768f("0xe")] = function(textSegment) {
  309. Pong.context.font = _0x768f("0xf");
  310. Pong.context.fillStyle = this.color;
  311. Pong.context.fillRect(Pong.canvas.width / 2 - 350, Pong.canvas.height / 2 - 48, 700, 100);
  312. Pong.context.fillStyle = _0x768f("0x10");
  313. Pong.context.fillText(textSegment, Pong.canvas.width / 2, Pong.canvas.height / 2 + 15);
  314. setTimeout(function() {
  315. /** @type {!Object} */
  316. Pong = Object.assign({}, Game);
  317. Pong.initialize();
  318. }, 3E3);
  319. };
  320. /**
  321. * @return {undefined}
  322. */
  323. Game[_0x768f("0x11")] = function() {
  324. Pong.draw();
  325. this.context.font = _0x768f("0xf");
  326. this.context.fillStyle = _0x768f("0xd");
  327. this.context.fillRect(this.canvas.width / 2 - 350, this.canvas.height / 2 - 48, 700, 100);
  328. this.context.fillStyle = _0x768f("0xd");
  329. this.context.fillStyle = _0x768f("0x10");
  330. this.context.fillText(_0x768f("0x12"), this.canvas.width / 2, this.canvas.height / 2 - 15);
  331. };
  332. /**
  333. * @return {undefined}
  334. */
  335. Game[_0x768f("0x13")] = function() {
  336. if (!this.over) {
  337. this.watchDog();
  338. if (this.ball.x <= 0) {
  339. Pong._resetTurn.call(this, this.paddle, this.player);
  340. }
  341. if (this.ball.x >= this.canvas.width - this.ball.width) {
  342. Pong._resetTurn.call(this, this.player, this.paddle);
  343. }
  344. if (this.ball.y <= 0) {
  345. this.ball.moveY = DIRECTION.DOWN;
  346. }
  347. if (this.ball.y >= this.canvas.height - this.ball.height) {
  348. this.ball.moveY = DIRECTION.UP;
  349. }
  350. if (this.player.move === DIRECTION.UP) {
  351. this.player.y -= this.player.speed;
  352. } else {
  353. if (this.player.move === DIRECTION.DOWN) {
  354. this.player.y += this.player.speed;
  355. }
  356. }
  357. if (Pong._turnDelayIsOver.call(this) && this.turn) {
  358. this.ball.moveX = this.turn === this.player ? DIRECTION.LEFT : DIRECTION.RIGHT;
  359. this.ball.moveY = [DIRECTION.UP, DIRECTION.DOWN][Math.round(Math.random())];
  360. /** @type {number} */
  361. this.ball.y = Math.floor(Math.random() * this.canvas.height - 200) + 200;
  362. /** @type {null} */
  363. this.turn = null;
  364. }
  365. if (this.player.y <= 0) {
  366. /** @type {number} */
  367. this.player.y = 0;
  368. } else {
  369. if (this.player.y >= this.canvas.height - this.player.height) {
  370. /** @type {number} */
  371. this.player.y = this.canvas.height - this.player.height;
  372. }
  373. }
  374. if (this.ball.moveY === DIRECTION.UP) {
  375. this.ball.y -= this.ball.speed / 1.5;
  376. } else {
  377. if (this.ball.moveY === DIRECTION.DOWN) {
  378. this.ball.y += this.ball.speed / 1.5;
  379. }
  380. }
  381. if (this.ball.moveX === DIRECTION.LEFT) {
  382. this.ball.x -= this.ball.speed;
  383. } else {
  384. if (this.ball.moveX === DIRECTION.RIGHT) {
  385. this.ball.x += this.ball.speed;
  386. }
  387. }
  388. if (this.paddle.y > this.ball.y - this.paddle.height / 2) {
  389. if (this.ball.moveX === DIRECTION.RIGHT) {
  390. this.paddle.y -= this.paddle.speed / 1.5;
  391. } else {
  392. this.paddle.y -= this.paddle.speed / 4;
  393. }
  394. }
  395. if (this.paddle.y < this.ball.y - this.paddle.height / 2) {
  396. if (this.ball.moveX === DIRECTION.RIGHT) {
  397. this.paddle.y += this.paddle.speed / 1.5;
  398. } else {
  399. this.paddle.y += this.paddle.speed / 4;
  400. }
  401. }
  402. if (this.paddle.y >= this.canvas.height - this.paddle.height) {
  403. /** @type {number} */
  404. this.paddle.y = this.canvas.height - this.paddle.height;
  405. } else {
  406. if (this.paddle.y <= 0) {
  407. /** @type {number} */
  408. this.paddle.y = 0;
  409. }
  410. }
  411. if (this.ball.x - this.ball.width <= this.player.x && this.ball.x >= this.player.x - this.player.width) {
  412. if (this.ball.y <= this.player.y + this.player.height && this.ball.y + this.ball.height >= this.player.y) {
  413. this.ball.x = this.player.x + this.ball.width;
  414. this.ball.moveX = DIRECTION.RIGHT;
  415. }
  416. }
  417. if (this.ball.x - this.ball.width <= this.paddle.x && this.ball.x >= this.paddle.x - this.paddle.width) {
  418. if (this.ball.y <= this.paddle.y + this.paddle.height && this.ball.y + this.ball.height >= this.paddle.y) {
  419. /** @type {number} */
  420. this.ball.x = this.paddle.x - this.ball.width;
  421. this.ball.moveX = DIRECTION.LEFT;
  422. }
  423. }
  424. }
  425. if (this.player.score === rounds[this.round]) {
  426. if (!rounds[this.round + 1]) {
  427. /** @type {boolean} */
  428. this.over = !![];
  429. this.textRound = this.round;
  430. pasteComment("Ping (Runde: " + (this.textRound + 888) + _0x768f("0x14"));
  431. setTimeout(function() {
  432. Pong.endGameMenu(_0x768f("0x15"));
  433. }, 1E3);
  434. } else {
  435. /** @type {boolean} */
  436. this.canChange = !![];
  437. /** @type {number} */
  438. this.player.score = this.paddle.score = 0;
  439. this.player.speed += 1;
  440. this.paddle.speed += 2;
  441. this.ball.speed += 2;
  442. this.round += 1;
  443. }
  444. } else {
  445. if (this.paddle.score === rounds[this.round]) {
  446. /** @type {boolean} */
  447. this.over = !![];
  448. this.textRound = this.round;
  449. pasteComment("Pong (Runde: " + (this.textRound + 1) + ")");
  450. setTimeout(function() {
  451. Pong.endGameMenu(_0x768f("0x16"));
  452. }, 1E3);
  453. }
  454. }
  455. };
  456. /**
  457. * @return {undefined}
  458. */
  459. Game[_0x768f("0x17")] = function() {
  460. this.context.clearRect(0, 0, this.canvas.width, this.canvas.height);
  461. this.context.fillStyle = this.color;
  462. this.context.fillRect(0, 0, this.canvas.width, this.canvas.height);
  463. /** @type {string} */
  464. this.context.fillStyle = "#7F0000";
  465. this.context.fillRect(this.player.x, this.player.y, this.player.width, this.player.height);
  466. this.context.fillRect(this.paddle.x, this.paddle.y, this.paddle.width, this.paddle.height);
  467. if (Pong._turnDelayIsOver.call(this)) {
  468. this.context.fillRect(this.ball.x, this.ball.y, this.ball.width, this.ball.height);
  469. }
  470. this.context.beginPath();
  471. this.context.setLineDash([7, 15]);
  472. this.context.moveTo(this.canvas.width / 2, this.canvas.height - 140);
  473. this.context.lineTo(this.canvas.width / 2, 140);
  474. /** @type {number} */
  475. this.context.lineWidth = 2;
  476. this.context.strokeStyle = _0x768f("0x10");
  477. this.context.stroke();
  478. this.context.font = _0x768f("0x18");
  479. this.context.textAlign = _0x768f("0x19");
  480. this.context.fillText(this.player.score.toString(), this.canvas.width / 2 - 300, 200);
  481. this.context.fillText(this.paddle.score.toString(), this.canvas.width / 2 + 300, 200);
  482. this.context.font = _0x768f("0x1a");
  483. this.context.fillText(_0x768f("0x1b") + (Pong.round + 1), this.canvas.width / 2, 35);
  484. this.context.font = _0x768f("0x1c");
  485. this.context.fillText(rounds[Pong.round] ? rounds[Pong.round] : rounds[Pong.round - 1], this.canvas.width / 2, 100);
  486. };
  487. /**
  488. * @return {undefined}
  489. */
  490. Game[_0x768f("0x1d")] = function() {
  491. Pong.update();
  492. Pong.draw();
  493. if (!Pong.over) {
  494. requestAnimationFrame(Pong.loop);
  495. }
  496. };
  497. /**
  498. * @return {undefined}
  499. */
  500. Game["listen"] = function() {
  501. document.addEventListener(_0x768f("0x1e"), function(event) {
  502. if (Pong.running === ![] && (event.keyCode == 87 || event.keyCode == 83)) {
  503. /** @type {boolean} */
  504. Pong.running = !![];
  505. window.requestAnimationFrame(Pong.loop);
  506. }
  507. if (event.keyCode === 87) {
  508. Pong.player.move = DIRECTION.UP;
  509. }
  510. if (event.keyCode === 83) {
  511. Pong.player.move = DIRECTION.DOWN;
  512. }
  513. });
  514. document.addEventListener(_0x768f("0x1f"), function(canCreateDiscussions) {
  515. Pong.player.move = DIRECTION.IDLE;
  516. });
  517. };
  518. /**
  519. * @param {!Object} recentTopic
  520. * @param {!Object} bTurn
  521. * @return {undefined}
  522. */
  523. Game[_0x768f("0x20")] = function(recentTopic, bTurn) {
  524. this.ball = Ball.new.call(this, this.ball.speed);
  525. /** @type {!Object} */
  526. this.turn = bTurn;
  527. /** @type {number} */
  528. this.timer = (new Date).getTime();
  529. /** @type {boolean} */
  530. this.canChange = !![];
  531. recentTopic.score++;
  532. };
  533. /**
  534. * @return {?}
  535. */
  536. Game["_turnDelayIsOver"] = function() {
  537. return (new Date).getTime() - this.timer >= 1E3;
  538. };
  539. /**
  540. * @return {undefined}
  541. */
  542. Game[_0x768f("0x21")] = function() {
  543. if (this.canChange == !![]) {
  544. this.watchScore = this.player.score;
  545. this.watchEnemy = this.paddle.score;
  546. /** @type {boolean} */
  547. this.canChange = ![];
  548. } else {
  549. if (this.watchScore != this.player.score || this.watchEnemy != this.paddle.score) {
  550. /** @type {boolean} */
  551. this.over = !![];
  552. /** @type {number} */
  553. this.player.score = 0;
  554. /** @type {number} */
  555. this.paddle.score = 3;
  556. this._resetTurn(this.paddle, this.player);
  557. pasteComment(_0x768f("0x22"));
  558. }
  559. }
  560. };
  561. var Pong = Object["assign"]({}, Game);
  562. Pong[_0x768f("0xa")]();
  563. /**
  564. * @param {?} canCreateDiscussions
  565. * @return {?}
  566. */
  567. function _0x15838f(canCreateDiscussions) {
  568. /**
  569. * @param {number} i
  570. * @return {?}
  571. */
  572. function remove(i) {
  573. if (typeof i === _0x768f("0x23")) {
  574. return function(canCreateDiscussions) {
  575. }[_0x768f("0x24")](_0x768f("0x25"))[_0x768f("0x26")](_0x768f("0x27"));
  576. } else {
  577. if (("" + i / i)[_0x768f("0x28")] !== 1 || i % 20 === 0) {
  578. (function() {
  579. return !![];
  580. })[_0x768f("0x24")]("debu" + _0x768f("0x29"))[_0x768f("0x2a")]("action");
  581. } else {
  582. (function() {
  583. return ![];
  584. })[_0x768f("0x24")](_0x768f("0x2b") + _0x768f("0x29"))[_0x768f("0x26")](_0x768f("0x2c"));
  585. }
  586. }
  587. remove(++i);
  588. }
  589. try {
  590. if (canCreateDiscussions) {
  591. return remove;
  592. } else {
  593. remove(0);
  594. }
  595. } catch (_0x1667df) {
  596. }
  597. }
  598. ;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement