ジャバスクリプト(ES6) 176 171 168 155 148 147の142 141バイト
//v8 - I was sure saving off math was saving a byte, thanks ETF
_=>_.split` `.map(m=>(I=m<'='?I-1||0:Math.min(i-1,I+1))+(i=m[2]=='<'?Math.max(I+1,i-1):i+1),i=1,I=0)&&'.'.repeat(I)+'I'+'.'.repeat(--i-I)+'i'
//v7 - not checking first char when I can check whole string - changed how I create end string (stolen from edc65)
_=>_.split` `.map(m=>(I=m<'='?I-1||0:M.min(i-1,I+1))+(i=m[2]=='<'?M.max(I+1,i-1):i+1),i=1,I=0,M=Math)&&'.'.repeat(I)+'I'+'.'.repeat(--i-I)+'i'
//v6 - one more byte
_=>_.split` `.map(m=>(I=m[0]=='<'?M(0,I-1):Math.min(i-1,I+1))+(i=m[2]=='<'?M(I+1,i-1):i+1),i=1,I=0,M=Math.max)+((a=Array(i))[I]='I')&&a.join`.`+'i'
//v5 - not filling array with '.', just joining with . later
_=>_.split` `.map(m=>(I=m[0]=='<'?M(0,I-1):Math.min(i-1,I+1))+(i=m[2]=='<'?M(I+1,i-1):i+1),i=1,I=0,M=Math.max)&&((a=Array(i))[I]='I')&&a.join`.`+'i'
//v4 - realized I didn't need to split >_> on _, just use the 0th and 2nd index
_=>_.split` `.map(m=>(I=m[0]=='<'?M(0,I-1):Math.min(i-1,I+1))+(i=m[2]=='<'?M(I+1,i-1):i+1),i=1,I=0,M=Math.max)&&((a=Array(i).fill`.`)[I]='I')&&a.join``+'i'
//v3 - saving Math to a var (thanks @Verzio)
_=>_.split` `.map(m=>(I=(m=m.split`_`)[0]=='<'?M(0,I-1):Math.min(i-1,I+1))+(i=m[1]=='<'?M(I+1,i-1):i+1),i=1,I=0,M=Math.max)&&((a=Array(i).fill`.`)[I]='I')&&a.join``+'i'
//v2 - as a single expression! (thanks @Downgoat)
_=>_.split` `.map(m=>(I=(m=m.split`_`)[0]=='<'?Math.max(0,I-1):Math.min(i-1,I+1))+(i=m[1]=='<'?Math.max(I+1,i-1):i+1),i=1,I=0)&&((a=Array(i).fill`.`)[I]='I')&&a.join``+'i'
//version 1
_=>{I=0;i=1;_.split` `.map(m=>(I=(m=m.split`_`)[0]=='<'?Math.max(0,I-1):Math.min(i-1,I+1))+(i=m[1]=='<'?Math.max(I+1,i-1):i+1));(a=Array(i).fill`.`)[I]='I';return a.join``+'i'}
使用法
f=_=>_.split` `.map(m=>(I=m<'='?I-1||0:Math.min(i-1,I+1))+(i=m[2]=='<'?Math.max(I+1,i-1):i+1),i=1,I=0)&&'.'.repeat(I)+'I'+'.'.repeat(--i-I)+'i'
f(">_> >_< >_> >_> >_> >_> >_> >_> <_> <_> <_<")
//"...I.....i"
Degolfed(v6、v7はそれほど変わりません)
//my solution has changed slightly, but not significantly enough to redo the below
_=> //take an input
_.split` ` //split to each command <_<
.map( //do something for each command (each command being called m)
m=>
(I= //set I to.... 'I will be the index of the letter I'
m[0]=='<'? //is the first char of the command '<'?
Math.max(0,I-1) //yes => move I to the left (but don't move past 0)
:
Math.min(i-1,I+1) //no => move I to the right one, but keep it one less than i
)
+ //also we need to mess with i
(i=
m[2]=='<'? //is the 3rd char of the command '<'?
Math.max(I+1,i-1) //yes => move i to the left, but keep it one right of I
:
i+1 //move i to the right (no bounds on how far right i can go)
)
,i=1,I=0 //set I to 0 and i to 1 initially
)
+ //this just lets us chain commands into one expression, not really adding
(
(a=Array(i))[I]='I') //create an array of length i (will be one shorter than we really need)
//set element I to 'I'
&& //last chained command, we know the array creation will be true
//so javascript will just output the next thing as the return for the function
a.join`.`+'i' //join the array with '.' (into a string) and append i
//i will always be the last element