# SCTimer || web based timer

#### Lucas Garron

##### Member
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!

Code:
	function timer(){

running = "yes";
if(miliseconds >= 99){
miliseconds = 00;
seconds += 1;
}
if(seconds >= 60){
seconds = 00;
minutes += 1;
}
miliseconds += 1.5;
ival = setTimeout(timer,15);

}

#### Tykwondo35

##### Member
Omg with this timer i just got a new pb. 27 sec normal solve. It was insane. I only avarage 50-60 sec

#### StefanR

##### Member
I'll use this timer maybe in 6 months, I hope then the timer is better...

#### Carson

I wouldn't recommend using the javascript timer. You may find more accuracy by using getTime instead. Here is a basic javascript stopwatch... view the source to see how it is implemented.

Edit: Included the link to the stopwatch I mentioned... oops

#### Cyrus C.

##### Member
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.

##### Member
AAAArGH, my eyes!

Code:
	function timer(){

running = "yes";
if(miliseconds >= 99){
miliseconds = 00;
seconds += 1;
}
if(seconds >= 60){
seconds = 00;
minutes += 1;
}
miliseconds += 1.5;
ival = setTimeout(timer,15);

}
lololol

EDIT:
stackmat: 1:00.16
SCTimer: 56.82

Last edited:

#### qqwref

##### Member
AAAArGH, my eyes!

Code:
	function timer(){

running = "yes";
if(miliseconds >= 99){
miliseconds = 00;
seconds += 1;
}
if(seconds >= 60){
seconds = 00;
minutes += 1;
}
miliseconds += 1.5;
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
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 , it's the first timer I ever made so yeah, il use a different function.

Last edited:

#### qqwref

##### Member
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.
I understand lazy, but I thought the metric units had pretty much the same names across all languages...?

#### emg

##### Member
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

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
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

#### XXGeneration

##### Member
SCTimer: 55.78
Watch: 1:00.04
I really like how it looks though, and all the features it has