// File: hobbitsyfeet[P]Turn/turn.cc
// Function: Turn::movePlayer(Unit&, Chart&)
void Turn::movePlayer(Unit& player, Chart& world){
	string option;
			bool spawning;
			int dist;
			cout<<"which way>>";
			cin>>option;
			cout<<"how much>>"<<endl;

			cin>>dist;
			world.setCanEnter(player.getPosX(),player.getPosY(),false);
			if(option == "north" || option == "up"){
				for(int i =0; i<dist;i++){
					//cout<<i;
					if( world.canEnter(player.getPosX(), player.getPosY()+1 ) ==false ){
						///increment Y
					player.posY += 1;
					world.isPortal(player.getPosX(),player.getPosY(),spawning);
						if(spawning == true){
							world.setSpawn('O',player.posX,player.posY);
							spawning = false;
							break;
						}
					}
					else{
						break;
					}
				}
				world.setCanEnter(player.getPosX(),player.getPosY(),true);
			}

			else if(option == "east" || option == "right"){
				for(int i =0; i<dist;i++){
					if( world.canEnter(player.getPosX()+1, player.getPosY() ) ==false ){
						//increment X
						player.posX += 1;
						world.isPortal(player.getPosX(),player.getPosY(),spawning);
						if(spawning == true){
							world.setSpawn('O',player.posX,player.posY);
							spawning = false;
							break;
						}
					}
					else{
						break;
						}
				}
				world.setCanEnter(player.getPosX(),player.getPosY(),true);
			}

			else if(option == "south" || option == "down"){
				for(int i =0; i<dist;i++){
					if( world.canEnter(player.getPosX(), player.getPosY()-1 ) ==false ){
						//decrement Y
					player.posY -=1;
					world.isPortal(player.getPosX(),player.getPosY(),spawning);
						if(spawning == true){
							world.setSpawn('O',player.posX,player.posY);
							spawning = false;
							break;
						}
					}
					else{
						break;
						}
				}
				world.setCanEnter(player.getPosX(),player.getPosY(),true);
			}

			else if(option == "west" || option == "left"){
				for(int i =0; i<dist;i++){
					if( world.canEnter(player.getPosX()-1, player.getPosY() ) ==false ){
						//decrement X
						player.posX -=1;
						world.isPortal(player.getPosX(),player.getPosY(),spawning);
						if(spawning == true){
							world.setSpawn('O',player.posX,player.posY);
							spawning = false;
							break;
						}
					}
					else{
						break;
						return;
					}
				}
				world.setCanEnter(player.getPosX(),player.getPosY(),true);
			}
			cout<<world.getChartName()<<endl;
			world.displayRange(player.getPosX(),player.getPosY(),5);
			player.setCurrentWorld(world.getChartName());
			//cout<<"you are at:"<<player.getCurrentWorld();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1f0, %rsp            # imm = 0x1F0
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x3390
movq 0xe839(%rip), %rdi      # 0x18fd0
leaq 0x7e91(%rip), %rsi      # 0x1262f
callq 0x3280
jmp 0xa7a5
movq 0xe834(%rip), %rdi      # 0x18fe0
leaq -0x38(%rbp), %rsi
callq 0x3350
jmp 0xa7b7
movq 0xe812(%rip), %rdi      # 0x18fd0
leaq 0x7e76(%rip), %rsi      # 0x1263b
callq 0x3280
movq %rax, -0xa8(%rbp)
jmp 0xa7d3
movq -0xa8(%rbp), %rdi
movq 0xe7df(%rip), %rsi      # 0x18fc0
callq 0x32b0
jmp 0xa7e8
movq 0xe7f1(%rip), %rdi      # 0x18fe0
leaq -0x40(%rbp), %rsi
callq 0x31b0
jmp 0xa7fa
movq -0x18(%rbp), %rax
movq %rax, -0xb8(%rbp)
movq -0x10(%rbp), %rdi
callq 0x5260
movl %eax, -0xac(%rbp)
jmp 0xa816
movq -0x10(%rbp), %rdi
callq 0x5240
movl %eax, -0xbc(%rbp)
jmp 0xa827
movl -0xbc(%rbp), %edx
movl -0xac(%rbp), %esi
movq -0xb8(%rbp), %rdi
xorl %ecx, %ecx
callq 0xc6b0
jmp 0xa843
leaq 0x7dfc(%rip), %rsi      # 0x12646
leaq -0x38(%rbp), %rdi
callq 0x4880
movb %al, -0xbd(%rbp)
jmp 0xa85b
movb -0xbd(%rbp), %al
testb $0x1, %al
jne 0xa88e
jmp 0xa867
leaq 0x7dde(%rip), %rsi      # 0x1264c
leaq -0x38(%rbp), %rdi
callq 0x4880
movb %al, -0xbe(%rbp)
jmp 0xa87f
movb -0xbe(%rbp), %al
testb $0x1, %al
jne 0xa88e
jmp 0xaa03
movl $0x0, -0x50(%rbp)
movl -0x50(%rbp), %eax
cmpl -0x40(%rbp), %eax
jge 0xa9b2
movq -0x18(%rbp), %rax
movq %rax, -0xd0(%rbp)
movq -0x10(%rbp), %rdi
callq 0x5260
movl %eax, -0xc4(%rbp)
jmp 0xa8bd
movq -0x10(%rbp), %rdi
callq 0x5240
movl %eax, -0xd4(%rbp)
jmp 0xa8ce
movl -0xc4(%rbp), %esi
movq -0xd0(%rbp), %rdi
movl -0xd4(%rbp), %edx
incl %edx
callq 0xc5f0
movb %al, -0xd5(%rbp)
jmp 0xa8f0
movb -0xd5(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0xa9a0
movq -0x10(%rbp), %rax
movl 0x7c(%rax), %ecx
incl %ecx
movl %ecx, 0x7c(%rax)
movq -0x18(%rbp), %rax
movq %rax, -0xe8(%rbp)
movq -0x10(%rbp), %rdi
callq 0x5260
movl %eax, -0xdc(%rbp)
jmp 0xa92c
movq -0x10(%rbp), %rdi
callq 0x5240
movl %eax, -0xec(%rbp)
jmp 0xa93d
movl -0xec(%rbp), %edx
movl -0xdc(%rbp), %esi
movq -0xe8(%rbp), %rdi
leaq -0x39(%rbp), %rcx
callq 0xc920
jmp 0xa95b
movb -0x39(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x1, %eax
jne 0xa99e
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rcx
movq %rcx, %rdx
addq $0x78, %rdx
addq $0x7c, %rcx
movl $0x4f, %esi
callq 0xc760
jmp 0xa987
movb $0x0, -0x39(%rbp)
jmp 0xa9b2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xb03c
jmp 0xa9a2
jmp 0xa9b2
jmp 0xa9a4
movl -0x50(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x50(%rbp)
jmp 0xa895
movq -0x18(%rbp), %rax
movq %rax, -0xf8(%rbp)
movq -0x10(%rbp), %rdi
callq 0x5260
movl %eax, -0xf0(%rbp)
jmp 0xa9ce
movq -0x10(%rbp), %rdi
callq 0x5240
movl %eax, -0xfc(%rbp)
jmp 0xa9df
movl -0xfc(%rbp), %edx
movl -0xf0(%rbp), %esi
movq -0xf8(%rbp), %rdi
movl $0x1, %ecx
callq 0xc6b0
jmp 0xa9fe
jmp 0xaf2b
leaq 0x7c45(%rip), %rsi      # 0x1264f
leaq -0x38(%rbp), %rdi
callq 0x4880
movb %al, -0xfd(%rbp)
jmp 0xaa1b
movb -0xfd(%rbp), %al
testb $0x1, %al
jne 0xaa4e
jmp 0xaa27
leaq 0x7c26(%rip), %rsi      # 0x12654
leaq -0x38(%rbp), %rdi
callq 0x4880
movb %al, -0xfe(%rbp)
jmp 0xaa3f
movb -0xfe(%rbp), %al
testb $0x1, %al
jne 0xaa4e
jmp 0xabbe
movl $0x0, -0x54(%rbp)
movl -0x54(%rbp), %eax
cmpl -0x40(%rbp), %eax
jge 0xab6d
movq -0x18(%rbp), %rax
movq %rax, -0x110(%rbp)
movq -0x10(%rbp), %rdi
callq 0x5260
movl %eax, -0x104(%rbp)
jmp 0xaa7d
movl -0x104(%rbp), %eax
incl %eax
movl %eax, -0x118(%rbp)
movq -0x10(%rbp), %rdi
callq 0x5240
movl %eax, -0x114(%rbp)
jmp 0xaa9c
movl -0x114(%rbp), %edx
movl -0x118(%rbp), %esi
movq -0x110(%rbp), %rdi
callq 0xc5f0
movb %al, -0x119(%rbp)
jmp 0xaabc
movb -0x119(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0xab5b
movq -0x10(%rbp), %rax
movl 0x78(%rax), %ecx
incl %ecx
movl %ecx, 0x78(%rax)
movq -0x18(%rbp), %rax
movq %rax, -0x128(%rbp)
movq -0x10(%rbp), %rdi
callq 0x5260
movl %eax, -0x120(%rbp)
jmp 0xaaf8
movq -0x10(%rbp), %rdi
callq 0x5240
movl %eax, -0x12c(%rbp)
jmp 0xab09
movl -0x12c(%rbp), %edx
movl -0x120(%rbp), %esi
movq -0x128(%rbp), %rdi
leaq -0x39(%rbp), %rcx
callq 0xc920
jmp 0xab27
movb -0x39(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x1, %eax
jne 0xab59
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rcx
movq %rcx, %rdx
addq $0x78, %rdx
addq $0x7c, %rcx
movl $0x4f, %esi
callq 0xc760
jmp 0xab53
movb $0x0, -0x39(%rbp)
jmp 0xab6d
jmp 0xab5d
jmp 0xab6d
jmp 0xab5f
movl -0x54(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x54(%rbp)
jmp 0xaa55
movq -0x18(%rbp), %rax
movq %rax, -0x138(%rbp)
movq -0x10(%rbp), %rdi
callq 0x5260
movl %eax, -0x130(%rbp)
jmp 0xab89
movq -0x10(%rbp), %rdi
callq 0x5240
movl %eax, -0x13c(%rbp)
jmp 0xab9a
movl -0x13c(%rbp), %edx
movl -0x130(%rbp), %esi
movq -0x138(%rbp), %rdi
movl $0x1, %ecx
callq 0xc6b0
jmp 0xabb9
jmp 0xaf29
leaq 0x7a95(%rip), %rsi      # 0x1265a
leaq -0x38(%rbp), %rdi
callq 0x4880
movb %al, -0x13d(%rbp)
jmp 0xabd6
movb -0x13d(%rbp), %al
testb $0x1, %al
jne 0xac09
jmp 0xabe2
leaq 0x7a77(%rip), %rsi      # 0x12660
leaq -0x38(%rbp), %rdi
callq 0x4880
movb %al, -0x13e(%rbp)
jmp 0xabfa
movb -0x13e(%rbp), %al
testb $0x1, %al
jne 0xac09
jmp 0xad6d
movl $0x0, -0x58(%rbp)
movl -0x58(%rbp), %eax
cmpl -0x40(%rbp), %eax
jge 0xad1c
movq -0x18(%rbp), %rax
movq %rax, -0x150(%rbp)
movq -0x10(%rbp), %rdi
callq 0x5260
movl %eax, -0x144(%rbp)
jmp 0xac38
movq -0x10(%rbp), %rdi
callq 0x5240
movl %eax, -0x154(%rbp)
jmp 0xac49
movl -0x144(%rbp), %esi
movq -0x150(%rbp), %rdi
movl -0x154(%rbp), %edx
decl %edx
callq 0xc5f0
movb %al, -0x155(%rbp)
jmp 0xac6b
movb -0x155(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0xad0a
movq -0x10(%rbp), %rax
movl 0x7c(%rax), %ecx
decl %ecx
movl %ecx, 0x7c(%rax)
movq -0x18(%rbp), %rax
movq %rax, -0x168(%rbp)
movq -0x10(%rbp), %rdi
callq 0x5260
movl %eax, -0x15c(%rbp)
jmp 0xaca7
movq -0x10(%rbp), %rdi
callq 0x5240
movl %eax, -0x16c(%rbp)
jmp 0xacb8
movl -0x16c(%rbp), %edx
movl -0x15c(%rbp), %esi
movq -0x168(%rbp), %rdi
leaq -0x39(%rbp), %rcx
callq 0xc920
jmp 0xacd6
movb -0x39(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x1, %eax
jne 0xad08
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rcx
movq %rcx, %rdx
addq $0x78, %rdx
addq $0x7c, %rcx
movl $0x4f, %esi
callq 0xc760
jmp 0xad02
movb $0x0, -0x39(%rbp)
jmp 0xad1c
jmp 0xad0c
jmp 0xad1c
jmp 0xad0e
movl -0x58(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x58(%rbp)
jmp 0xac10
movq -0x18(%rbp), %rax
movq %rax, -0x178(%rbp)
movq -0x10(%rbp), %rdi
callq 0x5260
movl %eax, -0x170(%rbp)
jmp 0xad38
movq -0x10(%rbp), %rdi
callq 0x5240
movl %eax, -0x17c(%rbp)
jmp 0xad49
movl -0x17c(%rbp), %edx
movl -0x170(%rbp), %esi
movq -0x178(%rbp), %rdi
movl $0x1, %ecx
callq 0xc6b0
jmp 0xad68
jmp 0xaf27
leaq 0x78f1(%rip), %rsi      # 0x12665
leaq -0x38(%rbp), %rdi
callq 0x4880
movb %al, -0x17d(%rbp)
jmp 0xad85
movb -0x17d(%rbp), %al
testb $0x1, %al
jne 0xadb8
jmp 0xad91
leaq 0x78d2(%rip), %rsi      # 0x1266a
leaq -0x38(%rbp), %rdi
callq 0x4880
movb %al, -0x17e(%rbp)
jmp 0xada9
movb -0x17e(%rbp), %al
testb $0x1, %al
jne 0xadb8
jmp 0xaf25
movl $0x0, -0x5c(%rbp)
movl -0x5c(%rbp), %eax
cmpl -0x40(%rbp), %eax
jge 0xaed7
movq -0x18(%rbp), %rax
movq %rax, -0x190(%rbp)
movq -0x10(%rbp), %rdi
callq 0x5260
movl %eax, -0x184(%rbp)
jmp 0xade7
movl -0x184(%rbp), %eax
decl %eax
movl %eax, -0x198(%rbp)
movq -0x10(%rbp), %rdi
callq 0x5240
movl %eax, -0x194(%rbp)
jmp 0xae06
movl -0x194(%rbp), %edx
movl -0x198(%rbp), %esi
movq -0x190(%rbp), %rdi
callq 0xc5f0
movb %al, -0x199(%rbp)
jmp 0xae26
movb -0x199(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0xaec5
movq -0x10(%rbp), %rax
movl 0x78(%rax), %ecx
decl %ecx
movl %ecx, 0x78(%rax)
movq -0x18(%rbp), %rax
movq %rax, -0x1a8(%rbp)
movq -0x10(%rbp), %rdi
callq 0x5260
movl %eax, -0x1a0(%rbp)
jmp 0xae62
movq -0x10(%rbp), %rdi
callq 0x5240
movl %eax, -0x1ac(%rbp)
jmp 0xae73
movl -0x1ac(%rbp), %edx
movl -0x1a0(%rbp), %esi
movq -0x1a8(%rbp), %rdi
leaq -0x39(%rbp), %rcx
callq 0xc920
jmp 0xae91
movb -0x39(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x1, %eax
jne 0xaec3
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rcx
movq %rcx, %rdx
addq $0x78, %rdx
addq $0x7c, %rcx
movl $0x4f, %esi
callq 0xc760
jmp 0xaebd
movb $0x0, -0x39(%rbp)
jmp 0xaed7
jmp 0xaec7
jmp 0xaed7
jmp 0xaec9
movl -0x5c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x5c(%rbp)
jmp 0xadbf
movq -0x18(%rbp), %rax
movq %rax, -0x1b8(%rbp)
movq -0x10(%rbp), %rdi
callq 0x5260
movl %eax, -0x1b0(%rbp)
jmp 0xaef3
movq -0x10(%rbp), %rdi
callq 0x5240
movl %eax, -0x1bc(%rbp)
jmp 0xaf04
movl -0x1bc(%rbp), %edx
movl -0x1b0(%rbp), %esi
movq -0x1b8(%rbp), %rdi
movl $0x1, %ecx
callq 0xc6b0
jmp 0xaf23
jmp 0xaf25
jmp 0xaf27
jmp 0xaf29
jmp 0xaf2b
movq -0x18(%rbp), %rsi
leaq -0x80(%rbp), %rdi
callq 0xcb30
jmp 0xaf3a
movq 0xe08f(%rip), %rdi      # 0x18fd0
leaq -0x80(%rbp), %rsi
callq 0x3270
movq %rax, -0x1c8(%rbp)
jmp 0xaf53
movq -0x1c8(%rbp), %rdi
movq 0xe05f(%rip), %rsi      # 0x18fc0
callq 0x32b0
jmp 0xaf68
leaq -0x80(%rbp), %rdi
callq 0x31c0
movq -0x18(%rbp), %rax
movq %rax, -0x1d8(%rbp)
movq -0x10(%rbp), %rdi
callq 0x5260
movl %eax, -0x1cc(%rbp)
jmp 0xaf8d
movq -0x10(%rbp), %rdi
callq 0x5240
movl %eax, -0x1dc(%rbp)
jmp 0xaf9e
movl -0x1dc(%rbp), %edx
movl -0x1cc(%rbp), %esi
movq -0x1d8(%rbp), %rdi
movl $0x5, %ecx
callq 0xc1f0
jmp 0xafbd
movq -0x10(%rbp), %rax
movq %rax, -0x1e8(%rbp)
movq -0x18(%rbp), %rsi
leaq -0xa0(%rbp), %rdi
callq 0xcb30
jmp 0xafda
movq -0x1e8(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x52b0
jmp 0xafef
leaq -0xa0(%rbp), %rdi
callq 0x31c0
leaq -0x38(%rbp), %rdi
callq 0x31c0
addq $0x1f0, %rsp            # imm = 0x1F0
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x80(%rbp), %rdi
callq 0x31c0
jmp 0xb03c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0xa0(%rbp), %rdi
callq 0x31c0
leaq -0x38(%rbp), %rdi
callq 0x31c0
movq -0x48(%rbp), %rdi
callq 0x3440
nop