Qbasicnews.com

Full Version: QB Obfuscation
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
I should have remembered just how friggin' LAZY programmers were before I set this challenge! ARG! :lol:
Quote:QBers write obfuscated code without trying, there's no need to make it any worse.
You know what the really funny thing is? I've recently (well, before my old comp took the big dirt nap) been looking at some old sourcecode by the "masters of QB", and it's some of the most horrendous crap I've ever seen. :barf: Even in QB, there's certain standards to be followed, despite the fact that QB is such a lazy language. I dunno...maybe it's just the C coder in me speaking, but that was some of the most horrible crap I've ever seen. Some of the so-called newbies on this forum have written much better code!
Quote:Heres a quick challenge I hope a few of you will enter.

Obfuscation of Qb code!

I got the idea when Nathan mention the IOCCC (The International Obfuscated C Code Contest). (if you dont know what obfuscated code looks like, try this and look at the .c files. they are all working programs.)
The point is to make your code as hard to read and different looking from the normal properly formattted language. Unfortunately this is quite hard in QB, and is really suited for C, but I thought we could have a go =)

I have written a small 3D wireframe app:
Code:
TYPE pt: x AS SINGLE: y AS SINGLE: z AS SINGLE: END TYPE
READ dps: DIM p(dps) AS pt: TYPE ln: l1 AS INTEGER: l2 AS INTEGER: END TYPE
FOR i = 1 TO dps: READ p(i).x, p(i).y, p(i).z: NEXT: READ dls
DIM l(dls) AS ln: FOR i = 1 TO dls: READ l(i).l1, l(i).l2: NEXT
pc = 3.14 / 180: zm = 20: SCREEN 7, , 1, 0: DO: kp = INP(96): d$ = INKEY$
SELECT CASE kp: CASE 1: CLS : END: CASE 78: zm = zm - 1: CASE 74: zm = zm + 1
CASE 72, 75, 73: d = 5: CASE 80, 77, 81: d = 355: END SELECT: SELECT CASE kp
CASE 75, 77: FOR i = 1 TO dps: nx = COS(d * pc) * p(i).x - SIN(d * pc) * p(i).z
nz = SIN(d * pc) * p(i).x + COS(d * pc) * p(i).z: p(i).x = nx: p(i).z = nz
NEXT: CASE 72, 80: FOR i = 1 TO dps: nz = COS(d * pc) * p(i).z - SIN(d * pc) * p(i).y
ny = SIN(d * pc) * p(i).z + COS(d * pc) * p(i).y: p(i).z = nz: p(i).y = ny
NEXT: CASE 73, 81: FOR i = 1 TO dps: ny = COS(d * pc) * p(i).y - SIN(d * pc) * p(i).x
nx = SIN(d * pc) * p(i).y + COS(d * pc) * p(i).x: p(i).y = ny
p(i).x = nx: NEXT: END SELECT: FOR i = 1 TO dls
IF p(l(i).l1).z + zm > 0 AND p(l(i).l2).z + zm > 0 THEN
x11 = p(l(i).l1).x * 256: xy11 = (p(l(i).l1).z + zm): y11 = p(l(i).l1).y * 256
x21 = p(l(i).l2).x * 256: xy21 = (p(l(i).l2).z + zm): y21 = p(l(i).l2).y * 256
x1 = x11 / xy11 + 160: y1 = y11 / xy11 + 100: x2 = x21 / xy21 + 160
y2 = y21 / xy21 + 100: LINE (x1, y1)-(x2, y2)
END IF: NEXT: WAIT &H3DA, 8: WAIT &H3DA, 8, 8: PCOPY 1, 0: CLS : LOOP
DATA 8,-5,2,-5,5,2,-5,-5,-2,-5,5,-2,-5,-5,2,5,5,2,5,-5,-2,5,5
DATA -2,5,12,1,2,4,2,6,2,7,3,1,3,4,3,6,5,8,6,8,7,5,7,4,8,5,1


Your entry does not have to be big, but can be a even a small algo for (for example) printing the Fibbonachi numbers or working out prime numbers etc.

if you want to see some excellent examples of obfuscated code, look at the "9-line" screen saver challenge

http://forum.qbasicnews.com/viewtopic.php?t=1876

lazy my ass...it's just...well...a lot of this has already been posted.

Cheers
OK. Obfuscating this took me about 10x as long as actually writing it, you know...
Code:
p% = 2 ^ 8 + 2 ^ 6 - 2 ^ 0: q% = p% - 2 ^ 7 + 2 ^ 3
r% = q% - 2 ^ 7 - 2 ^ 4 - 2 ^ 2 - 2 ^ 1
DIM a%(r%), b%(r%), c%(r%): FOR i% = 0 TO r%: a%(i%) = RND * p%
b%(i%) = RND * q%: c%(i%) = (RND * 3) + 1: NEXT: SCREEN 13
WHILE LEN(INKEY$) = 0: WAIT &H3DA, 8, 8: WAIT &H3DA, 8: FOR i% = 0 TO r%
PSET (a%(i%), b%(i%)), 0: a%(i%) = a%(i%) - c%(i%)
IF a%(i%) < 0 THEN a%(i%) = p%: b%(i%) = RND * q%: c%(i%) = (RND * 3) + 1
PSET (a%(i%), b%(i%)), 16 + (2 * c%(i%)): NEXT: WEND
Quote:
Blitz Wrote:QBers write obfuscated code without trying, there's no need to make it any worse.
You know what the really funny thing is? I've recently (well, before my old comp took the big dirt nap) been looking at some old sourcecode by the "masters of QB", and it's some of the most horrendous crap I've ever seen. :barf: Even in QB, there's certain standards to be followed, despite the fact that QB is such a lazy language. I dunno...maybe it's just the C coder in me speaking, but that was some of the most horrible crap I've ever seen. Some of the so-called newbies on this forum have written much better code!


