Commits

Alexander Regueiro committed 7b51b69 Merge

Merged in misc changes.

Comments (0)

Files changed (2)

misc/ccodegen/icfp.hpp

 	gout << 1 << " zero " << cell << endl;	
 }
 
-vector<int> makenum (unsigned int num){
+vector<int> makenum (unsigned int num){ //Works
 	vector<int> out;
 	while (num != 0) {
 		if (num %2 ==1) {
 	return out;
 }
 
-void makenum(unsigned int cell, unsigned int num){
+void makenum(unsigned int cell, unsigned int num){ //works
 	vector<int> out = makenum(num);
 	
 	//clearcell(cell);
 void tonumber(unsigned int cell, unsigned int tonum ){
 	vector<int> out = makenum(tonum);
 	
-	for (unsigned int i=out.size(); i != 0; i--) {
+	for (unsigned int i=0; i != out.size(); i++) {
 		gout << 1 << " K "	  << cell << endl;
 		gout << 1 << " S "    << cell << endl;
-		if (out[i-1] == 1) {
-			gout << 1 << " succ " << cell << endl;
+		if (out[i] == 1) {
+			gout << 2 << " succ " << cell << endl;
 		} else {
-			gout << 1 << " dbl "  << cell << endl;
+			gout << 2 << " dbl "  << cell << endl;
 		}
 	}
 	gout << 2 << " zero " << cell << endl;

misc/ccodegen/tom.cpp

 // Sorry Tom!!! :(
 //
 int mainish(int argc, char **argv) {
-	heal(0,1,16);
+	tonumber(0,1);
+	tonumber(2,2);
+	tonumber(4,128);
+	tonumber(42,420);
+	tonumber(128,65535);
     return 0;
 }