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.
Messages - jacobly
Pages: 1 ... 10 11 [12] 13 14
166
« on: November 27, 2011, 07:51:50 pm »
Perhaps a floating-point-math Axiom, with a function to store a float to an axevar?
How can a float fit in a single axe var? Unless you want truncation, but then you would have to specify how you want it truncated.
There is only one kind of truncation. It's where you chop off the decimal portion. Or, to put it another way, round towards 0
By how you want it truncated, I mean what do you want it truncated to.
167
« on: November 27, 2011, 07:01:18 pm »
A function to get the power of a number would be pretty easy to make, if there isn't one handy. Here's a C++ function; I don't know Axe:
double Pow(double number,double power) { for (power;power>0;power--) number*=number; return number }
O(log n) instead of O(n) double Pow(double number,double power) { result = 1 for (power;power>0;power>>=1) { if (power % 2) result *= number; number*=number; } return result; }
168
« on: November 27, 2011, 06:43:42 pm »
I'm pretty sure it's like that, just have the second line of hex under/part of the first one.
... Ok, I was optimizing last night and wrote down a bunch of Q's as I went.
Do the ?/?? conditionals save space in the executable in relation to conventional If loops? How about speed?
Can they be nested? like B?(A++5?-1→A),→A works, nvm that
Which is faster: If (commonly true) / If (sparsely true) ?
So it's optimized to put the constants at the end...what if it's like L2+2? Would a different order influence anything?
1. ? and ?? are just convenience notation, so they are probably the same as If statements. 2. The speed of an If statement depends on what conditionals you use. However, for If / Else statements, the Else is generally faster due to one fewer jump. This is why I generally put the commonly true branch in the else part. 3. L₂+2 and 2+L₂ both optimize to 35388
169
« on: November 27, 2011, 06:17:58 pm »
Perhaps a floating-point-math Axiom, with a function to store a float to an axevar?
How can a float fit in a single axe var? Unless you want truncation, but then you would have to specify how you want it truncated. Page isn't loading at the moment. If you can provide the file I'll attach it to your post.
Added the file directly to the post.
170
« on: November 22, 2011, 03:23:22 am »
Yeah, I know why it's slow, and it's because my algorithm is pretty bad Here's my flood-fill code:{~1.01,~.01,.99,~1,1,~.99,.01,1.01->L3 DelVar I{A+sub(B->L2 Repeat I=dim(L2 I+1->I L2(Ans F+pxl-Test(600fPart(Ans)+2,6iPart(Ans)+2->F sum(seq(max(L1=L2(I)+L3(J)),J,1,8 If Ans Then " "+sub("12345678",Ans,1)+" Else For(J,1,8) L2(I)+L3(J If Ans>=0 and iPart(Ans)<C and |E2fPart(Ans)<D and prod(L2-Ans Ans->L2(1+dim(L2 End " End Text(600fPart(L2(I))+1,6iPart(L2(I))+2,Ans End The stuff between lines 11 and 15 are what's really slowing the thing down. It goes through the eight surrounding pixels and individually tests them to see if they're valid or not, and if so they get appended to the queue (L2). Because it has to do this for every element on the queue that doesn't have any mines surrounding it, blank squares take a while to show up.
I tried to implement the third algorithm on the Wikipedia article, but since there are eight directions in Minesweeper and three classes of elements (blank, numbered, mine), it turned out to be even slower than the one I have.
Replacing the above code with :A+sub(B :sum(seq(max(L₁=Ans+L₃(I)),I,1,8 :If Ans :Then :Text(6B+1,6A+2," "+sub("12345678",Ans,1)+" :Else :Text(6B+1,6A+2," :DelVar I{A+sub(B➔L₂ :Repeat I=dim(L₂ :I+1➔I :For(J,1,8 :L₂(I)+L₃(J :If Ans≥0 and iPart(Ans)<C and ᴇ2fPart(Ans)<D :Then :If pxl-Test(600fPart(Ans)+2,6iPart(Ans)+2 :Then :sum(seq(max(L₁=L₂(I)+L₃(J)+L₃(K)),K,1,8 :If Ans :Then :" "+sub("12345678",Ans,1)+" :Else :L₂(I)+L₃(J➔L₂(1+dim(L₂ :" :End :Text(600fPart(L₂(I)+L₃(J))+1,6iPart(L₂(I)+L₃(J))+2,Ans :End :End :End :End :End
appears faster, although it could probably be optimized some more. Edit to show how good I am at minesweeper J/k, actually to see the speed difference (I hope).
171
« on: November 19, 2011, 03:05:38 am »
My initial guess would be that it is because of missing function implementations: specifically void Medicine::Effect() { } and void DCD::Effect() { } and void BlueLobster::Effect() { }. Edit: If you get a link error of the form "Error: Unresolved or undefined symbols detected: virtual table for class Fred," you probably have an undefined virtual member function in class Fred.
So that's probably it.
172
« on: November 17, 2011, 02:28:40 pm »
For the output command, the column is in the range 0-15 and the row is in the range 0-7. In your code, I ranges from 1 to 8, so everywhere you have I, you need I-1 (unless you want to use {L₁+0} for something else).
For(I,1,8) rand^16→{I-1+L₁} End For(I,1,8) Output({I-1+L₁},I-1,"∗") End Pause 5000
Edit: The fact that you have 0→I before For(I,1,8) makes me think that you are trying to make I range from 0 to 7. However, For(I,1,8) starts off by storing 1 to I, causing the 0→I statement to be useless. Instead you may want For(I,0,7).
173
« on: November 16, 2011, 03:12:41 am »
Jacobly: I mean sign-exponent-mantissa, like the TI floating-point format and IEEE754.
Sorry, I wasn't very clear in my post. I actually was talking about sign-exponent-mantissa floating point numbers. What I was referring to in my post was that TI floating-point numbers are base 10 and IEEE754 are base 2. I'm not exactly using one of the IEEE754 specifications atm, but a 24 bit version split up into 1-7-16 bits. Edit:
174
« on: November 16, 2011, 12:47:28 am »
ASM is not good for writing floating-point math programs
If by floating-point you happen to mean binary floating-point, and not that awkward base 10 format, then coincidentally I happen to be doing that right now.
175
« on: November 15, 2011, 12:01:37 am »
p_Input: saves three bytes and lots of cycles p_Input: .db __InputEnd-$-1 res 6,(iy+$1C) set 7,(iy+$09) xor a ld (ioPrompt),a B_CALL(_GetStringInput) B_CALL(_ZeroOP1) ld hl,$2D04 ld (OP1),hl B_CALL(_ChkFindSym) inc de inc de ex de,hl ret __InputEnd:
| p_Input: .db __InputEnd-$-1 res 6,(iy+$1C) set 7,(iy+$09) xor a ld (ioPrompt),a B_CALL(_GetStringInput) B_CALL(_ZeroOP1) ld a,$2D ld (OP1+1),a rst rFindSym inc de inc de ex de,hl ret __InputEnd:
|
176
« on: November 10, 2011, 09:21:48 pm »
SAXParser in a very round-about way eventually uses a URLConnection, so you might as well create your own and set its timeout.
public RSS(String uri) { try { SAXParser parser = SAXParserFactory.newInstance().newSAXParser(); URL url = new URL(uri); URLConnection conn = url.openConnection(); conn.setConnectTimeout(0); conn.setReadTimeout(0); parser.parse(conn.getInputStream(), new RSSHandler()); } catch (SAXException ex) { ex.printStackTrace(); } catch (MalformedURLException ex) { ex.printStackTrace(); } catch (IOException ex) { ex.printStackTrace(); } catch (ParserConfigurationException ex) { ex.printStackTrace(); } }
177
« on: November 09, 2011, 12:59:17 pm »
(does "dividable" exist ?)
yep, its called divisible
178
« on: November 09, 2011, 11:53:35 am »
I think I got it!
ld hl, (SaveIY) push hl pop IY
^ That code is really important, right? but what happens if it is clipped off the bottom... then the routine returns at the clipping code
bit 7, a jp nz, Clip ld a, (_ty) cp 6 ret nc // early return, above code is not run!
This results it iy pointing to flash, which is why the os goes crazy... because it is unable to set any of its own flags O.o Edit: my mistake, it actually points inside saveSScreen, which still causes problems
P.S. ld iy,(nnnn) and ld (nnnn),iy are both documented instructions...
179
« on: November 08, 2011, 09:44:37 pm »
I have that on a shirt.
180
« on: November 08, 2011, 10:43:59 am »
Feel free to change the packages back. I rewrote the RSS Parser like 4 times, and each time I moved it to a new package instead of deleting the old code. Also, the more info page works fine for me. What version of Android are you testing it on?
Pages: 1 ... 10 11 [12] 13 14
|