No kidding, makes your eyes hurt look at source by QBers.
Quote:
Code:
p% = 2 ^ 8 + 2 ^ 6 - 2 ^ 0: q% = p% - 2 ^ 7 + 2 ^ 3
r% = q% - 2 ^ 7 - 2 ^ 4 - 2 ^ 2 - 2 ^ 1
DIM a%(r%), b%(r%), c%(r%): FOR i% = 0 TO r%: a%(i%) = RND * p%
b%(i%) = RND * q%: c%(i%) = (RND * 3) + 1: NEXT: SCREEN 13
WHILE LEN(INKEY$) = 0: WAIT &H3DA, 8, 8: WAIT &H3DA, 8: FOR i% = 0 TO r%
PSET (a%(i%), b%(i%)), 0: a%(i%) = a%(i%) - c%(i%)
IF a%(i%) < 0 THEN a%(i%) = p%: b%(i%) = RND * q%: c%(i%) = (RND * 3) + 1
PSET (a%(i%), b%(i%)), 16 + (2 * c%(i%)): NEXT: WEND

Hey Cool! Someone entered! Nice starfield! =)

Quote:OK. Obfuscating this took me about 10x as long as actually writing it, you know...
Lol! Tell me about it! Writing that 3D program took so much longer than usual!
I'm lazy, So I'll enter old code...


Ignore links and my old nickname...
Code:
'**************************[WarTanks by XiberLord]****************************
'This program is freeware wich means that you can use this code in yor own
'programs as long as credit is given. I am not responsible for any damages
'occuring when using or missusing this code. You may distribute this file
'freely as long as the original package of files is included.
'
'This code have no explanations, markings or anything else that isnt necessery
'but if yo are good at QB (hopefully you are) then this wont bee any problem.
'
'This code is not meant to be used for learning when there are a lot of
'advanced commands and operations in it, although you can read it anyway to
'get an idea of how you make some "small" yet good programs using GOSUB and
'sub routines
'
'The level generater is very good if you want to make a 2D game. I think you
'will work it out itïs not to complicated, if you dont then take a look at
'2D.Bas. (WWW.NetColony.Com/Technology/XiberLord/2D.Zip)
'
'Also the ballistic sub is good if you want realistic gravity in your program
'take a look at Grav.Bas (WWW.NetColony.Com/Technology/XiberLord/Grav.Zip)
'and you will find out how to use it.
'
'Finaly this code is part of the full game WarTanks.Bas which is
'avialable at: WWW.NetColony.Com/Technology/XiberLord/WarTanks.Zip
'there you also find other good programs, games and utilities to use in
'your own program. You may do this as long as credit is given.
'ZeeQues programs are also avialable to download if you click on the link
'leading to his site.
'
'Thanx.
'
'EMail: XiberLord@Hotmail.Com
'
'                                                                -:XiberLord:-
'
DEFINT A-Z
DECLARE SUB Pal ()
DECLARE SUB Intro ()
DECLARE SUB Outro ()
DECLARE SUB DrawTank (X, Y, Team)
DECLARE SUB EraseTank (X, Y)
DECLARE SUB GenerateLevel (X, Y)
DECLARE SUB DoBallistic (X, Y, Speed, Power, Gravity, Wind)
Intro
Pal
DIM GPoint$(640)
NewGame:
AILevel = 0
Balls = 0
Opps = 20
league = 0
Damage = 0
EDamage = 0
Armor = 0
EArmor = 0
Life = 100
ELife = 100
Score = 0
EScore = 0
ContinueGame:
CLS
RANDOMIZE TIMER
Y = 0
X = 0
FOR X = 0 TO 640
  GenerateLevel X, Y
  GPoint$(X) = STR$(Y + 240)
NEXT X
AILevel = AILevel + 1
Life = Life + Armor
IF ELife < 100 THEN ELife = 100
ELife = ELife + EArmor
TankX = 50 + INT(150 * RND)
EnemyX = 450 + INT(150 * RND)
Gravity = 1
ESpeed = -20
EPower = 12
UpdateAll:
DrawTank EnemyX, VAL(GPoint$(EnemyX)), 0
DrawTank TankX, VAL(GPoint$(TankX)), 1
Speed = 20
Power = 15
Wind = 5 * RND - 5 * RND
IF Wind < 0 THEN LOCATE 1, 30: COLOR 12: PRINT "<" + STR$(Wind) + "      "
IF Wind > 0 THEN LOCATE 1, 30: COLOR 12: PRINT STR$(Wind) + ">   "
IF Wind = 0 THEN LOCATE 1, 30: COLOR 12: PRINT "<" + STR$(Wind) + ">      "
UpDate:
LOCATE 1, 1: COLOR 15: PRINT "Height" + STR$(Power) + "  "
LOCATE 2, 1: COLOR 15: PRINT "Power" + STR$(Speed) + "  "
LOCATE 3, 1: COLOR 15: PRINT "Armor" + STR$(Life) + "%  "
LOCATE 3, 60: PRINT "Enemy" + STR$(ELife) + "%  "
IF AirStrike = 1 THEN
  FOR Air = 0 TO 5
    Y = 0
    IF AirTeam = 1 THEN X = EnemyX + INT(50 * RND) - INT(50 * RND)
    IF AirTeam = 0 THEN X = TankX + INT(50 * RND) - INT(50 * RND)
    DO
    DoBallistic X, Y, 0, -20, Gravity, Wind
    IF X > 640 THEN EXIT DO
    IF X < 0 THEN EXIT DO
    LOOP UNTIL Y >= VAL(GPoint$(X))
    IF X - 10 > 0 AND X + 10 < 640 THEN
      GOSUB ExplosionEffect:
    END IF
  NEXT Air
  IF AirRaides = 1 THEN
    AirRaides = 0
    AirStrike = 1
    AirTeam = 1
    GOTO UpdateAll:
  END IF
  AirStrike = 0
  GOTO UpdateAll:
END IF
DO
K$ = INKEY$
IF K$ = CHR$(0) + "H" THEN Power = Power + 1: GOTO UpDate:
IF K$ = CHR$(0) + "P" THEN Power = Power - 1: GOTO UpDate:
IF K$ = CHR$(0) + "M" THEN Speed = Speed + 1: GOTO UpDate:
IF K$ = CHR$(0) + "K" THEN Speed = Speed - 1: GOTO UpDate:
IF K$ = " " THEN
  X = TankX
  Y = VAL(GPoint$(TankX)) - 5
  Balls = Balls + 1
  DO
  DoBallistic X, Y, Speed, Power, Gravity, Wind
  IF X > 640 THEN GOTO EnemyShoot:
  IF X < 0 THEN GOTO EnemyShoot:
  LOOP UNTIL Y >= VAL(GPoint$(X))
  X = X
  IF X - 10 > 0 AND X + 10 < 640 THEN
    GOSUB ExplosionEffect:
  END IF
EnemyShoot:
  LOCATE 1, 1: COLOR 15: PRINT "Height" + STR$(Power) + "  "
  LOCATE 2, 1: COLOR 15: PRINT "Power" + STR$(Speed) + "  "
  LOCATE 3, 1: COLOR 15: PRINT "Armor" + STR$(Life) + "%  "
  LOCATE 3, 60: PRINT "Enemy" + STR$(ELife) + "%  "
  X = EnemyX
  Y = VAL(GPoint$(EnemyX)) - 5
  Power = EPower
  Speed = ESpeed
  Balls = Balls + 1
  DO
  DoBallistic X, Y, Speed, Power, Gravity, 0
  IF X > 640 THEN ESpeed = ESpeed - 1: GOTO UpdateAll:
  IF X < 0 THEN ESpeed = ESpeed + 1: GOTO UpdateAll:
  LOOP UNTIL Y >= VAL(GPoint$(X))
  X = X
  IF X - 10 > 0 AND X + 10 < 640 THEN
    GOSUB ExplosionEffect:
  END IF
  IF X < TankX THEN ESpeed = ESpeed + 1
  IF X > TankX THEN ESpeed = ESpeed - 1
  GOTO UpdateAll:
