diff --git a/LICENCE b/LICENCE index 94a9ed0..acd88d4 100644 --- a/LICENCE +++ b/LICENCE @@ -634,12 +634,12 @@ the "copyright" line and a pointer to where the full notice is found. Copyright (C) - This program is free software: you can redistribute it and/or modify + Terminal Worm is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + Terminal Worm is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. @@ -653,7 +653,7 @@ Also add information on how to contact you by electronic and paper mail. notice like this when it starts in an interactive mode: Copyright (C) - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + Terminal Worm comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. diff --git a/classes.py b/classes.py index 94ac767..f06ec5d 100644 --- a/classes.py +++ b/classes.py @@ -1,12 +1,12 @@ '''Terminal Worm: A remake of the classic Snake game Copyright (C) 2012, 2013 Yuri Pieters - This program is free software: you can redistribute it and/or modify + Terminal Worm is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + Terminal Worm is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. diff --git a/constants.py b/constants.py index e0ee0ad..dc0c22a 100644 --- a/constants.py +++ b/constants.py @@ -1,12 +1,12 @@ '''Terminal Worm: A remake of the classic Snake game Copyright (C) 2012, 2013 Yuri Pieters - This program is free software: you can redistribute it and/or modify + Terminal Worm is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + Terminal Worm is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. diff --git a/dialogue.py b/dialogue.py index 76a0908..4633e53 100644 --- a/dialogue.py +++ b/dialogue.py @@ -1,12 +1,12 @@ '''Terminal Worm: A remake of the classic Snake game Copyright (C) 2012, 2013 Yuri Pieters - This program is free software: you can redistribute it and/or modify + Terminal Worm is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + Terminal Worm is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. diff --git a/display_utils.py b/display_utils.py index 7c7f5f6..09a55e3 100644 --- a/display_utils.py +++ b/display_utils.py @@ -1,12 +1,12 @@ '''Terminal Worm: A remake of the classic Snake game Copyright (C) 2012, 2013 Yuri Pieters - This program is free software: you can redistribute it and/or modify + Terminal Worm is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + Terminal Worm is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. diff --git a/flow_control.py b/flow_control.py index b1091a2..85704f6 100644 --- a/flow_control.py +++ b/flow_control.py @@ -1,12 +1,12 @@ '''Terminal Worm: A remake of the classic Snake game Copyright (C) 2012, 2013 Yuri Pieters - This program is free software: you can redistribute it and/or modify + Terminal Worm is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + Terminal Worm is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. diff --git a/intro.py b/intro.py index e32e424..17b1c02 100644 --- a/intro.py +++ b/intro.py @@ -1,12 +1,12 @@ '''Terminal Worm: A remake of the classic Snake game Copyright (C) 2012, 2013 Yuri Pieters - This program is free software: you can redistribute it and/or modify + Terminal Worm is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + Terminal Worm is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. diff --git a/main.py b/main.py index 21b2294..3cdd32d 100644 --- a/main.py +++ b/main.py @@ -1,12 +1,12 @@ '''Terminal Worm: A remake of the classic Snake game Copyright (C) 2012, 2013 Yuri Pieters - This program is free software: you can redistribute it and/or modify + Terminal Worm is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + Terminal Worm is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. @@ -29,6 +29,17 @@ # NB: In curses, positions are 'y,x', instead of 'x,y' +def move_handling(char): + '''This function handles movement keys''' + if char == curses.KEY_LEFT or char == ord(CONTROL_KEYS[LEFT]): + return LEFT + elif char == curses.KEY_RIGHT or char == ord(CONTROL_KEYS[RIGHT]): + return RIGHT + elif char == curses.KEY_UP or char == ord(CONTROL_KEYS[UP]): + return UP + elif char == curses.KEY_DOWN or char == ord(CONTROL_KEYS[DOWN]): + return DOWN + def main(stdscreen): '''The main function. This is where things happen!''' @@ -61,21 +72,15 @@ def main(stdscreen): while True: # The game loop # Event handling char = window.getch() - if char == curses.KEY_LEFT or char == ord(CONTROL_KEYS[LEFT]): - direction = LEFT - elif char == curses.KEY_RIGHT or char == ord(CONTROL_KEYS[RIGHT]): - direction = RIGHT - elif char == curses.KEY_UP or char == ord(CONTROL_KEYS[UP]): - direction = UP - elif char == curses.KEY_DOWN or char == ord(CONTROL_KEYS[DOWN]): - direction = DOWN - elif char == ord('q'): - if flow_control.confirm_quit(window): - break - elif char == ord('p'): - flow_control.pause(window) - elif char == ord('?'): - misc_utils.help(window) + direction = move_handling(char) + if direction is not None: + if char == ord('q'): + if flow_control.confirm_quit(window): + break + elif char == ord('p'): + flow_control.pause(window) + elif char == ord('?'): + misc_utils.help(window) snake.move(direction) @@ -105,9 +110,9 @@ def main(stdscreen): bug.display_timer(stdscreen) if bug is not None: - # We chareck two separate times if bug is not None, + # We check two separate times if bug is not None, # because the first time has the possibility of - # charanging bugs value. + # changing bugs value. if snake.pos_list[0] == bug.pos: snake.extend() score += bug.timeout diff --git a/misc_utils.py b/misc_utils.py index 8443b91..090c01a 100644 --- a/misc_utils.py +++ b/misc_utils.py @@ -1,12 +1,12 @@ '''Terminal Worm: A remake of the classic Snake game Copyright (C) 2012, 2013 Yuri Pieters - This program is free software: you can redistribute it and/or modify + Terminal Worm is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + Terminal Worm is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.