[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-games-devel
Subject:    Re: [Kde-games-devel] Review Request 114845: [knavalbattle] utilties for the several ships patch
From:       "Roney Gomes" <roney477 () gmail ! com>
Date:       2014-01-15 11:52:32
Message-ID: 20140115115232.14108.2897 () probe ! kde ! org
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/114845/#review47433
-----------------------------------------------------------



src/battlefield.cpp
<https://git.reviewboard.kde.org/r/114845/#comment33735>

    Would you mind to put this code in a private method? Preferably with some meaningful name \
like setUpSecondaryBoard() or something like this.



src/battlefield.cpp
<https://git.reviewboard.kde.org/r/114845/#comment33736>

    The two structures above should be also split into smaller methods.
    
    One method to take care of adding a ship to the secondary board and a second one \
responsible for adding the borders.



src/battlefield.cpp
<https://git.reviewboard.kde.org/r/114845/#comment33737>

    I see here that you're testing for both horizontal and vertical availability, which -- once \
again -- could also be split into smaller methods. One for each case.  
    You also decided to check horizontal availability first. Any reason for this or the order \
doesn't matter at all?  
    How the AI would know in which direction it should place the new ship?


- Roney Gomes


On Jan. 4, 2014, 9:57 a.m., Jaime Torres Amate wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/114845/
> -----------------------------------------------------------
> 
> (Updated Jan. 4, 2014, 9:57 a.m.)
> 
> 
> Review request for KDE Games and Roney Gomes.
> 
> 
> Repository: knavalbattle
> 
> 
> Description
> -------
> 
> These are the tools I use to check if a ship can be placed in the board or if the user/AI \
> should start again. Also, it serves me to split a big patch into smaller pieces.
> How it is done:
> * Pass the parameter allow adjacent ships also to the BattleField.
> * Implement a bool canAddShipOfSize(size). When a ship of size size can not be placed, then \
>                 the AI or the player should start again (what I'm working on) or an Undo.
> * Implement a clear() to be able to start again
> * In the battleField also add another hidden board with the cells having only two status \
> (free, busy) to be able to know the availability of the cells. It is easier for me in this \
> way than the other way (sending a signal to clear the ship borders when the shooting starts). \
>  
> Diffs
> -----
> 
> src/battlefield.h b2f30bc 
> src/battlefield.cpp 6467d8c 
> src/sea.h 4af50b7 
> src/sea.cpp 38ab8b5 
> 
> Diff: https://git.reviewboard.kde.org/r/114845/diff/
> 
> 
> Testing
> -------
> 
> It detects the blocked boards (played much more games than I wanted to implement the restart \
> placing ships). 
> 
> Thanks,
> 
> Jaime Torres Amate
> 
> 


[Attachment #5 (text/html)]

<html>
 <body>
  <div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
   <table bgcolor="#f9f3c9" width="100%" cellpadding="8" style="border: 1px #c9c399 solid;">
    <tr>
     <td>
      This is an automatically generated e-mail. To reply, visit:
      <a href="https://git.reviewboard.kde.org/r/114845/">https://git.reviewboard.kde.org/r/114845/</a>
  </td>
    </tr>
   </table>
   <br />











<div>




<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; \
border-collapse: collapse; margin: 2px padding: 2px;">  <thead>
  <tr>
   <th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; font-size: 9pt; \
padding: 4px 8px; text-align: left;">  <a \
href="https://git.reviewboard.kde.org/r/114845/diff/2/?file=229803#file229803line30" \
style="color: black; font-weight: bold; text-decoration: underline;">src/battlefield.cpp</a>  \
<span style="font-weight: normal;">

     (Diff revision 2)

    </span>
   </th>
  </tr>
 </thead>

 <tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
  <tr>

   <td colspan="2"><pre style="font-size: 8pt; line-height: 140%; margin: 0; \
">BattleField::~BattleField()</pre></td>  <td colspan="2"><pre style="font-size: 8pt; \
line-height: 140%; margin: 0; "></pre></td>

  </tr>
 </tbody>



 
 

 <tbody>

  <tr>
    <th bgcolor="#f0f0f0" style="border-right: 1px solid #C0C0C0;" align="right"><font \
size="2">23</font></th>  <td bgcolor="#ffffff" width="50%"><pre style="font-size: 8pt; \
line-height: 140%; margin: 0; "><span class="p">}</span></pre></td>  <th bgcolor="#f0f0f0" \
style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font \
size="2">30</font></th>  <td bgcolor="#ffffff" width="50%"><pre style="font-size: 8pt; \
line-height: 140%; margin: 0; "><span class="p">}</span></pre></td>  </tr>

 </tbody>

</table>

<pre style="margin-left: 2em; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Would you mind to put this code in \
a private method? Preferably with some meaningful name like setUpSecondaryBoard() or something \
like this.</pre> </div>
<br />

<div>




<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; \
border-collapse: collapse; margin: 2px padding: 2px;">  <thead>
  <tr>
   <th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; font-size: 9pt; \
padding: 4px 8px; text-align: left;">  <a \
href="https://git.reviewboard.kde.org/r/114845/diff/2/?file=229803#file229803line107" \
style="color: black; font-weight: bold; text-decoration: underline;">src/battlefield.cpp</a>  \
<span style="font-weight: normal;">

     (Diff revision 2)

    </span>
   </th>
  </tr>
 </thead>

 <tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
  <tr>

   <td colspan="4"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">void \
BattleField::add(Ship* ship)</pre></td>

  </tr>
 </tbody>



 
 

 <tbody>

  <tr>
    <th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" align="right"><font \
size="2"></font></th>  <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; \
line-height: 140%; margin: 0; "></pre></td>  <th bgcolor="#b1ebb0" style="border-left: 1px \
solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">100</font></th>  \
<td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">  \
<span class="p">}</span></pre></td>  </tr>

 </tbody>

</table>

<pre style="margin-left: 2em; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">The two structures above should be \
also split into smaller methods.

One method to take care of adding a ship to the secondary board and a second one responsible \
for adding the borders.</pre> </div>
<br />

<div>




<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; \
border-collapse: collapse; margin: 2px padding: 2px;">  <thead>
  <tr>
   <th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; font-size: 9pt; \
padding: 4px 8px; text-align: left;">  <a \
href="https://git.reviewboard.kde.org/r/114845/diff/2/?file=229803#file229803line213" \
style="color: black; font-weight: bold; text-decoration: underline;">src/battlefield.cpp</a>  \
<span style="font-weight: normal;">

     (Diff revision 2)

    </span>
   </th>
  </tr>
 </thead>



 
 

 <tbody>

  <tr>
    <th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" align="right"><font \
size="2"></font></th>  <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; \
line-height: 140%; margin: 0; "></pre></td>  <th bgcolor="#b1ebb0" style="border-left: 1px \
solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">206</font></th>  \
<td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; \
"></pre></td>  </tr>

 </tbody>

</table>

<pre style="margin-left: 2em; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">I see here that you&#39;re testing \
for both horizontal and vertical availability, which -- once again -- could also be split into \
smaller methods. One for each case.

You also decided to check horizontal availability first. Any reason for this or the order \
doesn&#39;t matter at all?

How the AI would know in which direction it should place the new ship?</pre>
</div>
<br />



<p>- Roney Gomes</p>


<br />
<p>On January 4th, 2014, 9:57 a.m. UTC, Jaime Torres Amate wrote:</p>








<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" style="background-image: \
url('https://git.reviewboard.kde.org/static/rb/images/review_request_box_top_bg.ab6f3b1072c9.png'); \
background-position: left top; background-repeat: repeat-x; border: 1px black solid;">  <tr>
  <td>

<div>Review request for KDE Games and Roney Gomes.</div>
<div>By Jaime Torres Amate.</div>


<p style="color: grey;"><i>Updated Jan. 4, 2014, 9:57 a.m.</i></p>









<div style="margin-top: 1.5em;">
 <b style="color: #575012; font-size: 10pt;">Repository: </b>
knavalbattle
</div>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
 <table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px \
solid #b8b5a0">  <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; \
white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">These are the tools I \
use to check if a ship can be placed in the board or if the user/AI should start again. Also, \
it serves me to split a big patch into smaller pieces. How it is done:
* Pass the parameter allow adjacent ships also to the BattleField.
* Implement a bool canAddShipOfSize(size). When a ship of size size can not be placed, then the \
                AI or the player should start again (what I&#39;m working on) or an Undo.
* Implement a clear() to be able to start again
* In the battleField also add another hidden board with the cells having only two status (free, \
busy) to be able to know the availability of the cells. It is easier for me in this way than \
the other way (sending a signal to clear the ship borders when the shooting starts).

</pre>
  </td>
 </tr>
</table>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Testing </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid \
#b8b5a0">  <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; \
white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">It detects the \
blocked boards (played much more games than I wanted to implement the restart placing \
ships).</pre>  </td>
 </tr>
</table>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">

 <li>src/battlefield.h <span style="color: grey">(b2f30bc)</span></li>

 <li>src/battlefield.cpp <span style="color: grey">(6467d8c)</span></li>

 <li>src/sea.h <span style="color: grey">(4af50b7)</span></li>

 <li>src/sea.cpp <span style="color: grey">(38ab8b5)</span></li>

</ul>

<p><a href="https://git.reviewboard.kde.org/r/114845/diff/" style="margin-left: 3em;">View \
Diff</a></p>







  </td>
 </tr>
</table>








  </div>
 </body>
</html>



_______________________________________________
kde-games-devel mailing list
kde-games-devel@kde.org
https://mail.kde.org/mailman/listinfo/kde-games-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic