Play the games, create the levels

Topic, Scratch Projects

Checkout our iPhone & iPad games!

You must register or log in to post a message.

Hexicube 13 years ago
  my prime checker
allyally 13 years ago
  Ok, updated it it with 4 more checks, should be fine now, Also should be much faster now,
Hexicube 13 years ago
  see the line 'change Var by VarVar'? change it to increase by 2, and add another check to the repeat where Var*Var>answer stops the repeat, reporting prime
[edit] screw it, ill make a prime finder in it, just to see the speed :P
Hexicube 13 years ago
  no, your code is backwards, it wont work because your code is already broken(says 49 prime)
allyally 13 years ago
  Ok ill ive that a try,
Hexicube 13 years ago
  alright, add another check:
if VarVar squared is greater than Var, its prime...also, before looping, check if its divisible by 2, and increase VarVar by 2 after each loop
also, you might want to square your percentage value too, due to new code :P
[edit] wait, change Var by VarVar? wtf
code fail, says 49=prime
Hexicube 13 years ago
  you know what, im also scared how much faster my code is in C++ compared to yours now...my code can work out 2 038 074 743 is prime faster than yours works out 89 is prime o.O
allyally 13 years ago
  Ok, wait...

[edit: Done,]
Hexicube 13 years ago
  ah...unoptimised code :3
I may need access to the whole thing, ive never used scratch code but by the look of that you go from 2 to whatever half the prime is...
btw that 1000000th prime number check is at 93% now
allyally 13 years ago
  repeat until ((Y/N [Boolean for if its a prime] = 0) or (Var [the quadatically increasing variable thats compared to the ans]= ans/2))
Without info; [repeat until ((Y/N=0) or (Var = ans/2)]
Hexicube 13 years ago
  you are using a for loop, yes?
write it here...(just the line declaring the loop)
allyally 13 years ago
  Well, what do i change?
Hexicube 13 years ago
  yes but I want to optimise it...seriously look at re-edit...
[edit] its not even trying, its only using half the available power from one of my processor cores (your version) :_
allyally 13 years ago
  Ah well thats scratch for you isnt it. It wont handle all that data in that amount of time,
Hexicube 13 years ago
  yes but I wish to optimise the code...
[edit] my C++ code can work out 2 038 074 743 is prime in about 20 seconds :3
[re-edit] OMFG! I optimised using the code using the sqrt limit, and its so fast I dont belive it(its near-instant) but after a few checks using other non-primes and primes it must be true o.O
allyally 13 years ago
  Its just increaing a variable quadratically then seeing if the mode of the variable/your number = 0, If it does then its not a prime,
Hexicube 13 years ago
  may I examine the code?
allyally 13 years ago
  What do you mean?

& btw mines currently churning out an 8 digit prime just to see what it can do,its been going for 7 minutes & its at 40%,
Hexicube 13 years ago
  hmm...not bad...btw little tip:
did you stop after the square root of the value you were checking? because if you didnt, youre going over yourself...
[edit] good prime to test: 1299709
its prime, I know it is because its the 100000th prime generated by MY prime finder made in C++ which happens to also work out a list of primes, and a special function for my friend which shows what 2 primes were multiplied together to make a certain value
allyally 13 years ago
  Another Maths one, A Prime Number Calculator
dingdong 13 years ago
  17 turns here.
gameinsky 13 years ago
  Got it in 18 turns :)
MARC2009 13 years ago
  oh noes...25
AK 13 years ago
  18 turns......
demonicyoshi 13 years ago
  21 turns. (thats probally not good)
allyally 13 years ago
  Yup... thats one let down of Scratch, (as well as not being able to make sprite arrays... Which sucks...)

Also, I have a new Matching cards Game, How many moves does it take you?
gameinsky 13 years ago
  Levels unfortunately don't save, azz :P
azz 13 years ago
  http://scratch.mit.edu/projects/allyally42/1591838 type into adress bar this is my level
jasperpostema 13 years ago
  Good work allyally!
murtaza64 13 years ago
  my account is murtaza64
most(all for now) of my projects only work offline (downloaded).

General

First post of the topic

allyally 13 years ago
  Scratch is simple animation/game making program thats very good for inexperienced game makers to get started off. You can then upload your projects to This site

Accounts:
My account
Geckojsc's account
gameinsky'saccount
Superdog

ActionScript Projects:
My Character Code Finder (Actionscript)
Bonuslevel Matching Game
AS Calculator
Our free flash games   Games for your site   Games for your iPhone   Contact   Twitter @jpsarda & @bonuslevelorg