Posts: 16
Threads: 5
Joined: Oct 2004
Get this
In pure qb (no libs, no asm)
Text or graphic mode.
And obviously, make it the smallest one.
othing to read...
Posts: 2,771
Threads: 96
Joined: Oct 2003
Good challenge, but i think you cant give the choice of text or graphics if the point is the smallest program. I would limit it to one, preferably graphics.
Posts: 2,765
Threads: 138
Joined: Nov 2002
too bad here mine is in text mode =P
[syntax="QBASIC"]CLS
RANDOMIZE TIMER
DIM game(1 TO 4, 1 TO 4) AS INTEGER
FOR i = 1 TO 15
DO
x = INT(RND * 4) + 1
y = INT(RND * 4) + 1
LOOP UNTIL game(x, y) = 0
game(x, y) = i
NEXT i
DO
DO
CLS
FOR y = 1 TO 4
FOR x = 1 TO 4
LOCATE y, x * 3
IF game(x, y) = 0 THEN PRINT " *" ELSE PRINT game(x, y)
NEXT x, y
FOR y = 1 TO 4
FOR x = 1 TO 4
i = i + 1
IF game(x, y) <> i THEN IF i = 16 THEN win = 1: EXIT DO
NEXT x, y
INPUT "Move number? ", num2move
LOOP UNTIL num2move < 16 AND num2move > 0
IF win = 1 THEN EXIT DO
FOR y = 1 TO 4
FOR x = 1 TO 4
IF game(x, y) = num2move THEN x1 = x: y1 = y
NEXT x, y
IF x1 > 1 THEN IF game(x1 - 1, y1) = 0 THEN game(x1, y1) = 0: game(x - 1, y1) = num2move
IF x1 < 4 THEN IF game(x1 + 1, y1) = 0 THEN game(x1, y1) = 0: game(x + 1, y1) = num2move
IF y1 > 1 THEN IF game(x1, y1 - 1) = 0 THEN game(x1, y1) = 0: game(x1, y1 - 1) = num2move
IF y1 < 4 THEN IF game(x1, y1 + 1) = 0 THEN game(x1, y1) = 0: game(x1, y1 + 1) = num2move
LOOP
PRINT "YOU WIN"[/syntax]
I can make is shorter by taking out the end condition....
Back by popular demand!
I will byte and nibble you bit by bit until nothing remains but crumbs.
Posts: 2,771
Threads: 96
Joined: Oct 2003
WT, tut tut! Where is the indentation?
Posts: 16
Threads: 5
Joined: Oct 2004
Tiger's bas doesnt work. It give some error on "end of statement"...
However, i should have precised that the game must be solved using arrow keys wich slide the tiles, and no input lines (that is kinda lammerish to me...). Sorry for that...
I'll also follow dark_prevail's hint.
Graph mode will be unquestionably larger, because there are at least 15 sprites to be drawn...
So i will opt for text mode.
Feel free, however, to make it also on screen 13...
othing to read...
Posts: 2,765
Threads: 138
Joined: Nov 2002
WHOOPS! I didn't post the neest saved version. I updated my previous post (and I indented for you (dark)...)
Back by popular demand!
I will byte and nibble you bit by bit until nothing remains but crumbs.