Forums

Topic: Petit Computer

Posts 7,721 to 7,740 of 9,618

randomous

So I've been working on a bit of handwritten number recognition, and it's going fairly well. The only problem is that I'm having trouble trying to process more than a single "reference" number per digit. The references are the handwritten numbers that you give the program at the beginning, which it then uses to try to figure out new numbers written later. Usually you'd have something like 3 or 4 handwritten numbers per digit at the very least, but this just isn't really plausible here. This means that the handwriting recognition is... well, sub-par. It can recognize numbers pretty well, don't get me wrong; it's just not good enough to be put to use yet. I'm trying to find ways around testing against multiple reference numbers, or to speed up the testing so that it doesn't take so long to recognize the number. Here's what I have so far:

Untitled

Just write the numbers 0 through 9 in ONE stroke (this means you cannot lift the stylus until you are done writing the number) at the beginning (the number at the top left will tell you what to draw), then when you've completed the last number, you can start writing numbers again in any order to see if the program can "guess" correctly. It'll spit out the "deviations" for each digit along with its guess. If you want the recognition to work well, you should write the original numbers clearly and slowly. It doesn't matter what size they are, but try not to make the original numbers too small. Again, this doesn't work quite as well as intended, but I just wanted to show off what I've done so far. Gosh, I'm such a show off lol, I'm so sorry.

[Edited by randomous]

randomous

ramstrong

twinArmageddons wrote:

