Nimbin2git.christianimmanuel.de / Games / 2048_bash / autorun.sh

2048_bash git · main

git clone https://git.christianimmanuel.de/games/2048_bash.gitwget https://git.christianimmanuel.de/games/2048_bash/archive/2048_bash.tar.gz
autorun.sh 623 B · 35 lines raw
### autorun.sh

setSwipeDirection() {
	swipeWhile=true
	sCc=0
	while [ "$swipeWhile" = "true" ]; do
		sCc=$((sCc+1))
		maxRank=$(printf '%s\n' "${TRank[@]}" | sort -n | tail -$sCc | head -1)
		for setSwipeC in {0..3}; do
			if [[ ${TRank[$setSwipeC]} -eq $maxRank && ${swipeState[$setSwipeC]} ]]; then
				if ${swipeState[$setSwipeC]}; then
					directionX=$setSwipeC
					log "if1b: $setSwipeC, ${swipeState[*]}"
					swipeWhile=false
				fi
			fi
			
		done

		if [ $sCc -eq 4 ]; then
			testSwipe
			swipeWhile=false
		fi
	done
}



########
##MAIN##
runAutoMx() {
	getRank
	setSwipeDirection
	${swipeXf[$directionX]}
}