END IF
LOOP UNTIL K$ = CHR$(27)
ExitGame:
Outro
ExplosionEffect:
EraseTank EnemyX, VAL(GPoint$(EnemyX))
EraseTank TankX, VAL(GPoint$(TankX))
LINE (X - 10, VAL(GPoint$(X - 10)) + 3)-(X - 10, 0), 0
LINE (X - 9, VAL(GPoint$(X - 9)) + 5)-(X - 9, 0), 0
LINE (X - 8, VAL(GPoint$(X - 8)) + 6)-(X - 8, 0), 0
LINE (X - 7, VAL(GPoint$(X - 7)) + 7)-(X - 7, 0), 0
LINE (X - 6, VAL(GPoint$(X - 6)) + 8)-(X - 6, 0), 0
LINE (X - 5, VAL(GPoint$(X - 5)) + 8)-(X - 5, 0), 0
LINE (X - 4, VAL(GPoint$(X - 4)) + 9)-(X - 4, 0), 0
LINE (X - 3, VAL(GPoint$(X - 3)) + 9)-(X - 3, 0), 0
LINE (X - 2, VAL(GPoint$(X - 2)) + 10)-(X - 2, 0), 0
LINE (X - 1, VAL(GPoint$(X - 1)) + 10)-(X - 1, 0), 0
LINE (X, VAL(GPoint$(X)) + 10)-(X, 0), 0
LINE (X + 1, VAL(GPoint$(X + 1)) + 10)-(X + 1, 0), 0
LINE (X + 2, VAL(GPoint$(X + 2)) + 10)-(X + 2, 0), 0
LINE (X + 3, VAL(GPoint$(X + 3)) + 9)-(X + 3, 0), 0
LINE (X + 4, VAL(GPoint$(X + 4)) + 9)-(X + 4, 0), 0
LINE (X + 5, VAL(GPoint$(X + 5)) + 8)-(X + 5, 0), 0
LINE (X + 7, VAL(GPoint$(X + 6)) + 8)-(X + 7, 0), 0
LINE (X + 6, VAL(GPoint$(X + 7)) + 7)-(X + 6, 0), 0
LINE (X + 8, VAL(GPoint$(X + 8)) + 6)-(X + 8, 0), 0
LINE (X + 9, VAL(GPoint$(X + 9)) + 5)-(X + 9, 0), 0
LINE (X + 10, VAL(GPoint$(X + 10)) + 3)-(X + 10, 0), 0
GPoint$(X - 10) = STR$(VAL(GPoint$(X - 10)) + 3)
GPoint$(X - 9) = STR$(VAL(GPoint$(X - 9)) + 5)
GPoint$(X - 8) = STR$(VAL(GPoint$(X - 8)) + 6)
GPoint$(X - 7) = STR$(VAL(GPoint$(X - 7)) + 7)
GPoint$(X - 6) = STR$(VAL(GPoint$(X - 6)) + 8)
GPoint$(X - 5) = STR$(VAL(GPoint$(X - 5)) + 8)
GPoint$(X - 4) = STR$(VAL(GPoint$(X - 4)) + 9)
GPoint$(X - 3) = STR$(VAL(GPoint$(X - 3)) + 9)
GPoint$(X - 2) = STR$(VAL(GPoint$(X - 2)) + 10)
GPoint$(X - 1) = STR$(VAL(GPoint$(X - 1)) + 10)
GPoint$(X) = STR$(VAL(GPoint$(X)) + 10)
GPoint$(X + 1) = STR$(VAL(GPoint$(X + 1)) + 10)
GPoint$(X + 2) = STR$(VAL(GPoint$(X + 2)) + 10)
GPoint$(X + 3) = STR$(VAL(GPoint$(X + 3)) + 9)
GPoint$(X + 4) = STR$(VAL(GPoint$(X + 4)) + 9)
GPoint$(X + 5) = STR$(VAL(GPoint$(X + 5)) + 8)
GPoint$(X + 6) = STR$(VAL(GPoint$(X + 6)) + 8)
GPoint$(X + 7) = STR$(VAL(GPoint$(X + 7)) + 7)
GPoint$(X + 8) = STR$(VAL(GPoint$(X + 8)) + 6)
GPoint$(X + 9) = STR$(VAL(GPoint$(X + 9)) + 5)
GPoint$(X + 10) = STR$(VAL(GPoint$(X + 10)) + 3)
IF X >= TankX - 20 AND X <= TankX + 20 THEN Life = Life - 15 - EDamage
IF X >= EnemyX - 20 AND X <= EnemyX + 20 THEN ELife = ELife - 15 - Damage
DrawTank EnemyX, VAL(GPoint$(EnemyX)), 0
DrawTank TankX, VAL(GPoint$(TankX)), 1
IF ELife <= 0 THEN GOTO YouWin:
IF Life <= 0 THEN Lost = 1: GOTO YouWin:
RETURN
YouWin:
AirRaides = 0
AirStrike = 0
IF EArmor < 0 THEN EArmor = 0
IF Armor < 0 THEN Armor = 0
CLS
PRINT "Position    Current         Points required"
PRINT "1                               25000"
PRINT "2                               20000"
PRINT "3                               15000"
PRINT "4                               10000"
PRINT "5                                9000"
PRINT "6                                8000"
PRINT "7                                7000"
PRINT "8                                6000"
PRINT "9                                5000"
PRINT "10                               4000"
PRINT "11                               3000"
PRINT "12                               2000"
PRINT "13                               1000"
PRINT "14                               900"
PRINT "15                               750"
PRINT "16                               600"
PRINT "17                               500"
PRINT "18                               250"
PRINT "19                               100"
PRINT "20                               50"
PRINT "There are " + STR$(Balls) + " shoots fired totaly"
PRINT "Press enter to continue"
IF Lost = 1 THEN
  Lost = 0:
  Score = Score - (Balls * 10)
  GOTO NoPoint:
END IF
IF Score >= 30000 THEN Score = 30000: GOTO NoPoint:
Score = Score + Balls * 10 + INT(500 * RND)
NoPoint:
EScore = EScore + Balls * 10 + INT(500 * RND)
IF Score >= 25000 THEN LOCATE 2, 13: COLOR 9: PRINT STR$(Score): GOTO GotPos:
IF Score >= 20000 THEN LOCATE 3, 13: COLOR 10: PRINT STR$(Score): GOTO GotPos:
IF Score >= 15000 THEN LOCATE 4, 13: COLOR 10: PRINT STR$(Score): GOTO GotPos:
IF Score >= 10000 THEN LOCATE 5, 13: COLOR 10: PRINT STR$(Score): GOTO GotPos:
IF Score >= 9000 THEN LOCATE 6, 13: COLOR 10: PRINT STR$(Score): GOTO GotPos:
IF Score >= 8000 THEN LOCATE 7, 13: COLOR 10: PRINT STR$(Score): GOTO GotPos:
IF Score >= 7000 THEN LOCATE 8, 13: COLOR 10: PRINT STR$(Score): GOTO GotPos:
IF Score >= 6000 THEN LOCATE 9, 13: COLOR 10: PRINT STR$(Score): GOTO GotPos:
IF Score >= 5000 THEN LOCATE 10, 13: COLOR 14: PRINT STR$(Score): GOTO GotPos:
IF Score >= 4000 THEN LOCATE 11, 13: COLOR 14: PRINT STR$(Score): GOTO GotPos:
IF Score >= 3000 THEN LOCATE 12, 13: COLOR 14: PRINT STR$(Score): GOTO GotPos:
IF Score >= 2000 THEN LOCATE 13, 13: COLOR 14: PRINT STR$(Score): GOTO GotPos:
IF Score >= 1000 THEN LOCATE 14, 13: COLOR 14: PRINT STR$(Score): GOTO GotPos:
IF Score >= 900 THEN LOCATE 15, 13: COLOR 14: PRINT STR$(Score): GOTO GotPos:
IF Score >= 750 THEN LOCATE 16, 13: COLOR 14: PRINT STR$(Score): GOTO GotPos:
IF Score >= 600 THEN LOCATE 17, 13: COLOR 14: PRINT STR$(Score): GOTO GotPos:
IF Score >= 500 THEN LOCATE 18, 13: COLOR 12: PRINT STR$(Score): GOTO GotPos:
IF Score >= 250 THEN LOCATE 19, 13: COLOR 12: PRINT STR$(Score): GOTO GotPos:
IF Score >= 100 THEN LOCATE 20, 13: COLOR 12: PRINT STR$(Score): GOTO GotPos:
IF Score >= 50 THEN LOCATE 21, 13: COLOR 12: PRINT STR$(Score): GOTO GotPos:
IF Score >= 0 THEN GOTO GotPos:
IF Score < 0 THEN GOTO YouLose:
GotPos:
DO
LOOP UNTIL INKEY$ = CHR$(13)
Selection:
CLS
COLOR 15
LOCATE 1, 1
PRINT "Round is over"
PRINT "Money:" + STR$(Score)
PRINT
PRINT "What do you want to do ?"
PRINT "1) Upgrade"
PRINT "2) Train your unit"
PRINT "Enter to continue"
DO
K$ = INKEY$
IF K$ = "1" THEN GOTO UpgradeShop:
IF K$ = "2" THEN GOTO TrainMen:
IF K$ = CHR$(13) THEN
  IF Score < 0 THEN GOTO YouLose:
  GOTO ContinueGame:
END IF
LOOP
TrainMen:
CLS
COLOR 15
IF Score >= 50 THEN O1 = 15
IF Score >= 100 THEN O2 = 15
IF Score >= 250 THEN O3 = 15
IF Score >= 500 THEN O4 = 15
IF Score >= 1000 THEN O5 = 15
IF Score < 50 THEN O1 = 12
IF Score < 100 THEN O2 = 12
IF Score < 250 THEN O3 = 12
IF Score < 500 THEN O4 = 12
IF Score < 1000 THEN O5 = 12
PRINT "Training camp"
PRINT
PRINT "You have " + STR$(Score) + " money left."
PRINT "You currently have " + STR$(Damage + 15) + " in fire power"
PRINT "How much money will you spend ?."
COLOR O1: PRINT "1) 50          + Damage 1-5"
COLOR O2: PRINT "2) 100         + Damage 2-10"
COLOR O3: PRINT "3) 250         + Damage 5-16"
COLOR O4: PRINT "4) 500         + Damage 8-27"
COLOR O5: PRINT "5) 1000        + Damage 12-61"
COLOR 15: PRINT "Enter to continue"
DO
K$ = INKEY$
IF K$ = "1" AND Score >= 50 THEN Score = Score - 50: Damage = Damage + 1 + INT(5 * RND): GOTO TrainMen:
IF K$ = "2" AND Score >= 100 THEN Score = Score - 100: Damage = Damage + 2 + INT(9 * RND): GOTO TrainMen:
IF K$ = "3" AND Score >= 250 THEN Score = Score - 250: Damage = Damage + 5 + INT(12 * RND): GOTO TrainMen:
IF K$ = "4" AND Score >= 500 THEN Score = Score - 500: Damage = Damage + 8 + INT(20 * RND): GOTO TrainMen:
IF K$ = "5" AND Score >= 1000 THEN Score = Score - 1000: Damage = Damage + 12 + INT(50 * RND): GOTO TrainMen:
LOOP UNTIL K$ = CHR$(13)
GOTO Selection:
UpgradeShop:
CLS
IF Score >= 2500 THEN AST = 15 ELSE AST = 12
IF Score >= 1000 THEN ST = 15 ELSE ST = 12
IF Score >= 500 THEN BA = 15 ELSE BA = 12
IF Score >= 250 THEN FP = 15 ELSE FP = 12
IF Score >= 100 THEN RT = 15 ELSE RT = 12
IF Sabotages = 1 THEN ST = 10
IF Repaired = 1 OR Life >= 100 THEN RT = 10
IF AirStrike = 1 THEN AST = 10
IF DamageUpg = 1 THEN FP = 10
IF ArmorUpg = 1 THEN BA = 10
LOCATE 1, 1:
COLOR 15: PRINT "Upgrade store..."
COLOR 15: PRINT "Money:" + STR$(Score)
COLOR 15: PRINT "What do you want to bye?"
COLOR RT: PRINT "1) Repair tank          Cost 100 (Current" + STR$(Life) + ")"
COLOR FP: PRINT "2) Fire power           Cost 250 (Current" + STR$(Damage + 15) + ")"
COLOR BA: PRINT "3) Armor                Cost 500 (Current" + STR$(Armor + 100) + ")"
COLOR ST: PRINT "4) Sabotage enemy tank  Cost 1000"
COLOR AST: PRINT "5) Order Air strike     Cost 2500"
COLOR 15: PRINT "Press enter to continue"
DO
K$ = INKEY$
IF K$ = "1" AND Score >= 100 AND Repaired = 0 AND Life < 100 THEN
  Life = 100
  Score = Score - 100
  Repaired = 1
  GOTO UpgradeShop:
