Advertisement
Triacontakai

goonstation prisoner's dilemma CU

Sep 20th, 2017
258
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.54 KB | None | 0 0
  1. CONTROL UNIT PRISONER'S DILEMMA AID
  2. PLAN:
  3. input 3 controls left room choice (0 is ally, 1 is betray)
  4. input 1 controls left room choicemade
  5. input 4 controls right room choice
  6. input 2 controls right room choicemade
  7.  
  8. inputs 1 and 2 are put into RAM 1 and 2 respectively
  9. once RAM 1 & 2 AND to 1, inputs 3 and 4 are checked
  10.  
  11. output 0 is activated when input 3 and 4 are both 0
  12. output 1 is activated when input 3 and 4 are both 1
  13. output 2 is activated when input 3 is 0 and input 4 is 1
  14. output 3 is activated when input 3 is 1 and input 4 is 0
  15. once an output is triggered, the RAM is reset and the unit should theoretically be reset
  16. --------------------------------------------------------------------------------------------------------------------------
  17. AND 0 ;reset RR (set to 0)
  18. IEN 0 ;enable input
  19. OEN 0 ;enable output
  20.  
  21. \\NOP
  22. \\NOP
  23. \\NOP ;placeholder for JMP
  24. \\NOP ;nvm not needed
  25.  
  26. LD 1 ;load left room selection into RR
  27. SKZ
  28. STO 8 ;store into RAM 1 if left choicemade = 1
  29. LD 2 ;load right room choicemade into RR
  30. SKZ
  31. STO 9 ;store into RAM 2 if right choicemade = 1
  32. LD 9 ;load in case room 2 make choice before room 1
  33. AND 8 ;logical AND with RR and RAM 1
  34. LD 0 ;find inverse of the previous AND for next step
  35. SKZ
  36. JMP 4 ;if the AND returns 1, it is converted to 0 and skips past this step
  37.  
  38. LD 3 ;load left room choice into RR
  39. STO A ;store left room choice into RAM 3
  40. LD 4 ;load right room choice into RR
  41. STO B :store right room choice into RAM 4
  42.  
  43. AND A ;RR is 1 if both rooms chose betray
  44. SKZ
  45. STO 1 ;output signal 1:1
  46.  
  47. LD B ;load right room choice into RR
  48. LD 0 ;invert RR
  49. ANDC A;logical AND of inverse left room choice and inverse right room choice :: RR is 1 if both rooms choose ally
  50. SKZ
  51. STO 0 ;output signal 0:1
  52.  
  53. LD B ;load right room choice into RR
  54. LD 0 ;invert RR
  55. AND A ;logical AND of inverse right room choice and left room choice :: RR is 1 if right room chooses ally and left room chooses betray
  56. SKZ
  57. STO 3 ;output signal 3:1
  58.  
  59. LD B ;load right room choice into RR
  60. ANDC A;logical AND of right room choice and inverse left room choice :: RR is 1 if right room chooses betray and left room chooses ally
  61. SKZ
  62. STO 2 ;output signal 2:1
  63.  
  64. AND 0
  65. STO 8
  66. STO 9
  67. STO A
  68. STO B ;CLEAR ALL RAM AFTER GAME OVER
  69. ------------------------------------------------------------------------------------------------------------------------
  70. COMPILED CODE: 30A0B011E08812E089193810E0C4138A148B3AE0811B104AE0801B103AE0831B4AE0823088898A8B
  71.  
  72. WARNING: CODE IS LONGER THAN 64 CHARACTERS AAAAAAAAAAAA
  73. TODO: fix goon2016 release to support this lol
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement