This commit is contained in:
StackSmith 2023-06-29 11:56:57 -04:00
parent 47e08e5fe1
commit a115ff2edd
3 changed files with 35 additions and 1 deletions

View File

@ -14,6 +14,10 @@ eleven.term: eleven.core.o eleven.term.o
gcc $(CFLAGS) -o eleven eleven.core.o eleven.term.o
strip eleven
elevenr: eleven.core.o eleven.termrot.o
gcc $(CFLAGS) -o elevenr eleven.core.o eleven.termrot.o
strip elevenr
clean:
rm -f *.o
rm -f eleven

View File

@ -27,6 +27,15 @@ void pr(U8* tiles){
}}
*/
#define RND (rand()%SIZE)
/* Orientation of the board, as shown by a bar:
* 0 = bottom
* 1 = left
* 2 = top
* 3 = right
*/
int orientation = 0;
void twist(U8* tiles){
int i,j;
@ -139,3 +148,23 @@ U32 move(U8* tiles, int way){
return n;
}
U32 moverot(U8* tiles, int way){
//if (way / 2) twist(tiles);
//if (way % 2) flip(tiles);
twist(tiles);
flip(tiles);
orientation = (orientation + 1) & 0x3;
if(way==2) {
twist(tiles);
flip(tiles);
twist(tiles);
flip(tiles);
orientation = (orientation + 2) & 0x3;
}
U32 n = step(tiles);
//if (way / 2) flip(tiles);
return n;
}

View File

@ -16,5 +16,6 @@ enum {
void init(U8* tiles);
U32 move(U8* tiles, int way);
U32 move(U8* tiles, int way);
U32 moverot(U8* tiles, int way);