END IF
IF K$ = "2" AND Score >= 250 AND DamageUpg = 0 THEN
  Damage = Damage + 10 + INT(10 * RND)
  Score = Score - 250
  DamageUpg = 1
  GOTO UpgradeShop:
END IF
IF K$ = "3" AND Score >= 500 AND ArmorUpg = 0 THEN
  Armor = Armor + 50
  Score = Score - 500
  ArmorUpg = 1
  GOTO UpgradeShop:
END IF
IF K$ = "4" AND Score >= 1000 AND Sabotages = 0 THEN
  EArmor = EArmor - 25
  Score = Score - 1000
  Sabotages = 1
  GOTO UpgradeShop:
END IF
IF K$ = "5" AND Score >= 2500 AND AirStrike = 0 THEN
  Score = Score - 2500
  AirStrike = 1
  AirTeam = 1
  GOTO UpgradeShop:
END IF
IF K$ = CHR$(13) THEN
  Sabotages = 0
  Repaired = 0
  DamageUpg = 0
  ArmorUpg = 0
  IF AILevel >= 5 THEN
    IF AirStrike = 1 THEN AirRaides = 1
    AirStrike = 1
    AirTeam = 0
    CLS
    COLOR 12
    PRINT "Enemy Air planes detected"
    PRINT "Press enter to continue"
    DO
    LOOP UNTIL INKEY$ = CHR$(13)
    CLS
  END IF
  IF EScore >= 1000 OR AILevel >= 5 THEN
    Armor = Armor - 25
    EScore = EScore - 1000
    CLS
    COLOR 12
    PRINT "Tank sabotage detected"
    PRINT "Press enter to continue"
    DO
    LOOP UNTIL INKEY$ = CHR$(13)
    CLS
  END IF
  IF EScore >= 500 OR AILevel >= 4 THEN
    EArmor = EArmor + 50
    EScore = EScore - 500
  END IF
  IF EScore >= 250 OR AILevel >= 5 THEN
    EDamage = EDamage + 20 + INT(10 * RND)
    EScore = EScore - 250
  END IF
  IF EScore >= 150 OR AILevel >= 6 THEN
    EDamage = EDamage + 5 + INT(5 * RND)
    EScore = EScore - 250
  END IF
  GOTO Selection:
END IF
LOOP
YouLose:
CLS
COLOR 12
PRINT "You were defeated..."
COLOR 15
PRINT "Your made it to AI level" + STR$(AILevel)
PRINT "Play again Y/N"
DO
K$ = INKEY$
IF K$ = "y" OR K$ = "Y" THEN GOTO NewGame:
IF K$ = "n" OR K$ = "N" THEN GOTO ExitGame:
LOOP

SUB DoBallistic (X, Y, Speed, Power, Gravity, Wind)
Power = Power - Gravity
X = X + Speed + Wind
Y = Y - Power
PRESET (X, Y), 15
T# = TIMER: DO: LOOP UNTIL TIMER - T# >= .1
PRESET (X, Y), 0
END SUB

SUB DrawTank (X, Y, Team)
Y = Y - 3
FOR Tank = 0 TO 4
LINE (X - 4 - Tank, Y - 3 + Tank)-(X + 4 + Tank, Y - 3 + Tank), 7 - Tank
NEXT Tank
LINE (X - 7, Y + 1)-(X + 7, Y + 1), 8
LINE (X - 8, Y + 2)-(X + 8, Y + 2), 8
LINE (X - 7, Y + 3)-(X + 7, Y + 3), 8
FOR Detail = 1 TO 8
PRESET (X - 8 + (Detail * 2), Y + 2), 7
NEXT Detail
IF Team = 0 THEN
  LINE (X - 2, Y - 1)-(X + 2, Y - 1), 12
  LINE (X, Y - 2)-(X, Y), 12
  LINE (X + 4, Y - 4)-(X + 4, Y - 8), 7
  LINE (X - 5, Y - 2)-(X - 10, Y - 2), 7
END IF
IF Team = 1 THEN
  LINE (X - 2, Y - 1)-(X + 2, Y - 1), 1
  LINE (X, Y - 2)-(X, Y), 1
  LINE (X - 4, Y - 4)-(X - 4, Y - 8), 7
  LINE (X + 5, Y - 2)-(X + 10, Y - 2), 7
