A bit of math programming. 4 colors on a grid : <p>Let's say I have a grid</p>

<pre><code>-----
| | |
-----
| | |
-----
</code></pre>

<p>And I have 4 colors, Red, Blue, Green, and Yellow. I am trying to figure out how many different combinations there can be using those colors in the each way. For instance I might have:</p>

<pre><code>BR      BR      BY      BY    
GY      YG      RG      GR
</code></pre>

<p>etc. 
I can use the same color more than once so it can be like this:</p>

<pre><code>BB             BB         BB
RR    or even  BR    or   BB
</code></pre>

<p>I tried drawing out the different combos but I always end up getting more confused the more I draw them out. I'm trying to figure this out because I'm  using it for a tile system for a game I'm trying to plan out. I just need to know the different combos so I'd know how many tiles I'd need to cover everything.</p>

<p>There has to be a math way to solve this, I just can't figure it out for the life of me. </p>

<p>Thanks in advance oh math programming gods. I'll be forever in your debt</p>
