Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Rotating a squared matrix
#11
Dr_Davenstein:

How are you?  Say, I tried your program in QuickBASIC.  The DECLARE SUB requires "parameters".  Since I am not into SUBs enough, I changed your SUB into a subroutine, so, in front of your "rotate", I added GOSUB.  IT WORKED PERFECTLY!  I would like to say that I really feel awed with your very short coding, and I will study it intensely, so that I may learn!  Thank you for posting it.

Of course, to reach the OP's goal, he will have to change from SCREEN 13 to SCREEN 12.  And, I don't know if we can accomodate his array with dimension 56x56!
Ralph, using QuickBASIC 4.5 and Windows XP Home Edition and Service Pack 2, with HP LaserJet 4L printer.
Reply
#12
Hey guys, both of your code work are awesome! I can't wait to see the final results!

Thank you for helping me!

Clay dragon
Reply
#13
Hi, Ralph. I've been great, really. Thanks for the compliment. How are you doing? Smile

Since I haven't seen you for a while, I'd like to mention this because I programmed something interesting recently. Have you ever heard of anaglyph? It's the name for images/movies that require those red/blue 3d glasses to view correctly. I've always wanted to try making something like that. Well, I did and I'm pretty happy with the results. Anyway, Here's a link, if you're interested. Smile

http://dave-stanley.dyndns.org/programs/stereo.zip


Have you programmed anything fun lately? I mean besides the code above. See ya around! Wink
Reply
#14
(01-24-2008, 06:20 PM)Mac link Wrote:Anyway, yep, it is hard. I give up. Good luck.

Evidently not too hard for the first team! Thanks for saving the thread, Ralph and Dr. Davidstein.

Mac
Reply
#15
Dr_Davenstein:

Quote:Since I haven't seen you for a while
I guess the modern expresion, LOL, is in order.  I haven't ever seen you, nor you, me!  (I just couldn't pass that opportunity up!  I hope you have a good sense of humor.)

From time to time, in this or that QB forum, I see you contributing a post or two, and, usually, the theme is beyond my programming understanding and ability, so, I don't get into the responses.

As to your anaglyph files, I tried to run the first .bas program from your zip file in QB 4.5; no dice, it stopped me at the first line.  So, rather than try to convert the program to run in QB, I ran your two .exe files.  They ran very smoothly, but I am going to have to find me a pair of blue and red "eye glasses", or, at least, a blue and a red piece of cellophane.  The program seems interesting.  The second .exe program, I ran in "mode" 1, the one you seem to prefer, of the four "modes". Undoubtedly, I'll be  missing the main reason for such programs, until I can get my 3-D eye pieces!

The only interesting thing (to me) that I've done is an Excel spreadsheet with IRS Form 1040, which looks "just like" the original, except I haven't used color on it.  I did it for myself, starting out with just the calculations, and ending up with the whole form.  For my simple case, it works fine.  And, once I've inputted all the required data, I just print it out and put it in the mail.  It's been accepted by the IRS for my first go at it for the 2006 tax year, and I will do the same for 2007.  As soon as I send in 2007, I'll advance the one for 2008 as much as I can, assuming some of the probable entries, to see where I can do things to reduce the tax.  I know that there are many programs out there that do this, but, I have always preferred my own.  I always run into things that I  

I have not gotten further into fb, as my needs are usually very simple, and I don't want to have to learn more "stuff" whenever I want to do a small program.  QB is so logical for my engineering mind, that I don't want to abandon the simplicity of most of what I do in QB.  

Ralph, using QuickBASIC 4.5 and Windows XP Home Edition and Service Pack 2, with HP LaserJet 4L printer.
Reply
#16
ClayDragon:

First, thanks for the kudos.  These are always welcome.  But...

You said, "I can't wait to see the final results".  What do you mean?  If you want "final results", we expect you to start contributing comments and code.  The reason for these forums is to help people that are interested in programming, or even in just one particular proyect, and learning how to code it.  We help, but don't do the "final result", unless the poster helps, too.  So, post some code and ask away.
Ralph, using QuickBASIC 4.5 and Windows XP Home Edition and Service Pack 2, with HP LaserJet 4L printer.
Reply
#17
That's cool. I tried doing my own taxes a cople of times, but I realy hated it, so I just take them to a pro these days. They usually get me more anyway, since they know more about our variable tax laws.

