<?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 threads)</title>
		<link>http://www.ascii-world.com/forum/c-9931/ascii-programming</link>
		<description>Threads 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>Thu, 09 Sep 2010 20:06:41 +0000</lastBuildDate>
		
					<item>
				<guid>http://www.ascii-world.com/forum/t-29719</guid>
				<title>tinyBasic with smallBasic</title>
				<link>http://www.ascii-world.com/forum/t-29719/tinybasic-with-smallbasic</link>
				<description>Intepreter written with intepreter...how perv :D</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</guid>
				<title>War card game for yaBasic.</title>
				<link>http://www.ascii-world.com/forum/t-28081/war-card-game-for-yabasic</link>
				<description>And more &quot;not so serious&quot; stuff here :D</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</guid>
				<title>Back to basic; Dice game</title>
				<link>http://www.ascii-world.com/forum/t-27827/back-to-basic-dice-game</link>
				<description>Another not so serious code. I had boring here lol</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-27563</guid>
				<title>Do you dare?</title>
				<link>http://www.ascii-world.com/forum/t-27563/do-you-dare</link>
				<description>Stupid &quot;suicide&quot; game for yaBasic.</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</guid>
				<title>Ancient Heroes</title>
				<link>http://www.ascii-world.com/forum/t-27444/ancient-heroes</link>
				<description>A turn-based, one-on-one fighting game in a fantasy setting. Select your hero, outfit him with weapons and armor, and slay the nine greatest warriors in the land!</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-27383</guid>
				<title>Countdown.bas in FB</title>
				<link>http://www.ascii-world.com/forum/t-27383/countdown-bas-in-fb</link>
				<description>Retro2FB submission</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>
					<item>
				<guid>http://www.ascii-world.com/forum/t-27379</guid>
				<title>*.BAS source code for Retro2FB project</title>
				<link>http://www.ascii-world.com/forum/t-27379/bas-source-code-for-retro2fb-project</link>
				<description>Want to work on your FB coding skill without have to create all the code?</description>
				<pubDate>Sun, 18 Nov 2007 12:00:59 +0000</pubDate>
				<wikidot:authorName>harmonv</wikidot:authorName>				<wikidot:authorUserId>49192</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p><a href="http://www.moorecad.com/classicbasic/">Classic Basic Games</a><br /> This website has the source code for ALL the programs from David Ahl's "BASIC Computer Programs Vol I."</p> <p>He also has "modified" versions with space between keywords too… Nice!</p> <p>You'll need to scroll down about half-way to see the links.</p> <p>For anyone who wants to contribute FB code to the Retro2FB project, this is a great resource.</p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://www.ascii-world.com/forum/t-19068</guid>
				<title>MP3 ReNamer (Win/Lin)</title>
				<link>http://www.ascii-world.com/forum/t-19068/mp3-renamer-win-lin</link>
				<description>Small console based application, semi ASCII.</description>
				<pubDate>Fri, 07 Sep 2007 20:03:02 +0000</pubDate>
				<wikidot:authorName>Anonymous</wikidot:authorName>								<content:encoded>
					<![CDATA[
						 <p>Here is a program I made on account of a friend who just moved to Linux. It's sortof ASCIIish because it outputs any information to a console, no fancy GUI here. Anyway, long story short I wrote a program for him to automatically name several thousand .mp3's based on Artist, Title, and Album, which in turn is a very useful program if you ask me. Example:</p> <blockquote> <p>blah.mp3……………………(Original filename)</p> <hr /> <p>Artist - Title - Album.mp3……(New Filename)</p> </blockquote> <p>All that needs to be done is stick the file bot (MP3_ReNamer.exe / MP3_ReNamer) into a dir with MP3's in it that you wish to rename. The bot will stream though the MP3's and load their trailers, find the right tags and rename it. If the bot doesn't find at least two tags it will skip the file and go to the next with out renaming it. That's about it. =)</p> <blockquote> <p>([{DISCLAIMER!}])<br /> This is an automated renaming tool. It is not guarantied by any means not to cause damage. Use at your own risk, and make sure you back up any MP3s you wish to rename in case of a failure. I will not be held responsible for any miss use of this program. Now warned, enjoy the software.</p> </blockquote> <p>Windows: <a href="http://file-pasta.com/d/1967.zip">http://file-pasta.com/d/1967.zip</a><br /> Linux: <a href="http://file-pasta.com/d/1986.zip">http://file-pasta.com/d/1986.zip</a> *</p> <p>*Linux version available thanks to E.K.Virtanen.</p> <p>-Rattra</p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://www.ascii-world.com/forum/t-18528</guid>
				<title>ASCII C converter.</title>
				<link>http://www.ascii-world.com/forum/t-18528/ascii-c-converter</link>
				<description>This is a very simple program to convert a given picture into a ASCII Art of 1s &amp; 0s. The output ASCII Image is saved in .html format.</description>
				<pubDate>Tue, 04 Sep 2007 06:22:19 +0000</pubDate>
				<wikidot:authorName>Anonymous</wikidot:authorName>								<content:encoded>
					<![CDATA[
						 <p>Download; <a href="http://www.codeproject.com/useritems/Simple_ASCII_Art.asp">http://www.codeproject.com/useritems/Simple_ASCII_Art.asp</a><br /> Sample picture; <a href="http://www.geocities.com/sajjitha_gunawardana/">http://www.geocities.com/sajjitha_gunawardana/</a></p> <p><em>E.K.Virtanen</em></p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://www.ascii-world.com/forum/t-16458</guid>
				<title>Print Snoopy to Screen (python)</title>
				<link>http://www.ascii-world.com/forum/t-16458/print-snoopy-to-screen-python</link>
				<description>from; http://python-forum.org/py/viewtopic.php?t=5063</description>
				<pubDate>Wed, 15 Aug 2007 16:57:35 +0000</pubDate>
				<wikidot:authorName>Anonymous</wikidot:authorName>								<content:encoded>
					<![CDATA[
						 <div class="code"> <pre> <code>#!/usr/bin/python """ Print Snoopy to the Screen""" # Marianne Williams 03 JUL 2007 Toronto, Ontario import sys import random # spacing S = [] S = [' ' * x for x in range(41)] # uppercase letter X X = [] X = ['X' * x for x in range(41)] # asterisk A = [] A = ['*' * x for x in range(41)] # keys to exit the program quitseq = 'q,x,end,quit,stop,exit,halt,off,' quitseq += quitseq.upper() # allow upper case versions quitseq = quitseq.split(',') # change string to list # default phrases defphrase = [] defphrase.append('Curse You, Red Baron!') defphrase.append("Yesterday I was a dog. Today I'm a dog. Tomorrow I'll probably still be a dog!") defphrase.append('My aunt Marian was right, but I forgot what she said!') defphrase.append('My life is full of unsuffered consequences!') defphrase.append("Dead puppies aren't much fun!") defphrase.append("Bring out the comfy chair!") defphrase.append("Your mother was a hamster!") defphrase.append("I don't like Spam!") defphrase.append("I'm more interesting than a wet pussycat!") # over word or maximum number of lines length overword = [] overword.append("I'm a dog, blast you, not a dictionary!") overword.append("Stop trying to suffocate me with words!") overword.append("You have GOT to be kidding!") overword.append('I am NOT going to repeat that, say it yourself!') overword.append("Give me a bloody break you twit!") overword.append("Information overload!!!") overword.append("Yeah, right!") overword.append("Are you nervy? Irritable? Deppressed? Tired of Life? Keep it up!") overword.append("You silly bunt!") overword.append("I wave my private parts at your aunties," + '\n' + "you cheesy lot of second-hand electric donkey bottom biters!") # Prompt for a Phrase to be printed print "Press the Enter key for Snoopy's default phrase" Phrase = '' try: Phrase = sys.argv[1] except: # no Phrase found, prompt for it print Phrase = '' while not Phrase: Phrase = raw_input("Enter an angry phrase for Snoopy to say ") if not Phrase: Phrase = random.choice(defphrase) if Phrase in quitseq: sys.exit() # exit the program # check to make sure the maximum word length is not longer than our line X 2 words = Phrase.split(' ') x = 0 y = 0 for word in words: x = len(word) if x &gt; y: y = x if y &gt; 42: Phrase = random.choice(overword) # Word Wrapping Function stolen from the internet def wrap(text, width): return reduce(lambda line, word, width=width: '%s%s%s' % (line, ' \n'[(len(line)-line.rfind('\n')-1 + len(word.split('\n',1)[0] ) &gt;= width)], word), text.split(' ') ) Line = {} # set to blank dictionary for x in range(11): Line[x] = '' # Check length of phrase if len(Phrase) &lt; 22: if Phrase.count('\n') == 0: Llen = len(Phrase) Line[7] = S[2] + '_' * Llen Line[8] = ' /' + ' ' * Llen + '\\' Line[9] = '( ' + Phrase + ' )' Line[10] = ' \\' + '_' * 4 + S[2] + '_' * (Llen - 6) + '/' if not Line[10]: msg = Phrase[:] NewLine = wrap(msg,21) if NewLine.count('\n') &gt; 8: msg = random.choice(overword) NewLine = wrap(msg,21) NewLine = NewLine.split('\n') NewLine.reverse() Line[10] = ' \\' + '_' * 4 + S[2] + '_' * 15 + '/' LNum = 9 for word in NewLine: if len(word) &gt; 21: word1 = word[21:] Line[LNum] = '| ' + word1.center(21) + ' |' LNum -= 1 word = word[:21] TLine = word.center(21) Line[LNum] = '| ' + TLine + ' |' LNum -= 1 if LNum == 1: break Line[LNum] = ' /' + S[21] + '\\' LNum -= 1 Line[LNum] = S[2] + '_' * 21 # time for Snoopy to head into battle print S[16] + X[4] + S[39] + Line[1] print S[15] + 'X' + S[4] + X[2] + S[14] + S[23] + Line[2] # top of snout print S[14] + 'X' + S[2] + A[3] + S[2] + 'X' + S[16] + X[5] + S[15] + Line[3] print S[13] + 'X' + S[2] + A[5] + S[2] + 'X' + S[12] + X[3] + S[5] + X[2] + S[13] + Line[4] print S[10] + X[4] + ' ' + A[5] + A[2] + ' ' + X[3] + S[5] + ' ' + X[4] + S[5] + S[5] + X[2] + S[11] + Line[5] # top of nose print S[8] + X[2] + S[3] + 'X' + ' ' + A[5] + '*' + S[2] + X[5] + X[4] + S[16] + X[2] + ' ' + X[3] + S[5] + Line[6] print S[6] + X[2] + S[6] + 'X' + ' ' + A[4] + S[2] + 'X' + S[27] + X[5] + S[4] + Line[7] # top of eye print S[5] + 'X' + S[8] + X[2] + S[4] + X[2] + S[5] + '~' + S[22] + X[5] + S[4] + Line[8] print S[4] + 'X' + S[9] + '//' + X[4] + S[7] + '@' + S[22] + X[4] + S[5] + Line[9] print S[3] + 'X' + S[9] + '//' + S[3] + 'X' + S[29] + X[2] + S[9] + Line[10] # top of open mouth print S[2] + 'X' + S[9] + '//' + S[4] + 'X' + S[12] + X[16] + '/' + S[16] + '/ /' print ' ' + 'X' + S[6] + X[3] + '//' + S[4] + 'X' + S[12] + 'X' + S[26] + '_' * 6 + '/ /' print 'X' + S[6] + 'X' + S[3] + 'X' + S[5] + 'X' + S[11] + 'X' + S[27] + '_' * 7 + '/' print 'X' + S[6] + 'X' + S[4] + 'X' + S[4] + 'X' + S[10] + 'X' # top of raised fist print 'X' + S[6] + 'X' + S[4] + 'X' + S[4] + 'X' + S[9] + 'X' + S[20] + X[2] print 'X' + S[7] + 'X' + S[3] + 'X' + S[4] + 'X' + S[9] + 'X' + S[17] + X[3] + S[2] + X[2] print ' ' + 'X' + S[7] + X[3] + S[5] + 'X' + S[9] + 'X' + S[16] + 'X' + S[2] + 'X X' + S[2] + 'X' print S[2] + 'X' + S[15] + 'X' + S[9] + 'X' + S[15] + X[2] + ' ' + 'X' + S[2] + X[4] # bottom of open mouth print S[3] + 'X' + S[15] + 'X' + S[9] + X[7] + '\\' + S[7] + X[2] + S[3] + X[2] + S[2] + 'X' print S[4] + X[2] + S[14] + X[2] + S[14] + 'X' + S[7] + 'X' + S[4] + 'X' + S[2] + X[2] # bottom of jaw print S[6] + X[2] + S[14] + X[14] + '/' + S[7] + 'X' + S[4] + X[4] print S[8] + X[3] + S[19] + A[3] + S[12] + 'X' + S[5] + 'X' print S[11] + X[17] + ' ' + '*' + S[3] + '*' + S[10] + 'X' + S[5] + 'X' print S[28] + '*' + S[3] + '*' + ' ' + 'X' + S[8] + 'X' + S[5] + 'X' print S[27] + '*' + S[3] + '*' + S[3] + X[3] + S[4] + 'X' + S[5] + 'X' print S[26] + '*' + S[3] + '*' + S[7] + X[4] + S[5] + 'X' print S[26] + '*' + S[3] + '*' + S[9] + X[2] + S[4] + 'X' # top of shoulder print S[26] + '*' + S[3] + '*' + 'X X' + S[8] + X[4] print S[25] + '*' + S[3] + '*' + ' ' + 'X' + S[2] + 'X' + S[9] + X[3] print S[24] + '*' + S[3] + '*' + S[2] + 'X' + S[3] + 'X' + S[10] + X[2] print S[23] + '*' + S[3] + '*' + S[3] + '*' + X[2] + S[2] + 'X' + S[10] + 'X' print S[22] + '*' + S[3] + '*' + S[4] + '*' + S[2] + 'X' + S[3] + 'X' + S[9] + 'X' # top of lowered fist print S[21] + '*' + S[3] + '*' + S[4] + A[2] + S[3] + 'X' + S[3] + X[4] + S[5] + 'X' print S[20] + '*' + S[3] + '*' + S[4] + A[3] + S[3] + X[2] + S[5] + 'X' + S[5] + 'X' print S[19] + '*' + S[3] + '*' + S[4] + A[4] + S[3] + 'X' + S[5] + X[2] + S[5] + 'X' print S[19] + '*' + S[3] + '*' + S[4] + A[4] + S[4] + X[2] + S[3] + 'X' + S[5] + X[2] print S[19] + '*' + S[3] + '*' + S[4] + A[3] + S[6] + X[4] + S[6] + 'X' print S[18] + '*' + S[3] + A[2] + S[4] + A[2] + S[16] + 'X' print S[17] + '*' + S[3] + A[3] + S[5] + '*' + S[15] + 'X' # top of legs print S[16] + '*' + S[3] + '* ' * 2 + S[5] + 'X' + '*' + S[12] + X[3] print S[15] + '*' + S[3] + '* ' * 2 + S[7] + X[4] + S[5] + 'X' + S[5] + 'X' print S[14] + '* ' * 5 + S[9] + 'X' + S[5] + 'X' + S[5] + 'X' # top of toes print S[14] + '* ' * 5 + S[9] + 'X' + S[5] + 'X' + S[6] + X[5] + 'x' print S[13] + '* ' * 5 + S[6] + 'x' + X[4] + S[6] + X[5] + 'x' + S[5] + 'Xx' print S[14] + '* ' * 5 + S[4] + 'xX' + S[15] + 'Xx' + X[4] + 'x' print S[13] + '* ' * 5 + S[6] + 'xX' + X[14] + 'x'</code> </pre></div> <p><em>E.K.Virtanen</em></p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://www.ascii-world.com/forum/t-16317</guid>
				<title>FBSound</title>
				<link>http://www.ascii-world.com/forum/t-16317/fbsound</link>
				<description>Neat one for FreeBASIC.</description>
				<pubDate>Tue, 14 Aug 2007 18:09:56 +0000</pubDate>
				<wikidot:authorName>EKVirtanen</wikidot:authorName>				<wikidot:authorUserId>12785</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>I have messed around with <a href="http://fsr.sourceforge.net/forum/viewforum.php?f=9">FBSound</a> library for a few days now.<br /> For programmer who wants to play .wav, .mp3 etc. audio files, this is definately good one to try.</p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://www.ascii-world.com/forum/t-15545</guid>
				<title>Visit Don&#039;s QuickBasic Programs webpage</title>
				<link>http://www.ascii-world.com/forum/t-15545/visit-don-s-quickbasic-programs-webpage</link>
				<description>View, download and examine various QuickBasic programs, BAS files and SUBs</description>
				<pubDate>Sat, 04 Aug 2007 02:15:14 +0000</pubDate>
				<wikidot:authorName>MarineDon</wikidot:authorName>				<wikidot:authorUserId>24903</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>Please visit my newly created webpage, "Don's QuickBasic Programs. The internet site is:</p> <p><a href="http://www.smithselfgen.com/QuickBasic/QuickBasic.Htm">http://www.smithselfgen.com/QuickBasic/QuickBasic.Htm</a></p> <p>If any one is interested in Figlet fonts, I have created a viewing platform called FigTail to easily view all the Figlet fonts so that you'll easily be able to choose the ones you like. Just go down to #43 at the QuickBasic website and download the FigTail1.Zip file.</p> <p>Regards, MarineDon</p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://www.ascii-world.com/forum/t-15084</guid>
				<title>Nicoma</title>
				<link>http://www.ascii-world.com/forum/t-15084/nicoma</link>
				<description>Retro2FB stuff too.</description>
				<pubDate>Sat, 28 Jul 2007 17:51:02 +0000</pubDate>
				<wikidot:authorName>EKVirtanen</wikidot:authorName>				<wikidot:authorUserId>12785</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p><strong>Original author:</strong> David Ahl</p> <p><strong>Description:</strong> Nearly all of us has seen some mathematical formulas with what is possible to solve a number what other person is thinking at. In some formulas, that other person is asked to multiply, divide etc. that number for few times and then, we can solve number he or she is thinking at.<br /> Arithmetica of Nicomachus is oldest known of these. It is also extremely easy one too. Probably easiest one that is known this far.<br /> This program uses arithmetica of <a href="http://en.wikipedia.org/wiki/Nicomachus">Nicomachus</a> to solve out what number you are thinking between '1' to '100'.</p> <div class="code"> <pre> <code>' ============================================= ' = Nicomachus = ' = Creative Computing Morristown, New Jersey = ' ============================================= ' Remade for FreeBASIC by E.K.Virtanen. ' www.ascii-world.com ' Public Domain Dim As Integer A, B, C, D Dim AS String YesNo, Message Screen 12 Do Cls Color 14, 0 Print Tab(33); "Nicoma" Print Tab(15); "Creative Computing Morristown, New Jersey" Print "" Color 15, 0 Print Tab(15); "Ported to FreeBASIC by E.K.Virtanen 2007." Print Tab(25); "www.ascii-world.com" Print "" Print "Boomerang puzzle from Arithmetica of Nicomachus -- A.D. 90!" Print Print "Please think of a number between '1' and '100'..." Input "Your number divided by '3' has remainder of "; A Input "Your number divided by '5' has remainder of "; B Input "Your number divided by '7' has remainder of "; C D = (70 * A + 21 * B + 15 * C) Do If D &gt; 104 Then D = (D - 105) Loop Until D &lt;= 105 Print "Your number was "; D; ", right? (Y/N): "; Input YesNo Message = "Eh...can't you just say 'Y' or 'N'?" If Ucase(YesNo) = "Y" Then Message = "Magic or math... ;)" If Ucase(YesNo) = "N" Then Message = "I think it's up to your math skills then ;)" YesNo = "" Print "" Print Message Print "" Print "Now, press 'Y' if you want to try again. Any other key to quit program." Do : YesNo = Inkey$ : Loop Until YesNo &lt;&gt; "" Loop While Ucase(YesNo) = "Y" End</code> </pre></div> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://www.ascii-world.com/forum/t-15083</guid>
				<title>23 matches.</title>
				<link>http://www.ascii-world.com/forum/t-15083/23-matches</link>
				<description>Trying to port programs from Retro2FB for FB .17.</description>
				<pubDate>Sat, 28 Jul 2007 17:41:58 +0000</pubDate>
				<wikidot:authorName>EKVirtanen</wikidot:authorName>				<wikidot:authorUserId>12785</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>I try to port all games from Retro2FB asap so Retro2FB in here gets started.</p> <h1><span>23 Matches</span></h1> <p><strong>Original author:</strong> Bob Albrecht</p> <p><strong>Description:</strong> 23 matches is one version of popular game where idea is to remove items from a table.<br /> In this case, there is 23 matches at table. You can remove one, two or three matches at once, as can computer too.<br /> Wich ever is forced to remove last match, is a loser.<br /> Crucial moments for players are starting when there is less than ten matches at the table. If you dont think then what you are goin to remove, you are goin to get beated.</p> <div class="code"> <pre> <code>' ============================================= ' = 23 Matches = ' = Creative Computing Morristown, New Jersey = ' ============================================= ' Remade for FreeBASIC by E.K.Virtanen. ' www.ascii-world.com ' Public Domain Function ScreenWidth AS Integer RETURN VAL(STR((Width) And 65535)) End Function SUB APrint(SubString AS String) Locate ,INT(ScreenWidth - (LEN(SubString))) / 2, 0 Print SubString End SUB Screen 12 Randomize TIMER DIM AS Integer Matches, Turn, Howmany, Manyhow CONST Computer = 1 Const Player = 2 DIM AS String YesNo DO Matches = 23 CLS Color 14, 0 APrint("23 Matches") APrint("Creative Computing Morristown, New Jersey") Color 7, 0 APrint("Remade for FreeBASIC by E.K.Virtanen.") APrint("www.ascii-world.com") APrint("Public Domain") Print "" Color 15, 0 APrint("This is a game called '"+ STR(Matches) + " Matches'.") Print "" APrint("When it is your turn, you may take one, two or three matches.") APrint("The object of the game is not to have to take the last match.") Print "" APrint("Let's flip a coin to see who goes first.") APrint("If it comes up heads, i will win the toss.") Print "" APrint("Press any key to play") : SLEEP While INKEY$ &lt;&gt; "" : Wend CLS IF INT(Rnd * 2) + 1 = Computer Then APrint("Heads! I win! HA! HA!") APrint("Prepare to lose, MEATBALL-NOSE !!") Turn = Computer ELSE APrint("You win coin flip so you can start.") Print "" Turn = Player END IF Print APrint("Now press a key to see how i beat you!") SLEEP : While INKEY$ &lt;&gt; "" : Wend DO IF Turn = Player Then Turn = Computer Color 14, 0 APrint("The number of matches is now: " + STR(Matches)) Color 15, 0 Print "" APrint("Your turn -- You may take 1, 2 or 3 matches.") APrint("How many do you wish to remove: ") DO LOCATE , (ScreenWidth / 2) : INPUT Howmany IF Howmany &gt; 3 OR Howmany &lt;= 0 Then APrint("Very funny! Dummy!") APrint("Do you want to play or goof around?") APrint( "Now how many matches do you want:") END IF LOOP Until Howmany &lt;= 3 AND Howmany &gt; 0 Matches = (Matches - Howmany) END IF IF Turn = Computer Then IF Matches &lt;= 1 Then EXIT DO Turn = Player : CLS : Color 14, 0 APrint("There are now " + STR(Matches) + " matches remaining.") Color 15, 0 Print "" APrint("My turn. hmm... i'll take...") : SLEEP (1000 + (INT(RND * 20) * 100)) IF Matches &gt; 15 THEN Manyhow = INT(RND * 3) + 1 IF Matches &gt; 4 AND Matches &lt; 16 THEN Manyhow = (4 - Howmany) IF Matches &lt; 5 THEN Manyhow = (Matches - 1) APrint( STR(Manyhow) + " matches.") Print "" Matches = (Matches - Manyhow) IF Matches &lt;= 1 Then Turn = Player : EXIT DO END IF Loop IF Turn = Player THEN Print "" APrint("You poor boob! You took the last match! I gotcha!!") APrint("HA! HA! I beat you!!!") Print "" APrint("Good bye loser!") END IF IF Turn = Computer THEN APrint("You won, floppy ears!") APrint("Think you're pretty smart?") APrint("Lets play again and i'll blow your shoes off!!") END IF APrint("Play again? (Y / N)") LOCATE , (ScreenWidth / 2) : INPUT YesNo Loop Until UCASE(YesNo) &lt;&gt; "Y" END</code> </pre></div> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://www.ascii-world.com/forum/t-14038</guid>
				<title>Useless programs, remake</title>
				<link>http://www.ascii-world.com/forum/t-14038/useless-programs-remake</link>
				<description>lol</description>
				<pubDate>Tue, 17 Jul 2007 18:12:16 +0000</pubDate>
				<wikidot:authorName>EKVirtanen</wikidot:authorName>				<wikidot:authorUserId>12785</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>I accidently made this and thought it is a good start to create this prolly our most popular thread from old forums :D</p> <p>err…this is…err…i dont know lol.</p> <div class="code"> <pre> <code>Screen 18, 32 Width 80, 60 Dim As Integer x, y For y= 1 TO 80 For x= 1 TO 60 COLOR (x * y), (x * y) LOCATE x,y : Print "#"; next x next y Sleep</code> </pre></div> <p>[edit]<br /> Pretty neat for ASCII stuff. But its all because of colors.</p> <div class="code"> <pre> <code>Screen 18, 32 Width 80, 60 Dim As Integer x, y For y= 1 TO 80 For x= 1 TO 60 COLOR (x * y / 25), (x * y / 25) LOCATE x, y : Print "#"; next x next y Sleep</code> </pre></div> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://www.ascii-world.com/forum/t-13021</guid>
				<title>DOS colors.</title>
				<link>http://www.ascii-world.com/forum/t-13021/dos-colors</link>
				<description>Hey DOS/windows folks, gimme a habd a bit here.</description>
				<pubDate>Thu, 05 Jul 2007 08:17:32 +0000</pubDate>
				<wikidot:authorName>Anonymous</wikidot:authorName>								<content:encoded>
					<![CDATA[
						 <p>Cant remember anymore and since my dosbox is pretty messed up, cant test it.<br /> Is there a way how to output colors, supported by DOS console?<br /> Some loop, goto or related thing so it would like print color number in current color?<br /> colors.bat would be nice one to have :)</p> <p><em>E.K.Virtanen</em></p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://www.ascii-world.com/forum/t-12998</guid>
				<title>guess the number topic</title>
				<link>http://www.ascii-world.com/forum/t-12998/guess-the-number-topic</link>
				<description></description>
				<pubDate>Wed, 04 Jul 2007 18:02:47 +0000</pubDate>
				<wikidot:authorName>EKVirtanen</wikidot:authorName>				<wikidot:authorUserId>12785</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>While waiting sauna to heat up, i decided to study more python since it seems to be quiet in every darn forum there is on internet.<br /> First, i created simple "guess the number" game with freebasic and then converted it to python.<br /> For python programmers, my code prolly looks ugly as hell, but it is like my first &gt; 5 lines long self-made code, so shut up :P</p> <p>Anyway, after studying more python documents, it feels interesting language. Want to learn more eventho i still hate since cant use CAPS at anywhere :D Silly me.</p> <p>guess.bas</p> <div class="code"> <pre> <code>' Guess what number for FreeBASIC .17b stable ' E.K.virtanen. 2007, public domain Randomize TIMER CONST MIN = 1 CONST MAX = 100 Dim AS Integer Plr_guess, Randomed, Rounds ' Main module of program. DO Color 15, 0 : CLS Randomed = INT(RND * ((MAX + 1) - MIN) + MIN) Rounds = 0 Print "Ok, i think random number between "; MIN; MAX; "." Print "Your job is to guess what it is in as minimal tries as possible." Print "" Print "After your every guess, ill give you hint is my number higher or lower than your guess." Print "You can exit by 'guessing' 0." Print "Press any key to start game."; : GETKEY ' From here starts the gaming loop itself. This is looped until guess it right one. CLS DO Rounds = (Rounds + 1) Print "This is round number: "; Rounds; "." INPUT "Give your guess: "; Plr_guess Color 14, 0 IF Plr_guess &gt; Randomed THEN Print "My number is smaller..." END IF IF Plr_guess &lt; Randomed THEN Print "My number is higher..." END IF Color 15, 0 IF Plr_guess = Randomed THEN EXIT DO LOOP While Plr_Guess &lt;&gt; 0 IF Randomed &lt;&gt; Plr_Guess THEN EXIT DO Print "You got it!!!" Print "It took "; Rounds; " rounds to guess right number." Print "" Print "Press 'y' to play again. Any other key to quit." DO Until INKEY$ &lt;&gt; "" : Loop IF INKEY$ &lt;&gt; "y" AND INKEY$ &lt;&gt; "Y" THEN EXIT DO Loop END</code> </pre></div> <p>guess.py. Result of 2 hours python learning.</p> <div class="code"> <pre> <code># Guess what number for python. My one of first python codes so it prolly looks ugly as hell. # E.K.virtanen. 2007, public domain # modules we need here import random import os # function wich solves what OS is used. linux and windows regignized. def os_clear(): return_value = "\n" if os.name == "posix": return_value = 'clear' elif os.name in ("nt", "dos", "ce"): return_value = 'CLS' return return_value # Constant variables const_min = 1 const_max = 100 clear_screen = os_clear() # MAIN MODULE OF PROGRAM guess_game = end_game = 'play' while end_game == 'play': os.system(clear_screen) randomed = random.randint(const_min, const_max) rounds = 0 print print 'Ok, i think random number between ', str(const_min), ' to ' + str(const_max) print 'Your job is to guess what it is in as minimal tries as possible.' print '' print 'After your every guess, ill give you hint is my number higher or lower than your guess.' print 'You can exit by "guessing" (0).' raw_input('Press &lt;ENTER&gt; to start game.') # guessing part of game os.system(clear_screen) while guess_game == 'play': rounds += 1 print 'This is rounds number: ', str(rounds) + '.' print plr_guess = int(raw_input('Give your guess: ')) if int(plr_guess) &lt; randomed: print 'My number is higher...' elif int(plr_guess) &gt; randomed: print 'Mu number is lower...' elif int(plr_guess) == randomed: guess_game = 'stop' elif int(plr_guess) == 0: break else: print 'Give value between ', str(const_min), ' to ' + str(const_max), ' please.' if guess_game == 'stop': end_game = 'stop' os.system(clear_screen) print 'You got it!' print 'It took ', str(rounds), ' rounds to guess right number.' print print ' Press &lt;y&gt; + &lt;ENTER&gt; to play again. &lt;ENTER&gt; only to quit.' if raw_input() == 'y': guess_game = end_game = 'play'</code> </pre></div> 
				 	]]>
				</content:encoded>							</item>
				</channel>
</rss>