Edit: (@ramstrong you'll like this) also the only bug i've found is the background flashes occasionally if you use gas, and that's due to ptc's limitations so i can't fix that. other than that it's 100% bug free

Of course, that's what they all say. Come to think of it, that's what I said, too.

@Discostew
ODD=X AND 1
EVEN=!ODD

Bluerobin2 wrote:

ACLS:CLEAR
X=RND(255)
Y=RND(191)

DIM TGEN(5)
TGEN(0)=ABS(0+X)
TGEN(1)=ABS(0+Y)
TGEN(2)=ABS(255-X)
TGEN(3)=ABS(191-Y)

SORT 0,4,TGEN
GCIRCLE X,Y,RND(TGEN(0)),6

You just want the minimum value. So, something like this:
R=X
IF Y<R THEN R=Y
IF 255-X<R THEN R=255-X
IF 191-Y<R THEN R=191-Y

or, alternatively

IF X>=128 THEN X=255-X
IF Y>=96 THEN Y=191-Y
IF X<Y THEN R=X ELSE R=Y

twinArmageddons wrote:

IF TCHTIME==1 THEN X=X+1

I tried it, and got 362 counts. I think there's a VSYNC 1 missing somewhere. Or maybe this:

X=0
FOR I=0 TO 100000
IF TCHTIME THEN DX=1 ELSE X=X+DX:DX=0
NEXT
?X

@Discostew

Not sure why you want to sort the data, but the algorithm breaks down when it got scaled to more than 2.

SPL=NUMP1/NUMP2:IDX=0
FOR I=0 TO NUMP2-1P2(I)=0OR (P1(IDX)+P1(IDX+SPL-.001))/2:?P2(I);" ";:IDX=IDX+SPL:NEXT:?

I did this, instead

SPL=NUMP2/NUMP1
FOR I=0 TO NUMP1-1
IDX=FLOOR(I*SPL):? IDX;" ";
P2[IDX]=P2[IDX]+P1[I]
N[IDX]=N[IDX]+1
NEXT
?
FOR i=0 TO NUMP2-1
?(P2[I]/N[I]);" ";
NEXT
?

You need to dimension N array per NUMP2. Also, I know you can use parenthesis as array, but I'd rather use square bracket so as not to confuse groupings.

[Edited by ramstrong]

Petit Computer Journal
Old site http://ramstrong.blogspot.com

Let's just call a spade, a spade.

ramstrong

@randomous

How's this for both compressing and expanding?

CLEAR:ACLS
NUMP1=6:NUMP2=10
DIM P1[NUMP1],P2[NUMP2],N[NUMP2]
FOR I=0 TO NUMP1-1: P1[I]=RND(100):?P1[I];" ";:NEXT:?

IF NUMP1>NUMP2 THEN MI=NUMP1 ELSE MI=NUMP2
S1=NUMP1/MI:S2=NUMP2/MI
FOR I=0 TO MI-1
ID1=FLOOR(I*S1):'? ID1;" ";
ID2=FLOOR(I*S2):'? ID2;" ";
P2[ID2]=P2[ID2]+P1[ID1]
N[ID2]=N[ID2]+1
NEXT:?

FOR I=0 TO NUMP2-1
?(P2[I]/N[I]);" ";
NEXT:?

TAINT_Zzyex wrote:

Due to the crappy system,

A bad workman blames his tools

hp==10

I think this here is your problem.

[Edited by ramstrong]

Petit Computer Journal
Old site http://ramstrong.blogspot.com

Let's just call a spade, a spade.

ShadowGame

How can i make that the enemy follows the player?? So that the enemy walk to the player.

ShadowGame

Pixelrobin

@randomous thanks! It worked. @Ramstrong great to see you back! I guess thanks as well!

So yeah, Battlewoods will be randomly generated, and you can share your worlds now, without the need for qr codes!

Everybody do a chirp. CHIRP.

Discostew

ShadowGame wrote:

How can i make that the enemy follows the player?? So that the enemy walk to the player.

A simple method would be...
If player is to the left of the enemy (IF PX<EX THEN), move the enemy to the left (EX=EX-1), else if player is to the right (ELSE IF PX>EX THEN), move to the right (EX=EX+1)
If player is above (IF PY<EY THEN), move enemy up (EY=EY-1), else if player is below (ELSE IF PY>EY THEN), move enemy down (EY=EY+1)

If you're wanting more complex AI, then you'll need to sit down and decide how you want to do it. Most complex methods are just sequences of simple methods to form one complex method. Write it down in pseudo code if you need to (kinda like I demonstrated above), just make sure you understand how it works and that the flow of the code will reach a desired result with certain bits of data.

Discostew

Switch Friend Code: SW-6473-2521-3817

ShadowGame

Thanks, but i tried it and it didnt work. But thats ok

ShadowGame

Discostew

ShadowGame wrote:

Thanks, but i tried it and it didnt work. But thats ok

I hope you didn't just take my code and expected it to work as-is, because it won't. I was just giving you an idea on how it works.

Discostew

Switch Friend Code: SW-6473-2521-3817

TAINT_Zzyex

@bluerobin2 Whats the point of living if you don't live?
Also, my game demo is done, there is a total of 1 enemy with stats unique to only it. because its the only enemy. I will release it in 1 day when my back-up wikia account is back.

"Did somebody say Aincrad?"
"No, go back to your own game!"
"awwww"
"And make out with Asuna."
"Aww-I mean YAY"

X:

ramstrong

TAINT_Zzyex wrote:

@bluerobin2 Whats the point of living if you don't live?
(snip) when my back-up wikia account is back.

your back-up account is gone? Heh. May you live in interesting times.

randomous wrote:

@Bluerobin2 Are you looking to just generate a world based on random numbers generated from a seed? In that case, you can use the Linear Congruental Generator (errr below):
(snip)
The randomness isn't all that great (in fact, it's terrible!), but it should be all right for games. This has a period of 59049 numbers, so if you generate more than that, they'll start to repeat in EXACTLY the same order (depending on the context, this might not matter as much as you think). For instance, if your first X numbers are 5, 669, and 7923, after 59049 numbers, you'll get the sequence 5, 669, 7923 again. There's not much I can do about this without making the algorithm EXTREMELY slow. (snip)

The linear congruent theory is widely used because it's fast. However, it does have the drawback on un-randomness on some values. Don Knuth of The Art of Computer Programming has examined the issue in detail.

from Robert Sedgewick's Algorithm in C++:
a[0] = seed;
for (i = 1; i<= N; i++)
a[i] = (a[i-1] * b+1) %m;

There's some gotchas. m should be large. b should be less than m, not too small, and ends with x21 with x being even.

[Edited by ramstrong]

Petit Computer Journal
Old site http://ramstrong.blogspot.com

Let's just call a spade, a spade.

InsertPi

I have a confession to make. I made Minecraft DS Beta 1.7.1 conpletely on PTCUtilities and didn't test it until after it was released. But it worked!

If Facebook, Myspace, Twitter, Instagram, and Snapchat were all destroyed, 90% of teens would go insane. If you're one of the 10% that would be laughing at them, copy & paste this into your signature and hope it happens.

X:

boot

IAmAPerson wrote:

