1666
BatLib / Re: BatLib
« on: July 03, 2012, 03:56:28 pm »
I probably will not, but if I can, I will try

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to. 1666
BatLib / Re: BatLib« on: July 03, 2012, 03:56:28 pm »
I probably will not, but if I can, I will try
![]() 1667
ASM / Re: ASM Optimized routines« on: July 03, 2012, 12:13:46 pm »
Necroedit: For a much better routine, please try the routines at the end of this post!
I created this last night for my next project: Code: [Select] PseudoRandWord: There are a few other nice features, too. For example, every 16-bit value is hit if you run this 65536 times. Or, if you only read 1 byte (for example, H from the output), it will hit every 8-bit number once if you run this 256 times. Plus, it can be seeded, which has its own uses. This can be modified to be smaller, too, if you know what you are doing, but I just like the numbers 241 and 257. Anyways, it produces some nice results ![]() P.S.-I used this in a routine called "ShuffleDeck" and it works very well. 1668
BatLib / Re: BatLib« on: July 03, 2012, 11:53:57 am »
Thanks, hopefully I didn't miss anything
![]() 1669
TI Z80 / Re: ORG: online Z80 IDE and assembler« on: July 03, 2012, 11:51:55 am »
Wow, thisis really awesome ! This is a very impressive job!
1670
Grammer / Re: Grammer 2-The APP« on: July 03, 2012, 11:46:13 am »
Now problem
![]() ![]() 1671
BatLib / Re: BatLib« on: July 03, 2012, 11:43:12 am »
Hmm, I am going to have to look into that, then
![]() dim(14) and dim(15) now have options for using 2-byte words dim(124) was added for creating variables dim(125) was added for executing inline Grammer code dim(60) now allows you to archive or unarchive a var dim(29) is fixed (before, it added 1 to the x-coordinate) dim(29) now has two options for pixel testing rectangle regions dim(56) and dim(62) have been fixed (pixel test results were broken) dim(63) was fixed (similar issue) I found a discrepancy in the compression routine that is now fixed. It sometimes lost data instead of being lossless. EDIT: Oh! I almost forgot to mention that I made an example program for compressing/decompressing data. It can get great compression ratios depending on the data (I had a tilemap compress down to almost 11%). It is very easy to use, so I hope it can get used in some big projects ! 1672
Math and Science / Re: Cool math hacks« on: June 23, 2012, 02:48:15 pm »
Yes, I did note the mistakes I made there. I made a mistake on one of the pages testing cases of parity.
EDIT: Also, I finally found mention of this technique while searching something unrelated. It is Fermat Factorization ![]() 1673
BatLib / Re: BatLib« on: June 23, 2012, 02:46:39 pm »
It won't work with zStart because it requires a modification to the app header and zStart already uses that area. But yes, I have already asked Kerm about officially supporting GroupHook with DoorsCS7 and if it gets added, it will be able to work with Omnicalc, Grammer, and BatLib.
1674
Grammer / Re: Grammer 2-The APP« on: June 22, 2012, 02:40:18 pm »
Output(2 lets you draw text to pixel coordinates with the small font, Output(0 only lets you draw to 24 columns.
I will definitely try to add in the increment for For( I don't think I will change Fill(23 as some programs use it already. This would prevent the programs from working properly ![]() length(' and L... I cannot remember the difference, sorry ![]() ![]() 1675
BatLib / Re: BatLib« on: June 22, 2012, 11:52:21 am »
I finally got the motivation to rewrite BatLib, so I was working on it all this past week. I have good news and bad news. The good news will hopefully be awesome enough to outweigh the bad
![]() Bad news: I cannot figure out how to make weird names with Brass, so this update uses BatLib with regular letters. Also, I have change the syntax of some ReCode commands and I have yet to document the changes (also, I think I still need to code in 8 more commands). Awesome news: I have added in all the other 104 commands as well as 19 more commands. I have updated almost everything, so a bunch of the commands are now more powerful (and still backwards compatible). All the bugs or issues that I could find are now fixed and I have yet to find bugs, now. Here are some changes:
Now for the new commands!
Also, in this release is a beta/test version of BatLib that will be able to use a revolutionary new "GroupHook" that I came up with. Since no other apps have it, I had to perform some modifications to existing apps for demonstration. Basically, I managed to make it so that when I installed BatLibG, I could use the parser hooks in Celtic 3, Omnicalc, and Grammer, too without installing them. Celtic 3 and Omnicalc did conflict with the real( commands, though. I managed to modify DoorsCS7, too, and I could use Celtic 3 and DSC commands, too, but I will not release the modified DCS7 because I haven't talked to Kerm about it. Finally, I could not send the as to my actual calc (I need to get new batteries), so I could not check if there were any issues on calc that didn't occur in WabbitEmu. 1676
TI Z80 / Re: ORG: online Z80 IDE and assembler« on: June 08, 2012, 07:05:14 am »
yep
![]() 1677
TI Z80 / Re: Samocal« on: June 07, 2012, 10:40:54 pm »
Hehe, thanks
![]() ![]() ![]() ![]() EDIT: Also, as a note, this program currently use 8312 bytes which is cool ![]() prgmITEMS 1567 bytes ;all the item data inlcuding names, description, and code for what it does. prgmWALK 3642 bytes ;the main program that will eventually be renamed appvMapA 2513 bytes ;the first 50x50 map appvSamoSave 316 bytes ;the quick-save file. In the future, there will be an appvar containg several save files. This will be in archive. appvTiles 274 bytes ;the tile data 1678
TI Z80 / Re: Samocal« on: June 07, 2012, 09:23:38 pm »
Hmm, it is weird that I never replied, maybe my internet was buggy. To answer your question, yes, you just need to draw a tilemap on two separate buffers and be sure to use DispGraph frequently. You will also need to be sure to define which buffer is the primary buffer and which is the secondary. (use Disp with the degree/minute modifier).
Anyway, I added a little bit to this last week, so now I have stats and a working item menu and item list. You can now use items, in theory, but since there is no way to actually lose health without hex editing the save file, it doesn't really help. All of the items programmed in have all the code necessary to work for battle and for out of battle, properly. There are currently 23 items including the material to use for creating new items such as armor, weapons, and charms. I don't have any of those kinds of items programmed in, yet, though. 1679
Math and Science / Re: Cool math hacks« on: June 06, 2012, 09:46:40 pm »
First, let me clarify that I am working solely with positive integers (natural numbers).
These proofs are not very formal, sorry. Typing them is a bit more tedious than writing them on paper ![]() Theorem: All integers except those of the form 4n+2 are the difference of two squares. Proof: Here, I will simply show by cases. Let A be odd, B be even. That is, A=2n+1, B=2m. Then:
Now, let A be even, B be odd. That is, A=2n, B=2m+1. Then:
If both are even, you have:
If both are odd, you have:
These are all the possible case, so you can have 4l,4l+1,and 4l+3 as the difference of two squares. As a very simple proof that all odd integers can be the difference of two squares, just plug in the trivial solution (c+1)/2 and (c-1)/2 for A and B respectivels. Since c is odd, c+1 and c-1 are even, so you can divide by two. For a process to arrive to this conclusion, forst note that the difference of two consecutive squares is odd. That is: (n+1)2-n2= So if you want to find, say, 23 as the difference of squares, 23=2n+1 means n=11. So 122-112=23. The powerful result of the math hack I presented says that because 23 is prime, this is the only solution. Theorem: If c is composite and odd, then there is a non-trivial solution for A2-B2=c. Proof: Let c be composite. That is, let c=n*m where n and m are neither 1. Since A2-B2=(A-B)(A+B), let n=(A-B) and m=(A+B). Then: n+2B=A+B n+2B=m 2B=n-m B=(n-m)/2 ;since c is odd, n and m are odd, so n-m is even. A=(n+m)/2 ;This, too, is an integer. [qed] Theorem: If c is an odd prime, then the non-trivial solution for A2-B2=c is the only solution. Proof: Assume there is a non trivial solution for A and B, A=D, B=E. This implies that (D-E) and (D+E) are factors of c. Since c is prime, the only factors are 1 and c. Therefore, (D-E)=1, (D+E)=c. This means: D+E=1+2E, D+E=c 1+2E=c E=(c-1)/2 D=(c+1)/2 However, this is the trivial solution, so we have met a contradiction. Therefore, the trivial solution is the only solution [qed] EDIT: I opened up my notes and followed through some of my work and what I have found so far: If there is a non-trivial solution for A2-B2=c, then it is of the form (A+2d)2-(B-4e)2 where d and e are integers. This will let me speed up my code as I can forget about half or 3/4 of the potential values. I am still working on cutting that down even more :) 1680
Math and Science / Re: Cool math hacks« on: June 06, 2012, 08:20:05 pm »
Hmm, I was fooling around with my math notes when I came across an old proof. I saw that all numbers of the form 4n+2 could not be expressed as the difference of two squares, but all other numbers could. However, I pretty much left it at that. Let me tell you now that there will be a really cool hack with this, but there is more to the story. Anyway, I was looking through another notebook and some of my work on the Putnam two years ago and I saw a familiar proof where I showed that all integers >2 are in at least one pythagorean triple (I had broken down the problem to requiring only this to be true). Anyways, all I did was design a formula where, given a value A, you could get a B and C. Anyways, the process to designing the formula sparked an idea. Here is the awesome math hack:
I had shown that all integers not of the form 4n+2 could be expressed as the difference of two squares, so essentially, I have A2-B2=c. If we look at only odd integers for c, however, we get magic. If c is odd, there is a trivial solution for A and B: A=(c+1)/2 B=(c-1)/2 But guess what? A2-B2=c can be factored to (A-B)(A+B)=c. DO you know what this means? Here:
I have been using this to write really fast factoring algorithms in assembly and I have been trying to figure out if there is a polynomial time method to finding if A2-B2=c has more than 1 solution (aside from using the AKS primality test on c). If you can find a way, then you can potentially run a very fast prime testing algorithm. Other than that, since I made this connection, I have been putting tons of energy toward following every path I can with this. |
|