END IF
Y = Y + 3
END SUB

SUB EraseTank (X, Y)
Y = Y - 3
FOR Tank = 0 TO 4
LINE (X - 4 - Tank, Y - 3 + Tank)-(X + 4 + Tank, Y - 3 + Tank), 0
NEXT Tank
LINE (X - 7, Y + 1)-(X + 7, Y + 1), 0
LINE (X - 8, Y + 2)-(X + 8, Y + 2), 0
LINE (X - 7, Y + 3)-(X + 7, Y + 3), 0
LINE (X - 2, Y - 1)-(X + 2, Y - 1), 0
LINE (X, Y - 2)-(X, Y), 0
LINE (X + 4, Y - 4)-(X + 4, Y - 8), 0
LINE (X - 5, Y - 2)-(X - 10, Y - 2), 0
LINE (X - 4, Y - 4)-(X - 4, Y - 8), 0
LINE (X + 5, Y - 2)-(X + 10, Y - 2), 0
Y = Y + 3
END SUB

SUB GenerateLevel (X, Y)
  RY = INT(RND * 12)
  IF RY = 0 THEN Y = Y + 1 * RND
  IF RY = 1 THEN Y = Y + 1.2 * RND
  IF RY = 2 THEN Y = Y + 1.4 * RND
  IF RY = 3 THEN Y = Y + 1.6 * RND
  IF RY = 4 THEN Y = Y + 1.8 * RND
  IF RY = 5 THEN Y = Y - 1 * RND
  IF RY = 6 THEN Y = Y - 1.2 * RND
  IF RY = 7 THEN Y = Y - 1.4 * RND
  IF RY = 8 THEN Y = Y - 1.6 * RND
  IF RY = 9 THEN Y = Y - 1.8 * RND
  LINE (X, 240 + Y)-(X, 480), 2
  PRESET (X, 240 + Y + 240 * RND), 9 + INT(6 * RND)
  PRESET (X, 240 + Y + 240 * RND), 9 + INT(6 * RND)
END SUB

SUB Intro
SCREEN 12: CLS
WIDTH 80, 60
LOCATE 28, 28: COLOR 10: PRINT "TerraSoft proudly presents"
LOCATE 28, 33: COLOR 10: PRINT "A XiberLord game"
LOCATE 28, 28: COLOR 10: PRINT "After an idea from Tank.Bas"
LOCATE 28, 33: COLOR 10: PRINT "WarTanks  (v1.0)"
END SUB

SUB Outro
CLS : SCREEN 0
COLOR 14
PRINT "Thanks for choosing a TerraSoft produkt."
PRINT "Please visit WWW.NetColony.Com/Technology/XiberLord"
PRINT "here you can find programs, games and other good stuff"
PRINT "that you can use in your QB programs."
PRINT
PRINT "-:XiberLord:-"
END
END SUB

SUB Pal
PALETTE 7, 65536 * 50 + 256 * 50 + 50
PALETTE 6, 65536 * 45 + 256 * 45 + 45
PALETTE 5, 65536 * 40 + 256 * 40 + 40
PALETTE 4, 65536 * 35 + 256 * 35 + 35
PALETTE 3, 65536 * 30 + 256 * 30 + 30
PALETTE 9, 65536 * 0 + 256 * 55 + 35
PALETTE 10, 65536 * 0 + 256 * 50 + 30
PALETTE 11, 65536 * 0 + 256 * 45 + 25
PALETTE 13, 65536 * 0 + 256 * 35 + 15
END SUB

Even I have problems following my own code, this is way old... I think it's even my first ever completed game =)
The best obfuscation for me has always been the perl camel http://www.thinkgeek.com/tshirts/coder/3...urce.shtml

I'm sure qb can be obfuscated some more ;-)
Heh heh Z!re, but as wildcard said, i bet you could have done a worse attempt lol! (worse=better, get it? get it?..... oh nevermind)

Wildcard: Nice Link! LOL! That code is some awesome stuff. The dude even left a space for the eye of the camel. And the output is awesome! lol!
Yes i kno this topic is old but hey.....

Code:
REM $DYNAMIC
DIM Stack(9999)
CLS

