<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Evan Meidell</title>
    <description>The latest articles on DEV Community by Evan Meidell (@evanmeidell).</description>
    <link>https://dev.to/evanmeidell</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F188951%2Fcbac3243-2815-404d-8be5-e52b1899bcd4.jpeg</url>
      <title>DEV Community: Evan Meidell</title>
      <link>https://dev.to/evanmeidell</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/evanmeidell"/>
    <language>en</language>
    <item>
      <title>What Algorithm am I looking for?</title>
      <dc:creator>Evan Meidell</dc:creator>
      <pubDate>Wed, 18 Oct 2023 03:43:09 +0000</pubDate>
      <link>https://dev.to/evanmeidell/what-algorithm-am-i-looking-for-2g0h</link>
      <guid>https://dev.to/evanmeidell/what-algorithm-am-i-looking-for-2g0h</guid>
      <description>&lt;p&gt;I was playing with my 3 year old today with some toys that he quite likes and it exposed a gap in my understanding. How does track auto completion work in games like Rollercoaster Tycoon? If I wanted to input a collection of track pieces how would you build the algorithm to build a 'valid' track? These &lt;a href="https://drivenbybattat.com/product/pocket-build-a-city-140pc/"&gt;Driven toy cars and tracks&lt;/a&gt; have up and down roads so assuming we don't include those(remove 3d space) where do you begin?&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;track&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;tileSize&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;straight&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;avilableConnections&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;male&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;female&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Assuming we only have straight, 90 degree turn, T intersection, and 4 way intersections seems like it shouldn't be too hard.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Place random piece.&lt;/li&gt;
&lt;li&gt;From first available connection get random piece that can connect.&lt;/li&gt;
&lt;li&gt;Repeat until 'T' or '4-way' intersections are given. Track in state an additional 'available connection'.&lt;/li&gt;
&lt;li&gt;Start looping through available connections and random pieces?&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This is where I start to break down. As a bootcamp grad I never spent any time learning algorithms. At some point I need to run a 'pathfinding' algorithm to complete the track but how do I run that while expanding the road? I want to use as many of the pieces as I can.&lt;/p&gt;

</description>
      <category>programming</category>
      <category>discuss</category>
      <category>learning</category>
    </item>
  </channel>
</rss>
