Advertisement
4_2005-2006 Games #152186

Black Jack

*Updated* This is a basic BlackJack program. You play against the computer using a 52 card deck. I rewrote most of the code so now it is easier to read and to maintain. Please let me know if you find any bugs or want any features added. [email protected]

AI

Shrnutí AI: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

Zdrojový kód
original-source
Upload
I think it is a basic coding standard to Indent each function, loop, etc. This not only helps others that may be working with your source, But it also helps when you go back and look at your source. Below are some examples of right and wrong.<br>
<br>
wrong way:<br>
if($foo==""){$var="1");}<br>
should be:<br>
if($foo=="")<br>
{<br>
&nbsp;&nbsp;&nbsp;$var="1";<br>
}<br>
<br>
wrong way:<br>
While(List($blah)=mysql_fetch_row($results)){<br>
if($blah==""){echo $blah;}else{echo "none";}}<br>
<br>
should be:<br>
While(List($blah)=mysql_fetch_row($results))<br>
{<br>
&nbsp;if($blah=="")<br>
&nbsp;{<br>
&nbsp;&nbsp;&nbsp;echo $blah;<br>
&nbsp;}<br>
&nbsp;else<br>
&nbsp;{<br>
&nbsp;&nbsp;&nbsp;echo "none";<br>
&nbsp;}<br>
}<br>
<br>
wrong way:<br>
function doit($var){<br>
if($var==""){$var="false";}else{$var="true";}<br>
return $var;}<br>
<br>
should be:<br>
function doit($var)<br>
{<br>
&nbsp;if($var=="")<br>
&nbsp;{<br>
&nbsp;&nbsp;&nbsp;$var="false";<br>
&nbsp;}<br>
&nbsp;else<br>
&nbsp;{<br>
&nbsp;&nbsp;&nbsp;$var="true";<br>
&nbsp;}<br>
&nbsp;return $var;<br>
}<br>
<br>
I think you get the basic Idea. Although it may seem long and drawn out, trust me, it will help you in the long run.<br><br>
-Steve
Původní komentáře (3)
Obnoveno z Wayback Machine