Stack(Pntr) = (Stack(Pntr) + 1) AND 255
Stack(Pntr) = (Stack(Pntr) + 1) AND 255
Stack(Pntr) = (Stack(Pntr) + 1) AND 255
Stack(Pntr) = (Stack(Pntr) + 1) AND 255
Pntr = (Pntr + 1) MOD 30000
Stack(Pntr) = (Stack(Pntr) + 1) AND 255
Stack(Pntr) = (Stack(Pntr) + 1) AND 255
Stack(Pntr) = (Stack(Pntr) + 1) AND 255
Stack(Pntr) = (Stack(Pntr) + 1) AND 255
Stack(Pntr) = (Stack(Pntr) + 1) AND 255
Stack(Pntr) = (Stack(Pntr) + 1) AND 255
Stack(Pntr) = (Stack(Pntr) + 1) AND 255
Stack(Pntr) = (Stack(Pntr) + 1) AND 255
Stack(Pntr) = (Stack(Pntr) + 1) AND 255
Stack(Pntr) = (Stack(Pntr) + 1) AND 255
Stack(Pntr) = (Stack(Pntr) + 1) AND 255
Stack(Pntr) = (Stack(Pntr) + 1) AND 255
Stack(Pntr) = (Stack(Pntr) + 1) AND 255
Stack(Pntr) = (Stack(Pntr) + 1) AND 255
Stack(Pntr) = (Stack(Pntr) + 1) AND 255
Stack(Pntr) = (Stack(Pntr) + 1) AND 255
Stack(Pntr) = (Stack(Pntr) + 1) AND 255
Stack(Pntr) = (Stack(Pntr) + 1) AND 255
Stack(Pntr) = (Stack(Pntr) + 1) AND 255
Stack(Pntr) = (Stack(Pntr) + 1) AND 255
Stack(Pntr) = (Stack(Pntr) + 1) AND 255
Stack(Pntr) = (Stack(Pntr) + 1) AND 255
Stack(Pntr) = (Stack(Pntr) + 1) AND 255
Stack(Pntr) = (Stack(Pntr) + 1) AND 255
Stack(Pntr) = (Stack(Pntr) + 1) AND 255
Stack(Pntr) = (Stack(Pntr) + 1) AND 255
Stack(Pntr) = (Stack(Pntr) + 1) AND 255
Stack(Pntr) = (Stack(Pntr) + 1) AND 255
Stack(Pntr) = (Stack(Pntr) + 1) AND 255
Stack(Pntr) = (Stack(Pntr) + 1) AND 255
Stack(Pntr) = (Stack(Pntr) + 1) AND 255
Stack(Pntr) = (Stack(Pntr) + 1) AND 255
Pntr = (Pntr + 1) MOD 30000
Stack(Pntr) = (Stack(Pntr) + 1) AND 255
Stack(Pntr) = (Stack(Pntr) + 1) AND 255
Stack(Pntr) = (Stack(Pntr) + 1) AND 255
Stack(Pntr) = (Stack(Pntr) + 1) AND 255
Stack(Pntr) = (Stack(Pntr) + 1) AND 255
Stack(Pntr) = (Stack(Pntr) + 1) AND 255
Stack(Pntr) = (Stack(Pntr) + 1) AND 255
Stack(Pntr) = (Stack(Pntr) + 1) AND 255
Stack(Pntr) = (Stack(Pntr) + 1) AND 255
Stack(Pntr) = (Stack(Pntr) + 1) AND 255
Stack(Pntr) = (Stack(Pntr) + 1) AND 255
Stack(Pntr) = (Stack(Pntr) + 1) AND 255
Stack(Pntr) = (Stack(Pntr) + 1) AND 255
Pntr = (Pntr - 1)
IF Pntr = -1 THEN Pntr = 9999
PRINT CHR$(Stack(Pntr));
PRINT CHR$(Stack(Pntr));
Pntr = (Pntr - 1)
IF Pntr = -1 THEN Pntr = 9999
PRINT CHR$(Stack(Pntr));
Pntr = (Pntr + 1) MOD 10000
PRINT CHR$(Stack(Pntr));
Pntr = (Pntr + 1) MOD 10000
PRINT CHR$(Stack(Pntr));
Pntr = (Pntr - 1)
IF Pntr = -1 THEN Pntr = 9999
PRINT CHR$(Stack(Pntr));
Pntr = (Pntr - 1)
IF Pntr = -1 THEN Pntr = 9999
PRINT CHR$(Stack(Pntr));
PRINT CHR$(Stack(Pntr));
PRINT CHR$(Stack(Pntr));
Pntr = (Pntr + 1) MOD 10000
Pntr = (Pntr + 1) MOD 10000
PRINT CHR$(Stack(Pntr));
Pntr = (Pntr - 1)
IF Pntr = -1 THEN Pntr = 9999
Pntr = (Pntr - 1)
IF Pntr = -1 THEN Pntr = 9999
PRINT CHR$(Stack(Pntr));
PRINT CHR$(Stack(Pntr));
PRINT CHR$(Stack(Pntr));
PRINT CHR$(Stack(Pntr));
PRINT CHR$(Stack(Pntr));
Pntr = (Pntr + 1) MOD 10000
Pntr = (Pntr + 1) MOD 10000
PRINT CHR$(Stack(Pntr));
Pntr = (Pntr - 1)
IF Pntr = -1 THEN Pntr = 9999
PRINT CHR$(Stack(Pntr));
Pntr = (Pntr - 1)
IF Pntr = -1 THEN Pntr = 9999
PRINT CHR$(Stack(Pntr));
PRINT CHR$(Stack(Pntr));
PRINT CHR$(Stack(Pntr));
Pntr = (Pntr + 1) MOD 10000
Pntr = (Pntr + 1) MOD 10000
PRINT CHR$(Stack(Pntr));
Pntr = (Pntr - 1)
IF Pntr = -1 THEN Pntr = 9999
PRINT CHR$(Stack(Pntr));
PRINT CHR$(Stack(Pntr));
Pntr = (Pntr - 1)
IF Pntr = -1 THEN Pntr = 9999
PRINT CHR$(Stack(Pntr));
Pages: 1 2 3