About the programs: Yeah, unfortunately, they wont compile with any version of QB. They use a FB library that me and a few friends programmed.
Reply
#18
(01-26-2008, 10:24 AM)Ralph link Wrote:ClayDragon:

First, thanks for the kudos.  These are always welcome.  But...

You said, "I can't wait to see the final results".  What do you mean?  If you want "final results", we expect you to start contributing comments and code.  The reason for these forums is to help people that are interested in programming, or even in just one particular proyect, and learning how to code it.  We help, but don't do the "final result", unless the poster helps, too.  So, post some code and ask away.

Seconded! Wink
Reply
#19
(01-26-2008, 10:24 AM)Ralph link Wrote:ClayDragon:

First, thanks for the kudos.  These are always welcome.  But...

You said, "I can't wait to see the final results".  What do you mean?  If you want "final results", we expect you to start contributing comments and code.  The reason for these forums is to help people that are interested in programming, or even in just one particular proyect, and learning how to code it.  We help, but don't do the "final result", unless the poster helps, too.  So, post some code and ask away.

By "final results", I meant the code snipet I could use to replace the part that is not working properly in my tile editor. I don't have your coding skills. I used to be good at coding but now I'm quite rusted after years of inactivity in the coding department...

So here is the code anyway: (the following is the sub that doesn't work properly. The very part that does work only for a complete grid selection is in the very end of the sub starting from case "R". That's the part that I want to replace with your code snipet)

If you want all the source code, it is here (executable included).

Code:
flip.rotate:
IF x% = xmax% - 3 OR y% = ymax% - 3 THEN GOTO 11
COLOR 10
LOCATE 23, 1
SELECT CASE A$
CASE "H": PRINT "Define area for horizontal flip..."
CASE "V": PRINT "Define area for vertical flip..."
CASE "R": PRINT "Define area for rotation..."
END SELECT
COLOR 15
B$ = "": mx% = x%: my% = y%: x% = x% + 6: y% = y% + 6
DO
LOCATE 23, 36: PRINT "     ": LOCATE 23, 36
IF A$ = "H" OR A$ = "V" THEN
  PRINT LTRIM$(STR$((x% - mx%) / 3)) + "x" + LTRIM$(STR$((y% - my%) / 3))
ELSE
  PRINT LTRIM$(STR$((x% - mx%) / 3)) + CHR$(253)
END IF
GET (mx% + (x% - mx%) / 2 - 2, my% + (y% - my%) / 2 - 2)-(mx% + (x% - mx%) / 2 + 2, my% + (y% - my%) / 2 + 2), buffer
DO WHILE B$ = ""
  FOR i% = 0 TO 1
   LINE (mx%, my%)-(x%, y%), 15 * i%, B
   LINE (mx% + (x% - mx%) / 2, my% + (y% - my%) / 2 - 2)-(mx% + (x% - mx%) / 2, my% + (y% - my%) / 2 + 2), 15 * i%, B
   LINE (mx% + (x% - mx%) / 2 - 2, my% + (y% - my%) / 2)-(mx% + (x% - mx%) / 2 + 2, my% + (y% - my%) / 2), 15 * i%, B
   FOR j% = 1 TO 300
    B$ = INKEY$
    IF B$ <> "" THEN EXIT FOR
   NEXT j%
   IF B$ <> "" THEN EXIT FOR
  NEXT i%
LOOP
LINE (mx%, my%)-(x%, y%), 19, B
PUT (mx% + (x% - mx%) / 2 - 2, my% + (y% - my%) / 2 - 2), buffer, PSET
B$ = UCASE$(B$)
SELECT CASE B$
  CASE CHR$(0) + CHR$(72): GOSUB check.up: IF A$ = "R" THEN GOSUB check.left
  CASE CHR$(0) + CHR$(80):
   GOSUB check.down
   IF A$ = "R" THEN
    GOSUB check.right
    IF mx% - my% <> x% - y% THEN x% = mx% + 6: y% = my% + 6
   END IF
  CASE CHR$(0) + CHR$(77):
   GOSUB check.right
   IF A$ = "R" THEN
    GOSUB check.down
    IF mx% - my% <> x% - y% THEN x% = mx% + 6: y% = my% + 6
   END IF
  CASE CHR$(0) + CHR$(75): GOSUB check.left: IF A$ = "R" THEN GOSUB check.up
  CASE CHR$(13): EXIT DO
  CASE CHR$(27): x% = mx%: y% = my%: GOTO 10
