<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wikidot="http://www.wikidot.com/rss-namespace">

	<channel>
		<title>Back to basic; Dice game</title>
		<link>http://www.ascii-world.com/forum/t-27827/back-to-basic-dice-game</link>
		<description>Posts in the discussion thread &quot;Back to basic; Dice game&quot; - Another not so serious code. I had boring here lol</description>
				<copyright></copyright>
		<lastBuildDate></lastBuildDate>
		
					<item>
				<guid>http://www.ascii-world.com/forum/t-27827#post-70491</guid>
				<title>Back to basic; Dice game</title>
				<link>http://www.ascii-world.com/forum/t-27827/back-to-basic-dice-game#post-70491</link>
				<description></description>
				<pubDate>Wed, 21 Nov 2007 13:30:57 +0000</pubDate>
				<wikidot:authorName>EKVirtanen</wikidot:authorName>				<wikidot:authorUserId>12785</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <div class="code"> <pre> <code>// Dice game for yaBasic www.yabasic.de // Just having a fun here. Nothing special diceMax = 6 // max value of dice diceMin = 1 // min value of dice CanExit = false // MAIN GAME LOOP while(CanExit = false) clear screen print "" print " Dice Game for yaBasic!" print " ************************" print "" print " Just having fun, nothing special here." print " E.K.Virtanen www.ascii-world.com" print " Public Domain" print "" print " Select:" print " 1.) Play" print " 2.) Help" print " 3.) Quit" temp$ = inkey$ if(temp$ = "1") gosub play if(temp$ = "2") gosub help if(temp$ = "3") CanExit = true wend clear screen print "" print " Thank you for playing." end label play gosub plrPlay if plrTotal &lt; 22 gosub cpuPlay return label plrPlay plrTotal = 0 throwNum = 0 done = false while(done = false) throwNum = (throwNum + 1) clear screen print "" print " This is throw #", throwNum print " Press a key to throw a dice" print "" inkey$ diceVal = int(ran(diceMax) + diceMin) plrTotal = (plrTotal + diceVal) sleep 1 print " You did throw ", diceVal // Now we check few things. if(plrTotal &gt; 21) then print " You go over 21. You lost." done = true end if if(plrTotal = 21) then print " You got it. 21 excatly." done = true break end if print " Your total is ", plrTotal print " Press 's' to stay or any other key for more." if(inkey$ = "s") done = true wend return label cpuPlay cpuTotal = 0 throwNum = 0 done = false while(done = false) throwNum = (throwNum + 1) clear screen print "" print " This is my throw #", throwNum print "" sleep 1 diceVal = int(ran(diceMax) + diceMin) cpuTotal = (cpuTotal + diceVal) print " I did throw ", diceVal // Now we check few things. if(cpuTotal &gt; 21) then print " I did go over 21. I lost." break end if if(cpuTotal = 21) then if(plrTotal &lt; 21) print " You lost, i got 21." if(plrTotal = 21) print" Amazing, we both got 21. You lost since it's tie." break end if if(cpuTotal = plrTotal) then print " I have same result now, in tie so i win." break end if print " My total is ", cpuTotal print " Your total was ", plrTotal print "" if(plrTotal &gt; cpuTotal) print " I just got to throw more to beat you." if(plrTotal &lt; cpuTotal) then print " No need to throw more, i did beat you" done = true end if sleep 3 wend inkey$ return label help clear screen print "" print " Dice Game for yaBasic!" print " ************************" print "" print " In this game, you throw a single six sided dice." print " Result of your throw is counted after every round." print " Idea is to get as close of total 21 as possible." print " Basic idea is same than in BlackJack card game." print "" print " If you go over 21, you loose automaticly." print " After youre done, computer throws too and tries to beat you." print " In tie, computer wins." print "" print " Press any key to return for menu." inkey$ return</code> </pre></div> 
				 	]]>
				</content:encoded>							</item>
				</channel>
</rss>