Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const alph = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'];
- const convert = () => {
- let t = []
- let tRow = []
- let alphI = 0;
- let relations = {}
- for(let i = 0; i < rows; i ++) {
- for(let j = 0; j <= alphabet.split(',').length; j++) {
- let accState = accepted.split(',').map(state => matrix.current[i][j].split(',').includes(state))
- if(!relations[matrix.current[i][j]]) {
- relations[matrix.current[i][j]] = alph[alphI]
- alphI++;
- }
- tRow.push(<td key={`${i}, ${j}`}>{`${(i === 0 && j === 0) ? '\u2192' : ''} ${(accState[0] && j === 0) ? '*' : ''} ${relations[matrix.current[i][j]]}`}</td>)
- }
- t.push(<tr key={`row${i}`}>{tRow}</tr>)
- tRow = []
- }
- setResult(t)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement