<turbo-stream action="append" target="posts_list"><template>    <div class="postbit" id="13824" data-post-id="13824">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="Hal9000" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/Hal9000/120/1915_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  Hal9000
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>I had trouble merging somehow. Couldn’t figure out how to resolve conflict manually.</p>
<p>Not sure what state this is in now.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="13824" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/porting-code-example-ruby-to-elixir/2148/22">Post #21</a>
	                </div>
	            </div>
              <div id="likers-container-13824" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="13824"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #21"></div>
  </section>
</div>
    <div class="postbit" id="13844" data-post-id="13844">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="Eiji" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/Eiji/120/36743_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  Eiji
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="Hal9000" data-post="22" data-topic="2148">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/hal9000/48/1915_2.png" class="avatar"> Hal9000:</div>
<blockquote>
<p>Not sure what state this is in now.</p>
</blockquote>
</aside>
<p>You can delete file that have conflict. In my commit this file is deleted.<br>
Try:</p>
<blockquote>
<p>git rm vexil/lib/referee.ex</p>
</blockquote>
<p>and push changes in your shell and then try submit PR.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="13844" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/porting-code-example-ruby-to-elixir/2148/23">Post #22</a>
	                </div>
	            </div>
              <div id="likers-container-13844" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="13844"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #22"></div>
  </section>
</div>
    <div class="postbit" id="13936" data-post-id="13936">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="Eiji" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/Eiji/120/36743_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  Eiji
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>I added PR with merge commit and now there are no conflicts with your master branch.<br>
Any questions for my code? Something is hard to interpreting?</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="13936" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/porting-code-example-ruby-to-elixir/2148/24">Post #23</a>
	                </div>
	            </div>
              <div id="likers-container-13936" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="13936"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #23"></div>
  </section>
</div>
    <div class="postbit" id="14420" data-post-id="14420">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="Eiji" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/Eiji/120/36743_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  Eiji
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Heh, finally my PR is accepted. <img src="https://forum.elixirforum.com/images/emoji/apple/smile.png?v=15" title=":smile:" class="emoji" alt=":smile:" loading="lazy" width="20" height="20"><br>
Before I begin work on AI I want to be sure:<br>
Do you understand all from my code?<br>
Whether the code is clear and intuitive for you?<br>
I’m not sure how much implement AI could take for me, but I think I finish it by the end of next week.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="14420" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/porting-code-example-ruby-to-elixir/2148/25">Post #24</a>
	                </div>
	            </div>
              <div id="likers-container-14420" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="14420"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #24"></div>
  </section>
</div>
    <div class="postbit" id="14444" data-post-id="14444">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="Hal9000" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/Hal9000/120/1915_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  Hal9000
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>I don’t understand it all yet. I will look at it tonight after I leave work<br>
and will ask questions.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="14444" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/porting-code-example-ruby-to-elixir/2148/26">Post #25</a>
	                </div>
	            </div>
              <div id="likers-container-14444" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="14444"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #25"></div>
  </section>
</div>
    <div class="postbit" id="14673" data-post-id="14673">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="Hal9000" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/Hal9000/120/1915_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  Hal9000
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Sorry, very busy week here.</p>
<p>So far:</p>
<ol>
<li>
<p>In mix.exs - why escript, build_embedded, start_permanent ?</p>
</li>
<li>
<p>In config.exs - why “coral” etc.?</p>
</li>
<li>
<p>Any reason Battleground shouldn’t be just Grid?</p>
</li>
<li>
<p>Uncertain how ai will work.</p>
</li>
<li>
<p>Are you distinguishing between color and team_color? Why?</p>
</li>
<li>
<p>Does Agent really buy us much here?</p>
</li>
<li>
<p>I don’t understand what you’ve done in battleground.ex – is the complexity really needed?</p>
</li>
<li>
<p>I don’t understand all the “edge/corner” stuff in bot_utils and elsewhere.</p>
</li>
</ol> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="14673" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/porting-code-example-ruby-to-elixir/2148/27">Post #26</a>
	                </div>
	            </div>
              <div id="likers-container-14673" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="14673"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #26"></div>
  </section>
