{"id":982,"date":"2019-10-04T13:14:08","date_gmt":"2019-10-04T08:14:08","guid":{"rendered":"https:\/\/www.edopedia.com\/blog\/?p=982"},"modified":"2022-02-26T01:51:48","modified_gmt":"2022-02-25T20:51:48","slug":"javascript-code-plays-google-dinosaur-t-rex-game-automatically","status":"publish","type":"post","link":"https:\/\/www.edopedia.com\/blog\/javascript-code-plays-google-dinosaur-t-rex-game-automatically\/","title":{"rendered":"JavaScript Code Plays Google Dinosaur\/T-Rex Game Automatically"},"content":{"rendered":"\n<p>Have you ever played <strong>Google Dinosaur\/T-Rex Game<\/strong> in chrome? I hope you did, whenever your internet goes down.<\/p>\n\n\n\n<p>To be honest, it&#8217;s a really addicting game that keeps you busy while Google Chrome continuously tries (behind the scenes) to get the connection back on your computer, tablet or even mobile.<\/p>\n\n\n\n<p>The sole purpose of writing this article is to give you some <strong>JavaScript code<\/strong> that automatically plays <strong>Google Dinosaur\/T-Rex Game<\/strong> for you. So, you just have to press the play button and relax!<\/p>\n\n\n\n<p>Below is the step by step process on how you can <strong><em>automate Google Dinosaur\/T-Rex <a href=\"https:\/\/www.edopedia.com\/blog\/open-source-html5-and-javascript-games\/\">Game Using JavaScript<\/a><\/em><\/strong>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 1:-<\/h2>\n\n\n\n<p>Open <strong>Google Chrome<\/strong> in your computer.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 2:-<\/h2>\n\n\n\n<p>Now enter <strong>chrome:\/\/dino\/<\/strong> in the URL address bar and press <strong>&#8220;Enter&#8221;<\/strong>. Or simply disconnect your internet and try to visit any website. After performing this step you will see the Google Dinosaur\/T-Rex Game.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"700\" height=\"373\" src=\"https:\/\/www.edopedia.com\/blog\/wp-content\/uploads\/2019\/10\/google_dinosaur_t_rex_game_700.jpg\" alt=\"Google Dinosaur\/T-Rex Game\" class=\"wp-image-991\" srcset=\"https:\/\/www.edopedia.com\/blog\/wp-content\/uploads\/2019\/10\/google_dinosaur_t_rex_game_700.jpg 700w, https:\/\/www.edopedia.com\/blog\/wp-content\/uploads\/2019\/10\/google_dinosaur_t_rex_game_700-300x160.jpg 300w\" sizes=\"auto, (max-width: 700px) 100vw, 700px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Step 3:-<\/h2>\n\n\n\n<p>Press <strong>&#8220;F12&#8221;<\/strong> on your keyboard. It will open a new window\/box on your screen. You need to click the <strong>&#8220;Console&#8221;<\/strong> button\/tab on this new window.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"700\" height=\"373\" src=\"https:\/\/www.edopedia.com\/blog\/wp-content\/uploads\/2019\/10\/google_chrome_devtools_console_700.jpg\" alt=\"Google Chrome DevTools Console\" class=\"wp-image-993\" srcset=\"https:\/\/www.edopedia.com\/blog\/wp-content\/uploads\/2019\/10\/google_chrome_devtools_console_700.jpg 700w, https:\/\/www.edopedia.com\/blog\/wp-content\/uploads\/2019\/10\/google_chrome_devtools_console_700-300x160.jpg 300w\" sizes=\"auto, (max-width: 700px) 100vw, 700px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Step 4:-<\/h2>\n\n\n\n<p>It&#8217;s time to add some code here.<\/p>\n\n\n\n<p>Just copy the code given below and paste it inside the <strong>&#8220;Console&#8221;<\/strong> window. After that press <strong>&#8220;Enter&#8221;<\/strong>.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"js\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">function keyDown(e){Podium={};var n=document.createEvent(\"KeyboardEvent\");Object.defineProperty(n,\"keyCode\",{get:function(){return this.keyCodeVal}}),n.initKeyboardEvent?n.initKeyboardEvent(\"keydown\",!0,!0,document.defaultView,e,e,\"\",\"\",!1,\"\"):n.initKeyEvent(\"keydown\",!0,!0,document.defaultView,!1,!1,!1,!1,e,0),n.keyCodeVal=e,document.body.dispatchEvent(n)}function keyUp(e){Podium={};var n=document.createEvent(\"KeyboardEvent\");Object.defineProperty(n,\"keyCode\",{get:function(){return this.keyCodeVal}}),n.initKeyboardEvent?n.initKeyboardEvent(\"keyup\",!0,!0,document.defaultView,e,e,\"\",\"\",!1,\"\"):n.initKeyEvent(\"keyup\",!0,!0,document.defaultView,!1,!1,!1,!1,e,0),n.keyCodeVal=e,document.body.dispatchEvent(n)}setInterval(function(){Runner.instance_.horizon.obstacles.length>0&amp;&amp;(Runner.instance_.horizon.obstacles[0].xPos&lt;25*Runner.instance_.currentSpeed-Runner.instance_.horizon.obstacles[0].width\/2&amp;&amp;Runner.instance_.horizon.obstacles[0].yPos>75&amp;&amp;(keyUp(40),keyDown(38)),Runner.instance_.horizon.obstacles[0].xPos&lt;30*Runner.instance_.currentSpeed-Runner.instance_.horizon.obstacles[0].width\/2&amp;&amp;Runner.instance_.horizon.obstacles[0].yPos&lt;=75&amp;&amp;keyDown(40))},5);<\/pre>\n\n\n\n<p><strong>Screenshot<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"700\" height=\"373\" src=\"https:\/\/www.edopedia.com\/blog\/wp-content\/uploads\/2019\/10\/javascript_code_that_automatically_plays_google_dinosaur_t_rex_game_700.jpg\" alt=\"JavaScript code that automatically plays Google Dinosaur\/T-Rex Game\" class=\"wp-image-995\" srcset=\"https:\/\/www.edopedia.com\/blog\/wp-content\/uploads\/2019\/10\/javascript_code_that_automatically_plays_google_dinosaur_t_rex_game_700.jpg 700w, https:\/\/www.edopedia.com\/blog\/wp-content\/uploads\/2019\/10\/javascript_code_that_automatically_plays_google_dinosaur_t_rex_game_700-300x160.jpg 300w\" sizes=\"auto, (max-width: 700px) 100vw, 700px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Step 5:-<\/h2>\n\n\n\n<p>Start the game by pressing <strong>&#8220;Space&#8221;<\/strong> or <strong>&#8220;Up Arrow&#8221;<\/strong> key.<\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p>Now its time for the code to show some magic.<\/p>\n\n\n\n<p>Basically after applying the code our dinosaur will be smart enough to do auto jumps or lay down according to the situation.<\/p>\n\n\n\n<p>A great thing about this code is that it will work correctly during night phase also.<\/p>\n\n\n\n<p>I hope you enjoyed this blog post. Feel free to leave your suggestions or reactions in the comments down below.<\/p>\n\n\n\n<p>By the way, isn&#8217;t it interesting enough to share it with your friends and family members?<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Have you ever played Google Dinosaur\/T-Rex Game in chrome? I hope you did, whenever your internet goes down. To be honest, it&#8217;s a really addicting game that keeps you busy while Google Chrome continuously tries (behind the scenes) to get the connection back on your computer, tablet or even mobile. The sole purpose of writing &#8230; <a title=\"JavaScript Code Plays Google Dinosaur\/T-Rex Game Automatically\" class=\"read-more\" href=\"https:\/\/www.edopedia.com\/blog\/javascript-code-plays-google-dinosaur-t-rex-game-automatically\/\" aria-label=\"Read more about JavaScript Code Plays Google Dinosaur\/T-Rex Game Automatically\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":988,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[112],"tags":[],"class_list":["post-982","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tutorials"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>JavaScript Code Plays Google Dinosaur\/T-Rex Game Automatically<\/title>\n<meta name=\"description\" content=\"Have you ever played Google Dinosaur\/T-Rex Game in chrome? I hope you did, whenever your internet goes down. To be honest, it&#039;s a really addicting game\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.edopedia.com\/blog\/javascript-code-plays-google-dinosaur-t-rex-game-automatically\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"JavaScript Code Plays Google Dinosaur\/T-Rex Game Automatically\" \/>\n<meta property=\"og:description\" content=\"Have you ever played Google Dinosaur\/T-Rex Game in chrome? I hope you did, whenever your internet goes down. To be honest, it&#039;s a really addicting game\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.edopedia.com\/blog\/javascript-code-plays-google-dinosaur-t-rex-game-automatically\/\" \/>\n<meta property=\"og:site_name\" content=\"Edopedia\" \/>\n<meta property=\"article:author\" content=\"trulyfurqan\" \/>\n<meta property=\"article:published_time\" content=\"2019-10-04T08:14:08+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-02-25T20:51:48+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.edopedia.com\/blog\/wp-content\/uploads\/2019\/10\/post_image_1_1.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"880\" \/>\n\t<meta property=\"og:image:height\" content=\"495\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Furqan\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Furqan\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"JavaScript Code Plays Google Dinosaur\/T-Rex Game Automatically","description":"Have you ever played Google Dinosaur\/T-Rex Game in chrome? I hope you did, whenever your internet goes down. To be honest, it's a really addicting game","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.edopedia.com\/blog\/javascript-code-plays-google-dinosaur-t-rex-game-automatically\/","og_locale":"en_US","og_type":"article","og_title":"JavaScript Code Plays Google Dinosaur\/T-Rex Game Automatically","og_description":"Have you ever played Google Dinosaur\/T-Rex Game in chrome? I hope you did, whenever your internet goes down. To be honest, it's a really addicting game","og_url":"https:\/\/www.edopedia.com\/blog\/javascript-code-plays-google-dinosaur-t-rex-game-automatically\/","og_site_name":"Edopedia","article_author":"trulyfurqan","article_published_time":"2019-10-04T08:14:08+00:00","article_modified_time":"2022-02-25T20:51:48+00:00","og_image":[{"width":880,"height":495,"url":"https:\/\/www.edopedia.com\/blog\/wp-content\/uploads\/2019\/10\/post_image_1_1.jpg","type":"image\/jpeg"}],"author":"Furqan","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Furqan","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.edopedia.com\/blog\/javascript-code-plays-google-dinosaur-t-rex-game-automatically\/#article","isPartOf":{"@id":"https:\/\/www.edopedia.com\/blog\/javascript-code-plays-google-dinosaur-t-rex-game-automatically\/"},"author":{"name":"Furqan","@id":"https:\/\/www.edopedia.com\/blog\/#\/schema\/person\/3951cb19e3aa56df09e408c98aa02339"},"headline":"JavaScript Code Plays Google Dinosaur\/T-Rex Game Automatically","datePublished":"2019-10-04T08:14:08+00:00","dateModified":"2022-02-25T20:51:48+00:00","mainEntityOfPage":{"@id":"https:\/\/www.edopedia.com\/blog\/javascript-code-plays-google-dinosaur-t-rex-game-automatically\/"},"wordCount":308,"commentCount":15,"publisher":{"@id":"https:\/\/www.edopedia.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.edopedia.com\/blog\/javascript-code-plays-google-dinosaur-t-rex-game-automatically\/#primaryimage"},"thumbnailUrl":"https:\/\/www.edopedia.com\/blog\/wp-content\/uploads\/2019\/10\/post_image_1_1.jpg","articleSection":["Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.edopedia.com\/blog\/javascript-code-plays-google-dinosaur-t-rex-game-automatically\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.edopedia.com\/blog\/javascript-code-plays-google-dinosaur-t-rex-game-automatically\/","url":"https:\/\/www.edopedia.com\/blog\/javascript-code-plays-google-dinosaur-t-rex-game-automatically\/","name":"JavaScript Code Plays Google Dinosaur\/T-Rex Game Automatically","isPartOf":{"@id":"https:\/\/www.edopedia.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.edopedia.com\/blog\/javascript-code-plays-google-dinosaur-t-rex-game-automatically\/#primaryimage"},"image":{"@id":"https:\/\/www.edopedia.com\/blog\/javascript-code-plays-google-dinosaur-t-rex-game-automatically\/#primaryimage"},"thumbnailUrl":"https:\/\/www.edopedia.com\/blog\/wp-content\/uploads\/2019\/10\/post_image_1_1.jpg","datePublished":"2019-10-04T08:14:08+00:00","dateModified":"2022-02-25T20:51:48+00:00","description":"Have you ever played Google Dinosaur\/T-Rex Game in chrome? I hope you did, whenever your internet goes down. To be honest, it's a really addicting game","breadcrumb":{"@id":"https:\/\/www.edopedia.com\/blog\/javascript-code-plays-google-dinosaur-t-rex-game-automatically\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.edopedia.com\/blog\/javascript-code-plays-google-dinosaur-t-rex-game-automatically\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.edopedia.com\/blog\/javascript-code-plays-google-dinosaur-t-rex-game-automatically\/#primaryimage","url":"https:\/\/www.edopedia.com\/blog\/wp-content\/uploads\/2019\/10\/post_image_1_1.jpg","contentUrl":"https:\/\/www.edopedia.com\/blog\/wp-content\/uploads\/2019\/10\/post_image_1_1.jpg","width":880,"height":495,"caption":"JavaScript Code Plays Google Dinosaur\/T-Rex Game Automatically"},{"@type":"BreadcrumbList","@id":"https:\/\/www.edopedia.com\/blog\/javascript-code-plays-google-dinosaur-t-rex-game-automatically\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.edopedia.com\/blog\/"},{"@type":"ListItem","position":2,"name":"JavaScript Code Plays Google Dinosaur\/T-Rex Game Automatically"}]},{"@type":"WebSite","@id":"https:\/\/www.edopedia.com\/blog\/#website","url":"https:\/\/www.edopedia.com\/blog\/","name":"Edopedia","description":"Coding\/Programming Blog","publisher":{"@id":"https:\/\/www.edopedia.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.edopedia.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.edopedia.com\/blog\/#organization","name":"Edopedia","url":"https:\/\/www.edopedia.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.edopedia.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.edopedia.com\/blog\/wp-content\/uploads\/2017\/10\/edopedia_icon_text_10.jpg","contentUrl":"https:\/\/www.edopedia.com\/blog\/wp-content\/uploads\/2017\/10\/edopedia_icon_text_10.jpg","width":400,"height":100,"caption":"Edopedia"},"image":{"@id":"https:\/\/www.edopedia.com\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.edopedia.com\/blog\/#\/schema\/person\/3951cb19e3aa56df09e408c98aa02339","name":"Furqan","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/e5e68aef3ad8f0b83d56f4953c512c8e57bd2e6dc64daec33b5d0495d9058f51?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/e5e68aef3ad8f0b83d56f4953c512c8e57bd2e6dc64daec33b5d0495d9058f51?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/e5e68aef3ad8f0b83d56f4953c512c8e57bd2e6dc64daec33b5d0495d9058f51?s=96&d=mm&r=g","caption":"Furqan"},"description":"Well. I've been working for the past three years as a web designer and developer. I have successfully created websites for small to medium sized companies as part of my freelance career. During that time I've also completed my bachelor's in Information Technology.","sameAs":["http:\/\/www.edopedia.com\/blog\/","trulyfurqan"],"url":"https:\/\/www.edopedia.com\/blog\/author\/furqan\/"}]}},"_links":{"self":[{"href":"https:\/\/www.edopedia.com\/blog\/wp-json\/wp\/v2\/posts\/982","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.edopedia.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.edopedia.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.edopedia.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.edopedia.com\/blog\/wp-json\/wp\/v2\/comments?post=982"}],"version-history":[{"count":0,"href":"https:\/\/www.edopedia.com\/blog\/wp-json\/wp\/v2\/posts\/982\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.edopedia.com\/blog\/wp-json\/wp\/v2\/media\/988"}],"wp:attachment":[{"href":"https:\/\/www.edopedia.com\/blog\/wp-json\/wp\/v2\/media?parent=982"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.edopedia.com\/blog\/wp-json\/wp\/v2\/categories?post=982"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.edopedia.com\/blog\/wp-json\/wp\/v2\/tags?post=982"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}