<?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>ASCII programming. (new posts)</title>
		<link>http://www.ascii-world.com/forum/c-9931/ascii-programming</link>
		<description>Posts in the forum category &quot;ASCII programming.&quot; - If its about ASCII/text programming, talk about it in here. Language or platform is not an issue.</description>
				<copyright></copyright>
		<lastBuildDate>Fri, 03 Sep 2010 19:51:49 +0000</lastBuildDate>
		
					<item>
				<guid>http://www.ascii-world.com/forum/t-15545#post-815648</guid>
				<title>Visit Don&#039;s QuickBasic Programs webpage: Re: Visit Don&#039;s QuickBasic Programs webpage</title>
				<link>http://www.ascii-world.com/forum/t-15545/visit-don-s-quickbasic-programs-webpage#post-815648</link>
				<description></description>
				<pubDate>Thu, 24 Jun 2010 18:47:00 +0000</pubDate>
				<wikidot:authorName>qbworker</wikidot:authorName>				<wikidot:authorUserId>506298</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>yeah i havnt checked the code but it looks great!</p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://www.ascii-world.com/forum/t-12998#post-718038</guid>
				<title>guess the number topic: Re: guess the number topic</title>
				<link>http://www.ascii-world.com/forum/t-12998/guess-the-number-topic#post-718038</link>
				<description></description>
				<pubDate>Mon, 08 Mar 2010 16:34:29 +0000</pubDate>
				<wikidot:authorName>EKVirtanen</wikidot:authorName>				<wikidot:authorUserId>12785</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>Ok, ports for BaCon and R now added to the list. See full list at <a href="http://www.ascii-world.com/guessit:guess-it">http://www.ascii-world.com/guessit:guess-it</a></p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://www.ascii-world.com/forum/t-12998#post-717925</guid>
				<title>guess the number topic: Re: guess the number topic - Guess a number in R</title>
				<link>http://www.ascii-world.com/forum/t-12998/guess-the-number-topic#post-717925</link>
				<description></description>
				<pubDate>Mon, 08 Mar 2010 13:53:04 +0000</pubDate>
				<wikidot:authorName>EKVirtanen</wikidot:authorName>				<wikidot:authorUserId>12785</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>Thanks Lance. Ill add your contribution today.</p> <p>I assume your code should look like this</p> <div class="code"> <pre> <code># Number guessing game for R # This is a test program in R to demonstrate interactive # programming and the If and While control structures # This program must be started using the source() command NumGuess &lt;- 0 # Initialise this symbol, used to count the number guesses Uname &lt;- readline("What is your name? ") cat("Guess a number between 1 and a 100 ", Uname, "\n") ComNum &lt;- as.integer(runif(1, min = 1, max = 100)) Guess &lt;- as.integer(readline("Enter your guess: ")) NumGuess &lt;- NumGuess + 1 while (ComNum != Guess) { if (Guess&lt;ComNum) { cat("Your guess is too low!", "\n") } else { cat("Your guess is too high!", "\n") } Guess &lt;- as.integer(readline("Please enter a new guess: ")) NumGuess &lt;- NumGuess + 1 } cat(Uname,", you got it! ", "\n") cat("It took you ",NumGuess," guesses to guess right.", "\n")</code> </pre></div> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://www.ascii-world.com/forum/t-12998#post-717911</guid>
				<title>guess the number topic: Re: guess the number topic - Guess a number in R</title>
				<link>http://www.ascii-world.com/forum/t-12998/guess-the-number-topic#post-717911</link>
				<description></description>
				<pubDate>Mon, 08 Mar 2010 13:45:52 +0000</pubDate>
				<wikidot:authorName>LanceGary</wikidot:authorName>								<content:encoded>
					<![CDATA[
						 <p>The numbered entries at the beginning of the R code should be "#" which is the R indicator of a comment. Don't try to enter numbered comments in R!</p> <p>Lance</p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://www.ascii-world.com/forum/t-12998#post-717907</guid>
				<title>guess the number topic: Re: guess the number topic - Guess a number in R</title>
				<link>http://www.ascii-world.com/forum/t-12998/guess-the-number-topic#post-717907</link>
				<description></description>
				<pubDate>Mon, 08 Mar 2010 13:41:10 +0000</pubDate>
				<wikidot:authorName>LanceGary</wikidot:authorName>								<content:encoded>
					<![CDATA[
						 <ol> <li>Number guessing game for R <ol> <li>This is a test program in R to demonstrate interactive</li> <li>programming and the If and While control structures</li> <li>This program must be started using the source() command</li> </ol> </li> </ol> <p>NumGuess &lt;- 0 # Initialise this symbol, used to count the number guesses</p> <p>Uname &lt;- readline("What is your name? ")</p> <p>cat("Guess a number between 1 and a 100 ", Uname, "\n")</p> <p>ComNum &lt;- as.integer(runif(1, min = 1, max = 100))</p> <p>Guess &lt;- as.integer(readline("Enter your guess: "))</p> <p>NumGuess &lt;- NumGuess + 1</p> <p>while (ComNum != Guess) {</p> <p>if (Guess&lt;ComNum) {<br /> cat("Your guess is too low!", "\n")<br /> } else {<br /> cat("Your guess is too high!", "\n")<br /> }<br /> Guess &lt;- as.integer(readline("Please enter a new guess: "))</p> <p>NumGuess &lt;- NumGuess + 1<br /> }</p> <p>cat(Uname,", you got it! ", "\n")<br /> cat("It took you ",NumGuess," guesses to guess right.", "\n")</p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://www.ascii-world.com/forum/t-12998#post-373063</guid>
				<title>guess the number topic: Re: guess the number topic</title>
				<link>http://www.ascii-world.com/forum/t-12998/guess-the-number-topic#post-373063</link>
				<description></description>
				<pubDate>Mon, 02 Feb 2009 09:56:05 +0000</pubDate>
				<wikidot:authorName>E.K.Virtanen</wikidot:authorName>								<content:encoded>
					<![CDATA[
						 <p>Thanks rCX. Cool to get new versions for this one. Ill add your code in guess-it page when i get back home from work.</p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://www.ascii-world.com/forum/t-12998#post-372222</guid>
				<title>guess the number topic: Re: guess the number topic</title>
				<link>http://www.ascii-world.com/forum/t-12998/guess-the-number-topic#post-372222</link>
				<description></description>
				<pubDate>Sun, 01 Feb 2009 04:07:14 +0000</pubDate>
				<wikidot:authorName>rCX</wikidot:authorName>								<content:encoded>
					<![CDATA[
						 <p>Really cool project. Here's one in MATLAB. I was going to write one if FASM for DOS as well.</p> <div class="code"> <pre> <code>% Guess what number for MATLAB 7.5.0 % rCX. 2009, public domain MIN = 1; MAX = 100; Plr_Guess = -1; while true() clc %Clear Command Window Randomed = uint8(rand() * ((MAX + 1) - MIN) + MIN); rounds = 0; disp(['Ok, i think random integer between ',num2str(MIN),' and ',num2str(MAX),'.']) disp('Your job is to guess what it is in as minimal tries as possible.') disp(' ') disp('After your every guess, ill give you hint is my number higher or lower than your guess.') disp('You can exit by ''guessing'' 0.') disp('Press any key to start game.') pause clc while true() rounds = rounds + 1; disp(['This is round number: ',num2str(rounds),'.']) Plr_Guess = str2num(input('Give your guess: ','s')); %'s' tells MATLAB to return input as string if Plr_Guess == 0 return %exit program elseif Plr_Guess &gt; Randomed disp('My number is smaller...') elseif Plr_Guess &lt; Randomed disp('My number is higher...') elseif Plr_Guess == Randomed break else return %exit program end disp(' ') end disp('You got it!!!') disp(['It took ',num2str(rounds),' rounds to guess right number.']) disp(' ') key = input('Do you want to play again? Enter ''y'' or ''n''. ','s'); if ~strcmp(key,'y') &amp;&amp; ~strcmp(key,'Y') break end end</code> </pre></div> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://www.ascii-world.com/forum/t-29719#post-75265</guid>
				<title>tinyBasic with smallBasic: tinyBasic with smallBasic</title>
				<link>http://www.ascii-world.com/forum/t-29719/tinybasic-with-smallbasic#post-75265</link>
				<description></description>
				<pubDate>Tue, 04 Dec 2007 03:56:19 +0000</pubDate>
				<wikidot:authorName>Anonymous</wikidot:authorName>								<content:encoded>
					<![CDATA[
						 <div class="code"> <pre> <code>''' TinyBASIC, by Nicholas Christopoulos '' A SmallBASIC example :) DIM variables(26) '' variables (one for each letter) DIM stack(10) '' executor''s stack (GOSUB/FOR-NEXT/WHILE-WEND) DIM labels(), program() DEF varidx(name) = asc(left(name))-65 ip = -1 '' next command to execute (-1 = none, -2 = error) sp = 0 '' stack pointer CLS print cat(2);"TinyBASIC v1";cat(-2) print "A 450-line (with expression parser) SmallBASIC example" print print "Type HELP for catalog." print "Type QUIT to exit..." print print "READY" print repeat input "&gt; ", inpstr inpstr = trim(upper(inpstr)) cmd = trim(leftof(inpstr+" ", " ")) '' get command name if len(cmd) par = trim(rightof(inpstr, " ")) if isnumber(cmd) '' store command addcmd val(cmd), par else '' execute command execute cmd, par fi fi until cmd="QUIT" end '' Store command to memory sub addcmd(num, cmd) local i, ins, rep ins = len(labels): rep = -1 for i = 0 to len(labels)-1 if labels(i) = num then rep=i:exit if labels(i) &gt; num then ins=i:exit next if rep = -1 '' new record if len(cmd) '' no error, insert (or append) insert labels, ins, num insert program, ins, cmd fi else if len(cmd) '' replace program(rep) = cmd else '' erase delete labels, rep delete program, rep fi fi end '' set value to a variable sub setvar(varname, varval) local idx if len(varname)&gt;1 TBError "ILLEGAL VARIABLES NAME, USE ONE-CHAR NAMES" else idx = varidx(varname) varval = trim(varval) if left(varvar) = chr(34) '' it is a string variables(idx) = disclose(varval) else '' it is an expression variables(idx) = tbeval(varval) fi fi end '' execute a TB command sub execute(cmd, par) local idx, i, var, vstr local parA, tstr, fstr, f, num if cmd in ["END", "NEW"] '' new program or end of program; syntax: NEW or END ip = -1 sp = 0 if cmd="NEW" erase labels, commands '' clear program dim variables(26) '' clear variables print:print "* DONE *":print fi elif cmd in ["QUIT", "REM"] '' do nothing elif cmd="LET" '' assigns a value to a variable; syntax: LET variable = expression sinput par; var, "=", vstr setvar var, vstr elif cmd="LIST" '' prints the program, syntax: LIST if len(labels) for i=0 to len(labels)-1 print using "####: &amp;"; labels(i); program(i) next else TBError "NO PROGRAM IN MEMORY" fi elif cmd="RUN" '' run the program, syntax: RUN ip = 0 while ip&lt;len(labels) last_ip = ip cmd = trim(leftof(program(ip)+" ", " ")) par = trim(rightof(program(ip), " ")) execute cmd, par if ip = -2 print "* ERROR AT ";labels(last_ip);" *" sp = 0 exit elif ip = -1 print:print "* DONE *":print sp = 0 exit else ip = ip + 1 fi wend elif cmd="INPUT" '' get a value form console, syntax: INPUT [prompt,] variable split par, ",", para, chr(34)+chr(34) use trim(x) if len(para) = 0 ip = -2 else if len(para) = 2 idx = 1 input disclose(para(i)); vstr else idx = 0 input "? ", vstr fi setvar para(idx), vstr fi elif cmd="PRINT" '' print to console, syntax: PRINT [var1 [, varN]] split par, ",", para, chr(34)+chr(34)+"()" use trim(x) for vstr in para if left(vstr)=chr(34) '' print string print disclose(vstr); " "; else '' print number (expression) print tbeval(vstr); " "; fi next print elif cmd in ["GOTO", "GOSUB"] '' Syntax: GOTO line or GOSUB line search labels, val(par), idx if idx = -1 TBError "LABEL "+par+" DOES NOT EXIST" else if cmd="GOSUB" stack(sp) = ["R", ip] '' "R" = a ''return'' command must read it sp = sp + 1 fi ip = idx-1 fi elif cmd="RETURN" '' syntax: RETURN if sp &gt; 0 sp = sp - 1 if stack(sp)(0) = "R" '' later you can add code for FOR and WHILE ip = stack(sp)(1) else TBError "STACK MESS" fi else TBError "STACK UNDERFLOW" fi elif cmd="IF" '' IF! what else?. Syntax: IF expression THEN line [ ELSE line ] sinput par; vstr, " THEN ", tstr, " ELSE ", fstr if tbeval(vstr) execute "GOTO",tstr elif len(fstr) execute "GOTO",fstr fi elif cmd="SAVE" f=disclose(par) if len(f)=0 TBError "MISSING: FILENAME" else if isarray(labels) if instr(f, ".TBAS")=0 THEN f=f+".tbas" ELSE f=leftoflast(f, ".TBAS")+".tbas" open f for output as #1 for i=0 to len(labels)-1 print #1; labels(i); " "; program(i) next close #1 print:print "* DONE *":print else TBError "NO PROGRAM IN MEMORY" fi fi elif cmd="LOAD" f=disclose(par) if len(f)=0 TBError "MISSING: FILENAME" else ip = -1 sp = 0 erase labels, commands '' clear program dim variables(26) '' clear variables if instr(f, ".TBAS")=0 THEN f=f+".tbas" ELSE f=leftoflast(f, ".TBAS")+".tbas" open f for input as #1 while not eof(1) line input #1; vstr num = leftof (vstr, " ") par = rightof(vstr, " ") addcmd val(num), par wend close #1 print:print "* DONE *":print fi elif cmd="FILES" print files("*.tbas") elif cmd="HELP" PRINT print " ";cat(2);"TinyBASIC, v1";cat(-2) PRINT print " * All variables are real numbers." print " * There are 26 variables, one for each letter" print " * INPUT return real number (not string)" print " * IF-THEN accepts only line-numbers (IF x THEN line ELSE line)" print " * PRINT uses only , as separator" PRINT print " HELP";tab(15);"This screen" print " NEW";tab(15);"New program" print " RUN";tab(15);"Run program" print " LIST";tab(15);"Prints program to screen" print " SAVE";tab(15);"Saves program to disk" print " LOAD";tab(15);"Loads a program from disk" print " FILES";tab(15);"Prints the list of TB programs" print " REM";tab(15);"Remarks" print " GOTO";tab(15);"Transfers control to ..." print " LET";tab(15);"Assigns a value to a variable" print " PRINT";tab(15);"Prints an expression" print " INPUT";tab(15);"Inputs a value" print " IF";tab(15);" " print " GOSUB";tab(15);" " print " RETURN";tab(15);" " print " END";tab(15);"Terminate the program" PRINT else TBError "BAD COMMAND" fi end '' Run-time error sub TBError(errmsg) PRINT print chr(7);"* ";errmsg;" *" PRINT ip = -2 end '' ==== expression parser ==== '' evaluate an expression def TBEval(expr) local result, rmn, c result = 0 expr = ltrim(expr) if len(expr) then logical result, expr TBEval = result end '' number def valueof(byref expr) local c, i, v for i=1 to len(expr) c = mid(expr, i, 1) if not (c in "0123456789.") then exit next if i &lt; len(expr) v = left(expr, i-1) expr = mid(expr, i) else v = expr expr = "" fi valueof = val(v) end '' operators: ( ) or value sub parenth(byref l, byref expr) local op, vname op = left(expr) if op = "(" expr = mid(expr, 2) logical l, expr if left(expr)=")" then expr = mid(expr, 2) else if op in "0123456789." l = valueof(expr) '' elif, check for function else '' variable l = variables(varidx(expr)) expr = if(len(expr)&gt;1, mid(expr, 2), "") fi fi end '' unary operators: - + NOT sub unary(byref l, byref expr) local op if left(expr,3) = "NOT" op="NOT" expr = mid(expr,4) elif left(expr,1) in ["-", "+"] op=left(expr) expr=mid(expr,2) fi parenth l, expr if op="NOT" l = NOT l elif op="-" l = -l elif op="+" '' ignore it fi end '' operators: * / sub muldiv(byref l, byref expr) local op, r unary l, expr while left(expr) in "*/" op = left(expr) expr = mid(expr, 2) unary r, expr if op = "*" l *= r elif op = "/" if r=0 TBError "DIVISION BY ZERO" else l /= r fi fi wend end '' operators: + - sub addsub(byref l, byref expr) local op, r muldiv l, expr while left(expr) in "+-" op = left(expr) expr = mid(expr, 2) muldiv r, expr if op = "+" l += r elif op = "-" l -= r fi wend end '' returns the logical operator func getlogopr(expr) local idx, op3, op2, op1 op3=["AND"] op2=["OR", "&lt;=", "&gt;=", "=&lt;", "=&gt;", "&lt;&gt;"] op1=["=", "&gt;", "&lt;"] search op3, left(expr,3), idx if idx &gt;= 0 then getlogopr=op3(idx):exit search op2, left(expr,2), idx if idx &gt;= 0 then getlogopr=op2(idx):exit search op1, left(expr,1), idx if idx &gt;= 0 then getlogopr=op1(idx):exit getlogopr="" end '' logical and comparation operators sub logical(byref l, byref expr) local op, r addsub l, expr while getlogopr(expr) &lt;&gt; "" op = getlogopr(expr) expr = mid(expr, len(op)+1) addsub r, expr if op = "AND" l = l AND r elif op = "OR" l = l OR r elif op = "=" l = (l = r) elif op = "&lt;" l = l &lt; r elif op = "&gt;" l = l &gt; r elif op = "&gt;=" or op = "=&gt;" l = l &gt;= r elif op = "&lt;=" or op = "=&lt;" l = l &lt;= r elif op = "&lt;&gt;" l = l &lt;&gt; r fi wend end '</code> </pre></div> <p><a href="http://smallbasic.sourceforge.net/?q=node/139">http://smallbasic.sourceforge.net/?q=node/139</a></p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://www.ascii-world.com/forum/t-28081#post-71098</guid>
				<title>War card game for yaBasic.: War card game for yaBasic.</title>
				<link>http://www.ascii-world.com/forum/t-28081/war-card-game-for-yabasic#post-71098</link>
				<description></description>
				<pubDate>Thu, 22 Nov 2007 20:54:16 +0000</pubDate>
				<wikidot:authorName>Anonymous</wikidot:authorName>								<content:encoded>
					<![CDATA[
						 <p>errr…have fun i guess :D</p> <div class="code"> <pre> <code>// WAR Card Game for yaBasic // E.K.Virtanen 2007 // www.ascii-world.com // Public Domain // ==================================== Main loop of game CanExit = FALSE while(CanExit = FALSE) clear screen print "" print color("red") " --- War ---" print "" print " Card game for yaBasic." print " E.K.Virtanen, www.ascii-world.com" print " Public Domain" print "" print color("yellow") " 1.)"; : print " Play" print color("yellow") " 2.)"; : print " Help" print color("yellow") " 3.)"; : print " Quit" temp$ = inkey$ if temp$ = "1" gosub play if temp$ = "2" gosub help if temp$ = "3" CanExit = TRUE wend print "" print " Thank you for playing." end // ==================================== Play sub label play gosub createDeck // we need to create deck with what we play gosub shuffleDeck // and then we shuffle it gosub playGame // now we play return // ==================================== createDeck sub label createDeck dim cardColor$(4, 2) cardColor$(1, 1) = "red" : cardColor$(1, 2) = "Heart" : cardColor$(2, 1) = "red" : cardColor$(2, 2) = "Diamond" cardColor$(3, 1) = "white" : cardColor$(3, 2) = "Spade" : cardColor$(4,1) = "white" : cardColor$(4,2) = "Cross" // some nifty looping and MOD to get a deck of cards dim cardDeck(52, 2) for counter = 0 to 51 cardDeck(counter + 1, 1) = int(counter / 4 + 1) cardDeck(counter + 1, 2) = Mod(counter, 4) + 1 next counter return // ==================================== shuffleDeck sub label shuffleDeck dim temp(2) for counter = 1 TO 10000 // ten thousand rounds should be more than enough :D tempFirst = int(ran(52) + 1) tempSecond = int(ran(52) + 1) if tempFirst &lt;&gt; tempSecond then temp(1) = cardDeck(tempFirst, 1) temp(2) = cardDeck(tempFirst, 2) cardDeck(tempFirst, 1) = cardDeck(tempSecond, 1) cardDeck(tempFirst, 2) = cardDeck(tempSecond, 2) cardDeck(tempSecond, 1) = temp(1) cardDeck(tempSecond, 2) = temp(2) end if next counter return // ==================================== playGame sub label playGame canExit = false roundNumber = 0 cardNumber = 1 plrTotal = 0 cpuTotal = 0 clear screen print "" print color("red") " --- War ---" print "" print " You can start." while(canExit = false) print " Choose, do you want first or second card?" print color("yellow") " 1.)"; : print " First" print color("yellow") " 2.)"; : print " Second" print " Any other key for Cpu choose." choice$ = inkey$ print "" if(choice$ &lt;&gt; "1" and choice$ &lt;&gt; "2") gosub cpuChoose if choice$ = "1" then print " You take first." plrCard = cardNumber cpuCard = cardNumber + 1 end if if choice$ = "2" then print " Cpu takes first." plrCard = cardNumber + 1 cpuCard = cardNumber end if cardNumber = cardNumber + 2 roundNumber = roundNumber + 1 if cardNumber = 53 canExit = true gosub revealCards gosub whoWin clear screen wend print "" print " War is over and results are:" print color("yellow") " You: "; : print plrTotal; : print " cards." print color("red") " Cpu: "; : print cpuTotal; : print " cards." print "" print " Press any key for back to menu." inkey$ return // ==================================== whoWin sub label whoWin if cardDeck(plrCard, 1) &gt; cardDeck(cpuCard, 1) then print "" print color("green") " You win!" print " You got both cards. "; plrTotal = plrTotal + 2 if cardDeck(plrCard, 1) - cardDeck(cpuCard, 1) &gt; 8 print " You really did crash Cpu!" if cardDeck(plrCard, 1) - cardDeck(cpuCard, 1) &lt; 3 print " So tight!" end if if cardDeck(plrCard, 1) &lt; cardDeck(cpuCard, 1) then print "" print color("red") " You lose!" print " Cpu got both cards."; if cardDeck(cpuCard, 1) - cardDeck(plrCard, 1) &gt; 8 print " Cpu really did override you!" if cardDeck(cpuCard, 1) - cardDeck(plrCard, 1) &lt; 3 print " Close, so close!" cpuTotal = cpuTotal + 2 end if if cardDeck(plrCard, 1) = cardDeck(cpuCard, 1) then print "" print color("yellow") " It's a tie." print " Both got their own card." cpuTotal = cpuTotal + 1 : plrTotal = plrTotal + 1 end if print "" print color("yellow") " Winned cards after round: "; : print roundNumber print "" print " You: "; : print plrTotal print " Cpu: "; : print cpuTotal gosub uselessComments print "" print color("yellow") " Press a key for next round." inkey$ return // ==================================== uselessComments sub label uselessComments if plrTotal &gt; cpuTotal then temp$ = " You are leading here!!!" if plrTotal - cpuTotal &gt; 5 temp$ = " Making a good lead there." if plrTotal - cpuTotal &gt; 10 temp$ = " You trying to escape?" if plrTotal - cpuTotal &gt; 15 temp$ = " HEHE, youre really crushing Cpu here!!!" end if if plrTotal &lt; cpuTotal then temp$ = " You are loosing!!!" if cpuTotal - plrTotal &gt; 5 temp$ = " Cpu leads clearly!" if cpuTotal - plrTotal &gt; 10 temp$ = " Cpu is trying to escape?" if cpuTotal - plrTotal &gt; 15 temp$ = " LOL, Cpu really kicks your ass here." end if if plrTotal = cpuTotal temp$ = " Side by side!" print temp$ return // ==================================== revealCards sub label revealCards print "" print " Your card is..."; print color(cardColor$(cardDeck(plrCard, 2), 1)) cardColor$(cardDeck(plrCard, 2), 2); : print " "; : print cardDeck(plrCard, 1) print " ...and Cpu slowly reveales hes card what is."; for counter = 1 to 2 sleep 1 print "."; next counter print color(cardColor$(cardDeck(cpuCard, 2), 1)) cardColor$(cardDeck(cpuCard, 2), 2); : print " "; : print cardDeck(cpuCard, 1) print "" return // ==================================== cpuChoose sub label cpuChoose choice$ = "1" if ran() = true choice$ = "2" return // ==================================== help sub label help clear screen print "" print color("red") " --- War ---" print "" print " Card game for yaBasic." print " E.K.Virtanen, www.ascii-world.com" print " Public Domain" print "" print " I game of War, a normal card deck is shuffled." print " Then from a top of deck, both players gets an card." print " Who's card is higher (in numerical value) wins and he get's the cards." print " This way, whole deck is revealed to the end. Who has more cards is the winner." print "" print " You opponent is Cpu (computer) so this is one player game." print "" print color("yellow") " Press any key to return for menu." inkey$ return</code> </pre></div> <p>E.K.Virtanen</p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://www.ascii-world.com/forum/t-27827#post-70491</guid>
				<title>Back to basic; Dice game: 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>
					<item>
				<guid>http://www.ascii-world.com/forum/t-12998#post-70483</guid>
				<title>guess the number topic: Re: guess the number topic</title>
				<link>http://www.ascii-world.com/forum/t-12998/guess-the-number-topic#post-70483</link>
				<description></description>
				<pubDate>Wed, 21 Nov 2007 12:50:10 +0000</pubDate>
				<wikidot:authorName>EKVirtanen</wikidot:authorName>				<wikidot:authorUserId>12785</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p><strong>Important</strong> about this project; Read more <a href="http://ascii-world.wikidot.com/forum/t-27823/guess-it-pages-changed">http://ascii-world.wikidot.com/forum/t-27823/guess-it-pages-changed</a></p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://www.ascii-world.com/forum/t-12998#post-70466</guid>
				<title>guess the number topic: Re: guess the number topic</title>
				<link>http://www.ascii-world.com/forum/t-12998/guess-the-number-topic#post-70466</link>
				<description></description>
				<pubDate>Wed, 21 Nov 2007 11:29:57 +0000</pubDate>
				<wikidot:authorName>EKVirtanen</wikidot:authorName>				<wikidot:authorUserId>12785</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>Thanks Jare for your contribution.<br /> <em>Finnish</em><br /> Pystyisitkö muokkaamaan tuota niin että se olisi hieman enemmän samallalailla toimiva kuin muutkin sorsat?<br /> Eli</p> <p>PÄÄLOOPPI<br /> tehdään valimistelut, printataan alkuteksti blaablaa</p> <p>PELILOOPPI<br /> kysellään kunnes oikein<br /> //PELILOOPPI</p> <p>Pääloopissa pysytään kunnen pelaaja arvaa 0 (eli haluaa lopettaa)<br /> //PÄÄLOOPPI</p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://www.ascii-world.com/forum/t-12998#post-70303</guid>
				<title>guess the number topic: Re: guess the number topic</title>
				<link>http://www.ascii-world.com/forum/t-12998/guess-the-number-topic#post-70303</link>
				<description></description>
				<pubDate>Tue, 20 Nov 2007 21:19:48 +0000</pubDate>
				<wikidot:authorName>Anonymous</wikidot:authorName>								<content:encoded>
					<![CDATA[
						 <p>Sorry, the code just didn't end up in the way I ment (no indents etc.).</p> <p>Here is more better looking one: <a href="http://koti.mbnet.fi/jare1/filer/files/guess.CB">http://koti.mbnet.fi/jare1/filer/files/guess.CB</a></p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://www.ascii-world.com/forum/t-12998#post-70298</guid>
				<title>guess the number topic: Re: guess the number topic</title>
				<link>http://www.ascii-world.com/forum/t-12998/guess-the-number-topic#post-70298</link>
				<description></description>
				<pubDate>Tue, 20 Nov 2007 21:15:03 +0000</pubDate>
				<wikidot:authorName>Anonymous</wikidot:authorName>								<content:encoded>
					<![CDATA[
						 <p>Here is mine, written in CoolBasic:</p> <div class="code"> <pre> <code>//the Ultimate Guessing Game (is that name proper English?) //By: Jarkko 'Jare' Linnanvirta 2007 (e-mail me if you want to ask something: kpelit2003@hotmail.com) //Can be used freely. 'The very important title SetWindow "the Ultimate Guessing Game!" 'Start by randomizing a number theNumber = Rand(1,100) Repeat Text 0,0, "Guess what number I am thinking (1 - 100)" 'Show console for user's ansrver Locate 0, ScreenHeight()-20 ansver = Input("? ") 'Check ansver when user hit's enter If KeyHit(cbKeyReturn) Then times + 1 If ansver = theNumber Then 'User got it right Text 0,20, "Yes, that's what I was thinking!" Text 0,40, "You tried "+times+" times." DrawScreen WaitKey theNumber = Rand(1,100) times = 0 ElseIf ansver &lt; theNumber Then 'User got it wrong Text 0,20, "No, too low!" DrawScreen WaitKey Else 'User got it wrong again Text 0,20, "No, too high!" DrawScreen WaitKey End If CloseInput 'Clear ansver in console End If DrawScreen 'Update screen so we can see something Forever 'Eternal loop (of course there is an inbuild safe exit feature: Escape key closes the program)</code> </pre></div> <p><em>admin edit:</em> added code tags.</p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://www.ascii-world.com/forum/t-27563#post-69876</guid>
				<title>Do you dare?: Do you dare?</title>
				<link>http://www.ascii-world.com/forum/t-27563/do-you-dare#post-69876</link>
				<description></description>
				<pubDate>Mon, 19 Nov 2007 20:10:50 +0000</pubDate>
				<wikidot:authorName>EKVirtanen</wikidot:authorName>				<wikidot:authorUserId>12785</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>Dont take these too seriously. Programming should be fun, at least for me ;D<br /> I made this maybe a week ago when i had boring.</p> <div class="code"> <pre> <code>// Do you dare? Version 0.001b for yaBasic // E.K.Virtanen, public domain. // www.ascii-world.com bulletMin = 1 bulletMax = 6 while(exitPrg = false) roundNum = 0 exitPrg = false exitGame = false // INTRO clear screen print color("red", "black") " Do You Dare?" print " E.K.Virtanen, public domain." print " Uberneat game for yaBasic ;D" print print " You are man with no future. You have nothing to lose." print " Wife left you, took your dog and childrens with her." print " You need to sell your house to pay kid's maintenance liability." print " Doctor told you have a bad brain tumor and you will die in few months." print print " So you dont have anything to loose..." print print " Green fairy comes to you, you are life 'WTF?!?" print " Fairy says, that if you take and survive of her challenge..." print " ...she heals your tumor and gives you a billion dollars of money." print print " Fairy has a revolver with a bullet. Point it to your head and pull the trigger." print " After every pull, bullet chamber is rolled randomly if you survive." print " If you survive for ten times, you have passed the challenge." print print color("red", "black") "PRESS A KEY TO ENTER FOR A CHALLENGE!" : inkey$ // ENTER THE GAME clear screen print color("yellow", "black") " Fairy thinks you are a brave man." print bulletIs = int(ran(6) + 1) // THE CHALLENGE repeat roundNum = (roundNum + 1) print print " This is round number: ", roundNum, "." print print " Fairy rolls the bullet wheel"; // BIT DELAY FOR EXCITEMENT for counter = 1 to 5 pause 0.5 print "."; next counter wheelIs = int(ran(bulletMax) + bulletMin) print print " ...and gives the revolver to you which you point to your head." print " Now you only need to pull the trigger and hope for the best." print print color("red", "black") " PRESS A KEY TO PULL THE TRIGGER!!!" inkey$ clear screen if wheelIs &lt;&gt; bulletIs then print color("green", "black") " You survived of this round!!!!!!" print color("green", "black") " There is still hope!!!" end if if wheelIs = bulletIs then print color("red", "black") " You feel shortly how the bullet smashes your brains..." print color("red", "black") " ...and now, you dont feel anything anymore." print color("red", "black") " May your body and soul rest in peace." break end if if roundNum = 10 then exitGame = true end if print " Press a key for next round." : inkey$ clear screen until(exitGame = true) if roundNum = 10 and exitGame = true then clear screen print print color("green", "black") " YOU HAVE SURVIVED THROUGH IMPOSSIBLE CHALLENGE!!!" print color("green", "black") " ***************************************************" print color("green", "black") " You pulled the trigger for TEN TIMES and you are still alive!" print print " Fairy cant believe it. But as for fairy of honor, she heals your tumor." print " She also gives you and briefcase which has a billion dollars." end if print print " Press 'y' to play again. Any other key to quit."; YesNo$ = inkey$ if upper$(YesNo$) &lt;&gt; "Y" then exitPrg = true end if wend</code> </pre></div> <p>E.K.Virtanen</p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://www.ascii-world.com/forum/t-27444#post-69863</guid>
				<title>Ancient Heroes: Re: Ancient Heroes</title>
				<link>http://www.ascii-world.com/forum/t-27444/ancient-heroes#post-69863</link>
				<description></description>
				<pubDate>Mon, 19 Nov 2007 19:27:50 +0000</pubDate>
				<wikidot:authorName>Anonymous</wikidot:authorName>								<content:encoded>
					<![CDATA[
						 <p>Hi.<br /> Looks interesting. Sad that cant try it now since im busy as hell here now. But i will try it tomorrow after work.</p> <p>E.K.Virtanen</p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://www.ascii-world.com/forum/t-27444#post-69522</guid>
				<title>Ancient Heroes: Ancient Heroes</title>
				<link>http://www.ascii-world.com/forum/t-27444/ancient-heroes#post-69522</link>
				<description></description>
				<pubDate>Sun, 18 Nov 2007 22:40:42 +0000</pubDate>
				<wikidot:authorName>Anonymous</wikidot:authorName>								<content:encoded>
					<![CDATA[
						 <p>Ancient heroes is a text-based game programmed in QBasic. The game [i]is[/i] illustrated, but the user may turn off images at the start of the game. I was encouraged (by E.K.Virtanen on the Freebasic forum) to post newer versions here, and I've recently finished a large upgrade.</p> <p>Here is a screenshot:<br /> <a href="http://www.childrenofmillennium.org/junk/screenshot3.gif">http://www.childrenofmillennium.org/junk/screenshot3.gif</a></p> <p>Download the game here, and run Heroes.exe: <a href="http://www.childrenofmillennium.org/junk/hero3.zip">Ancient Heroes</a></p> <p>Would it be worth making a purely ASCII version for upload? The game is of course much smaller without images.</p> <p>—Mark</p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://www.ascii-world.com/forum/t-27379#post-69364</guid>
				<title>*.BAS source code for Retro2FB project: Re: *.BAS source code for Retro2FB project</title>
				<link>http://www.ascii-world.com/forum/t-27379/bas-source-code-for-retro2fb-project#post-69364</link>
				<description></description>
				<pubDate>Sun, 18 Nov 2007 13:57:36 +0000</pubDate>
				<wikidot:authorName>EKVirtanen</wikidot:authorName>				<wikidot:authorUserId>12785</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>Yeah, i know that site too and it is great one. I think its in our basic related links but im not sure lol.</p> <p>E.K.Virtanen</p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://www.ascii-world.com/forum/t-27383#post-69363</guid>
				<title>Countdown.bas in FB: Re: Countdown.bas in FB</title>
				<link>http://www.ascii-world.com/forum/t-27383/countdown-bas-in-fb#post-69363</link>
				<description></description>
				<pubDate>Sun, 18 Nov 2007 13:55:55 +0000</pubDate>
				<wikidot:authorName>EKVirtanen</wikidot:authorName>				<wikidot:authorUserId>12785</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>Thanks. This is neat one.<br /> You can add it yourself in wiki if you like ;) But i cando it too, no matter.</p> <p>E.K.Virtanen</p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://www.ascii-world.com/forum/t-27383#post-69339</guid>
				<title>Countdown.bas in FB: Countdown.bas in FB</title>
				<link>http://www.ascii-world.com/forum/t-27383/countdown-bas-in-fb#post-69339</link>
				<description></description>
				<pubDate>Sun, 18 Nov 2007 12:24:01 +0000</pubDate>
				<wikidot:authorName>harmonv</wikidot:authorName>				<wikidot:authorUserId>49192</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <div class="code"> <pre> <code>' ============================================= ' = Countdown = ' = Original program by Mark Chambers = ' = from BASIC Computer Games Vol. II = ' = TRS-80 Edition - page 46 = ' = Creative Computing Morristown, New Jersey = ' ============================================= ' FreeBasic version by Harmon V. ' Public Domain Dim As Integer A, N, T, X, game Dim AS String YesNo, Message Screen 12 Do Cls Color 14, 0 Print : Print Print Tab(30); "C O U N T D O W N" Print Print print Color 15, 0 print tab(10); : input "Hit &lt;Enter&gt; to start";YesNo A = int(10*rnd(1)) N = 0 : T = 0 print print "You have activated the self-destruct sequence" print "in this school. If you wish, you may stop the" print "countdown. To do so, just type in the correct" print "number, which will stop the countdown." print "The number is from 0 to 9." print print "Please Hurry! There is no time to waste!!!!" game=0 while game=0 print : input "What'll it be? "; X if T=4 then game =-1 : exit while if X=A then game = 1 : exit while if X&lt;A then print "Too small !!!! "; if X&gt;A then print "Too big !!!! "; print "Your number does not compute." T = T + 1 print "Please try again !!!" if T=2 then print "Time grows short, please hurry !!!!" if T=3 then print "Hurry, the Count-down is approaching zero !!!!!" end if wend print if game&lt;0 then print ,"\\\\\|/////" print ,"&gt; B-O-O-M &lt;" print ,"/////|\\\\\" print print " You died a hero's death." print "Your funeral was well-attended." else print ,"Correct!!!!!" print ,"The countdown has stopped." print ,"You have saved the school !!" print print " *** Congratulations ***" print "(Have you seen your shrink lately?)" end if Print : Print "Do you want to play again? "; Do : YesNo = Inkey$ : Loop Until YesNo&lt;&gt;"" Loop While Ucase(YesNo)="Y" END</code> </pre></div> 
				 	]]>
				</content:encoded>							</item>
				</channel>
</rss>