<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/">
	<channel>
		<title><![CDATA[Southperry.net - Rubik's Cube]]></title>
		<link>https://www.southperry.net/</link>
		<description><![CDATA[Southperry.net - https://www.southperry.net]]></description>
		<pubDate>Sun, 05 Jul 2026 21:54:17 +0000</pubDate>
		<generator>MyBB</generator>
		<item>
			<title><![CDATA[I BELIEVE I may have discovered how to successfully utilize "Alchemy"]]></title>
			<link>https://www.southperry.net/showthread.php?tid=78119</link>
			<pubDate>Mon, 12 Mar 2018 00:59:45 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://www.southperry.net/member.php?action=profile&uid=13935">afeuicoku</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.southperry.net/showthread.php?tid=78119</guid>
			<description><![CDATA[For example, I throw a green pebble into a body of water..<br />
Later, I find a giant green crystal ball when I look in the right places...<br />
Coincidence? MAYBE, but I think not!<br />
Its been working with so much!]]></description>
			<content:encoded><![CDATA[For example, I throw a green pebble into a body of water..<br />
Later, I find a giant green crystal ball when I look in the right places...<br />
Coincidence? MAYBE, but I think not!<br />
Its been working with so much!]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Thermodynamics & Stat. Mech.]]></title>
			<link>https://www.southperry.net/showthread.php?tid=75880</link>
			<pubDate>Mon, 15 Feb 2016 05:33:00 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://www.southperry.net/member.php?action=profile&uid=5154">Tay</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.southperry.net/showthread.php?tid=75880</guid>
			<description><![CDATA[If anyone is good at Stat. Mech or Thermodynamics pls look at this and let me know where'd you start. <br />
<br />
<img src="http://i.imgur.com/9CZhxwr.png" loading="lazy"  alt="[Image: 9CZhxwr.png]" class="mycode_img" /><br />
<br />
EDIT: Calling you out  [MENTION=3070]Marksman Bryan[/MENTION].]]></description>
			<content:encoded><![CDATA[If anyone is good at Stat. Mech or Thermodynamics pls look at this and let me know where'd you start. <br />
<br />
<img src="http://i.imgur.com/9CZhxwr.png" loading="lazy"  alt="[Image: 9CZhxwr.png]" class="mycode_img" /><br />
<br />
EDIT: Calling you out  [MENTION=3070]Marksman Bryan[/MENTION].]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Deriving a linear recurrence equation from a word problem]]></title>
			<link>https://www.southperry.net/showthread.php?tid=73137</link>
			<pubDate>Sun, 16 Nov 2014 04:48:17 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://www.southperry.net/member.php?action=profile&uid=6121">Imagine</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.southperry.net/showthread.php?tid=73137</guid>
			<description><![CDATA[<img src="http://i.imgur.com/9x4X2Lw.png" loading="lazy"  alt="[Image: 9x4X2Lw.png]" class="mycode_img" /><br />
What I'm having trouble with understanding is finding a recurrence relation from a word problem. I've looked at my notes, but I can't make heads or tails of how my professor and TA got from 1 step to another. I've drawn out a tree of the relationship, but I just don't know where do I go from there?<br />
<br />
So take problem 1b for example. What should I be looking out for and how do I approach the problem? I've plotted out terms 0 to 3:<br />
<div class="spoiler" style="margin: 5px 0; padding: 5px; border: 1px solid #ccc; background: #f9f9f9;">
		<input type="button" onclick="showSpoiler(this);" value="Show" style="width: 5em; padding-right: 3px;" />&nbsp;<b>Spoiler</b><br />
		<div class="inner" style="display:none; margin-left: 15px; margin-top: 5px; border-left: 2px solid #ccc; padding-left: 5px;">
			<br />
<img src="http://i.imgur.com/fnccSBY.jpg" loading="lazy"  alt="[Image: fnccSBY.jpg]" class="mycode_img" /><br />
<br />
		</div>
	</div>
and got 1, 3, 7, 15. I then expressed the groups of 3 I made for n =3 in terms of a previous term (i.e group of 3 under AA is Tn-3, AC is Tn-2, etc, etc), and then summed those up to get the recurrence equation of: Tn = 6Tn-3 + 3Tn-2. And then I'm lost after this. Is what I'm doing even right?<br />
<br />
EDIT: I took another swing at it, got: Tn = 2Tn-3 + 2Tn-2 + Tn-1. Brute forced all possible combinations for T4, got 35 terms. My recurrence relation also got me 35. Still kind of lost on why my thought process worked out (break tree diagram of recurrence into groups =&gt; get a recurrence equation for each of the groups =&gt; adding those recurrences up).]]></description>
			<content:encoded><![CDATA[<img src="http://i.imgur.com/9x4X2Lw.png" loading="lazy"  alt="[Image: 9x4X2Lw.png]" class="mycode_img" /><br />
What I'm having trouble with understanding is finding a recurrence relation from a word problem. I've looked at my notes, but I can't make heads or tails of how my professor and TA got from 1 step to another. I've drawn out a tree of the relationship, but I just don't know where do I go from there?<br />
<br />
So take problem 1b for example. What should I be looking out for and how do I approach the problem? I've plotted out terms 0 to 3:<br />
<div class="spoiler" style="margin: 5px 0; padding: 5px; border: 1px solid #ccc; background: #f9f9f9;">
		<input type="button" onclick="showSpoiler(this);" value="Show" style="width: 5em; padding-right: 3px;" />&nbsp;<b>Spoiler</b><br />
		<div class="inner" style="display:none; margin-left: 15px; margin-top: 5px; border-left: 2px solid #ccc; padding-left: 5px;">
			<br />
<img src="http://i.imgur.com/fnccSBY.jpg" loading="lazy"  alt="[Image: fnccSBY.jpg]" class="mycode_img" /><br />
<br />
		</div>
	</div>
and got 1, 3, 7, 15. I then expressed the groups of 3 I made for n =3 in terms of a previous term (i.e group of 3 under AA is Tn-3, AC is Tn-2, etc, etc), and then summed those up to get the recurrence equation of: Tn = 6Tn-3 + 3Tn-2. And then I'm lost after this. Is what I'm doing even right?<br />
<br />
EDIT: I took another swing at it, got: Tn = 2Tn-3 + 2Tn-2 + Tn-1. Brute forced all possible combinations for T4, got 35 terms. My recurrence relation also got me 35. Still kind of lost on why my thought process worked out (break tree diagram of recurrence into groups =&gt; get a recurrence equation for each of the groups =&gt; adding those recurrences up).]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[jQuery validation help.]]></title>
			<link>https://www.southperry.net/showthread.php?tid=72196</link>
			<pubDate>Thu, 07 Aug 2014 09:19:57 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://www.southperry.net/member.php?action=profile&uid=3140">DeanNim</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.southperry.net/showthread.php?tid=72196</guid>
			<description><![CDATA[Hey SP,<br />
<br />
<br />
So I'm working on a web form for a user to update their profile. Im having problems with the validation due to the confusing logic(to me atleast lol).<br />
<br />
The form contains a Current Password, New Password &amp; Confirm New Password fields.<br />
<br />
In order for the form to be successfully posted, the New Password and Confirm New Password must match(if the user wants to change his password), but it will also be optional and can be left completely blank(if he doesnt want to change his password). On top of that, his current password has to be validated server side to match in the database.<br />
<br />
I am using JSON/AJAX and ASP.NET C#.]]></description>
			<content:encoded><![CDATA[Hey SP,<br />
<br />
<br />
So I'm working on a web form for a user to update their profile. Im having problems with the validation due to the confusing logic(to me atleast lol).<br />
<br />
The form contains a Current Password, New Password &amp; Confirm New Password fields.<br />
<br />
In order for the form to be successfully posted, the New Password and Confirm New Password must match(if the user wants to change his password), but it will also be optional and can be left completely blank(if he doesnt want to change his password). On top of that, his current password has to be validated server side to match in the database.<br />
<br />
I am using JSON/AJAX and ASP.NET C#.]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Trigonometry]]></title>
			<link>https://www.southperry.net/showthread.php?tid=71423</link>
			<pubDate>Sat, 07 Jun 2014 02:26:54 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://www.southperry.net/member.php?action=profile&uid=6066">Hanabira.Kage</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.southperry.net/showthread.php?tid=71423</guid>
			<description><![CDATA[This going to sound dumb, but say if I'm given something like cos(n&#952<img src="https://www.southperry.net/images/smilies/wink.png" alt="Wink" title="Wink" class="smilie smilie_2" />, is there any way at all to get the n out?<br />
<br />
You see, I'm stuck on my math assignment. It looks like I've almost got it, but I think I may have driven myself into a corner because I have to do the above after reducing powers.<br />
<br />
I've never been good at proving trigonometric identities and stuff.<br />
<br />
<br />
EDIT: Well, at least I'll get half-credit for this assignment. I can do the other half of it, which is to prove the exact same identity with a different method.]]></description>
			<content:encoded><![CDATA[This going to sound dumb, but say if I'm given something like cos(n&#952<img src="https://www.southperry.net/images/smilies/wink.png" alt="Wink" title="Wink" class="smilie smilie_2" />, is there any way at all to get the n out?<br />
<br />
You see, I'm stuck on my math assignment. It looks like I've almost got it, but I think I may have driven myself into a corner because I have to do the above after reducing powers.<br />
<br />
I've never been good at proving trigonometric identities and stuff.<br />
<br />
<br />
EDIT: Well, at least I'll get half-credit for this assignment. I can do the other half of it, which is to prove the exact same identity with a different method.]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[HTML/Dreamweaver help?]]></title>
			<link>https://www.southperry.net/showthread.php?tid=71140</link>
			<pubDate>Thu, 15 May 2014 06:36:14 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://www.southperry.net/member.php?action=profile&uid=276">Sn1perJohnE</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.southperry.net/showthread.php?tid=71140</guid>
			<description><![CDATA[Hello folks, I am trying to create angled buttons in Dreamweaver that use a hotspot map for a hoverover, but the image box is screwing with my hotspot. Anyone know how to help?<br />
<br />
Here is my site for a visual of whats happening <a href="http://jellisarts.com/" target="_blank" rel="noopener" class="mycode_url">http://jellisarts.com/</a> the buttons are the ones on the left (derp).]]></description>
			<content:encoded><![CDATA[Hello folks, I am trying to create angled buttons in Dreamweaver that use a hotspot map for a hoverover, but the image box is screwing with my hotspot. Anyone know how to help?<br />
<br />
Here is my site for a visual of whats happening <a href="http://jellisarts.com/" target="_blank" rel="noopener" class="mycode_url">http://jellisarts.com/</a> the buttons are the ones on the left (derp).]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[C++ Project, need all the help i can get!]]></title>
			<link>https://www.southperry.net/showthread.php?tid=70970</link>
			<pubDate>Thu, 01 May 2014 19:18:49 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://www.southperry.net/member.php?action=profile&uid=10363">InvictHero</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.southperry.net/showthread.php?tid=70970</guid>
			<description><![CDATA[Hey guys, <br />
<br />
It's crunch time for college students, good luck to you all! If any of you have time to help, it would be greatly appreciated. Here's my project:<br />
<br />
Program Description: Write a program that calculates the intensity of light onto a NBA basketball court. A standard NBA basketball court is 94 feet long and 50 feet wide. We will assume that every square foot is represented by a cell in a two-dimensional array (or matrix). Given certain criteria that you read in from a data file, you will need to calculate the intensity of light at each square foot of the court.<br />
<br />
Your program must have the following 4 functions:<br />
A.	Calculate the intensity of light (see formulas below)<br />
B.	Calculate the distance from the light to the floor<br />
C.	Random number generator<br />
D.	Print out the results<br />
<br />
Formulas:	     Fc=Cp/D^2         D=sqrt(b^2+h^2)<br />
		<br />
Where:	Fc = is the level of light the candle (floodlight) produces<br />
		D = the distance the lamp is from the surface<br />
		Cp = the candle power of the lamp (in watts)<br />
	Use the second formula to calculate the distance (D) from the light to each position (cell) on the basketball court.<br />
<br />
Here's the data file and what each number/character gives:<br />
Data file:<br />
A<br />
2<br />
G<br />
25	23.5<br />
25	70.5<br />
400<br />
20<br />
B<br />
2<br />
G<br />
25	23.5<br />
25	70.5<br />
1000<br />
30<br />
C<br />
3<br />
R<br />
400<br />
35<br />
<br />
<br />
What each line means:<br />
o	Option letter (to be echoed back out)<br />
o	Number of floodlights installed<br />
o	Character to determine if the measurements are (G)iven or &reg;andom. (If random then you need to randomly produce the position of that number of floodlights.)<br />
o	For each given floodlight, the number of feet across the court (in the 50 direction) then the number of feet (in the 94 direction)<br />
o	Power of the floodlights in watts<br />
o	Distance (feet) the lights are mounted above the positions<br />
<br />
<span style="font-weight: bold;" class="mycode_b"><span style="color: #FF0000;" class="mycode_color">Here's where I need your help. I'm pretty good with functions and inputting the data from the file, I'm just terrible at arrays. After I calculate the intensity of light(Fc), how do I put these values into an array? Any help with this at all would be greatly appreciated. I need more help with the array part of it, but I could use tips throughout the whole thing. Thank you!</span></span>]]></description>
			<content:encoded><![CDATA[Hey guys, <br />
<br />
It's crunch time for college students, good luck to you all! If any of you have time to help, it would be greatly appreciated. Here's my project:<br />
<br />
Program Description: Write a program that calculates the intensity of light onto a NBA basketball court. A standard NBA basketball court is 94 feet long and 50 feet wide. We will assume that every square foot is represented by a cell in a two-dimensional array (or matrix). Given certain criteria that you read in from a data file, you will need to calculate the intensity of light at each square foot of the court.<br />
<br />
Your program must have the following 4 functions:<br />
A.	Calculate the intensity of light (see formulas below)<br />
B.	Calculate the distance from the light to the floor<br />
C.	Random number generator<br />
D.	Print out the results<br />
<br />
Formulas:	     Fc=Cp/D^2         D=sqrt(b^2+h^2)<br />
		<br />
Where:	Fc = is the level of light the candle (floodlight) produces<br />
		D = the distance the lamp is from the surface<br />
		Cp = the candle power of the lamp (in watts)<br />
	Use the second formula to calculate the distance (D) from the light to each position (cell) on the basketball court.<br />
<br />
Here's the data file and what each number/character gives:<br />
Data file:<br />
A<br />
2<br />
G<br />
25	23.5<br />
25	70.5<br />
400<br />
20<br />
B<br />
2<br />
G<br />
25	23.5<br />
25	70.5<br />
1000<br />
30<br />
C<br />
3<br />
R<br />
400<br />
35<br />
<br />
<br />
What each line means:<br />
o	Option letter (to be echoed back out)<br />
o	Number of floodlights installed<br />
o	Character to determine if the measurements are (G)iven or &reg;andom. (If random then you need to randomly produce the position of that number of floodlights.)<br />
o	For each given floodlight, the number of feet across the court (in the 50 direction) then the number of feet (in the 94 direction)<br />
o	Power of the floodlights in watts<br />
o	Distance (feet) the lights are mounted above the positions<br />
<br />
<span style="font-weight: bold;" class="mycode_b"><span style="color: #FF0000;" class="mycode_color">Here's where I need your help. I'm pretty good with functions and inputting the data from the file, I'm just terrible at arrays. After I calculate the intensity of light(Fc), how do I put these values into an array? Any help with this at all would be greatly appreciated. I need more help with the array part of it, but I could use tips throughout the whole thing. Thank you!</span></span>]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[I suck at coding need some help]]></title>
			<link>https://www.southperry.net/showthread.php?tid=70899</link>
			<pubDate>Sat, 26 Apr 2014 15:14:48 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://www.southperry.net/member.php?action=profile&uid=7908">The Great One</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.southperry.net/showthread.php?tid=70899</guid>
			<description><![CDATA[Okay,  so I have to make a code in python that converts from decimal to binary decimal to hexadecimal and lastly from binary to decimal.  This is what I have so far:<br />
<br />
Decimal to binary<br />
<br />
 <div class="spoiler" style="margin: 5px 0; padding: 5px; border: 1px solid #ccc; background: #f9f9f9;">
		<input type="button" onclick="showSpoiler(this);" value="Show" style="width: 5em; padding-right: 3px;" />&nbsp;<b>Spoiler</b><br />
		<div class="inner" style="display:none; margin-left: 15px; margin-top: 5px; border-left: 2px solid #ccc; padding-left: 5px;">
			# convert a decimal to binary<br />
    <br />
def Denary2Binary(n):<br />
    '''convert denary integer n to binary string bStr'''<br />
    bStr = ''<br />
    if n &lt; 0: raise ValueError, "must be a positive integer"<br />
    if n == 0: return '0'<br />
    while n &gt; 0:<br />
    bStr = str(n % 2) + bStr<br />
    n = n &gt;&gt; 1<br />
    return bStr<br />
    def int2bin(n, count=24):<br />
    """returns the binary of integer n, using count number of digits"""<br />
    return "".join([str((n &gt;&gt; y) &amp; 1) for y in range(count-1, -1, -1)])<br />
    <br />
    if __name__ == '__main__':<br />
    print Denary2Binary(255) <br />
    print int(Denary2Binary(255), 2) <br />
    print<br />
    <br />
    print int2bin(255, 12) <br />
   <br />
    print int("000011111111", 2) <br />
    print<br />
    <br />
    print Denary2Binary(0)<br />
    print Denary2Binary(-5) <br />
<br />
<br />
<br />
		</div>
	</div>
<br />
decimal to hexadecimal <br />
<div class="spoiler" style="margin: 5px 0; padding: 5px; border: 1px solid #ccc; background: #f9f9f9;">
		<input type="button" onclick="showSpoiler(this);" value="Show" style="width: 5em; padding-right: 3px;" />&nbsp;<b>Spoiler</b><br />
		<div class="inner" style="display:none; margin-left: 15px; margin-top: 5px; border-left: 2px solid #ccc; padding-left: 5px;">
			#converting decimal to hexdecimal<br />
def decToHex():<br />
    #Get number from user<br />
    number=int(input("enter a postive number ")<br />
        if(number is&lt;= 0)<br />
           0)<br />
               print("enter a postive number")<br />
    if(number=0)<br />
               print("the hexadecimal value of 0 equals 0")<br />
    else<br />
        hstr=" "<br />
        q=number<br />
            while(q&gt;0):<br />
               if(q%16&lt;10):<br />
               hstr=str(q%16)+hstr<br />
               elif(q%16==10):<br />
               hstr="A"+hstr<br />
               elif(q%16==11):<br />
               hstr="B"+hstr<br />
               elif(q%16==12):<br />
               hstr="C"+hstr<br />
               elif(q%16==13):<br />
               hstr="D"+hstr<br />
               elif(q%16==14):<br />
               hstr="E"+hstr<br />
               elif(q%16==15):<br />
              else:<br />
               hstr="F"+hstr<br />
               q=q//16<br />
               print(number, "converted to hexadecimal is " , hstr) <br />
<br />
    <br />
<br />
<br />
<br />
<br />
		</div>
	</div>
<br />
Binary to decimal<br />
<div class="spoiler" style="margin: 5px 0; padding: 5px; border: 1px solid #ccc; background: #f9f9f9;">
		<input type="button" onclick="showSpoiler(this);" value="Show" style="width: 5em; padding-right: 3px;" />&nbsp;<b>Spoiler</b><br />
		<div class="inner" style="display:none; margin-left: 15px; margin-top: 5px; border-left: 2px solid #ccc; padding-left: 5px;">
			def decimal_to_binary(arr,decimal):<br />
       if decimal ==1:<br />
           arr.append(1)<br />
       else:<br />
           rem = decimal%2<br />
           arr.append(rem)<br />
           rev = decimal/2<br />
           decimal_to_binary(arr,rev)<br />
       string<br />
       for i in arr[::-1]:<br />
           string+=str(i)<br />
       return string<br />
<br />
		</div>
	</div>
<br />
<br />
I try to run these and I keep getting syntax errors so the program won't run and I have no idea how to fix them.  So could anyone help me correct them not necessarily do them for me but at least give me a better explanation of where the errors are and what to do to fix them  any help at all would be appreciated I'm at my wits end here.]]></description>
			<content:encoded><![CDATA[Okay,  so I have to make a code in python that converts from decimal to binary decimal to hexadecimal and lastly from binary to decimal.  This is what I have so far:<br />
<br />
Decimal to binary<br />
<br />
 <div class="spoiler" style="margin: 5px 0; padding: 5px; border: 1px solid #ccc; background: #f9f9f9;">
		<input type="button" onclick="showSpoiler(this);" value="Show" style="width: 5em; padding-right: 3px;" />&nbsp;<b>Spoiler</b><br />
		<div class="inner" style="display:none; margin-left: 15px; margin-top: 5px; border-left: 2px solid #ccc; padding-left: 5px;">
			# convert a decimal to binary<br />
    <br />
def Denary2Binary(n):<br />
    '''convert denary integer n to binary string bStr'''<br />
    bStr = ''<br />
    if n &lt; 0: raise ValueError, "must be a positive integer"<br />
    if n == 0: return '0'<br />
    while n &gt; 0:<br />
    bStr = str(n % 2) + bStr<br />
    n = n &gt;&gt; 1<br />
    return bStr<br />
    def int2bin(n, count=24):<br />
    """returns the binary of integer n, using count number of digits"""<br />
    return "".join([str((n &gt;&gt; y) &amp; 1) for y in range(count-1, -1, -1)])<br />
    <br />
    if __name__ == '__main__':<br />
    print Denary2Binary(255) <br />
    print int(Denary2Binary(255), 2) <br />
    print<br />
    <br />
    print int2bin(255, 12) <br />
   <br />
    print int("000011111111", 2) <br />
    print<br />
    <br />
    print Denary2Binary(0)<br />
    print Denary2Binary(-5) <br />
<br />
<br />
<br />
		</div>
	</div>
<br />
decimal to hexadecimal <br />
<div class="spoiler" style="margin: 5px 0; padding: 5px; border: 1px solid #ccc; background: #f9f9f9;">
		<input type="button" onclick="showSpoiler(this);" value="Show" style="width: 5em; padding-right: 3px;" />&nbsp;<b>Spoiler</b><br />
		<div class="inner" style="display:none; margin-left: 15px; margin-top: 5px; border-left: 2px solid #ccc; padding-left: 5px;">
			#converting decimal to hexdecimal<br />
def decToHex():<br />
    #Get number from user<br />
    number=int(input("enter a postive number ")<br />
        if(number is&lt;= 0)<br />
           0)<br />
               print("enter a postive number")<br />
    if(number=0)<br />
               print("the hexadecimal value of 0 equals 0")<br />
    else<br />
        hstr=" "<br />
        q=number<br />
            while(q&gt;0):<br />
               if(q%16&lt;10):<br />
               hstr=str(q%16)+hstr<br />
               elif(q%16==10):<br />
               hstr="A"+hstr<br />
               elif(q%16==11):<br />
               hstr="B"+hstr<br />
               elif(q%16==12):<br />
               hstr="C"+hstr<br />
               elif(q%16==13):<br />
               hstr="D"+hstr<br />
               elif(q%16==14):<br />
               hstr="E"+hstr<br />
               elif(q%16==15):<br />
              else:<br />
               hstr="F"+hstr<br />
               q=q//16<br />
               print(number, "converted to hexadecimal is " , hstr) <br />
<br />
    <br />
<br />
<br />
<br />
<br />
		</div>
	</div>
<br />
Binary to decimal<br />
<div class="spoiler" style="margin: 5px 0; padding: 5px; border: 1px solid #ccc; background: #f9f9f9;">
		<input type="button" onclick="showSpoiler(this);" value="Show" style="width: 5em; padding-right: 3px;" />&nbsp;<b>Spoiler</b><br />
		<div class="inner" style="display:none; margin-left: 15px; margin-top: 5px; border-left: 2px solid #ccc; padding-left: 5px;">
			def decimal_to_binary(arr,decimal):<br />
       if decimal ==1:<br />
           arr.append(1)<br />
       else:<br />
           rem = decimal%2<br />
           arr.append(rem)<br />
           rev = decimal/2<br />
           decimal_to_binary(arr,rev)<br />
       string<br />
       for i in arr[::-1]:<br />
           string+=str(i)<br />
       return string<br />
<br />
		</div>
	</div>
<br />
<br />
I try to run these and I keep getting syntax errors so the program won't run and I have no idea how to fix them.  So could anyone help me correct them not necessarily do them for me but at least give me a better explanation of where the errors are and what to do to fix them  any help at all would be appreciated I'm at my wits end here.]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Found this interesting, Atheist on evolution.]]></title>
			<link>https://www.southperry.net/showthread.php?tid=70890</link>
			<pubDate>Fri, 25 Apr 2014 22:27:55 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://www.southperry.net/member.php?action=profile&uid=12885">Jazeon</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.southperry.net/showthread.php?tid=70890</guid>
			<description><![CDATA[<a href="http://gbam.tv/question-asked-to-atheist-which-they-could-not-answer/#.U0-eL78Lo6K.facebook" target="_blank" rel="noopener" class="mycode_url">http://gbam.tv/question-asked-to-atheist...K.facebook</a>]]></description>
			<content:encoded><![CDATA[<a href="http://gbam.tv/question-asked-to-atheist-which-they-could-not-answer/#.U0-eL78Lo6K.facebook" target="_blank" rel="noopener" class="mycode_url">http://gbam.tv/question-asked-to-atheist...K.facebook</a>]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[C++ Programming help needed]]></title>
			<link>https://www.southperry.net/showthread.php?tid=70022</link>
			<pubDate>Tue, 25 Feb 2014 22:43:47 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://www.southperry.net/member.php?action=profile&uid=10363">InvictHero</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.southperry.net/showthread.php?tid=70022</guid>
			<description><![CDATA[Hi all~<br />
I'm having a little trouble coming up with a program for this problem I was assigned. Here is the problem:<br />
<br />
A minivan has two sliding doors. Each door can be opened by either a dashboard switch, its inside handle or its outside handle. However, the inside handles do not work if a child lock switch is activated, in order for the sliding doors to open, the gear shift must be in park and the master unlock switch must be activated. <br />
Your task is to simulate a portion of the control software for the vehicle. The input is a sequence of values for the switches and the gear shift, in the following order:<br />
- Dashboard switches for left and right sliding door, child lock and mast lock (0 for off and 1 for activated).<br />
- Inside and outside hands on the left and right doors (1 and 0).<br />
- The gear shift setting (one of P N D 1 2 3 R).<br />
<br />
Typical input would be 		0 0 0 1 0 1 0 0 P<br />
<br />
Print Left door opens and/or right door opens as appropriate. If neither door opens, print both doors stay closed.<br />
<br />
So far I have asked for input for the nine boolean things. I'm having trouble coming up with some if and if/else statements. It's quite tough to organize all these combinations and stuff. Anyway, any help would be much appreciated!<br />
<br />
Also, sorry for the block of text <img src="https://www.southperry.net/images/smilies/Maple/tongue.png" alt="Tongue" title="Tongue" class="smilie smilie_25" />]]></description>
			<content:encoded><![CDATA[Hi all~<br />
I'm having a little trouble coming up with a program for this problem I was assigned. Here is the problem:<br />
<br />
A minivan has two sliding doors. Each door can be opened by either a dashboard switch, its inside handle or its outside handle. However, the inside handles do not work if a child lock switch is activated, in order for the sliding doors to open, the gear shift must be in park and the master unlock switch must be activated. <br />
Your task is to simulate a portion of the control software for the vehicle. The input is a sequence of values for the switches and the gear shift, in the following order:<br />
- Dashboard switches for left and right sliding door, child lock and mast lock (0 for off and 1 for activated).<br />
- Inside and outside hands on the left and right doors (1 and 0).<br />
- The gear shift setting (one of P N D 1 2 3 R).<br />
<br />
Typical input would be 		0 0 0 1 0 1 0 0 P<br />
<br />
Print Left door opens and/or right door opens as appropriate. If neither door opens, print both doors stay closed.<br />
<br />
So far I have asked for input for the nine boolean things. I'm having trouble coming up with some if and if/else statements. It's quite tough to organize all these combinations and stuff. Anyway, any help would be much appreciated!<br />
<br />
Also, sorry for the block of text <img src="https://www.southperry.net/images/smilies/Maple/tongue.png" alt="Tongue" title="Tongue" class="smilie smilie_25" />]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Java threads and synchronization]]></title>
			<link>https://www.southperry.net/showthread.php?tid=69969</link>
			<pubDate>Fri, 21 Feb 2014 00:49:30 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://www.southperry.net/member.php?action=profile&uid=1009">Jedward</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.southperry.net/showthread.php?tid=69969</guid>
			<description><![CDATA[OK, I just don't understand how threads work. I don't know how I'm supposed to wake up a -specific- thread.<br />
<br />
I'm working on the implementation of a simple two-player card game. I have five classes: Card, CardDeck, Dealer, Player and CardGame.<br />
<br />
First, I ask for keyboard input for two Strings representing the names of the two players. I make two Players based on those names, and make a new CardDeck.<br />
<br />
The CardDeck contains an ArrayList of Cards, which are numbered 0-7. There are 4 cards with each number in the deck. The CardDeck is shuffled after its creation.<br />
<br />
Then an instance of Dealer takes the top 8 cards off CardDeck and gives each player four of the cards.<br />
<br />
Starting with player1, each player draws a card (now having five in their hand). The player's hand is printed out to the console and the player discards one of their cards, aiming to have four cards all with the same value (4 4 4 4, or 0 0 0 0). If player1 doesn't win at this point, player2 takes their turn and vice versa until one player wins.<br />
<br />
CardGame acts as the 'main' class and sets everything in motion. It starts three threads (dealer, player1 and player2) and waits for Dealer to give the signal that the game is over, after which it just cleans up and terminates.<br />
<br />
<div class="spoiler" style="margin: 5px 0; padding: 5px; border: 1px solid #ccc; background: #f9f9f9;">
		<input type="button" onclick="showSpoiler(this);" value="Show" style="width: 5em; padding-right: 3px;" />&nbsp;<b>CardGame.java</b><br />
		<div class="inner" style="display:none; margin-left: 15px; margin-top: 5px; border-left: 2px solid #ccc; padding-left: 5px;">
			<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>vpackage matchGame;<br />
<br />
import java.util.Scanner;<br />
<br />
/**<br />
 * Represents the actual card game. Creates players and deck<br />
 * for Dealer to manipulate. <br />
 */<br />
<br />
public final class CardGame implements Runnable {<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;public static void main(String[] args) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CardGame game = new CardGame();<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Thread cardGameThread = new Thread(game);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cardGameThread.start();<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;@Override<br />
&nbsp;&nbsp;&nbsp;&nbsp;public void run() {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Scanner keyboard = new Scanner(System.in);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.out.println("Game started...");<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CardDeck deck = new CardDeck();<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Dealer deal = new Dealer(deck);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.out.print("Please enter the player's name: ");<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Player player1 = new Player(keyboard.next(), deck, deal, keyboard);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.out.print("Please enter the other player's name: ");<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Player player2 = new Player(keyboard.next(), deck, deal, keyboard);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;deal.setP1(player1);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;deal.setP2(player2);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Player threads currently do nothing.<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Thread dealerThread = new Thread(deal);<br />
//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Thread player1Thread = new Thread(player1);<br />
//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Thread player2Thread = new Thread(player2);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dealerThread.setPriority(10);<br />
//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;player1Thread.setPriority(6);<br />
//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;player2Thread.setPriority(4);<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dealerThread.start();<br />
//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;player1Thread.start();<br />
//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;player2Thread.start();<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;while(!(deal.isFinished)){<br />
//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Here I would put a wait() function to wait for the<br />
//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dealer thread to finish the game.<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(player1.hasWon)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.out.println(player1.getName() + " is the winner.");<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else if(player2.hasWon)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.out.println(player2.getName() + " is the winner.");<br />
//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;player1Thread = null;<br />
//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;player2Thread = null;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;keyboard.close();<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />
<br />
}</code></div></div><br />
		</div>
	</div>
<br />
Player represents a player and implements Runnable. Each instance has a name and a hand, and a boolean showing whether or not they have won. I also pass in CardDeck and the Scanner object representing the keyboard in order to take keyboard input within the class.<br />
<br />
At the moment, the run() method does nothing. This is because I don't know how to implement the multithreading functionality into Player.<br />
<br />
<div class="spoiler" style="margin: 5px 0; padding: 5px; border: 1px solid #ccc; background: #f9f9f9;">
		<input type="button" onclick="showSpoiler(this);" value="Show" style="width: 5em; padding-right: 3px;" />&nbsp;<b>Player.java</b><br />
		<div class="inner" style="display:none; margin-left: 15px; margin-top: 5px; border-left: 2px solid #ccc; padding-left: 5px;">
			<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>package matchGame;<br />
<br />
import java.util.ArrayList;<br />
import java.util.Collections;<br />
import java.util.Scanner;<br />
<br />
public class Player implements Runnable {<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;private final String name;<br />
&nbsp;&nbsp;&nbsp;&nbsp;public ArrayList&lt;Card&gt; hand;<br />
&nbsp;&nbsp;&nbsp;&nbsp;public final Dealer deal;<br />
&nbsp;&nbsp;&nbsp;&nbsp;public boolean hasWon;<br />
&nbsp;&nbsp;&nbsp;&nbsp;private final CardDeck deck;<br />
&nbsp;&nbsp;&nbsp;&nbsp;private Scanner kb;<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;public Player(String name, CardDeck deck, Dealer deal, Scanner kb){<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;this.name = name;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;this.hand = new ArrayList&lt;Card&gt;();<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;this.hasWon = false;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;this.deal = deal;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;this.deck = deck;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;this.kb = kb;<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;public String getName(){<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return this.name;<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;public void giveCard(Card newCard){<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;hand.add(newCard);<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;public Card removeCard(int destroyCard) throws Exception{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Card temp = new Card(destroyCard);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;try{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(!(hand.remove(temp)))<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;throw new Exception("Specified card is not in your hand!");<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;catch(Exception e){<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;e.printStackTrace();<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return temp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;public void sortHand(){<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Collections.sort(hand);<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;public String toString(){<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;String returnString = "";<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for(Card i : hand)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;returnString += " " + i;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return returnString;<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;@Override<br />
&nbsp;&nbsp;&nbsp;&nbsp;public void run() {<br />
//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Here I would have a wait() while the dealer deals out cards.<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;I would just have another wait() after that to wait for the player's<br />
//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;turn here. This is probably wrong because I would have no way<br />
//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;of notifying player1 separately.<br />
&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;public synchronized void playTurn(){<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.out.println(deck);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.out.println("---------------------------------------" +<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"----------------------------");<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.out.println(this.getName() + " is Playing ...");<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;giveCard(deck.draw());<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.out.println(this.getName() + " draws " + hand.get(hand.size() - 1)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;+ " from deck.");<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;this.sortHand();<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.out.println(this.getName() + "'s five cards after DRAWING a" +<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" card from deck are: " + this + "(sorted)");<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.out.print(this.getName() + ": Please discard one of the five cards in your hand: ");<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;try {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;int cardToRemove = kb.nextInt();<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for(Card i : hand){<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(Integer.valueOf(i.toString()) == cardToRemove){<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cardToRemove = hand.indexOf(i);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;deck.discard(hand.remove(cardToRemove));<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} catch (Exception e) {e.printStackTrace();}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;this.sortHand();<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.out.println(this.getName() + "'s four cards after DISCARD are: " + this);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;int a = Integer.valueOf(hand.get(0).toString());<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for(Card i : this.hand){<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(a == Integer.valueOf(i.toString()))<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;this.hasWon = true;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;this.hasWon = false;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;notify();<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />
<br />
}</code></div></div><br />
		</div>
	</div>
<br />
The code for CardDeck might be necessary for the solution I'm asking for, so here it is. It's a simple ArrayList of instances of Card, and CardDeck contains the methods necessary for drawing cards from the top of the deck and discarding cards to the bottom of the deck.<br />
<br />
<div class="spoiler" style="margin: 5px 0; padding: 5px; border: 1px solid #ccc; background: #f9f9f9;">
		<input type="button" onclick="showSpoiler(this);" value="Show" style="width: 5em; padding-right: 3px;" />&nbsp;<b>CardDeck.java</b><br />
		<div class="inner" style="display:none; margin-left: 15px; margin-top: 5px; border-left: 2px solid #ccc; padding-left: 5px;">
			<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>package matchGame;<br />
<br />
import java.util.ArrayList;<br />
import java.util.Collections;<br />
<br />
public class CardDeck {<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;private ArrayList&lt;Card&gt; deck;<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;public CardDeck(){<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;deck = new ArrayList&lt;Card&gt;();<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for(int i = 0; i &lt; 32; i++){<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;deck.add(new Card(i % 8));&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Collections.shuffle(deck);<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;public Card draw(){<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return deck.remove(0);<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;public void discard(Card thisCard){<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;deck.add(thisCard);<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;@Override<br />
&nbsp;&nbsp;&nbsp;&nbsp;public String toString(){<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;String returnString = "";<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for(Card i : deck)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;returnString += i + " ";<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return returnString;<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />
}</code></div></div><br />
		</div>
	</div>
<br />
Added the code for Dealer below. Dealer just represents the dealer and has one job: to deal four cards to each player at the beginning of the game. This code is inside its own class because I'm following the instructor (otherwise I'd just have deal() in CardGame).<br />
<br />
Dealer pretty much runs the entire game once its thread is started. This is because I haven't figured out the multithreading part of the exercise yet. Preferably, at the very end of Dealer's run() method it would notify CardGame to let it know that the game has finished.<br />
<br />
<div class="spoiler" style="margin: 5px 0; padding: 5px; border: 1px solid #ccc; background: #f9f9f9;">
		<input type="button" onclick="showSpoiler(this);" value="Show" style="width: 5em; padding-right: 3px;" />&nbsp;<b>Dealer.java</b><br />
		<div class="inner" style="display:none; margin-left: 15px; margin-top: 5px; border-left: 2px solid #ccc; padding-left: 5px;">
			<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>package matchGame;<br />
<br />
public class Dealer implements Runnable{<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;private CardDeck deck;<br />
&nbsp;&nbsp;&nbsp;&nbsp;public boolean isFinished;<br />
&nbsp;&nbsp;&nbsp;&nbsp;private Player player1;<br />
&nbsp;&nbsp;&nbsp;&nbsp;private Player player2;<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;public Dealer(CardDeck deck){<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;this.deck = deck;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;isFinished = false;<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;public void setP1(Player player1){<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;this.player1 = player1;<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;public void setP2(Player player2){<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;this.player2 = player2;<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;public synchronized void deal(Player toPlayer){<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for(int i = 0; i &lt; 4; i++){<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;toPlayer.hand.add(deck.draw());<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;notify();<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;@Override<br />
&nbsp;&nbsp;&nbsp;&nbsp;public void run() {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;deal(player1);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;deal(player2);<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.out.println("Dealer deals four cards to the players as follows...&#92;n"<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; + player1.getName() + "'s FIRST four cards are: " + player1 + "&#92;n"<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; + player2.getName() + "'s FIRST four cards are: " + player2 + "&#92;n");<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;while((!(player1.hasWon)) &amp;&amp; (!(player2.hasWon))){<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Here I would add a wait() while player1 plays their turn.<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;player1.playTurn();<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(player1.hasWon)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Here I would add another wait() while player2 plays their turn.<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;player2.playTurn();<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;isFinished = true;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;notify();<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />
}</code></div></div><br />
		</div>
	</div>
What's the correct implementation for this? After starting the two Player threads, Player1 should go first immediately. When Player1's turn is done (and Player1 hasn't won yet), Player2 should be notified and Player1 should go to sleep and vice versa. And of course, when either Player1 or Player2 hasWon, the main() thread should keep going.<br />
<br />
Any help would be greatly appreciated. I'm just having trouble grasping how this is supposed to work.]]></description>
			<content:encoded><![CDATA[OK, I just don't understand how threads work. I don't know how I'm supposed to wake up a -specific- thread.<br />
<br />
I'm working on the implementation of a simple two-player card game. I have five classes: Card, CardDeck, Dealer, Player and CardGame.<br />
<br />
First, I ask for keyboard input for two Strings representing the names of the two players. I make two Players based on those names, and make a new CardDeck.<br />
<br />
The CardDeck contains an ArrayList of Cards, which are numbered 0-7. There are 4 cards with each number in the deck. The CardDeck is shuffled after its creation.<br />
<br />
Then an instance of Dealer takes the top 8 cards off CardDeck and gives each player four of the cards.<br />
<br />
Starting with player1, each player draws a card (now having five in their hand). The player's hand is printed out to the console and the player discards one of their cards, aiming to have four cards all with the same value (4 4 4 4, or 0 0 0 0). If player1 doesn't win at this point, player2 takes their turn and vice versa until one player wins.<br />
<br />
CardGame acts as the 'main' class and sets everything in motion. It starts three threads (dealer, player1 and player2) and waits for Dealer to give the signal that the game is over, after which it just cleans up and terminates.<br />
<br />
<div class="spoiler" style="margin: 5px 0; padding: 5px; border: 1px solid #ccc; background: #f9f9f9;">
		<input type="button" onclick="showSpoiler(this);" value="Show" style="width: 5em; padding-right: 3px;" />&nbsp;<b>CardGame.java</b><br />
		<div class="inner" style="display:none; margin-left: 15px; margin-top: 5px; border-left: 2px solid #ccc; padding-left: 5px;">
			<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>vpackage matchGame;<br />
<br />
import java.util.Scanner;<br />
<br />
/**<br />
 * Represents the actual card game. Creates players and deck<br />
 * for Dealer to manipulate. <br />
 */<br />
<br />
public final class CardGame implements Runnable {<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;public static void main(String[] args) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CardGame game = new CardGame();<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Thread cardGameThread = new Thread(game);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cardGameThread.start();<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;@Override<br />
&nbsp;&nbsp;&nbsp;&nbsp;public void run() {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Scanner keyboard = new Scanner(System.in);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.out.println("Game started...");<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CardDeck deck = new CardDeck();<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Dealer deal = new Dealer(deck);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.out.print("Please enter the player's name: ");<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Player player1 = new Player(keyboard.next(), deck, deal, keyboard);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.out.print("Please enter the other player's name: ");<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Player player2 = new Player(keyboard.next(), deck, deal, keyboard);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;deal.setP1(player1);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;deal.setP2(player2);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Player threads currently do nothing.<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Thread dealerThread = new Thread(deal);<br />
//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Thread player1Thread = new Thread(player1);<br />
//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Thread player2Thread = new Thread(player2);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dealerThread.setPriority(10);<br />
//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;player1Thread.setPriority(6);<br />
//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;player2Thread.setPriority(4);<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dealerThread.start();<br />
//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;player1Thread.start();<br />
//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;player2Thread.start();<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;while(!(deal.isFinished)){<br />
//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Here I would put a wait() function to wait for the<br />
//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dealer thread to finish the game.<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(player1.hasWon)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.out.println(player1.getName() + " is the winner.");<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else if(player2.hasWon)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.out.println(player2.getName() + " is the winner.");<br />
//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;player1Thread = null;<br />
//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;player2Thread = null;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;keyboard.close();<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />
<br />
}</code></div></div><br />
		</div>
	</div>
<br />
Player represents a player and implements Runnable. Each instance has a name and a hand, and a boolean showing whether or not they have won. I also pass in CardDeck and the Scanner object representing the keyboard in order to take keyboard input within the class.<br />
<br />
At the moment, the run() method does nothing. This is because I don't know how to implement the multithreading functionality into Player.<br />
<br />
<div class="spoiler" style="margin: 5px 0; padding: 5px; border: 1px solid #ccc; background: #f9f9f9;">
		<input type="button" onclick="showSpoiler(this);" value="Show" style="width: 5em; padding-right: 3px;" />&nbsp;<b>Player.java</b><br />
		<div class="inner" style="display:none; margin-left: 15px; margin-top: 5px; border-left: 2px solid #ccc; padding-left: 5px;">
			<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>package matchGame;<br />
<br />
import java.util.ArrayList;<br />
import java.util.Collections;<br />
import java.util.Scanner;<br />
<br />
public class Player implements Runnable {<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;private final String name;<br />
&nbsp;&nbsp;&nbsp;&nbsp;public ArrayList&lt;Card&gt; hand;<br />
&nbsp;&nbsp;&nbsp;&nbsp;public final Dealer deal;<br />
&nbsp;&nbsp;&nbsp;&nbsp;public boolean hasWon;<br />
&nbsp;&nbsp;&nbsp;&nbsp;private final CardDeck deck;<br />
&nbsp;&nbsp;&nbsp;&nbsp;private Scanner kb;<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;public Player(String name, CardDeck deck, Dealer deal, Scanner kb){<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;this.name = name;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;this.hand = new ArrayList&lt;Card&gt;();<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;this.hasWon = false;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;this.deal = deal;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;this.deck = deck;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;this.kb = kb;<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;public String getName(){<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return this.name;<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;public void giveCard(Card newCard){<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;hand.add(newCard);<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;public Card removeCard(int destroyCard) throws Exception{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Card temp = new Card(destroyCard);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;try{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(!(hand.remove(temp)))<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;throw new Exception("Specified card is not in your hand!");<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;catch(Exception e){<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;e.printStackTrace();<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return temp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;public void sortHand(){<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Collections.sort(hand);<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;public String toString(){<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;String returnString = "";<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for(Card i : hand)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;returnString += " " + i;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return returnString;<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;@Override<br />
&nbsp;&nbsp;&nbsp;&nbsp;public void run() {<br />
//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Here I would have a wait() while the dealer deals out cards.<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;I would just have another wait() after that to wait for the player's<br />
//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;turn here. This is probably wrong because I would have no way<br />
//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;of notifying player1 separately.<br />
&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;public synchronized void playTurn(){<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.out.println(deck);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.out.println("---------------------------------------" +<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"----------------------------");<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.out.println(this.getName() + " is Playing ...");<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;giveCard(deck.draw());<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.out.println(this.getName() + " draws " + hand.get(hand.size() - 1)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;+ " from deck.");<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;this.sortHand();<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.out.println(this.getName() + "'s five cards after DRAWING a" +<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" card from deck are: " + this + "(sorted)");<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.out.print(this.getName() + ": Please discard one of the five cards in your hand: ");<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;try {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;int cardToRemove = kb.nextInt();<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for(Card i : hand){<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(Integer.valueOf(i.toString()) == cardToRemove){<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cardToRemove = hand.indexOf(i);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;deck.discard(hand.remove(cardToRemove));<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} catch (Exception e) {e.printStackTrace();}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;this.sortHand();<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.out.println(this.getName() + "'s four cards after DISCARD are: " + this);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;int a = Integer.valueOf(hand.get(0).toString());<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for(Card i : this.hand){<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(a == Integer.valueOf(i.toString()))<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;this.hasWon = true;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;this.hasWon = false;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;notify();<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />
<br />
}</code></div></div><br />
		</div>
	</div>
<br />
The code for CardDeck might be necessary for the solution I'm asking for, so here it is. It's a simple ArrayList of instances of Card, and CardDeck contains the methods necessary for drawing cards from the top of the deck and discarding cards to the bottom of the deck.<br />
<br />
<div class="spoiler" style="margin: 5px 0; padding: 5px; border: 1px solid #ccc; background: #f9f9f9;">
		<input type="button" onclick="showSpoiler(this);" value="Show" style="width: 5em; padding-right: 3px;" />&nbsp;<b>CardDeck.java</b><br />
		<div class="inner" style="display:none; margin-left: 15px; margin-top: 5px; border-left: 2px solid #ccc; padding-left: 5px;">
			<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>package matchGame;<br />
<br />
import java.util.ArrayList;<br />
import java.util.Collections;<br />
<br />
public class CardDeck {<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;private ArrayList&lt;Card&gt; deck;<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;public CardDeck(){<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;deck = new ArrayList&lt;Card&gt;();<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for(int i = 0; i &lt; 32; i++){<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;deck.add(new Card(i % 8));&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Collections.shuffle(deck);<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;public Card draw(){<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return deck.remove(0);<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;public void discard(Card thisCard){<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;deck.add(thisCard);<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;@Override<br />
&nbsp;&nbsp;&nbsp;&nbsp;public String toString(){<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;String returnString = "";<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for(Card i : deck)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;returnString += i + " ";<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return returnString;<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />
}</code></div></div><br />
		</div>
	</div>
<br />
Added the code for Dealer below. Dealer just represents the dealer and has one job: to deal four cards to each player at the beginning of the game. This code is inside its own class because I'm following the instructor (otherwise I'd just have deal() in CardGame).<br />
<br />
Dealer pretty much runs the entire game once its thread is started. This is because I haven't figured out the multithreading part of the exercise yet. Preferably, at the very end of Dealer's run() method it would notify CardGame to let it know that the game has finished.<br />
<br />
<div class="spoiler" style="margin: 5px 0; padding: 5px; border: 1px solid #ccc; background: #f9f9f9;">
		<input type="button" onclick="showSpoiler(this);" value="Show" style="width: 5em; padding-right: 3px;" />&nbsp;<b>Dealer.java</b><br />
		<div class="inner" style="display:none; margin-left: 15px; margin-top: 5px; border-left: 2px solid #ccc; padding-left: 5px;">
			<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>package matchGame;<br />
<br />
public class Dealer implements Runnable{<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;private CardDeck deck;<br />
&nbsp;&nbsp;&nbsp;&nbsp;public boolean isFinished;<br />
&nbsp;&nbsp;&nbsp;&nbsp;private Player player1;<br />
&nbsp;&nbsp;&nbsp;&nbsp;private Player player2;<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;public Dealer(CardDeck deck){<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;this.deck = deck;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;isFinished = false;<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;public void setP1(Player player1){<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;this.player1 = player1;<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;public void setP2(Player player2){<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;this.player2 = player2;<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;public synchronized void deal(Player toPlayer){<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for(int i = 0; i &lt; 4; i++){<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;toPlayer.hand.add(deck.draw());<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;notify();<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;@Override<br />
&nbsp;&nbsp;&nbsp;&nbsp;public void run() {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;deal(player1);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;deal(player2);<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.out.println("Dealer deals four cards to the players as follows...&#92;n"<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; + player1.getName() + "'s FIRST four cards are: " + player1 + "&#92;n"<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; + player2.getName() + "'s FIRST four cards are: " + player2 + "&#92;n");<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;while((!(player1.hasWon)) &amp;&amp; (!(player2.hasWon))){<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Here I would add a wait() while player1 plays their turn.<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;player1.playTurn();<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(player1.hasWon)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Here I would add another wait() while player2 plays their turn.<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;player2.playTurn();<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;isFinished = true;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;notify();<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />
}</code></div></div><br />
		</div>
	</div>
What's the correct implementation for this? After starting the two Player threads, Player1 should go first immediately. When Player1's turn is done (and Player1 hasn't won yet), Player2 should be notified and Player1 should go to sleep and vice versa. And of course, when either Player1 or Player2 hasWon, the main() thread should keep going.<br />
<br />
Any help would be greatly appreciated. I'm just having trouble grasping how this is supposed to work.]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[A basic Engineering Physics (vectors/forces) problem]]></title>
			<link>https://www.southperry.net/showthread.php?tid=69904</link>
			<pubDate>Sun, 16 Feb 2014 19:41:49 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://www.southperry.net/member.php?action=profile&uid=10509">Declaimed</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.southperry.net/showthread.php?tid=69904</guid>
			<description><![CDATA[Woo, alright. So, I'll throw this out there right off the bat: I'm taking a college level Physics course, but I've had no experience with anything Physics prior. So forgive me if I seem like I don't know what I'm doing (because I probably don't). I have a lab that I'm working on involving forces, and using vectors to graphically depict/analytically calculate said forces. Here is my dilemma:<br />
<br />
Given two forces, F1 and F2:<br />
<br />
F1 = <br />
Force:  2.452 N<br />
Mass: .25 kg<br />
Direction: 30 degrees<br />
<br />
F2 = <br />
Force: 3.433 N<br />
Mass: .35 kg<br />
Direction: 130 degrees<br />
<br />
[As cos 130 yields a negative value, I added 90 to it to get my angle measure back into Q1 for a positive value and used that for my calculations]<br />
<br />
, I am to find the resultant |R| (its magnitude and direction).<br />
<br />
<br />
Using the head-to-tail method of moving vectors, I moved F2 on the graph without rotating it to the tail of F1, and constructed |R| by drawing a straight line from the tail of F2 to the head of F1. This forms a triangle (not a right triangle, just a triangle). The first part of this exercise asks me to graphically depict and measure the resultant force. Measuring things out with a ruler and protractor, I come to the result:<br />
<br />
|R|:<br />
Force(N) = 3.813 N<br />
Direction: 93.5 degrees.<br />
<br />
<br />
<br />
The next step is to calculate the resultant analytically. The formula below is given to accomplish this:<br />
<br />
Rx = ([F1]x+[F2]x) = [F1]cos(angle[F1]) + [F2]cos(angle[F2])<br />
Ry = ([F1]y+[F2]y) = [F1]sin(angle[F1]) + [F2]sin(angle[F2])<br />
|R| = sqrt([Rx]^2+[Ry]^2)<br />
<br />
Plugging in my values I get:<br />
<br />
Rx = ([F1]x+[F2]x) = [2.452]cos(30) + [3.433]cos(40)<br />
Ry = ([F1]y+[F2]y) = [2.452]sin(30) +  [3.433]sin(40)<br />
<br />
Rx = 4.7533<br />
Ry = 3.4327<br />
Rx^2 = 22.594<br />
Ry^2 = 11.783<br />
<br />
|R| = sqrt([Rx]^2+[Ry]^2)<br />
<br />
|R| = sqrt(22.594+11.783)<br />
|R| = sqrt(34.377)<br />
<span style="font-weight: bold;" class="mycode_b">|R| = 5.8632<br />
</span><br />
<br />
So, analytically:<br />
|R|:<br />
Force(N) = 5.863 N<br />
Direction: 72.2 degrees.<br />
Mass: 0.60 kg<br />
<br />
<br />
<br />
My analytical and graphical results are extremely different. I can't figure out where I'm going wrong.]]></description>
			<content:encoded><![CDATA[Woo, alright. So, I'll throw this out there right off the bat: I'm taking a college level Physics course, but I've had no experience with anything Physics prior. So forgive me if I seem like I don't know what I'm doing (because I probably don't). I have a lab that I'm working on involving forces, and using vectors to graphically depict/analytically calculate said forces. Here is my dilemma:<br />
<br />
Given two forces, F1 and F2:<br />
<br />
F1 = <br />
Force:  2.452 N<br />
Mass: .25 kg<br />
Direction: 30 degrees<br />
<br />
F2 = <br />
Force: 3.433 N<br />
Mass: .35 kg<br />
Direction: 130 degrees<br />
<br />
[As cos 130 yields a negative value, I added 90 to it to get my angle measure back into Q1 for a positive value and used that for my calculations]<br />
<br />
, I am to find the resultant |R| (its magnitude and direction).<br />
<br />
<br />
Using the head-to-tail method of moving vectors, I moved F2 on the graph without rotating it to the tail of F1, and constructed |R| by drawing a straight line from the tail of F2 to the head of F1. This forms a triangle (not a right triangle, just a triangle). The first part of this exercise asks me to graphically depict and measure the resultant force. Measuring things out with a ruler and protractor, I come to the result:<br />
<br />
|R|:<br />
Force(N) = 3.813 N<br />
Direction: 93.5 degrees.<br />
<br />
<br />
<br />
The next step is to calculate the resultant analytically. The formula below is given to accomplish this:<br />
<br />
Rx = ([F1]x+[F2]x) = [F1]cos(angle[F1]) + [F2]cos(angle[F2])<br />
Ry = ([F1]y+[F2]y) = [F1]sin(angle[F1]) + [F2]sin(angle[F2])<br />
|R| = sqrt([Rx]^2+[Ry]^2)<br />
<br />
Plugging in my values I get:<br />
<br />
Rx = ([F1]x+[F2]x) = [2.452]cos(30) + [3.433]cos(40)<br />
Ry = ([F1]y+[F2]y) = [2.452]sin(30) +  [3.433]sin(40)<br />
<br />
Rx = 4.7533<br />
Ry = 3.4327<br />
Rx^2 = 22.594<br />
Ry^2 = 11.783<br />
<br />
|R| = sqrt([Rx]^2+[Ry]^2)<br />
<br />
|R| = sqrt(22.594+11.783)<br />
|R| = sqrt(34.377)<br />
<span style="font-weight: bold;" class="mycode_b">|R| = 5.8632<br />
</span><br />
<br />
So, analytically:<br />
|R|:<br />
Force(N) = 5.863 N<br />
Direction: 72.2 degrees.<br />
Mass: 0.60 kg<br />
<br />
<br />
<br />
My analytical and graphical results are extremely different. I can't figure out where I'm going wrong.]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Esoterics]]></title>
			<link>https://www.southperry.net/showthread.php?tid=69786</link>
			<pubDate>Mon, 10 Feb 2014 11:49:00 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://www.southperry.net/member.php?action=profile&uid=12885">Jazeon</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.southperry.net/showthread.php?tid=69786</guid>
			<description><![CDATA[So in light of the recent thread about creationist vs evolution, I started thinking about how people view the ideas of the people behind the scenes. Questions like do you think they are just as crazy religious people, do you even think they existed and acted in the capacity people claim the did and do and the like. <br />
<br />
I'm referring to influential people in this realm such as Manly P. Hall, Francis Bacon, Benjamin Franklin, Aleister Crowley,  Anton Szandor LaVey,the great families who control the federal banks (or who are claimed to control: Goldman Sachs, Rockefellers, Lehmans and Kuhn Loebs of New York; the Rothschilds of Paris and London; the Warburgs of Hamburg; the Lazards of Paris; and the Israel Moses Seifs of Rome).<br />
<br />
Do many people even believe the stuff the are suspected of doing or does anyone even care in the first place. I want to get an opinion from the people of southperry since I seen some of your views on science and the like, partly because these influential people admittedly believe in alot more than just science they use it sure, but their ideas and actions go beyond regular thought patterns. <br />
<br />
They are many videos you can find on the workings of these people, i'm sure any of you being learned in the ways of the internet can find them if you choose, but I wouldn't mind posting specific videos that claim to expose what these people were/are all about.<br />
<br />
Your views gentlemen?]]></description>
			<content:encoded><![CDATA[So in light of the recent thread about creationist vs evolution, I started thinking about how people view the ideas of the people behind the scenes. Questions like do you think they are just as crazy religious people, do you even think they existed and acted in the capacity people claim the did and do and the like. <br />
<br />
I'm referring to influential people in this realm such as Manly P. Hall, Francis Bacon, Benjamin Franklin, Aleister Crowley,  Anton Szandor LaVey,the great families who control the federal banks (or who are claimed to control: Goldman Sachs, Rockefellers, Lehmans and Kuhn Loebs of New York; the Rothschilds of Paris and London; the Warburgs of Hamburg; the Lazards of Paris; and the Israel Moses Seifs of Rome).<br />
<br />
Do many people even believe the stuff the are suspected of doing or does anyone even care in the first place. I want to get an opinion from the people of southperry since I seen some of your views on science and the like, partly because these influential people admittedly believe in alot more than just science they use it sure, but their ideas and actions go beyond regular thought patterns. <br />
<br />
They are many videos you can find on the workings of these people, i'm sure any of you being learned in the ways of the internet can find them if you choose, but I wouldn't mind posting specific videos that claim to expose what these people were/are all about.<br />
<br />
Your views gentlemen?]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Reflection of a Vector]]></title>
			<link>https://www.southperry.net/showthread.php?tid=69595</link>
			<pubDate>Sat, 01 Feb 2014 08:01:00 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://www.southperry.net/member.php?action=profile&uid=5154">Tay</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.southperry.net/showthread.php?tid=69595</guid>
			<description><![CDATA[Ok, Linear Algebra question here. I have no idea what I'm exactly doing wrong, or how everyone else does this. I can't find a good example online that is doing it the way my text book is teaching it. <br />
<br />
So here's the problem. <br />
<br />
Let L be the line in R^3 that consists of all scalar multiples of<br />
L=<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>2<br />
1<br />
2</code></div></div>*this is a 1x3 matrix, not sure how to represent a matrix well on here*<br />
<br />
Find the reflection of the vector about the line L.<br />
v=<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>1<br />
1<br />
1</code></div></div> <br />
*again, 1x3 matrix*<br />
<br />
From what I know, I need to find the orthogonal projection of v onto line L, and then use a handy dandy formula. <br />
I know that a projection is equal to ;<br />
(1/||w||^2)w dot w^T<br />
<br />
where ||w||^2 is the magnitude of w squared and w^T is w transpose. <br />
<br />
So, I'm saying that w is my line, L. Therefore, ||w||^2 = ((2^2 + 1^2 + 2)^1/2)^2  = ((9)^1/2)^2) = 9<br />
<br />
hopefully?<br />
<br />
and L dot L^T = 3x3 matrix; <div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>4 2 4<br />
2 1 2<br />
4 2 4</code></div></div><br />
SoOoOOoOo my projection matrix, A, is equal to <br />
<br />
(1/9) *<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>4 2 4<br />
2 1 2<br />
4 2 4</code></div></div><br />
And my handy dandy formula to find the reflection of a matrix with respect to a line is 2proj(x) - x which is also <br />
2Ax - x <br />
(2A - I)x where I is an identity matrix<br />
<br />
preforming this out is definitely not getting me the answer in the back of the book though. <br />
<br />
<br />
I apologize for this really weird way of typing this out, and I really dunno what I'm seeing incorrectly but it's something massive lol.]]></description>
			<content:encoded><![CDATA[Ok, Linear Algebra question here. I have no idea what I'm exactly doing wrong, or how everyone else does this. I can't find a good example online that is doing it the way my text book is teaching it. <br />
<br />
So here's the problem. <br />
<br />
Let L be the line in R^3 that consists of all scalar multiples of<br />
L=<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>2<br />
1<br />
2</code></div></div>*this is a 1x3 matrix, not sure how to represent a matrix well on here*<br />
<br />
Find the reflection of the vector about the line L.<br />
v=<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>1<br />
1<br />
1</code></div></div> <br />
*again, 1x3 matrix*<br />
<br />
From what I know, I need to find the orthogonal projection of v onto line L, and then use a handy dandy formula. <br />
I know that a projection is equal to ;<br />
(1/||w||^2)w dot w^T<br />
<br />
where ||w||^2 is the magnitude of w squared and w^T is w transpose. <br />
<br />
So, I'm saying that w is my line, L. Therefore, ||w||^2 = ((2^2 + 1^2 + 2)^1/2)^2  = ((9)^1/2)^2) = 9<br />
<br />
hopefully?<br />
<br />
and L dot L^T = 3x3 matrix; <div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>4 2 4<br />
2 1 2<br />
4 2 4</code></div></div><br />
SoOoOOoOo my projection matrix, A, is equal to <br />
<br />
(1/9) *<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>4 2 4<br />
2 1 2<br />
4 2 4</code></div></div><br />
And my handy dandy formula to find the reflection of a matrix with respect to a line is 2proj(x) - x which is also <br />
2Ax - x <br />
(2A - I)x where I is an identity matrix<br />
<br />
preforming this out is definitely not getting me the answer in the back of the book though. <br />
<br />
<br />
I apologize for this really weird way of typing this out, and I really dunno what I'm seeing incorrectly but it's something massive lol.]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Gravity from a mountain observation.]]></title>
			<link>https://www.southperry.net/showthread.php?tid=69223</link>
			<pubDate>Mon, 13 Jan 2014 06:39:08 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://www.southperry.net/member.php?action=profile&uid=6121">Imagine</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.southperry.net/showthread.php?tid=69223</guid>
			<description><![CDATA[A sensitive gravimeter at a mountain observatory finds that the free-fall acceleration is 8.00×10&#8722;3m/s^2 less than that at sea level.<br />
What is the observatory's altitude?<br />
<br />
Given gravity at sea level: 9.83 m/s^2<br />
<br />
I used:<br />
G = 6.673 * 10 ^ -11 m^3 kg^-1 s^-2<br />
r = 6.37*10^6 m<br />
mass of the earth = 5.98 *10^24 kg<br />
<br />
The equation I used was: g = Gm/(r^2)<br />
<br />
How I did the problem:<br />
9.822 = Gm/(r+h)^2<br />
(r+h)^2 = Gm/9.822<br />
h = sqrt(Gm/9.822) - r<br />
The answer I got was 3987 m, while the correct answer is 2590 m. Plugging in their answer I get 9.826 m/s^2, while plugging in my answer gets me 9.822 m/s^2.<br />
<br />
Is their answer wrong, or am I using the wrong equation?]]></description>
			<content:encoded><![CDATA[A sensitive gravimeter at a mountain observatory finds that the free-fall acceleration is 8.00×10&#8722;3m/s^2 less than that at sea level.<br />
What is the observatory's altitude?<br />
<br />
Given gravity at sea level: 9.83 m/s^2<br />
<br />
I used:<br />
G = 6.673 * 10 ^ -11 m^3 kg^-1 s^-2<br />
r = 6.37*10^6 m<br />
mass of the earth = 5.98 *10^24 kg<br />
<br />
The equation I used was: g = Gm/(r^2)<br />
<br />
How I did the problem:<br />
9.822 = Gm/(r+h)^2<br />
(r+h)^2 = Gm/9.822<br />
h = sqrt(Gm/9.822) - r<br />
The answer I got was 3987 m, while the correct answer is 2590 m. Plugging in their answer I get 9.826 m/s^2, while plugging in my answer gets me 9.822 m/s^2.<br />
<br />
Is their answer wrong, or am I using the wrong equation?]]></content:encoded>
		</item>
	</channel>
</rss>