Advertisement
Guest User

Chess Square Color_Conditional statements

a guest
Apr 30th, 2019
686
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. const getGets = (arr) => {
  2. let index = 0;
  3.  
  4. return () => {
  5. const toReturn = arr[index];
  6. index += 1;
  7. return toReturn;
  8. };
  9. };
  10. // this is the test
  11.  
  12. const test = [
  13. 'a',
  14. 1,
  15. ];
  16.  
  17. const gets = this.gets || getGets(test);
  18. const print = this.print || console.log;
  19.  
  20. let label = gets();
  21. let rank = +gets();
  22.  
  23. if(label==='a' || label==='c'|| label==='e'|| label==='g')
  24. {
  25. if(rank % 10===0)
  26. {
  27. print('light');
  28. }
  29. else
  30. {
  31. print('dark');
  32. }
  33. }
  34. else if(label==='b'|| label==='d'|| label==='f'|| label==='h')
  35. {
  36. if(rank % 10===0)
  37. {
  38. print('dark')
  39. }
  40. else
  41. {
  42. print('light');
  43. }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement