Advertisement
Guest User

Untitled

a guest
Sep 17th, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. 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'];
  2.  
  3. const convert = () => {
  4. let t = []
  5. let tRow = []
  6. let alphI = 0;
  7. let relations = {}
  8. for(let i = 0; i < rows; i ++) {
  9. for(let j = 0; j <= alphabet.split(',').length; j++) {
  10. let accState = accepted.split(',').map(state => matrix.current[i][j].split(',').includes(state))
  11. if(!relations[matrix.current[i][j]]) {
  12. relations[matrix.current[i][j]] = alph[alphI]
  13. alphI++;
  14. }
  15. tRow.push(<td key={`${i}, ${j}`}>{`${(i === 0 && j === 0) ? '\u2192' : ''} ${(accState[0] && j === 0) ? '*' : ''} ${relations[matrix.current[i][j]]}`}</td>)
  16. }
  17. t.push(<tr key={`row${i}`}>{tRow}</tr>)
  18. tRow = []
  19. }
  20. setResult(t)
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement