{"action":"created","issue":{"url":"https://api.github.com/repos/ASPP/pelita/issues/281","labels_url":"https://api.github.com/repos/ASPP/pelita/issues/281/labels{/name}","comments_url":"https://api.github.com/repos/ASPP/pelita/issues/281/comments","events_url":"https://api.github.com/repos/ASPP/pelita/issues/281/events","html_url":"https://github.com/ASPP/pelita/issues/281","id":79471182,"number":281,"title":"[discussion] Syntax: Food in maze[pos]","user":{"login":"Debilski","id":216179,"avatar_url":"https://avatars.githubusercontent.com/u/216179?v=3","gravatar_id":"","url":"https://api.github.com/users/Debilski","html_url":"https://github.com/Debilski","followers_url":"https://api.github.com/users/Debilski/followers","following_url":"https://api.github.com/users/Debilski/following{/other_user}","gists_url":"https://api.github.com/users/Debilski/gists{/gist_id}","starred_url":"https://api.github.com/users/Debilski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Debilski/subscriptions","organizations_url":"https://api.github.com/users/Debilski/orgs","repos_url":"https://api.github.com/users/Debilski/repos","events_url":"https://api.github.com/users/Debilski/events{/privacy}","received_events_url":"https://api.github.com/users/Debilski/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-05-22T14:15:11Z","updated_at":"2015-05-25T11:18:36Z","closed_at":null,"body":"Should we get rid of the syntax\r\n\r\n    Food in maze[pos]\r\n\r\nSince Python offers no first-class support for singleton symbols[*], we currently have `Food`, `Free`, and `Wall` defined as single-character strings and `maze[pos].__contains__` is overloaded to return a multi-character string. While the syntax looks quite nice, I do not really like its underlying representation. Additionally, since it is not possible to query\r\n\r\n     Bot(1) in maze[pos]\r\n\r\nit is unclear, if special casing the food (which does not even differentiate between enemy and own food) is really worth it.\r\n\r\nI don’t have the students’ repositories with me right now, so I cannot make any guesses how often this syntax has been used (in the tutors’ repo it is only used by Pietro and me in three lines altogether) but in many cases, I’d think the stateful helper methods on `Player` provide enough information for the neighbourhood already and for global scales, we’d probably resort to boolean matrices `maze.food[pos]`. (Exact procedure might vary depending on internal optimisations regarding the data structure.)\r\n\r\nIs there anyone who especially likes the old syntax?\r\n\r\n[*]: Alternatives would be classes, which are weird because they could be initialised (which would be senseless) or objects, which would not be singletons and we’d have to do instance checks."},"comment":{"url":"https://api.github.com/repos/ASPP/pelita/issues/comments/105213239","html_url":"https://github.com/ASPP/pelita/issues/281#issuecomment-105213239","issue_url":"https://api.github.com/repos/ASPP/pelita/issues/281","id":105213239,"user":{"login":"Debilski","id":216179,"avatar_url":"https://avatars.githubusercontent.com/u/216179?v=3","gravatar_id":"","url":"https://api.github.com/users/Debilski","html_url":"https://github.com/Debilski","followers_url":"https://api.github.com/users/Debilski/followers","following_url":"https://api.github.com/users/Debilski/following{/other_user}","gists_url":"https://api.github.com/users/Debilski/gists{/gist_id}","starred_url":"https://api.github.com/users/Debilski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Debilski/subscriptions","organizations_url":"https://api.github.com/users/Debilski/orgs","repos_url":"https://api.github.com/users/Debilski/repos","events_url":"https://api.github.com/users/Debilski/events{/privacy}","received_events_url":"https://api.github.com/users/Debilski/received_events","type":"User","site_admin":false},"created_at":"2015-05-25T11:18:36Z","updated_at":"2015-05-25T11:18:36Z","body":"Actually, I think most people go for the food helper methods on universe anyway. We could probably get rid of `maze.food` completely and have the maze only store the walls."}}