END SELECT
B$ = ""
LOOP
LINE (mx%, my%)-(x%, y%), 15, B
IF A$ = "H" OR A$ = "V" THEN
COLOR 10
LOCATE 23, 1
PRINT "Mirror effect (Y/N)?                    "
B$ = ""
DO WHILE B$ = ""
  B$ = UCASE$(INKEY$)
  IF B$ <> "" THEN IF B$ <> "Y" AND B$ <> "N" THEN B$ = ""
LOOP
LOCATE 23, 22: PRINT B$
mirror% = ASC(B$) \ 89
END IF
IF A$ = "R" THEN
COLOR 10
LOCATE 23, 1
PRINT "Rotate which way: (R)ight or (L)eft?    "
B$ = ""
DO WHILE B$ = ""
  B$ = UCASE$(INKEY$)
  IF B$ <> "" THEN IF B$ <> "R" AND B$ <> "L" THEN B$ = ""
LOOP
LOCATE 23, 38: PRINT B$
END IF
COLOR 15
LINE (mx% + (x% - mx%) / 2, my% + (y% - my%) / 2 - 2)-(mx% + (x% - mx%) / 2, my% + (y% - my%) / 2 + 2), 19, B
LINE (mx% + (x% - mx%) / 2 - 2, my% + (y% - my%) / 2)-(mx% + (x% - mx%) / 2 + 2, my% + (y% - my%) / 2), 19, B
LINE (mx%, my%)-(x%, y%), 19, B
FOR j% = mx% / 3 TO x% / 3 - 1
FOR i% = my% / 3 TO y% / 3 - 1
  buffer(j%, i%) = POINT(171 + j%, 1 + i%)
NEXT i%
NEXT j%
FOR j% = mx% / 3 TO x% / 3 - 1
FOR i% = my% / 3 TO y% / 3 - 1
  SELECT CASE A$
   CASE "H":
    IF i% < (my% / 3 + y% / 3) / (mirror% + 1) THEN
     LINE (1 + j% * 3, 1 + ((my% / 3 + y% / 3) - i% - 1) * 3)-(2 + j% * 3, 2 + ((my% / 3 + y% / 3) - i% - 1) * 3), buffer(j%, i%), BF
     PSET (171 + j%, 1 + (my% / 3 + y% / 3) - i% - 1), buffer(j%, i%)
    END IF
   CASE "V":
    IF j% < (mx% / 3 + x% / 3) / (mirror% + 1) THEN
     LINE (1 + ((mx% / 3 + x% / 3) - j% - 1) * 3, 1 + i% * 3)-(2 + ((mx% / 3 + x% / 3) - j% - 1) * 3, 2 + i% * 3), buffer(j%, i%), BF
     PSET (171 + (mx% / 3 + x% / 3 - j% - 1), 1 + i%), buffer(j%, i%)
    END IF
   CASE "R":
    IF B$ = "R" THEN
     LINE (1 + (i% * 3), 1 + (j% * 3))-(2 + (i% * 3), 2 + (j% * 3)), buffer(j%, y% / 3 - i% - 1), BF
     PSET (171 + i%, 1 + j%), buffer(j%, y% / 3 - i% - 1)
    ELSE
     LINE (1 + (i% * 3), 1 + (j% * 3))-(2 + (i% * 3), 2 + (j% * 3)), buffer(x% / 3 - j% - 1, i%), BF
     PSET (171 + i%, 1 + j%), buffer(x% / 3 - j% - 1, i%)
    END IF
  END SELECT
NEXT i%
NEXT j%
x% = mx%: y% = my%
GOTO 10
Reply
#20
Claydragon, you wrote:
Quote:By "final results", I meant the code snipet I could use to replace the part that is not working properly in my tile editor. I don't have your coding skills. I used to be good at coding but now I'm quite rusted after years of inactivity in the coding department...

I understand you.  However, there is too much code for me to try to understand just what it is that you need. 

I would suggest that you write pseudocode to explain what you need.  Then, maybe I can help you.  But, perhaps Dr_Davenstein can help you, at this point? 

Ralph, using QuickBASIC 4.5 and Windows XP Home Edition and Service Pack 2, with HP LaserJet 4L printer.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)