Advertisement
aaaaaa123456789

Famed Racer's "Robotic PR2 Player"

Jan 18th, 2015
669
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. To the casual pastebin reader: the "code" that follows is the result of very heavy trolling here: http://jiggmin.com/threads/128966-Robotic-PR2-Player
  2. The poor soul asked us to make the program for him, and he thought we were sending real stuff... thankfully he even GPL'd it so now that he realized what's going on, I can still upload it here and nothing can be said about it because he gave me the legal right to do so
  3. Everything that follows after the blank line here is the "code" of the "bot"... 10 points to whoever figures out what language this is in
  4.  
  5. // <PR2 Pro Robot Program>
  6. // Copyright (C) 2015 <Famed Racer, aaaaaa123456789, Reisyukaku, Fire-Bird, Zinx10, Ringstaart, usb hub, aki>
  7. //
  8. // This program is free software: you can redistribute it and/or modify
  9. // it under the terms of the GNU General Public License as published by
  10. // the Free Software Foundation, either version 3 of the License, or
  11. // (at your option) any later version.
  12. //
  13. // This program is distributed in the hope that it will be useful,
  14. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. // GNU General Public License for more details.
  17. //
  18. // You should have received a copy of the GNU General Public License
  19. // along with this program. If not, see http://www.gnu.org/licenses/.
  20. //
  21. // asio.hpp
  22. // ~~~~~~~~
  23. //
  24. // Copyright (c) 2003-2013 Christopher M. Kohlhoff (chris at kohlhoff dot com)
  25. //
  26. // Distributed under the Boost Software License, Version 1.0. (See accompanying
  27. // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  28. //
  29. // See www.boost.org/libs/asio for documentation.
  30. //
  31.  
  32. #ifndef BOOST_ASIO_HPP
  33. #define BOOST_ASIO_HPP
  34.  
  35. #if defined(_MSC_VER) && (_MSC_VER >= 1200)
  36. # pragma once
  37. #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
  38.  
  39. #include <boost/asio/async_result.hpp>
  40. #include <boost/asio/basic_datagram_socket.hpp>
  41. #include <boost/asio/basic_deadline_timer.hpp>
  42. #include <boost/asio/basic_io_object.hpp>
  43. #include <boost/asio/basic_raw_socket.hpp>
  44. #include <boost/asio/basic_seq_packet_socket.hpp>
  45. #include <boost/asio/basic_serial_port.hpp>
  46. #include <boost/asio/basic_signal_set.hpp>
  47. #include <boost/asio/basic_socket_acceptor.hpp>
  48. #include <boost/asio/basic_socket_iostream.hpp>
  49. #include <boost/asio/basic_socket_streambuf.hpp>
  50. #include <boost/asio/basic_stream_socket.hpp>
  51. #include <boost/asio/basic_streambuf.hpp>
  52. // some generic stuff that will probably get used anyway
  53. #include <stdio.h>
  54. #include <string.h>
  55. #include <stdlib.h>
  56.  
  57. bool can_your_bot_play_pr2(){
  58. return false;
  59. }
  60.  
  61. int main (int argc, char ** argv) {
  62. if(!can_your_bot_play_pr2()) return 1;
  63.  
  64. // _main:
  65. push {r0-r2,lr}
  66. ldr r0, =0x20000000
  67. mov r1, #0x67
  68. strb r1, [r0]
  69. add r1, r1, #8
  70. strb r1, [r0,#1]
  71. sub r1, r1, #4F
  72. strb r1, [r0,#2]
  73. add r1, r1, #0x41
  74. strb r1, [r0,#3]
  75. mov r2, r1
  76. add r1, r1, #16
  77. strb r1, [r0,#4]
  78. strb r2, [r0,#5]
  79. add r1, r2, #18
  80. strb r1, [r0,#6]
  81. mov r2, #0
  82. strb r2, [r0,#7]
  83. bl magicalPrintFunc
  84. pop {r0-r2,lr}
  85. public class Bot {
  86.  
  87. private bool working = false;
  88.  
  89. public Bot () {
  90. working = can_your_bot_play_pr2();
  91. }
  92.  
  93. public virtual void play (int level) {
  94. if (!working)
  95. throw new System.Exception("the bot cannot play");
  96. // insert playing code here
  97. }
  98. }
  99. return 0;
  100. };; 1 = Race
  101. ;; 2 = Deathmatch
  102. ;; 3 = Egghunt
  103. ;; 4 = Don't Move
  104. (define (pr2bot mode)
  105. (if (= mode 4)
  106. (display "Please wait while the bot completes the level.")
  107. (display "WIP")))
  108. int play_level (int level_type, unsigned long levelID, unsigned char slot,
  109. int (* join_level) (unsigned long, unsigned char),
  110. void (** play_levels) (int)) {
  111. int level = join_level(levelID, slot);
  112. if (!level) return 0;
  113. level_type[play_levels](level);
  114. return 1;
  115. }
  116. if int(self.score) == 0:
  117. self.endgame() #end the game if the if player hits finish block
  118. self.entry_var = ''
  119. textvariable = ''
  120. errorF1 = 0
  121. error = 0
  122. guessflag = 0
  123. greaterthanError = 0
  124. stringError = 0
  125. lessthanZeroError = 0
  126. if int(self.score) != 0:
  127. self.userChoice = self.userInput.get()
  128. try:
  129. int(self.userChoice)
  130. except:
  131. self.errorhappened = 1
  132. self.endgameerror = 1
  133. error = 1
  134. errorF1 = 1
  135. if error == 0:
  136. if int(self.userChoice) < 0:
  137. lessthanZeroError = 1
  138. if self.userChoice == "-0":
  139. stringError = 1
  140. if errorF1 == 0:
  141. if int(self.userChoice) > self.num:
  142. greaterthanError = 1
  143. if int(self.userChoice) < self.num:
  144. greaterthanError = 0
  145. var hats = window.prompt("Number of hats: ");
  146. var speed = window.prompt("Speed: ");
  147. var accel = window.prompt("Acceleration: ")
  148. var jump = window.prompt("Jumping: ")
  149. window.alert("You have selected: " + '\n' + "Hats: " + hats + '\n' + "Speed: " + speed + '\n' + "Acceleration: " + accel + '\n' + "Jump: " + jump);
  150.  
  151. var god = ["Dr. SLAY", "Bloodyhead1", "Killer XYZ", "Milkmann"];
  152. var veryhard = ["C MAN", "ZXD", "MWG"];
  153. var superhard = ["Katiek", "Dexterity"];
  154.  
  155. if (godFound = 1) {
  156. setSkill 100;
  157. } else if (veryhardFound = 1) {
  158. setSkill 80;
  159. } else if (superhardFound = 1) {
  160. setSkill 65;
  161. } else {
  162. setSkill 50;
  163. }
  164. init a;
  165.  
  166. //Code to process a jump
  167. function jumpForce(){
  168. Math.pow(a, 2);
  169. coordY = -9.81(a) + setSkill(a) + coordY;
  170. }
  171.  
  172. while self.blockDownRight == 1 && self.blockRight == 0 {
  173. //Walk the distance of a block
  174. coordX = coordX + (30 * (setSkill / 100));
  175. }
  176. while self.blockRight == 1 && self.blockUp == 0 {
  177. //Jump if able
  178. jumpForce();
  179. }
  180. var fetch_site = function (site) {
  181. var req = new XMLHttpRequest();
  182. req.open("GET", site, false);
  183. req.send();
  184. if (req.status >= 400) return null;
  185. return req;
  186. }
  187.  
  188. var load_result_page = function(query, page) {
  189. var qs = "q=" + encodeURIComponent(query);
  190. var doc = fetch_site("http://google.com?" + qs + "&start=" + ((page - 1) * 10) + "#" + qs);
  191. if (!doc) return null;
  192. return doc.responseXML.querySelectorAll("div.rc h3.r a").map(function(x) {return x.href;});
  193. }
  194.  
  195. function get_embed (url) {
  196. var doc = fetch_site(url);
  197. if (!doc) return null;
  198. var embed = doc.responseXML.querySelectorAll("embed");
  199. if (embed.length == 0) return null;
  200. return embed[0].src;
  201. }
  202.  
  203. function search_for_embed (query_string) {
  204. var result = null;
  205. var page = 0;
  206. while (true) {
  207. result = load_result_page(query_string, ++ page);
  208. if (!result) break;
  209. for (var i = 0; i < result.length; i ++) {
  210. var location = get_embed(result[i]);
  211. if (location) return location;
  212. }
  213. }
  214. return null;
  215. }
  216.  
  217. var pr2_swf = search_for_embed("pr2");
  218.  
  219. require 'socket'
  220.  
  221. host = 'www.pr2hub.com'
  222. port = 80
  223. path = "/index.htm"
  224.  
  225. request = "GET #{path} HTTP/1.0\r\n\r\n"
  226.  
  227. socket = TCPSocket.open(host,port)
  228. socket.print(request)
  229. response = socket.read
  230.  
  231. headers,body = response.split("\r\n\r\n", 2)
  232. print body
  233.  
  234. $all_datas = array();
  235. call(learn_call, 1000); //call learn function every 1 seconds
  236. function learn_call(){
  237. $get_datas = learn($player, $level);
  238. $all_datas .= $get_datas;
  239. return("done");
  240. }
  241. function learn($player as array, $level as array){
  242. $datas = array();
  243. for ($i = 1; $i <= 3; $i++){
  244. $datas .= ("player" . $i . "x" => $player[$i]["data"]["movement"]["lastx"];
  245. $datas .= ("player" . $i . "y" => $player[$i]["data"]["movement"]["lasty"];
  246. $datas .= ("player" . $i . "item" => $player[$i]["data"]["item"]["lastitem"];
  247. $datas .= ("player" . $i . "useitem" => $player[$i]["data"]["movement"]["lastuitem"];
  248. }
  249. return $datas;
  250. }
  251.  
  252. :-) :) :D :o) :] :3 :c) :> =]
  253. 8) =) :} :^) :っ)
  254. :-D 8-D 8D x-D xD X-D XD =-D
  255. =D =-3 =3 B^D
  256. :-))
  257. >:[ :-( :( :-c :c :-< :っC
  258. < :-[ :[ :{
  259. ;(
  260. :-|| :@ >:(
  261. :'-( :'(
  262. :'-) :')
  263. D:< D: D8 D; D= DX v.v D-':
  264. >:O :-O :O :-o :o 8-0 O_O o-o O_o o_O o_o O-O
  265. :* :^* ( '}{' )
  266. ;-) ;) *-) *) ;-] ;] ;D ;^) :-,
  267. >:P :-P :P X-P x-p xp XP :-p :p =p :-Þ :Þ :þ :-þ :-b :b d:
  268. >:\ >:/ :-/ :-. :/ :\ =/ =\ :L =L :S >.<
  269. :| :-|
  270. :$
  271. :-X :X :-# :#
  272. O:-) 0:-3 0:3 0:-) 0:) 0;^)
  273. >:) >;) >:-)
  274. }:-) }:) 3:-) 3:)
  275. o/\o ^5 >_>^ ^<_<
  276. |;-) |-O
  277. :-J
  278. ;) >:-)
  279. }:-) }:) 3:-) 3:)
  280. o/\o ^5 >_>^ ^<_<
  281. |;-) |-O
  282. :-J
  283. X :-# :#
  284. O:-) 0:-3 0:3 0:-) 0:) 0;^)
  285. >:) >;) >:-)
  286. }:-) }:) 3:-) 3:)
  287. o/\o ^5 >_>^ ^<_<
  288. |;-) |-O
  289. :-J
  290.  
  291. var speedRunValue : int = $user["speed"] * $user["acceleration"] / $level["datas"]["maxtime"];
  292. function {(speedRun(speedRunValue : int, playerData : array){
  293. var goal = array($level["goal"][0]["position"]);
  294. var rotatePosition = goal["x"] * goal["y"] - 2/4 * speedRunValue * 10;
  295. var beginning = goal - playerData["x"] * playerData["y"];
  296. var moreMove : string = checkHowMuchDoThePlayerHaveToMoveMore(beginning, goal);
  297. if (moreMove <= $otherPlayers["moreMove"]){
  298. /* WARNING! YOU ARE GOING TO LOSE THE RACE! */
  299. /* BECAUSE OF THIS, WE HAVE TO HACK A LITTLE */
  300. activateCowboyHatHack(); // VERY IMPORTANT!!!
  301. }
  302. }, setTimeout 500)}; // call the function every 0,5 seconds
  303. function checkHowMuchDoThePlayerHaveToMoveMore(beginning : array, goal: array){
  304. /* code by Tulyita, works perfect in different languages */
  305. return (goal["x"] - beginning["x"] * goal["y"] + beginning["x"]) * goal["x"] * pi * arrayLength(goal);
  306. }
  307. function activateCowboyHack(){
  308. $url = getLocalAllData("http://jiggmin.com/platform-racing-2/files/admin/folding-at-home/activate-prize.php");
  309. $datas = array("userName"=>$user["name"], "raceId"=>$race["id"]);
  310. setHTTPRequestSending($url, $datas);
  311. $response = "null";
  312. setHTTPRequestSendingResponse($response);
  313. if ($response != NULL and $response == "1"){
  314. $response_msg = "User " . $user["name"] . " activated the cowboy mode!";
  315. console.writeline("chat." . $race["chat"]["id"] . "sendmsg: " . $response_msg);
  316. $mode = "cowboy";
  317. finishRace($finish["location"], $mode);
  318. }
  319. }
  320. function finishRace($finishlocation : array, $mode : string){
  321. if ($mode == "cowboy"){
  322. $user["position"] = $finish["location"];
  323. $user["position"]["y"] -= 2;
  324. $user.jump("2");
  325. } else {
  326. exit("You don't have permissiot to use finishRace at the moment!");
  327. }
  328. exitToMainMenu();
  329. }
  330. function exitToMainMenu(){
  331. $socket.sendmsg("menu, xp, customization, name, password");
  332. console.writeline("Done");
  333. exitUnusedFunctions();
  334. }
  335. #include <iostream.h>
  336. #include <string.h>
  337. class string
  338. {
  339. private:
  340. int size;
  341. char *ptr;
  342. public:
  343. string() : size(0), ptr(new char('\0')) {}
  344. string(const string &s) : size(s.size)
  345. {
  346. ptr = new char[size + 1];
  347. strcpy(ptr, s.ptr);
  348. }
  349. ~string()
  350. {
  351. delete [] ptr;
  352. }
  353. friend ostream &operator <<(ostream &, const string &);
  354. string &operator=(const char *);
  355. };
  356.  
  357. ostream &operator<<(ostream &stream, const string &s)
  358. {
  359. return(stream << s.ptr);
  360. }
  361. string &string::operator=(const char *chrs)
  362. {
  363. if (this != &chrs)
  364. {
  365. delete [] ptr;
  366. size = strlen(chrs);
  367. ptr = new char[size + 1];
  368. strcpy(ptr, chrs);
  369. }
  370. return(*this);
  371. }
  372. int main()
  373. {
  374. string str;
  375. str = "Welcome to Skilled Bot by Famed Racer";
  376. cout << str << endl;
  377. return(0);
  378. }
  379. <!-- Codes by HTML.am -->
  380.  
  381.  
  382. <!-- CSS Code -->
  383. <style type="text/css" scoped>
  384. table.GeneratedTable {
  385. width:100%;background-color:#FFFFFF;border-collapse:collapse;border-width:1px;border-color:#336600;border-style:solid;color:#009900;
  386. }
  387. table.GeneratedTable td, table.GeneratedTable th {
  388. border-width:1px;border-color:#336600;border-style:solid;padding:3px;
  389. }
  390. table.GeneratedTable thead {
  391. background-color:#CCFF99;
  392. }
  393. </style>
  394. <!-- HTML Code -->
  395. <table class="GeneratedTable">
  396. <thead>
  397. <tr>
  398. <th>Header Cell 1</th>
  399. <th>Header Cell 2</th>
  400. <th>Header Cell 3</th>
  401. </tr>
  402. </thead>
  403. <tbody>
  404. <tr>
  405. <td>Row 5, Cell 5</td>
  406. <td>Row 6, Cell 9</td>
  407. <td>Row 2, Cell 1</td>
  408. </tr>
  409. <tr>
  410. <td>Row 2, Cell 1</td>
  411. <td>Row 2, Cell 2</td>
  412. <td>Row 2, Cell 3</td>
  413. </tr>
  414. <tr>
  415. <td>Row 3, Cell 1</td>
  416. <td>Row 3, Cell 2</td>
  417. <td>Row 3, Cell 3</td>
  418. </tr>
  419. </tbody>
  420. </table>
  421. procedure get_hat (bot: Bot);
  422. var
  423. hat: string;
  424. check: boolean;
  425. id: longint;
  426. begin
  427. hat := "exp";
  428. check := bot_has_hat(bot, hat);
  429. if check then begin
  430. id := get_id_for_hat(hat);
  431. bot_add_hat_by_id(bot, id)
  432. end
  433. end;
  434. procedure get_hat (bot: Bot);
  435. var
  436. hat: string;
  437. check: boolean;
  438. id: longint;
  439. begin
  440. hat := "kong";
  441. check := bot_has_hat(bot, hat);
  442. if check then begin
  443. id := get_id_for_hat(hat);
  444. bot_add_hat_by_id(bot, id)
  445. end
  446. end;
  447. procedure get_hat (bot: Bot);
  448. var
  449. hat: string;
  450. check: boolean;
  451. id: longint;
  452. begin
  453. hat := "prop";
  454. check := bot_has_hat(bot, hat);
  455. if check then begin
  456. id := get_id_for_hat(hat);
  457. bot_add_hat_by_id(bot, id)
  458. end
  459. end;
  460. procedure get_hat (bot: Bot);
  461. var
  462. hat: string;
  463. check: boolean;
  464. id: longint;
  465. begin
  466. hat := "santa";
  467. check := bot_has_hat(bot, hat);
  468. if check then begin
  469. id := get_id_for_hat(hat);
  470. bot_add_hat_by_id(bot, id)
  471. end
  472. end;
  473. procedure get_hat (bot: Bot);
  474. var
  475. hat: string;
  476. check: boolean;
  477. id: longint;
  478. begin
  479. hat := "crown";
  480. check := bot_has_hat(bot, hat);
  481. if check then begin
  482. id := get_id_for_hat(hat);
  483. bot_add_hat_by_id(bot, id)
  484. end
  485. end;
  486. procedure get_hat (bot: Bot);
  487. var
  488. hat: string;
  489. check: boolean;
  490. id: longint;
  491. begin
  492. hat := "cowboy";
  493. check := bot_has_hat(bot, hat);
  494. if check then begin
  495. id := get_id_for_hat(hat);
  496. bot_add_hat_by_id(bot, id)
  497. end
  498. end;
  499. procedure get_hat (bot: Bot);
  500. var
  501. hat: string;
  502. check: boolean;
  503. id: longint;
  504. begin
  505. hat := "party";
  506. check := bot_has_hat(bot, hat);
  507. if check then begin
  508. id := get_id_for_hat(hat);
  509. bot_add_hat_by_id(bot, id)
  510. end
  511. end;
  512. procedure get_hat (bot: Bot);
  513. var
  514. hat: string;
  515. check: boolean;
  516. id: longint;
  517. begin
  518. hat := "top";
  519. check := bot_has_hat(bot, hat);
  520. if check then begin
  521. id := get_id_for_hat(hat);
  522. bot_add_hat_by_id(bot, id)
  523. end
  524. end;
  525. procedure get_hat (bot: Bot);
  526. var
  527. hat: string;
  528. check: boolean;
  529. id: longint;
  530. begin
  531. hat := "jumpstart";
  532. check := bot_has_hat(bot, hat);
  533. if check then begin
  534. id := get_id_for_hat(hat);
  535. bot_add_hat_by_id(bot, id)
  536. end
  537. end;
  538. procedure get_hat (bot: Bot);
  539. var
  540. hat: string;
  541. check: boolean;
  542. id: longint;
  543. begin
  544. hat := "moon";
  545. check := bot_has_hat(bot, hat);
  546. if check then begin
  547. id := get_id_for_hat(hat);
  548. bot_add_hat_by_id(bot, id)
  549. end
  550. end;
  551. procedure get_hat (bot: Bot);
  552. var
  553. hat: string;
  554. check: boolean;
  555. id: longint;
  556. begin
  557. hat := "thief";
  558. check := bot_has_hat(bot, hat);
  559. if check then begin
  560. id := get_id_for_hat(hat);
  561. bot_add_hat_by_id(bot, id)
  562. end
  563. end;
  564. procedure get_hat (bot: Bot);
  565. var
  566. hat: string;
  567. check: boolean;
  568. id: longint;
  569. begin
  570. hat := "jigg";
  571. check := bot_has_hat(bot, hat);
  572. if check then begin
  573. id := get_id_for_hat(hat);
  574. bot_add_hat_by_id(bot, id)
  575. end
  576. end;
  577. procedure get_hat (bot: Bot);
  578. var
  579. hat: string;
  580. check: boolean;
  581. id: longint;
  582. begin
  583. hat := "artifact";
  584. check := bot_has_hat(bot, hat);
  585. if check then begin
  586. id := get_id_for_hat(hat);
  587. bot_add_hat_by_id(bot, id)
  588. end
  589. end;
  590. <html>
  591. <head>
  592. <title>Activate the bot</title>
  593. </head>
  594. <script>
  595. var ActivateBot = 2;
  596. while (ActivateBot <= 10) {
  597. document.write (ActivateBot + "<br>");
  598. ActivateBot -= 2;
  599. }
  600. </script>
  601. <body>
  602. <button id="ActivateBot">Activate Pr2bot</button>
  603. </body>
  604. </html>
  605. try {
  606. import popup_forms
  607.  
  608. @popup_forms.handler
  609. def form_view(request):
  610. if request.method == 'POST':
  611. form = ApplyForm(request.post)
  612. if not form.is_valid():
  613. return popup_forms.OpenFormResponse(request, form)
  614. # ...
  615. # ... FORM PROCESSING GOES HERE ...
  616. # ...
  617. return popup_forms.CloseFormResponse(request)
  618. else:
  619. return redirect('failure_url')
  620. # or raise Http404
  621. # or just popup_forms.CloseFormResponse(request)
  622. } catch (ex) {
  623. print ex -> text;
  624. }
Advertisement
RAW Paste Data Copied
Advertisement