</div>
    <div class="postbit" id="14681" data-post-id="14681">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="Eiji" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/Eiji/120/36743_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  Eiji
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="Hal9000" data-post="27" data-topic="2148">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/hal9000/48/1915_2.png" class="avatar"> Hal9000:</div>
<blockquote>
<p>Sorry, very busy week here.</p>
</blockquote>
</aside>
<p>It’s not a problem for me, but If it’s possible wrote about when you will have a time for this project, so I do not need wait and I can better manage my time.</p>
<p>My English is not good, but I will try answer your questions:</p>
<aside class="quote no-group" data-username="Hal9000" data-post="27" data-topic="2148">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/hal9000/48/1915_2.png" class="avatar"> Hal9000:</div>
<blockquote>
<p>In mix.exs - why escript, build_embedded, start_permanent ?</p>
</blockquote>
</aside>
<p><code>escript</code> - read <a href="http://asquera.de/blog/2015-04-10/writing-a-commandline-app-in-elixir/" rel="noopener nofollow ugc">this</a> tutorial<br>
rest is generated by <code>mix new vexil</code> command</p>
<aside class="quote no-group" data-username="Hal9000" data-post="27" data-topic="2148">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/hal9000/48/1915_2.png" class="avatar"> Hal9000:</div>
<blockquote>
<p>In config.exs - why “coral” etc.?</p>
</blockquote>
</aside>
<p>It’s predefined color name. See <a href="https://github.com/rrrene/bunt" rel="noopener nofollow ugc">bunt</a> dependency github project.</p>
<aside class="quote no-group" data-username="Hal9000" data-post="27" data-topic="2148">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/hal9000/48/1915_2.png" class="avatar"> Hal9000:</div>
<blockquote>
<p>Any reason Battleground shouldn’t be just Grid?</p>
</blockquote>
</aside>
<p>No, when I wrote this code I had <code>Grid</code> struct (so I found another name for this module), but after some changes this struct was not needed. But now I think it’s much more cleaner, because <code>Battleground</code> generate <code>grid</code> and have methods for read and write to it. Of course I can send PR with changed module name if you wwant.</p>
<aside class="quote no-group" data-username="Hal9000" data-post="27" data-topic="2148">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/hal9000/48/1915_2.png" class="avatar"> Hal9000:</div>
<blockquote>
<p>Uncertain how ai will work.</p>
</blockquote>
</aside>
<p>AI as a separated Erlang process will decide what to do.<br>
It will ask <code>Battleground</code> module if it can do something and depends on results it will call <code>Battleground</code> to apply AI decision (for example because AI - here bot - see only cells in specific range, think about <code>Battleground</code> as game engine).</p>
<aside class="quote no-group" data-username="Hal9000" data-post="27" data-topic="2148">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/hal9000/48/1915_2.png" class="avatar"> Hal9000:</div>
<blockquote>
<p>Are you distinguishing between color and team_color? Why?</p>
</blockquote>
</aside>
<p><strong>Note</strong>: color should be unique for all teams.<br>
Database naming convention for example in simple blog we have:</p>
<ol>
<li><code>Post</code> with <code>title</code>, <code>body</code> and <code>id</code></li>
<li><code>Comment</code> with <code>user_name</code>, <code>body</code> and <strong>post_id</strong>.</li>
</ol>
<p>So <code>Team</code> has <code>color</code> (like <code>id</code>) and <code>Bot</code> has <code>team_color</code> (like <code>team_id</code>).</p>
<aside class="quote no-group" data-username="Hal9000" data-post="27" data-topic="2148">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/hal9000/48/1915_2.png" class="avatar"> Hal9000:</div>
<blockquote>
<p>Does Agent really buy us much here?</p>
</blockquote>
</aside>
<p>I use <code>Agent</code> to store game data. In previous (not pushed) version I don’t have <code>Agent</code> and I was need to pass more arguments. For example see where I read <code>map_last_index</code>. In previous version I need to pass it in lots of functions. I think it’s much more easier to read when we read game data from <code>Agent</code>.</p>
<aside class="quote no-group" data-username="Hal9000" data-post="27" data-topic="2148">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/hal9000/48/1915_2.png" class="avatar"> Hal9000:</div>
<blockquote>
<p>I don’t understand what you’ve done in battleground.ex – is the complexity really needed?</p>
</blockquote>
</aside>
<p>What do you exactly mean?<br>
I added code to make it configurable, so you can easily setup game rules, for example <code>Bot</code> types and their count.<br>
I think it’s much more easier to modify this code without completely rewrite “<em>game engine</em>”.<br>
Do you know <code>M.U.G.E.N</code>? It was really configurable. Anybody could add new characters, backgrounds, music and lots more. Lots of fans from lots of communities used this to create own games with for example: characters from other game.<br>
I think project like it (but much more simpler - your vexil) should be configurable too. You can add some exercises to implement new features without need to write new game.<br>
Also I read your code in <code>Ruby</code> and my configuration and it’s implementation is based on <code>setup</code> method in <code>Referee</code> class.This method have statically selected data and I split it to  configuration (<code>config.exs</code>) and implementation (<code>Battleground</code> and it’s utils). See how I place bots based on their number.<br>
Do you agree with me?</p>
<aside class="quote no-group" data-username="Hal9000" data-post="27" data-topic="2148">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/hal9000/48/1915_2.png" class="avatar"> Hal9000:</div>
<blockquote>
<p>I don’t understand all the “edge/corner” stuff in bot_utils and elsewhere.</p>
</blockquote>
</aside>
<p><code>start_edge</code> from <code>config.exs</code> is based on your <code>setup</code> method.</p>
<pre data-code-wrap="ruby"><code class="lang-ruby"># I translated it like:
# Defender count is: 3
# if the rest of the division bot count (from configuration) by 2 is 1
# place bot exactly at `start_edge` corner
place(team, Defender, 5, 5)
place(team, Defender, 5, rand(1..4)) # `start_edge` for `defender` is 5
place(team, Defender, rand(1..4), 5) # same here
</code></pre>
<p><code>corner</code> is from <code>Team</code> struct and it’s randomly selected - see <code>&amp;Vexil.Battleground.TeamUtils.random_corner/1</code> method.</p>
<p><strong>Note</strong>: in configuration I use “<em>human</em>” numbers (people count from 1) and translate it to <code>List</code> index (computers count from 0). So when <code>start_edge</code> is 5 I place bots on 4th index random cell (half on X edge and half on Y edge).</p>
<p>Do you have any more questions?</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="14681" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/porting-code-example-ruby-to-elixir/2148/28">Post #27</a>
	                </div>
	            </div>
              <div id="likers-container-14681" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="14681"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-last-post cat-last-post" title="Last post!"></div>
  </section>
</div>
</template></turbo-stream><turbo-stream action="replace" target="load-more-container"><template><div id="load-more-container" class="load-more-container">
    <span class="all-loaded">— All posts loaded —</span>
</div></template></turbo-stream>