I have a confession to make. I made Minecraft DS Beta 1.7.1 conpletely on PTCUtilities and didn't test it until after it was released. But it worked!

0: .... we all hate you forever now. lol JK I doubt anyone cares that much. it still turned out great. wat update was that?

Just your average talking boot. FC: 0791-4881-1672 for Smash and Pokemon.

randomous

Hmm, nobody tried out the number recognition program? I thought machine learning was cool! Lol oh well, here's a much better version which is far more accurate at recognizing your handwritten numbers.

Untitled

Just as a recap, this program learns your handwritten numbers and then identifies further handwritten numbers. You know... handwriting recognition? Lol I guess I think it's much cooler than it is; sorry. Anyway, if you do try it, remember that it first asks you to draw the numbers 0 through 9 to learn how you write them. Make sure to draw them slowly (not too slowly though) and in a single stroke (you cannot lift the stylus). Next, just draw whatever number you like and see if it guesses correctly. If you don't care about the pile of data is spews out, just look for the green line, which will tell you what it thought your number was.

Here's a quick explanation on the data given when you draw a number: the list of values gives the "deviation" calculated for various recognition schemes. The first column gives the deviation from each number for the euclidean distance; that is, how much each point sampled while drawing differs from the stored points for each number. The second column gives the deviation for a "shorthand" euclidean distance, which is less accurate but quite a bit faster. The third column gives the deviations for the directions of each stroke. For instance, if you draw a 9, the beginning is curved. This is quite different than the beginning of a 1, which is straight. The next section of data tells you what the program thought you drew. The first number is the guess based on the euclidean distance, which is the scheme I used in the original program (orgnl). Next is the shorthand euclidean (quick), and after that is the directional (drctn). The next one is highlighted in green; this is the euclidean deviation with each point weighted by the difference in direction, so basically euclidean and directional combined (cmbne). It's highlighted because I think this one performs the best in terms of accuracy. Finally, the last one is the same as the regular combination, except the weight is more curved. Surprisingly, this one doesn't perform as well, so I didn't pick it. If you find that a particular recognition scheme is outperforming the highlighted one, please let me know. Or, you know, if nobody tries it, I'll just pick one and make a game with it lol.

[Edited by randomous]

randomous

Pixelrobin

The linear method fit my needs perfectly. You can use any seed of any length of any text now. And if you choose to have a random seed, you can still access it. Perfect for my needs!

I was wondering, Does memory usage increase with more variables, or do the variables only use up space when the are being read/written to? I know there is a limit. I was wondering because I have 4 main variables in pretty much all my programs that I dump randomous values on (for statements, temporary values, etc). They are z,z$,zx and zy (or sometimes I use other letters).

Edit: @randomous aww I wanted to do something like that, but you beat me to it .

[Edited by Pixelrobin]

Everybody do a chirp. CHIRP.

randomous

@Bluerobin2 I think the variables take up space and stay there as soon as you use them, but you have so much space I wouldn't worry about it.

randomous

GraphicGenius

Hey guys how do you make music?

If Facebook, Myspace, Twitter, Instagram, and Snapchat were all destroyed, 90% of teens would go insane. If you're one of the 10% that would be laughing at them, copy & paste this into your signature and hope it happens. Wait was that just a joke?

TAINT_Zzyex

IAmAPerson wrote:

I have a confession to make. I made Minecraft DS Beta 1.7.1 conpletely on PTCUtilities and didn't test it until after it was released. But it worked!

@graphicgenius look at my guide on the wikia, search petit class.
@IAMAPERSON You Fiend! I am still absent from the credits! ._.

"Did somebody say Aincrad?"
"No, go back to your own game!"
"awwww"
"And make out with Asuna."
"Aww-I mean YAY"

X:

TAINT_Zzyex

ramstrong wrote:

TAINT_Zzyex wrote:

@bluerobin2 Whats the point of living if you don't live?
(snip) when my back-up wikia account is back.

your back-up account is gone? Heh. May you live in interesting times.

oh, don't worry... My backup account's [(aka troll acount)Don't you worry i wont be trolling with it on ptc's wiki.] 3 mounth long suspension is almost up... mwhahahahahahaha!

"Did somebody say Aincrad?"
"No, go back to your own game!"
"awwww"
"And make out with Asuna."
"Aww-I mean YAY"

X:

twinArmageddons

im finally going to get some sprites done

get in loser we're going titan hunting

Sorry, this topic has been locked.