• Welcome to the Speedsolving.com, home of the web's largest puzzle community!
    You are currently viewing our forum as a guest which gives you limited access to join discussions and access our other features.

    Registration is fast, simple and absolutely free so please, join our community of 35,000+ people from around the world today!

    If you are already a member, simply login to hide this message and begin participating in the community!

SCTimer || web based timer

Lucas Garron

Member
Joined
Jul 6, 2007
Messages
3,557
Location
California
WCA
2006GARR01
YouTube
Visit Channel
sctimer 4.24
stackmat 5.43

Wow, this is like a smart phone with tons of cool stuff but poor telephone quality. Seriously, if you're making a timer, the one thing you absolutely need to get right is the time.
AAAArGH, my eyes! :eek:

Code:
	function timer(){
 
	running = "yes";
		if(miliseconds >= 99){
			miliseconds = 00;
			seconds += 1;
		}
		if(seconds >= 60){
			seconds = 00;
			minutes += 1;
		}
		miliseconds += 1.5;
		document.getElementById("time").innerHTML = pad2(minutes)+':'+pad2(seconds)+'.'+pad2(miliseconds)[0]+pad2(miliseconds)[1];
		ival = setTimeout(timer,15);
 
	}
 

Cyrus C.

Member
Joined
Oct 17, 2009
Messages
2,159
Location
IOWA
WCA
2010COLA01
YouTube
Visit Channel
Looking at it in Safari.

First of all, the timer is off.
Stackmat: 1:00.28
SCtimer: 58.13

Second, Average of 5, and Average of 12 formats are much more preferable. In cubing average means you remove the best and worst time, and then average the remaining times. Right now you're using means of 5 and 10.

Third, it would be nice if you could enlarge the graph, and have the x and y axis labeled, like cubetimer. Also, it doesn't seem to be to scale. Right now I have 4.07, 3.24, and 58.13 entered. If 4.07 was 1, 3.24 would be .9, and 58.13 would be 2.

Fourth, it would be nice if you could add DNF or +2 to your time.

Fifth, it's much better if you can stop the timer with any key, I know I sometimes miss the spacebar.

Sixth, it would really be nice if I could enter in times. I use a stackmat right now, and just use timers as a place to log my time and to calculate averages, etc.
 

ShadenSmith

Member
Joined
Jan 4, 2008
Messages
1,015
Location
Minneapolis, USA
WCA
2008SMIT01
AAAArGH, my eyes! :eek:

Code:
	function timer(){
 
	running = "yes";
		if(miliseconds >= 99){
			miliseconds = 00;
			seconds += 1;
		}
		if(seconds >= 60){
			seconds = 00;
			minutes += 1;
		}
		miliseconds += 1.5;
		document.getElementById("time").innerHTML = pad2(minutes)+':'+pad2(seconds)+'.'+pad2(miliseconds)[0]+pad2(miliseconds)[1];
		ival = setTimeout(timer,15);
 
	}
lololol

EDIT:
stackmat: 1:00.16
SCTimer: 56.82
 
Last edited:

qqwref

Member
Joined
Dec 18, 2007
Messages
7,830
Location
a <script> tag near you
WCA
2006GOTT01
YouTube
Visit Channel
AAAArGH, my eyes! :eek:

Code:
	function timer(){
 
	running = "yes";
		if(miliseconds >= 99){
			miliseconds = 00;
			seconds += 1;
		}
		if(seconds >= 60){
			seconds = 00;
			minutes += 1;
		}
		miliseconds += 1.5;
		document.getElementById("time").innerHTML = pad2(minutes)+':'+pad2(seconds)+'.'+pad2(miliseconds)[0]+pad2(miliseconds)[1];
		ival = setTimeout(timer,15);
 
	}
I laughed out loud at this! setTimeout is an incredibly bad choice because it will call the function when *at least* the given time has elapsed. The more other stuff your computer or browser is doing, the more extra time it will wait before calling it again. And if you're calling it 65 times a second, well... you can figure out the consequences.

PS: Don't use "milliseconds" to mean 1/100 of a second! That's not what it means! It means 1/1000 of a second!

The way I suggest to do times, and the way qqTimer does it, is to create a "new Date();" object when the timer starts and another one when the timer ends. This object is automatically initialized with the current time. So, the time elapsed between the two calls is simply the interval between those two dates: "stopTime.getTime() - startTime.getTime()". You can use this to update the timer, too, by creating a new object every time and keeping the startTime the same. Keep in mind that this will give you the time in a multiple of 1/1000 of a second, so you will probably want to divide by 1000 and then round to the nearest 0.01.
 

zxoraz

Member
Joined
Aug 22, 2010
Messages
3
:D thanks for trying to timer,
I KNOW that it isn't reliable yet, just wanted to see what people think about it,
so yea i will fix the timer and let you guys know when I'm done,

So thanks again for trying & commenting ;D

BTW: Lol dont take the "miliseconds" too seriously, I didn't really care of how the variable is called. and yeah my english isn't really good and im quite lazy, so didnt bother to name it correctly.

About the SetTimout - my bad :p , it's the first timer I ever made so yeah, il use a different function.
 
Last edited:

emg

Member
Joined
Aug 12, 2010
Messages
24
Location
United States
WCA
2004GATE02
If you'd like I could help you incorporate the two phase algorithm from QBX for better scrambles. It's not WCA legal yet, I'm working on getting it approved.
 

Cride5

Premium Member
Joined
Jan 27, 2009
Messages
1,226
Location
Scotland
WCA
2009RIDE01
emg, wow I'm impressed! It's probably too slow in Firefox, but works pretty well in Chrome. I never thought twophase would be feasible in Javascript!

It looks like transition & pruning table data is stored as number type. When I tried porting the Java implementation of TwoPhase to Javascript the main problem was that the memory consumption was too high (using tables of type Number array) - how did you get around the memory problem?

I also noticed that solutions tend to be around 23 htm - is this because of memory optimisations made?
 

emg

Member
Joined
Aug 12, 2010
Messages
24
Location
United States
WCA
2004GATE02
I haven't looked at the java implementation so I'm not entirely sure what it does, but here's an explanation of QBX. If any of it is hard to follow, I'd recommend checking my C code it's based on, which doesn't have all of the speed hacks in it (courtesy of Tomas Rokicki, otherwise it would be unbearably slow). You can browse http://bitbucket.org/emg/cubeutils

The transition tables hold a single turn for each face, if you want to do 2 or 3, apply that transition 2 or 3 times, but we never apply more than once at a time anyway, because after each turn we search down that branch, before coming back and just doing another turn.

As for the pruning tables, there is one for each coordinate (co, eo, ud1, cp, ep, ud2), no bigger tables based off of multiple coordinates.

The solution length will generally be a bit longer than say cube explorer, because we only find a single solution, instead of trying more phase 1 solutions of increasing length in order to find shorter overall solutions.

In the future (perhaps distant, we shall see) I hope to have the option of downloading larger tables as opposed to generating the small ones on load I'm also looking to add the ability to search for shorter solutions, much like cube explorer does, with the play/stop button by each cube.

-emg
 
Top