bullet-401 July 20, 2004 Author Share bullet-401 Member July 20, 2004 Yeah, this is really obscure... FOR Y = 10 TO 1 STEP -1 Otherwise BASIC will always assume you want to increment by 1. So, Y = 10, then next loop, Y = 11, which exceeds the bounds....I'm pretty sure it always runs through the loop at least once. Add that STEP -1 though. It's like the y-- operator. Your my hero! Yep you guys were right N=4 X=11 Y=0 Sigh I fail at my own game. NOFX got the answer first so have at the next one! Link to comment Share on other sites More sharing options...
NOFX July 20, 2004 Share NOFX Member July 20, 2004 gotta go to work, ill try to think of something while Im at work and post it up Link to comment Share on other sites More sharing options...
appalachian_fox July 20, 2004 Share appalachian_fox Member July 20, 2004 (edited) Yeah, Bullet, it didn't strike me at first until I looked at it closer. Then I remembered facing that problem, many years ago, in a rather large BASIC program. That was a pain in the tuckus and a half to figure out. Edited July 20, 2004 by appalachian_fox Link to comment Share on other sites More sharing options...
Playaa July 20, 2004 Share Playaa Member July 20, 2004 here was my version of the code in VB (that got me my above answer) Dim x As Integer = 0 Dim y As Integer = 10 Dim n As Integer = 0 Do While x <= 10 Do While y > 0 x += 1 If ((x > 5) And (y > 1)) Then n += 1 TextBox1.Text &= "x=" & x & " y=" & y & " n=" & n & vbCrLf End If y -= 1 TextBox1.Text &= "x=" & x & " y=" & y & " n=" & n & vbCrLf Loop x += 1 TextBox1.Text &= "x=" & x & " y=" & y & " n=" & n & vbCrLf Loop Link to comment Share on other sites More sharing options...
bullet-401 July 20, 2004 Author Share bullet-401 Member July 20, 2004 Oh man that VB code is going to drive me insane! How could Bill Gates like that crap? I shall pee on his grave. Link to comment Share on other sites More sharing options...
Playaa July 20, 2004 Share Playaa Member July 20, 2004 can I request that we make a rule that you must attempt to solve in your head? I mean sure we're talking honor system here, but where's the fun if we all just go plug the code into a program? Link to comment Share on other sites More sharing options...
Playaa July 20, 2004 Share Playaa Member July 20, 2004 Oh man that VB code is going to drive me insane! How could Bill Gates like that crap? I shall pee on his grave. AHAHAHA! you mean cause it's readable and actually somewhat understandable? I CAN code in c-based languages...but I choose not to because I like to be able to read my code easily. Link to comment Share on other sites More sharing options...
bullet-401 July 20, 2004 Author Share bullet-401 Member July 20, 2004 Java and C++ just make more sence to me. Pascal anyone? Link to comment Share on other sites More sharing options...
Playaa July 20, 2004 Share Playaa Member July 20, 2004 I got one for ya fellers VB.Net Code: Dim i As Integer = 1     Dim y As Integer = 5     Dim alpb As String = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ"     Dim alpa As String = "1234567890"     Dim HoldAnswer As String     Do While i < 10       Dim alph As String = alpa       Do While alph.Length > 4         HoldAnswer &= alpb.Substring(i, y)         alph = alph.Substring(0, alph.Length - 2)       Loop       i += 3       y += (i - 2)     Loop C# Code: int i = 1;  int y = 5;  string alpb = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ";  string alpa = "1234567890";  string HoldAnswer = "";  do  {   string alph = alpa;   do   {   HoldAnswer += alpb.Substring(i, y);   alph = alph.Substring(0, alph.Length - 2);   } while(alph.Length > 4);   i += 3;   y += (i - 2);  } while(i < 10); What will "HoldAnswer" be? *edit* I'm solving in my head to (yes I have already seen the answer, but believe me...it's not something I can memorize) Link to comment Share on other sites More sharing options...
dwEEziL July 20, 2004 Share dwEEziL Member July 20, 2004 eleventy-five? Link to comment Share on other sites More sharing options...
Playaa July 20, 2004 Share Playaa Member July 20, 2004 heh, worked out a bit easier than I thought it would when doing it in your head. my answer: i = 1 y = 5 HoldAnswer = "BCDEFBCDEFBCDEF" i = 4 y = 7 HoldAnswer = "BCDEFBCDEFBCDEFDEFGHIJDEFGHIJDEFGHIJ" i = 7 y = 12 HoldAnswer = "BCDEFBCDEFBCDEFDEFGHIJDEFGHIJDEFGHIJHIJKLMNOPQRSHIJKLMNOPQRSHIJKLMNOPQRS" *edit* DOH! I'm off by one letter. Link to comment Share on other sites More sharing options...
appalachian_fox July 21, 2004 Share appalachian_fox Member July 21, 2004 Pascal, I remember those days. Yeah, those were good days... FORTRAN anyone? Any assembler? Link to comment Share on other sites More sharing options...
NOFX July 22, 2004 Share NOFX Member July 22, 2004 (edited) woot assembler lets see who can get this baby .begin .org 2048 a_start .equ 3000 ld [length], %r1 ld [address], %r2 andcc %r3, %r0, %r3 loop: andcc %r1, %r1, %r0 be done addcc %r1, -4, %r1 addcc %r1, %r2, %r4 ld %r4, %r5 ba loop addcc %r15, 4, %r15 done: jmpl %r15 + 4 , %r0 length: 40 address: a_start .org a_start a: 25 -10 33 -5 7 9 -2 20 -24 1 .end Edited July 22, 2004 by NOFX Link to comment Share on other sites More sharing options...
Playaa July 22, 2004 Share Playaa Member July 22, 2004 maybe if it wasn't written in some dumb language I'd try... Link to comment Share on other sites More sharing options...
appalachian_fox July 22, 2004 Share appalachian_fox Member July 22, 2004 Wh000f, what compiler is this written for? It isn't ARM RISC, that's fo'shizzle. Link to comment Share on other sites More sharing options...
NOFX July 22, 2004 Share NOFX Member July 22, 2004 I wrote that on my ARC simulator Link to comment Share on other sites More sharing options...
NOFX July 22, 2004 Share NOFX Member July 22, 2004 (edited) heh I could rewrite a more modernized version temp[] = new array; int temp = 0;; int i =0; temp[0] = 25; temp[1] = -10; temp[2] = 33; temp[3] = -5; temp[4] = 7 temp[5] = 9; temp[6] = -2; temp[7] = 20; temp[8] = -24; temp[9] = 1; while(i<10, i++) { temp2 = temp + temp2; } print temp2; ahhh much easier to read than the other, but your comp has to do a gazillion more proceses to produce the same answer. Edited July 22, 2004 by NOFX Link to comment Share on other sites More sharing options...
Playaa July 22, 2004 Share Playaa Member July 22, 2004 big deal...my comps a gazillion times more powerful than the comps that were around when that other language was probably written Link to comment Share on other sites More sharing options...
TaPe July 23, 2004 Share TaPe Member July 23, 2004 Easier to read except temp2 was never declared. Link to comment Share on other sites More sharing options...
gOOters July 23, 2004 Share gOOters Member July 23, 2004 I like Ice Cream. Link to comment Share on other sites More sharing options...
appalachian_fox July 24, 2004 Share appalachian_fox Member July 24, 2004 The andcc command was really throwing me, but I recognized the array and registers used. That new way of writing it happens to be much clearer Link to comment Share on other sites More sharing options...
dwEEziL July 30, 2004 Share dwEEziL Member July 30, 2004 Hmm, this died. Link to comment Share on other sites More sharing options...
Recommended Posts