Friday, March 21, 2014

RobotC has Issues

While I was working on Step 1 of my Rubik's Cube solver, the program kept running the first statement instead of the right one. After a few hours of experimenting I found the answer. For some reason, RobotC does not check that the whole equation is true, but only parts of it.

 task main() {
 if( PI == 10 == -30 == 15.63 == 0) { 
nxtDisplayTextLine(1,"Confused yet?I am."); 
 while(1); }

In this code, the line should not be displayed because obviously nothing is equal to each other. Yet, when I run the code, it does display the text. The solution to this is to rewrite the code in this manner:


 task main() {
 if( PI == 10 && 10 == -30 && -30 == 15.63 && 15.63 == 0) { 
nxtDisplayTextLine(1,"Confused yet?I am."); 
 while(1); }

While this works, it is not ideal. It would be better the first way but, since it doesn't work. I will need to rewrite my code to reincorporate this new findings.

Thursday, March 13, 2014

Structs and Update

As I was working on the solver, I was having difficulty because it was not possible to just reference a face. So I started my attempted to change everything to structs and pointers. I was having a hard time and eventually abandoned this attempted because I could not change the value at a pointer.

Since then I have been continuing work on my solver. Now it looks for 'bars' and moves them towards the bottom. And if there is only one bar, it will move it towards a specific spot.

Thursday, March 6, 2014

Origin of the 2x2 Solver

I am on the 7460 team thunder FTC team this year, it was our first year and we were all getting to know each other. We found out that we could all solve a Rubik's cube. Originally we planned on making a robot from plans online but we ran out of time. I decided that I wanted to do more than just use someone's plans, I wanted to build my own, though a little less ambitious, 2x2 solver.
During my spare time I would work on the code. As of now, I have code that can store and simulate a Rubik's cube. I am now starting on the actual solving algorithms. I have also attempted the actual robotic part of the design but will likely scrap it because it is not reliable.
The code I have so far is on github, though I am planning on going through it at some point in order to make it easier to understand.