+ 1
Need help with Ruby hashes
Can anyone tell me why the linked code isn't working? What it's supposed to do is output to the screen: ### # # # For some reason, however, I can't make the hashes work right. And if you're asking why not just type that into a string, it's because I need to make it randomly do that, and have their exits marked so each path goes somewhere. https://code.sololearn.com/cW28x7VpTRA8/?ref=app
2 ответов
+ 14
Try putting commas after the } like this:
ways = {
allways: { left: True, right: True, up: True, down: True, image:"# #\n \n# #" },
hrzstrt: { left: True, right: True, up: False, down: False, image:"###\n \n###" },
vrtstrt: { left: False, right: False, up: True, down: True, image:"# #\n# #\n# #" },
ulfcrnr: { left: True, right: True, up: True, down: True, image:"###\n# \n# #" }
}
You might get a new error (that I don't know how to fix) but your old one should be gone xD
+ 1
first, change True by true and False by false
but there is an another bug