├── .flake8 ├── .gitignore ├── DF - Python.mm ├── LICENSE ├── README.md ├── cursor.cfg ├── cursor.py ├── data ├── channel.png ├── channelx32.png ├── clear.png ├── clearx32.png ├── crumbledwall.png ├── crumbledwallx32.png ├── cursor.png ├── cursorx32.png ├── dig.png ├── digx32.png ├── dorf.png ├── dorfx32.png ├── downramp.png ├── downrampx32.png ├── dump.png ├── dumpx32.png ├── end.png ├── grass.png ├── grass2.png ├── grass2x32.png ├── grass3.png ├── grass3x32.png ├── grass4.png ├── grass4x32.png ├── grassx32.png ├── logx32.png ├── magmax32.png ├── rockx32.png ├── selected.png ├── selectedx32.png ├── start.png ├── swordx32.png ├── treex32.png ├── upramp.png ├── uprampx32.png ├── wall.png ├── wall1x32.png ├── wall2x32.png └── waterx32.png ├── engine.py ├── ezmenu.py ├── gamemap.cfg ├── gamemap.py ├── intro.py ├── item.cfg ├── item.py ├── job.py ├── loader.py ├── main.cfg ├── main.py ├── maptile.py ├── mob.cfg ├── mob.py ├── noise.py ├── pathfinder.py ├── poetry.lock ├── priorityqueueset.py ├── pylintrc ├── pyproject.toml ├── room.py └── selected.py /.flake8: -------------------------------------------------------------------------------- 1 | [flake8] 2 | ignore = E501, W503 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | __pycache__ 3 | 3.8 4 | 2.7 5 | map.dat 6 | -------------------------------------------------------------------------------- /DF - Python.mm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | License 2 | 3 | THE WORK (AS DEFINED BELOW) IS PROVIDED UNDER THE TERMS OF THIS CREATIVE COMMONS PUBLIC LICENSE ("CCPL" OR "LICENSE"). THE WORK IS PROTECTED BY COPYRIGHT AND/OR OTHER APPLICABLE LAW. ANY USE OF THE WORK OTHER THAN AS AUTHORIZED UNDER THIS LICENSE OR COPYRIGHT LAW IS PROHIBITED. 4 | 5 | BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED HERE, YOU ACCEPT AND AGREE TO BE BOUND BY THE TERMS OF THIS LICENSE. TO THE EXTENT THIS LICENSE MAY BE CONSIDERED TO BE A CONTRACT, THE LICENSOR GRANTS YOU THE RIGHTS CONTAINED HERE IN CONSIDERATION OF YOUR ACCEPTANCE OF SUCH TERMS AND CONDITIONS. 6 | 7 | 1. Definitions 8 | 9 | "Adaptation" means a work based upon the Work, or upon the Work and other pre-existing works, such as a translation, adaptation, derivative work, arrangement of music or other alterations of a literary or artistic work, or phonogram or performance and includes cinematographic adaptations or any other form in which the Work may be recast, transformed, or adapted including in any form recognizably derived from the original, except that a work that constitutes a Collection will not be considered an Adaptation for the purpose of this License. For the avoidance of doubt, where the Work is a musical work, performance or phonogram, the synchronization of the Work in timed-relation with a moving image ("synching") will be considered an Adaptation for the purpose of this License. 10 | "Collection" means a collection of literary or artistic works, such as encyclopedias and anthologies, or performances, phonograms or broadcasts, or other works or subject matter other than works listed in Section 1(g) below, which, by reason of the selection and arrangement of their contents, constitute intellectual creations, in which the Work is included in its entirety in unmodified form along with one or more other contributions, each constituting separate and independent works in themselves, which together are assembled into a collective whole. A work that constitutes a Collection will not be considered an Adaptation (as defined above) for the purposes of this License. 11 | "Distribute" means to make available to the public the original and copies of the Work or Adaptation, as appropriate, through sale or other transfer of ownership. 12 | "License Elements" means the following high-level license attributes as selected by Licensor and indicated in the title of this License: Attribution, Noncommercial, ShareAlike. 13 | "Licensor" means the individual, individuals, entity or entities that offer(s) the Work under the terms of this License. 14 | "Original Author" means, in the case of a literary or artistic work, the individual, individuals, entity or entities who created the Work or if no individual or entity can be identified, the publisher; and in addition (i) in the case of a performance the actors, singers, musicians, dancers, and other persons who act, sing, deliver, declaim, play in, interpret or otherwise perform literary or artistic works or expressions of folklore; (ii) in the case of a phonogram the producer being the person or legal entity who first fixes the sounds of a performance or other sounds; and, (iii) in the case of broadcasts, the organization that transmits the broadcast. 15 | "Work" means the literary and/or artistic work offered under the terms of this License including without limitation any production in the literary, scientific and artistic domain, whatever may be the mode or form of its expression including digital form, such as a book, pamphlet and other writing; a lecture, address, sermon or other work of the same nature; a dramatic or dramatico-musical work; a choreographic work or entertainment in dumb show; a musical composition with or without words; a cinematographic work to which are assimilated works expressed by a process analogous to cinematography; a work of drawing, painting, architecture, sculpture, engraving or lithography; a photographic work to which are assimilated works expressed by a process analogous to photography; a work of applied art; an illustration, map, plan, sketch or three-dimensional work relative to geography, topography, architecture or science; a performance; a broadcast; a phonogram; a compilation of data to the extent it is protected as a copyrightable work; or a work performed by a variety or circus performer to the extent it is not otherwise considered a literary or artistic work. 16 | "You" means an individual or entity exercising rights under this License who has not previously violated the terms of this License with respect to the Work, or who has received express permission from the Licensor to exercise rights under this License despite a previous violation. 17 | "Publicly Perform" means to perform public recitations of the Work and to communicate to the public those public recitations, by any means or process, including by wire or wireless means or public digital performances; to make available to the public Works in such a way that members of the public may access these Works from a place and at a place individually chosen by them; to perform the Work to the public by any means or process and the communication to the public of the performances of the Work, including by public digital performance; to broadcast and rebroadcast the Work by any means including signs, sounds or images. 18 | "Reproduce" means to make copies of the Work by any means including without limitation by sound or visual recordings and the right of fixation and reproducing fixations of the Work, including storage of a protected performance or phonogram in digital form or other electronic medium. 19 | 20 | 2. Fair Dealing Rights. Nothing in this License is intended to reduce, limit, or restrict any uses free from copyright or rights arising from limitations or exceptions that are provided for in connection with the copyright protection under copyright law or other applicable laws. 21 | 22 | 3. License Grant. Subject to the terms and conditions of this License, Licensor hereby grants You a worldwide, royalty-free, non-exclusive, perpetual (for the duration of the applicable copyright) license to exercise the rights in the Work as stated below: 23 | 24 | to Reproduce the Work, to incorporate the Work into one or more Collections, and to Reproduce the Work as incorporated in the Collections; 25 | to create and Reproduce Adaptations provided that any such Adaptation, including any translation in any medium, takes reasonable steps to clearly label, demarcate or otherwise identify that changes were made to the original Work. For example, a translation could be marked "The original work was translated from English to Spanish," or a modification could indicate "The original work has been modified."; 26 | to Distribute and Publicly Perform the Work including as incorporated in Collections; and, 27 | to Distribute and Publicly Perform Adaptations. 28 | 29 | The above rights may be exercised in all media and formats whether now known or hereafter devised. The above rights include the right to make such modifications as are technically necessary to exercise the rights in other media and formats. Subject to Section 8(f), all rights not expressly granted by Licensor are hereby reserved, including but not limited to the rights described in Section 4(e). 30 | 31 | 4. Restrictions. The license granted in Section 3 above is expressly made subject to and limited by the following restrictions: 32 | 33 | You may Distribute or Publicly Perform the Work only under the terms of this License. You must include a copy of, or the Uniform Resource Identifier (URI) for, this License with every copy of the Work You Distribute or Publicly Perform. You may not offer or impose any terms on the Work that restrict the terms of this License or the ability of the recipient of the Work to exercise the rights granted to that recipient under the terms of the License. You may not sublicense the Work. You must keep intact all notices that refer to this License and to the disclaimer of warranties with every copy of the Work You Distribute or Publicly Perform. When You Distribute or Publicly Perform the Work, You may not impose any effective technological measures on the Work that restrict the ability of a recipient of the Work from You to exercise the rights granted to that recipient under the terms of the License. This Section 4(a) applies to the Work as incorporated in a Collection, but this does not require the Collection apart from the Work itself to be made subject to the terms of this License. If You create a Collection, upon notice from any Licensor You must, to the extent practicable, remove from the Collection any credit as required by Section 4(d), as requested. If You create an Adaptation, upon notice from any Licensor You must, to the extent practicable, remove from the Adaptation any credit as required by Section 4(d), as requested. 34 | You may Distribute or Publicly Perform an Adaptation only under: (i) the terms of this License; (ii) a later version of this License with the same License Elements as this License; (iii) a Creative Commons jurisdiction license (either this or a later license version) that contains the same License Elements as this License (e.g., Attribution-NonCommercial-ShareAlike 3.0 US) ("Applicable License"). You must include a copy of, or the URI, for Applicable License with every copy of each Adaptation You Distribute or Publicly Perform. You may not offer or impose any terms on the Adaptation that restrict the terms of the Applicable License or the ability of the recipient of the Adaptation to exercise the rights granted to that recipient under the terms of the Applicable License. You must keep intact all notices that refer to the Applicable License and to the disclaimer of warranties with every copy of the Work as included in the Adaptation You Distribute or Publicly Perform. When You Distribute or Publicly Perform the Adaptation, You may not impose any effective technological measures on the Adaptation that restrict the ability of a recipient of the Adaptation from You to exercise the rights granted to that recipient under the terms of the Applicable License. This Section 4(b) applies to the Adaptation as incorporated in a Collection, but this does not require the Collection apart from the Adaptation itself to be made subject to the terms of the Applicable License. 35 | You may not exercise any of the rights granted to You in Section 3 above in any manner that is primarily intended for or directed toward commercial advantage or private monetary compensation. The exchange of the Work for other copyrighted works by means of digital file-sharing or otherwise shall not be considered to be intended for or directed toward commercial advantage or private monetary compensation, provided there is no payment of any monetary compensation in con-nection with the exchange of copyrighted works. 36 | If You Distribute, or Publicly Perform the Work or any Adaptations or Collections, You must, unless a request has been made pursuant to Section 4(a), keep intact all copyright notices for the Work and provide, reasonable to the medium or means You are utilizing: (i) the name of the Original Author (or pseudonym, if applicable) if supplied, and/or if the Original Author and/or Licensor designate another party or parties (e.g., a sponsor institute, publishing entity, journal) for attribution ("Attribution Parties") in Licensor's copyright notice, terms of service or by other reasonable means, the name of such party or parties; (ii) the title of the Work if supplied; (iii) to the extent reasonably practicable, the URI, if any, that Licensor specifies to be associated with the Work, unless such URI does not refer to the copyright notice or licensing information for the Work; and, (iv) consistent with Section 3(b), in the case of an Adaptation, a credit identifying the use of the Work in the Adaptation (e.g., "French translation of the Work by Original Author," or "Screenplay based on original Work by Original Author"). The credit required by this Section 4(d) may be implemented in any reasonable manner; provided, however, that in the case of a Adaptation or Collection, at a minimum such credit will appear, if a credit for all contributing authors of the Adaptation or Collection appears, then as part of these credits and in a manner at least as prominent as the credits for the other contributing authors. For the avoidance of doubt, You may only use the credit required by this Section for the purpose of attribution in the manner set out above and, by exercising Your rights under this License, You may not implicitly or explicitly assert or imply any connection with, sponsorship or endorsement by the Original Author, Licensor and/or Attribution Parties, as appropriate, of You or Your use of the Work, without the separate, express prior written permission of the Original Author, Licensor and/or Attribution Parties. 37 | 38 | For the avoidance of doubt: 39 | Non-waivable Compulsory License Schemes. In those jurisdictions in which the right to collect royalties through any statutory or compulsory licensing scheme cannot be waived, the Licensor reserves the exclusive right to collect such royalties for any exercise by You of the rights granted under this License; 40 | Waivable Compulsory License Schemes. In those jurisdictions in which the right to collect royalties through any statutory or compulsory licensing scheme can be waived, the Licensor reserves the exclusive right to collect such royalties for any exercise by You of the rights granted under this License if Your exercise of such rights is for a purpose or use which is otherwise than noncommercial as permitted under Section 4(c) and otherwise waives the right to collect royalties through any statutory or compulsory licensing scheme; and, 41 | Voluntary License Schemes. The Licensor reserves the right to collect royalties, whether individually or, in the event that the Licensor is a member of a collecting society that administers voluntary licensing schemes, via that society, from any exercise by You of the rights granted under this License that is for a purpose or use which is otherwise than noncommercial as permitted under Section 4(c). 42 | Except as otherwise agreed in writing by the Licensor or as may be otherwise permitted by applicable law, if You Reproduce, Distribute or Publicly Perform the Work either by itself or as part of any Adaptations or Collections, You must not distort, mutilate, modify or take other derogatory action in relation to the Work which would be prejudicial to the Original Author's honor or reputation. Licensor agrees that in those jurisdictions (e.g. Japan), in which any exercise of the right granted in Section 3(b) of this License (the right to make Adaptations) would be deemed to be a distortion, mutilation, modification or other derogatory action prejudicial to the Original Author's honor and reputation, the Licensor will waive or not assert, as appropriate, this Section, to the fullest extent permitted by the applicable national law, to enable You to reasonably exercise Your right under Section 3(b) of this License (right to make Adaptations) but not otherwise. 43 | 44 | 5. Representations, Warranties and Disclaimer 45 | 46 | UNLESS OTHERWISE MUTUALLY AGREED TO BY THE PARTIES IN WRITING AND TO THE FULLEST EXTENT PERMITTED BY APPLICABLE LAW, LICENSOR OFFERS THE WORK AS-IS AND MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND CONCERNING THE WORK, EXPRESS, IMPLIED, STATUTORY OR OTHERWISE, INCLUDING, WITHOUT LIMITATION, WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR THE ABSENCE OF LATENT OR OTHER DEFECTS, ACCURACY, OR THE PRESENCE OF ABSENCE OF ERRORS, WHETHER OR NOT DISCOVERABLE. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OF IMPLIED WARRANTIES, SO THIS EXCLUSION MAY NOT APPLY TO YOU. 47 | 48 | 6. Limitation on Liability. EXCEPT TO THE EXTENT REQUIRED BY APPLICABLE LAW, IN NO EVENT WILL LICENSOR BE LIABLE TO YOU ON ANY LEGAL THEORY FOR ANY SPECIAL, INCIDENTAL, CONSEQUENTIAL, PUNITIVE OR EXEMPLARY DAMAGES ARISING OUT OF THIS LICENSE OR THE USE OF THE WORK, EVEN IF LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 49 | 50 | 7. Termination 51 | 52 | This License and the rights granted hereunder will terminate automatically upon any breach by You of the terms of this License. Individuals or entities who have received Adaptations or Collections from You under this License, however, will not have their licenses terminated provided such individuals or entities remain in full compliance with those licenses. Sections 1, 2, 5, 6, 7, and 8 will survive any termination of this License. 53 | Subject to the above terms and conditions, the license granted here is perpetual (for the duration of the applicable copyright in the Work). Notwithstanding the above, Licensor reserves the right to release the Work under different license terms or to stop distributing the Work at any time; provided, however that any such election will not serve to withdraw this License (or any other license that has been, or is required to be, granted under the terms of this License), and this License will continue in full force and effect unless terminated as stated above. 54 | 55 | 8. Miscellaneous 56 | 57 | Each time You Distribute or Publicly Perform the Work or a Collection, the Licensor offers to the recipient a license to the Work on the same terms and conditions as the license granted to You under this License. 58 | Each time You Distribute or Publicly Perform an Adaptation, Licensor offers to the recipient a license to the original Work on the same terms and conditions as the license granted to You under this License. 59 | If any provision of this License is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this License, and without further action by the parties to this agreement, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable. 60 | No term or provision of this License shall be deemed waived and no breach consented to unless such waiver or consent shall be in writing and signed by the party to be charged with such waiver or consent. 61 | This License constitutes the entire agreement between the parties with respect to the Work licensed here. There are no understandings, agreements or representations with respect to the Work not specified here. Licensor shall not be bound by any additional provisions that may appear in any communication from You. This License may not be modified without the mutual written agreement of the Licensor and You. 62 | The rights granted under, and the subject matter referenced, in this License were drafted utilizing the terminology of the Berne Convention for the Protection of Literary and Artistic Works (as amended on September 28, 1979), the Rome Convention of 1961, the WIPO Copyright Treaty of 1996, the WIPO Performances and Phonograms Treaty of 1996 and the Universal Copyright Convention (as revised on July 24, 1971). These rights and subject matter take effect in the relevant jurisdiction in which the License terms are sought to be enforced according to the corresponding provisions of the implementation of those treaty provisions in the applicable national law. If the standard suite of rights granted under applicable copyright law includes additional rights not granted under this License, such additional rights are deemed to be included in the License; this License is not intended to restrict the license of any rights under applicable law. 63 | 64 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # pyDF 2 | 3 | pyDF is a python dwarf fortress clone written in python / pygame. 4 | 5 | # Screenshot 6 | 7 | ![pyDF](https://raw.githubusercontent.com/wiki/mcgillij/pyDF/images/screenshot6.png) 8 | 9 | License: http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode 10 | 11 | And the default license for any of the libs that are used applies to their code. 12 | -------------------------------------------------------------------------------- /cursor.cfg: -------------------------------------------------------------------------------- 1 | [cursor] 2 | imagename16=cursor.png 3 | imagename32=cursorx32.png 4 | -------------------------------------------------------------------------------- /cursor.py: -------------------------------------------------------------------------------- 1 | """ Cursor class """ 2 | try: 3 | from loader import load_png 4 | import configparser 5 | except ImportError as err: 6 | print("couldn't load module. %s" % (err)) 7 | import sys 8 | 9 | sys.exit(2) 10 | 11 | 12 | class Cursor: 13 | """ Cursor class, generic class for a Cursor """ 14 | 15 | def __init__(self, tw, x, y): 16 | self.tw = tw 17 | self.position = [x, y] 18 | self.mapx = 0 19 | self.mapy = 0 20 | config = configparser.ConfigParser() 21 | config.read_file(open("cursor.cfg")) 22 | sectionname = "imagename" + str(tw) 23 | imagename = config.get("cursor", sectionname) 24 | self.image, self.rect = load_png(imagename) 25 | -------------------------------------------------------------------------------- /data/channel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcgillij/pyDF/d63f182db891d9879fb335f1d8e84fc202849dc5/data/channel.png -------------------------------------------------------------------------------- /data/channelx32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcgillij/pyDF/d63f182db891d9879fb335f1d8e84fc202849dc5/data/channelx32.png -------------------------------------------------------------------------------- /data/clear.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcgillij/pyDF/d63f182db891d9879fb335f1d8e84fc202849dc5/data/clear.png -------------------------------------------------------------------------------- /data/clearx32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcgillij/pyDF/d63f182db891d9879fb335f1d8e84fc202849dc5/data/clearx32.png -------------------------------------------------------------------------------- /data/crumbledwall.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcgillij/pyDF/d63f182db891d9879fb335f1d8e84fc202849dc5/data/crumbledwall.png -------------------------------------------------------------------------------- /data/crumbledwallx32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcgillij/pyDF/d63f182db891d9879fb335f1d8e84fc202849dc5/data/crumbledwallx32.png -------------------------------------------------------------------------------- /data/cursor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcgillij/pyDF/d63f182db891d9879fb335f1d8e84fc202849dc5/data/cursor.png -------------------------------------------------------------------------------- /data/cursorx32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcgillij/pyDF/d63f182db891d9879fb335f1d8e84fc202849dc5/data/cursorx32.png -------------------------------------------------------------------------------- /data/dig.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcgillij/pyDF/d63f182db891d9879fb335f1d8e84fc202849dc5/data/dig.png -------------------------------------------------------------------------------- /data/digx32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcgillij/pyDF/d63f182db891d9879fb335f1d8e84fc202849dc5/data/digx32.png -------------------------------------------------------------------------------- /data/dorf.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcgillij/pyDF/d63f182db891d9879fb335f1d8e84fc202849dc5/data/dorf.png -------------------------------------------------------------------------------- /data/dorfx32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcgillij/pyDF/d63f182db891d9879fb335f1d8e84fc202849dc5/data/dorfx32.png -------------------------------------------------------------------------------- /data/downramp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcgillij/pyDF/d63f182db891d9879fb335f1d8e84fc202849dc5/data/downramp.png -------------------------------------------------------------------------------- /data/downrampx32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcgillij/pyDF/d63f182db891d9879fb335f1d8e84fc202849dc5/data/downrampx32.png -------------------------------------------------------------------------------- /data/dump.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcgillij/pyDF/d63f182db891d9879fb335f1d8e84fc202849dc5/data/dump.png -------------------------------------------------------------------------------- /data/dumpx32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcgillij/pyDF/d63f182db891d9879fb335f1d8e84fc202849dc5/data/dumpx32.png -------------------------------------------------------------------------------- /data/end.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcgillij/pyDF/d63f182db891d9879fb335f1d8e84fc202849dc5/data/end.png -------------------------------------------------------------------------------- /data/grass.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcgillij/pyDF/d63f182db891d9879fb335f1d8e84fc202849dc5/data/grass.png -------------------------------------------------------------------------------- /data/grass2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcgillij/pyDF/d63f182db891d9879fb335f1d8e84fc202849dc5/data/grass2.png -------------------------------------------------------------------------------- /data/grass2x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcgillij/pyDF/d63f182db891d9879fb335f1d8e84fc202849dc5/data/grass2x32.png -------------------------------------------------------------------------------- /data/grass3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcgillij/pyDF/d63f182db891d9879fb335f1d8e84fc202849dc5/data/grass3.png -------------------------------------------------------------------------------- /data/grass3x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcgillij/pyDF/d63f182db891d9879fb335f1d8e84fc202849dc5/data/grass3x32.png -------------------------------------------------------------------------------- /data/grass4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcgillij/pyDF/d63f182db891d9879fb335f1d8e84fc202849dc5/data/grass4.png -------------------------------------------------------------------------------- /data/grass4x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcgillij/pyDF/d63f182db891d9879fb335f1d8e84fc202849dc5/data/grass4x32.png -------------------------------------------------------------------------------- /data/grassx32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcgillij/pyDF/d63f182db891d9879fb335f1d8e84fc202849dc5/data/grassx32.png -------------------------------------------------------------------------------- /data/logx32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcgillij/pyDF/d63f182db891d9879fb335f1d8e84fc202849dc5/data/logx32.png -------------------------------------------------------------------------------- /data/magmax32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcgillij/pyDF/d63f182db891d9879fb335f1d8e84fc202849dc5/data/magmax32.png -------------------------------------------------------------------------------- /data/rockx32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcgillij/pyDF/d63f182db891d9879fb335f1d8e84fc202849dc5/data/rockx32.png -------------------------------------------------------------------------------- /data/selected.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcgillij/pyDF/d63f182db891d9879fb335f1d8e84fc202849dc5/data/selected.png -------------------------------------------------------------------------------- /data/selectedx32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcgillij/pyDF/d63f182db891d9879fb335f1d8e84fc202849dc5/data/selectedx32.png -------------------------------------------------------------------------------- /data/start.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcgillij/pyDF/d63f182db891d9879fb335f1d8e84fc202849dc5/data/start.png -------------------------------------------------------------------------------- /data/swordx32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcgillij/pyDF/d63f182db891d9879fb335f1d8e84fc202849dc5/data/swordx32.png -------------------------------------------------------------------------------- /data/treex32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcgillij/pyDF/d63f182db891d9879fb335f1d8e84fc202849dc5/data/treex32.png -------------------------------------------------------------------------------- /data/upramp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcgillij/pyDF/d63f182db891d9879fb335f1d8e84fc202849dc5/data/upramp.png -------------------------------------------------------------------------------- /data/uprampx32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcgillij/pyDF/d63f182db891d9879fb335f1d8e84fc202849dc5/data/uprampx32.png -------------------------------------------------------------------------------- /data/wall.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcgillij/pyDF/d63f182db891d9879fb335f1d8e84fc202849dc5/data/wall.png -------------------------------------------------------------------------------- /data/wall1x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcgillij/pyDF/d63f182db891d9879fb335f1d8e84fc202849dc5/data/wall1x32.png -------------------------------------------------------------------------------- /data/wall2x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcgillij/pyDF/d63f182db891d9879fb335f1d8e84fc202849dc5/data/wall2x32.png -------------------------------------------------------------------------------- /data/waterx32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcgillij/pyDF/d63f182db891d9879fb335f1d8e84fc202849dc5/data/waterx32.png -------------------------------------------------------------------------------- /engine.py: -------------------------------------------------------------------------------- 1 | """ Main Engine module """ 2 | # noqa: E501 3 | import sys 4 | try: 5 | import pygame 6 | import pygame.locals 7 | 8 | # from time import time 9 | import mob 10 | import gamemap 11 | from job import Job 12 | import math 13 | import configparser 14 | import cursor 15 | import ezmenu 16 | from pathfinder import PathFinder 17 | from intro import Intro 18 | except ImportError as err: 19 | print("couldn't load module, %s" % (err)) 20 | sys.exit(2) 21 | 22 | 23 | class Engine: 24 | """ Main Engine class """ 25 | 26 | def __init__(self): 27 | self.running = True # set the game loop good to go 28 | config = configparser.ConfigParser() 29 | config.read_file(open("main.cfg")) 30 | self.fsw = config.getint("main", "fullscreenwidth") 31 | self.fsh = config.getint("main", "fullscreenheight") 32 | self.ww = config.getint("main", "windowedwidth") 33 | self.wh = config.getint("main", "windowedheight") 34 | self.tw = config.getint("main", "tilewidth") 35 | self.mapw = config.getint("main", "mapwidth") 36 | self.maph = config.getint("main", "mapheight") 37 | self.fullscreen = config.getboolean("main", "fullscreen") 38 | self.paused = False 39 | self.white = (255, 255, 255) # the colour :) 40 | 41 | # fullscreen = False 42 | self.FPS = 60 43 | pygame.init() 44 | # setup the default screen size 45 | if self.fullscreen: 46 | self.screen = pygame.display.set_mode( 47 | (self.fsw, self.fsh), pygame.FULLSCREEN 48 | ) 49 | else: 50 | self.screen = pygame.display.set_mode((self.ww, self.wh), pygame.RESIZABLE) 51 | 52 | pygame.display.set_caption("pyDF") 53 | # Intro's on by default, will need to add a config file entry for this. 54 | self.intro = True 55 | self.mainclock = pygame.time.Clock() 56 | # various rendering offsets 57 | self.vpRenderOffset = (self.tw, self.tw) 58 | self.statsOffset = (math.floor(int(0.8 * self.ww) + 2 * self.tw), self.tw) 59 | self.menuOffset = (math.floor(int(0.8 * self.ww) + 2 * self.tw), 4 * self.tw) 60 | self.menuOffset2 = (math.floor(int(0.8 * self.ww) + 2 * self.tw), 5 * self.tw) 61 | self.menuOffset3 = ( 62 | math.floor(int(0.8 * self.ww) + 2 * self.tw), 63 | 6 * self.tw, 64 | ) # testing for ezmenu 65 | self.idleOffset = ( 66 | math.floor(int(0.8 * self.ww) + 2 * self.tw), 67 | 0, 68 | ) # testing for ezmenu 69 | self.pauseDisplayOffset = (self.tw, 0) 70 | self.digTypeOffset = (math.floor(int(0.8 * self.ww) + 2 * self.tw), 4 * self.tw) 71 | self.showmenu = False 72 | self.currentmenu = None 73 | self.vpCoordinate = [0, 0] # Starting coordinates for the view port 74 | self.vpDimensions = ( 75 | math.floor(int(0.8 * self.ww) / self.tw) * self.tw, 76 | math.floor(int(0.9 * self.wh) / self.tw) * self.tw, 77 | ) # resolution of the view port 78 | self.vpStep = self.tw # move 1 tile over. 79 | self.vpShiftStep = self.tw * 10 # move 10 tile over. 80 | self.minHorizScrollBound = 0 81 | self.minVertScrollBound = 0 82 | self.maxHorizScrollBound = self.mapw * self.tw 83 | self.maxVertScrollBound = self.maph * self.tw 84 | self.numXTiles = int( 85 | math.ceil(int(self.vpDimensions[0]) / self.tw) 86 | ) # the number of tiles to be shown at one time for X 87 | self.numYTiles = int( 88 | math.ceil(int(self.vpDimensions[1]) / self.tw) 89 | ) # the number of tiles to be shown at one time for y 90 | self.startXTile = math.floor(int(self.vpCoordinate[0]) / self.tw) 91 | self.startYTile = math.floor(int(self.vpCoordinate[1]) / self.tw) 92 | 93 | if not pygame.font.get_init(): 94 | pygame.font.init() 95 | self.arialFnt = pygame.font.SysFont("Arial", 16) 96 | self.m = gamemap.GameMap( 97 | self.tw, 98 | self.mapw, 99 | self.maph, 100 | self.startXTile, 101 | self.startYTile, 102 | self.numXTiles, 103 | self.numYTiles, 104 | ) 105 | self.m.initMap() 106 | self.m.initEMap() 107 | self.editmode = [None, None] 108 | self.selectmode = False 109 | self.testmode = False 110 | self.room_tiles = [] 111 | self.selectcursor = cursor.Cursor( 112 | self.tw, self.m.numXTiles / 2 * self.tw, self.m.numYTiles / 2 * self.tw 113 | ) 114 | self.queued_jobs = [] 115 | self.mobs = [] 116 | self.mapvalue = None 117 | self.tilecontent = None 118 | # self.currentZlevel = self.m.currentZlevel 119 | openspot = self.m.find_open_spot() 120 | self.currentZlevel = openspot[2] 121 | self.mobs.append(mob.Mob(openspot, self.tw)) 122 | self.addTileMob(openspot[0], openspot[1], openspot[2], self.mobs[0]) 123 | self.mobs.append(mob.Mob(openspot, self.tw)) 124 | self.addTileMob(openspot[0], openspot[1], openspot[2], self.mobs[0]) 125 | self.mobs.append(mob.Mob(openspot, self.tw)) 126 | self.addTileMob(openspot[0], openspot[1], openspot[2], self.mobs[0]) 127 | self.buttons = {} 128 | # self.keys = set() 129 | self.motion = None 130 | 131 | def _recompute_path(self, _map, start, end): 132 | pf = PathFinder(_map.successors, _map.move_cost, _map.move_cost) 133 | # t = time.process_time() 134 | pathlines = list(pf.compute_path(start, end)) 135 | 136 | # dt = time.process_time() - t 137 | if pathlines == []: 138 | print("No path found") 139 | return pathlines 140 | else: 141 | print("Found path (length %d)" % len(pathlines)) 142 | return pathlines 143 | # self.path_valid = True 144 | 145 | def handle_events(self): 146 | for event in pygame.event.get(): 147 | if event.type == pygame.QUIT: 148 | self.quit() 149 | return 150 | elif event.type == pygame.KEYDOWN: 151 | self.handle_keyboard(event) 152 | elif event.type == pygame.MOUSEBUTTONDOWN: 153 | self.buttons[event.button] = event.pos 154 | elif event.type == pygame.MOUSEMOTION: 155 | # dir(event) 156 | # pprint(event) 157 | self.motion = event.pos 158 | # self.motion = event 159 | elif event.type == pygame.MOUSEBUTTONUP: 160 | del self.buttons[event.button] 161 | elif event.type == pygame.VIDEORESIZE: 162 | # allow for the window to be resized manually. 163 | self.ww, self.wh = event.w, event.h 164 | pygame.display.set_mode((self.ww, self.wh), pygame.RESIZABLE) 165 | newwidth = math.floor(int(0.8 * self.ww) / self.tw) 166 | newheight = math.floor(int(0.9 * self.wh) / self.tw) 167 | self.statsOffset = ( 168 | math.floor(int(0.8 * self.ww) + 2 * self.tw), 169 | self.tw, 170 | ) 171 | self.vpDimensions = ( 172 | newwidth * self.tw, 173 | newheight * self.tw, 174 | ) # resolution of the view port 175 | self.m.numXTiles = int( 176 | math.ceil(int(self.vpDimensions[0]) / self.tw) 177 | ) # the number of tiles to be shown at one time for X 178 | self.m.numYTiles = int( 179 | math.ceil(int(self.vpDimensions[1]) / self.tw) 180 | ) # the number of tiles to be shown at one time for y 181 | self.m.tiledBG = pygame.Surface( 182 | (self.m.numXTiles * self.tw, self.m.numYTiles * self.tw) 183 | ).convert() 184 | self.fullscreen = False 185 | 186 | def logic(self): 187 | self.handle_events() 188 | self.handle_mouse() 189 | self.handle_viewport() 190 | 191 | if not self.paused: 192 | 193 | # build the queue 194 | self.mining() 195 | self.channel() 196 | self.moveitem() 197 | # process the queue 198 | # print(self.queued_jobs) 199 | self.move_mobs() 200 | self.mob_logic() 201 | self.handle_logic() 202 | 203 | def showIntro(self): 204 | intro = Intro() 205 | text_list = [ 206 | "Welcome to PyDF", 207 | "d + mouse for digging", 208 | "h + mouse for channeling", 209 | "i + mouse to designate item dump", 210 | "o + mouse selects items for dumping", 211 | "k + arrows to inspect tile content", 212 | "s to save or l to load map from disk", 213 | "arrow keys to move the viewport around", 214 | "shift + < or > goes UP and DOWN Z levels", 215 | "shift + arrow keys to move 10 tiles at a time", 216 | "spacebar unpauses the game or pauses", 217 | "Esc quits", 218 | "", 219 | "Press any key to continue", 220 | ] 221 | hoffset = self.tw 222 | voffset = self.tw * 2 223 | for item in text_list: 224 | intro.drawText(item, self.screen, hoffset, voffset) 225 | voffset += self.tw * 2 226 | 227 | pygame.display.update() 228 | intro.waitForKey() 229 | self.intro = False 230 | 231 | def cleanup(self): 232 | pygame.quit() 233 | 234 | def quit(self): 235 | self.running = False 236 | 237 | def pausegame(self): 238 | if self.paused: 239 | self.showmenu = False 240 | self.selectMode = False 241 | self.editmode = [None, None] 242 | self.paused = False 243 | else: 244 | self.paused = True 245 | # no longer running a seperate loop for pause, handled by the various modes 246 | # while self.paused: 247 | # for event in pygame.event.get(): 248 | # if event.type == KEYDOWN and event.key == K_SPACE: 249 | # self.paused = False 250 | 251 | def moveitem(self): 252 | selected = self.m.get_selected_items() 253 | dropoff = self.m.get_selected(4) 254 | if dropoff == []: 255 | return 256 | else: 257 | for coord in selected: # change this at some point 258 | adjacent_open_tiles = self.m.successors(coord) 259 | queue = [] 260 | if adjacent_open_tiles != []: 261 | queue.append(coord) 262 | if len(queue): 263 | for move in queue: 264 | if len(self.m.successors(move)): 265 | content = self.m.get_items(move[0], move[1], move[2]) 266 | if content is not None: 267 | for item in content: 268 | if item.selected and not item.inqueue: 269 | item.inqueue = True 270 | self.queued_jobs.append( 271 | Job("MoveItem", move, dropoff) 272 | ) 273 | continue 274 | 275 | def channel(self): 276 | selected = self.m.get_selected(3) 277 | for coord in selected: # change this at some point 278 | # checking if the neighboring tiles are accessible from 1 tile away in every direction 279 | # would have to make this more intelligent in the future, but it works for now. 280 | adjacent_open_tiles = self.m.successors(coord) 281 | queue = [] 282 | if adjacent_open_tiles != []: 283 | queue.append(coord) 284 | if len(queue): 285 | dest = queue.pop(0) 286 | # if self.m.checkEMapQueue(dest[0], dest[1], dest[2]) is True: 287 | # continue 288 | list_of_moves = self.m.successors(dest) 289 | for move in list_of_moves: 290 | if len(self.m.successors(move)): 291 | # dest[2] = dest[2] -1 #channel digs a zlevel below but creates a ramp 292 | self.m.writeEMapQueue(dest[0], dest[1], dest[2], True) 293 | self.queued_jobs.append(Job("Channeling", move, dest)) 294 | continue 295 | 296 | def mining(self): 297 | selected = self.m.get_selected(2) 298 | print("Selected: ", selected) 299 | for coord in selected: # change this at some point 300 | # checking if the neighboring tiles are accessible from 1 tile away in every direction 301 | # would have to make this more intelligent in the future, but it works for now. 302 | job = self.find_mining_job(coord) 303 | inqueue = False 304 | if job: # check if the dorfs already have that job 305 | for m in self.mobs: 306 | if m.job is not None: 307 | if ( 308 | m.job.name == job.name 309 | and m.job.move == job.move 310 | and m.job.dest == job.dest 311 | ): 312 | inqueue = True 313 | continue 314 | 315 | if not inqueue and job: 316 | self.m.writeEMapQueue(job.dest[0], job.dest[1], job.dest[2], True) 317 | self.queued_jobs.append(job) 318 | 319 | def find_mining_job(self, coord): 320 | adjacent_open_tiles = self.m.successors(coord) 321 | queue = [] 322 | if adjacent_open_tiles != []: 323 | queue.append(coord) 324 | if len(queue): 325 | dest = queue.pop(0) 326 | # if self.m.checkEMapQueue(dest[0], dest[1], dest[2]) == True: 327 | # continue 328 | list_of_moves = self.m.successors(dest) 329 | for move in list_of_moves: 330 | if len(self.m.successors(move)): 331 | return Job("Mining", move, dest) 332 | return None 333 | 334 | def expand_selection(self, coord): 335 | list_selection = self.m.successors(coord) 336 | for item in list_selection: 337 | if item in self.room_tiles: 338 | print("already in list") 339 | else: 340 | self.room_tiles.append(item) 341 | 342 | def menu(self, menu_list): 343 | if not self.showmenu: 344 | self.currentmenu = ezmenu.EzMenu(menu_list) 345 | self.currentmenu.set_pos(self.menuOffset3[0], self.menuOffset3[1]) 346 | self.currentmenu.set_font(self.arialFnt) 347 | self.currentmenu.set_highlight_color((0, 255, 0)) 348 | self.currentmenu.set_normal_color(self.white) 349 | self.showmenu = True 350 | 351 | def handle_keyboard(self, event): 352 | keymods = pygame.key.get_mods() 353 | if event.key == ord("k"): # and self.selectmode == False: 354 | self.paused = True 355 | if not self.selectmode: 356 | self.selectmode = True 357 | else: 358 | self.selectmode = False 359 | self.showmenu = False 360 | 361 | elif event.key == ord("d"): 362 | self.paused = True 363 | # mining 364 | self.editmode = ["designate", "mining"] 365 | elif event.key == ord("h"): 366 | self.paused = True 367 | # channeling 368 | self.editmode = ["designate", "channel"] 369 | elif event.key == ord("i"): 370 | self.paused = True 371 | # Item Drop location 372 | self.editmode = ["designate", "drop"] 373 | elif event.key == ord("o"): 374 | self.paused = True 375 | # select items to move 376 | self.editmode = ["designate", "itemselect"] 377 | elif event.key == ord("x"): 378 | self.paused = True 379 | # REMOVE MODE 380 | self.editmode[1] = "remove" 381 | elif event.key == ord("l"): 382 | self.paused = True 383 | # Loading map 384 | self.m.load_map() 385 | elif event.key == ord("s"): 386 | self.paused = True 387 | # Saving map 388 | self.m.save_map() 389 | elif event.key == ord("t"): 390 | self.paused = True 391 | # Testing 392 | if not self.testmode: 393 | self.testmode = True 394 | else: 395 | print("testing") 396 | self.testmode = False 397 | self.room_tiles = [] 398 | 399 | elif event.key == ord("n") and self.testmode and self.selectmode: 400 | mapx = (self.selectcursor.position[0] + self.vpCoordinate[0]) / self.tw 401 | mapy = (self.selectcursor.position[1] + self.vpCoordinate[1]) / self.tw 402 | if self.room_tiles == []: 403 | self.expand_selection((mapx, mapy, self.currentZlevel)) 404 | else: 405 | room_list = self.room_tiles 406 | for item in room_list: 407 | self.expand_selection((item[0], item[1], self.currentZlevel)) 408 | 409 | elif event.key == ord("m") and self.testmode and self.selectmode: 410 | print("Decreasing") 411 | 412 | elif event.key == pygame.K_ESCAPE: 413 | self.quit() 414 | elif event.key == pygame.K_SPACE: 415 | # PAUSING OR UNPAUSE 416 | self.pausegame() 417 | 418 | # move the menu selector: 419 | elif (event.key == pygame.K_UP or event.key == pygame.K_DOWN) and ( 420 | keymods & pygame.KMOD_LALT 421 | and self.showmenu 422 | and self.currentmenu is not None 423 | ): 424 | self.currentmenu.update(event) 425 | elif ( 426 | event.key == pygame.K_RETURN 427 | and self.showmenu 428 | and self.currentmenu is not None 429 | and self.selectmode 430 | ): 431 | self.currentmenu.update(event) 432 | 433 | # Movement Keys l,r,u,d 434 | # Cursor Movement 435 | 436 | elif event.key == pygame.K_LEFT and self.selectmode: 437 | if keymods & pygame.KMOD_LSHIFT: 438 | self.selectcursor.position[0] = ( 439 | self.selectcursor.position[0] - self.vpShiftStep 440 | ) 441 | else: 442 | self.selectcursor.position[0] = ( 443 | self.selectcursor.position[0] - self.vpStep 444 | ) 445 | 446 | elif event.key == pygame.K_RIGHT and self.selectmode: 447 | if keymods & pygame.KMOD_LSHIFT: 448 | self.selectcursor.position[0] = ( 449 | self.selectcursor.position[0] + self.vpShiftStep 450 | ) 451 | else: 452 | self.selectcursor.position[0] = ( 453 | self.selectcursor.position[0] + self.vpStep 454 | ) 455 | 456 | elif event.key == pygame.K_UP and self.selectmode and not self.testmode: 457 | if keymods & pygame.KMOD_LSHIFT: 458 | self.selectcursor.position[1] = ( 459 | self.selectcursor.position[1] - self.vpShiftStep 460 | ) 461 | else: 462 | self.selectcursor.position[1] = ( 463 | self.selectcursor.position[1] - self.vpStep 464 | ) 465 | 466 | elif event.key == pygame.K_DOWN and self.selectmode and not self.testmode: 467 | if keymods & pygame.KMOD_LSHIFT: 468 | self.selectcursor.position[1] = ( 469 | self.selectcursor.position[1] + self.vpShiftStep 470 | ) 471 | else: 472 | self.selectcursor.position[1] = ( 473 | self.selectcursor.position[1] + self.vpStep 474 | ) 475 | 476 | # move up and down zlevels. 477 | elif ( 478 | event.key == pygame.K_COMMA 479 | and not self.selectmode 480 | and keymods & pygame.KMOD_LSHIFT 481 | ): 482 | if self.currentZlevel + 1 in range(self.m.zlevels): 483 | self.currentZlevel = self.currentZlevel + 1 484 | elif ( 485 | event.key == pygame.K_PERIOD 486 | and not self.selectmode 487 | and keymods & pygame.KMOD_LSHIFT 488 | ): 489 | if self.currentZlevel - 1 in range(self.m.zlevels): 490 | self.currentZlevel = self.currentZlevel - 1 491 | 492 | # View port Movement 493 | elif event.key == pygame.K_LEFT and not self.selectmode: 494 | if keymods & pygame.KMOD_LSHIFT: 495 | self.vpCoordinate[0] = self.vpCoordinate[0] - self.vpShiftStep 496 | else: 497 | self.vpCoordinate[0] = self.vpCoordinate[0] - self.vpStep 498 | 499 | elif event.key == pygame.K_RIGHT and not self.selectmode: 500 | if keymods & pygame.KMOD_LSHIFT: 501 | self.vpCoordinate[0] = self.vpCoordinate[0] + self.vpShiftStep 502 | else: 503 | self.vpCoordinate[0] = self.vpCoordinate[0] + self.vpStep 504 | 505 | elif event.key == pygame.K_UP and not self.selectmode: 506 | if keymods & pygame.KMOD_LSHIFT: 507 | self.vpCoordinate[1] = self.vpCoordinate[1] - self.vpShiftStep 508 | else: 509 | self.vpCoordinate[1] = self.vpCoordinate[1] - self.vpStep 510 | elif event.key == pygame.K_DOWN and not self.selectmode: 511 | if keymods & pygame.KMOD_LSHIFT: 512 | self.vpCoordinate[1] = self.vpCoordinate[1] + self.vpShiftStep 513 | else: 514 | self.vpCoordinate[1] = self.vpCoordinate[1] + self.vpStep 515 | 516 | # reset viewport 517 | elif event.key == pygame.K_F11: 518 | if not self.fullscreen: 519 | pygame.display.set_mode((self.fsw, self.fsh), pygame.FULLSCREEN, 32) 520 | newwidth = math.floor(int(0.8 * self.fsw) / self.tw) 521 | newheight = math.floor(int(0.9 * self.fsh) / self.tw) 522 | self.statsOffset = ( 523 | math.floor(int(0.8 * self.fsw) + 2 * self.tw), 524 | self.tw, 525 | ) 526 | self.vpDimensions = ( 527 | newwidth * self.tw, 528 | newheight * self.tw, 529 | ) # resolution of the view port 530 | self.m.numXTiles = int( 531 | math.ceil(int(self.vpDimensions[0]) / self.tw) 532 | ) # tiles to be shown at one time for X 533 | self.m.numYTiles = int( 534 | math.ceil(int(self.vpDimensions[1]) / self.tw) 535 | ) # tiles to be shown at one time for y 536 | self.m.tiledBG = pygame.Surface( 537 | (self.m.numXTiles * self.tw, self.m.numYTiles * self.tw) 538 | ).convert() 539 | self.fullscreen = True 540 | elif self.fullscreen: 541 | pygame.display.set_mode((self.ww, self.wh), pygame.RESIZABLE) 542 | newwidth = math.floor(int(0.8 * self.ww) / self.tw) 543 | newheight = math.floor(int(0.9 * self.wh) / self.tw) 544 | self.statsOffset = ( 545 | math.floor(int(0.8 * self.ww) + 2 * self.tw), 546 | self.tw, 547 | ) 548 | self.vpDimensions = ( 549 | newwidth * self.tw, 550 | newheight * self.tw, 551 | ) # resolution of the view port 552 | self.m.numXTiles = int( 553 | math.ceil(int(self.vpDimensions[0]) / self.tw) 554 | ) # tiles to be shown at one time for X 555 | self.m.numYTiles = int( 556 | math.ceil(int(self.vpDimensions[1]) / self.tw) 557 | ) # tiles to be shown at one time for y 558 | self.m.tiledBG = pygame.Surface( 559 | (self.m.numXTiles * self.tw, self.m.numYTiles * self.tw) 560 | ).convert() 561 | self.fullscreen = False 562 | 563 | def handle_mouse(self): 564 | MOUSE_BUTTON_ONE = 1 565 | if ( 566 | MOUSE_BUTTON_ONE in self.buttons 567 | and self.editmode[0] == "designate" 568 | and self.editmode[1] == "itemselect" 569 | ): 570 | mx, my = pygame.mouse.get_pos() 571 | # mx = self.motion.pos[0] 572 | # my = self.motion.pos[1] 573 | if ( 574 | mx < self.m.numXTiles * self.tw + self.vpRenderOffset[0] 575 | and my < self.m.numYTiles * self.tw + self.vpRenderOffset[1] 576 | ): # within the map viewport 577 | self.m.select_items( 578 | (mx - self.vpRenderOffset[0] + self.vpCoordinate[0]) / self.tw, 579 | (my - self.vpRenderOffset[1] + self.vpCoordinate[1]) / self.tw, 580 | self.currentZlevel, 581 | ) 582 | 583 | # drop point for items 584 | if ( 585 | MOUSE_BUTTON_ONE in self.buttons 586 | and self.editmode[0] == "designate" 587 | and self.editmode[1] == "drop" 588 | ): 589 | mx, my = pygame.mouse.get_pos() 590 | # mx = self.motion.pos[0] 591 | # my = self.motion.pos[1] 592 | if ( 593 | mx < self.m.numXTiles * self.tw + self.vpRenderOffset[0] 594 | and my < self.m.numYTiles * self.tw + self.vpRenderOffset[1] 595 | ): # within the map viewport 596 | self.m.updateEMap( 597 | (mx - self.vpRenderOffset[0] + self.vpCoordinate[0]) / self.tw, 598 | (my - self.vpRenderOffset[1] + self.vpCoordinate[1]) / self.tw, 599 | self.currentZlevel, 600 | self.editmode, 601 | ) 602 | 603 | if MOUSE_BUTTON_ONE in self.buttons and self.editmode[0] == "designate": 604 | mx, my = pygame.mouse.get_pos() 605 | # mx = self.motion.pos[0] 606 | # my = self.motion.pos[1] 607 | if ( 608 | mx < self.m.numXTiles * self.tw + self.vpRenderOffset[0] 609 | and my < self.m.numYTiles * self.tw + self.vpRenderOffset[1] 610 | ): # within the map viewport 611 | self.m.updateEMap( 612 | (mx - self.vpRenderOffset[0] + self.vpCoordinate[0]) / self.tw, 613 | (my - self.vpRenderOffset[1] + self.vpCoordinate[1]) / self.tw, 614 | self.currentZlevel, 615 | self.editmode, 616 | ) 617 | 618 | # if MOUSE_BUTTON_ONE in self.buttons and self.editmode[0] == "designate": 619 | 620 | # if MOUSE_BUTTON_ONE in self.buttons and self.motion == pygame.MOUSEMOTION.pos and self.editmode[0] == "designate": 621 | # mx = self.motion.pos[0] 622 | # my = self.motion.pos[1] 623 | # if mx < self.m.numXTiles * self.tw + self.vpRenderOffset[0] and my < self.m.numYTiles * self.tw + self.vpRenderOffset[1]: #within the map viewport 624 | # self.m.updateEMap((mx - self.vpRenderOffset[0] + self.vpCoordinate[0]) / self.tw, (my - self.vpRenderOffset[1] + self.vpCoordinate[1]) / self.tw, self.currentZlevel, self.editmode) 625 | 626 | def handle_viewport(self): 627 | # Restrict Cursor Movement. 628 | if self.selectmode: 629 | if self.selectcursor.position[0] < 0: 630 | self.selectcursor.position[0] = 0 631 | if self.selectcursor.position[0] > self.m.numXTiles * self.tw: 632 | self.selectcursor.position[0] = self.vpDimensions[0] - self.tw 633 | if self.selectcursor.position[1] < 0: 634 | self.selectcursor.position[1] = 0 635 | if self.selectcursor.position[1] > self.m.numYTiles * self.tw: 636 | self.selectcursor.position[1] = self.vpDimensions[1] - self.tw 637 | 638 | self.selectcursor.mapx = ( 639 | self.selectcursor.position[0] + self.vpCoordinate[0] 640 | ) / self.tw 641 | self.selectcursor.mapy = ( 642 | self.selectcursor.position[1] + self.vpCoordinate[1] 643 | ) / self.tw 644 | # list = [['item1', 'data1'],['item2', 'data2'],['item3', 'data3']] 645 | self.mapvalue = self.m.checkMap( 646 | self.selectcursor.mapx, self.selectcursor.mapy, self.currentZlevel 647 | ) 648 | self.tilecontent = self.m.checkMapContent( 649 | self.selectcursor.mapx, self.selectcursor.mapy, self.currentZlevel 650 | ) 651 | if self.tilecontent is not None: 652 | self.menu(self.tilecontent) 653 | else: 654 | self.showmenu = False 655 | self.currentmenu = None 656 | # view port reset. 657 | if self.vpCoordinate[0] < 0: 658 | self.vpCoordinate[0] = 0 659 | if self.vpCoordinate[0] + self.vpDimensions[0] > self.maxHorizScrollBound: 660 | self.vpCoordinate[0] = self.maxHorizScrollBound - self.vpDimensions[0] 661 | if self.vpCoordinate[1] < 0: 662 | self.vpCoordinate[1] = 0 663 | if self.vpCoordinate[1] + self.vpDimensions[1] > self.maxVertScrollBound: 664 | self.vpCoordinate[1] = self.maxVertScrollBound - self.vpDimensions[1] 665 | 666 | def addTileContent(self, x, y, zlevel, content): 667 | val = self.m.mapdata[zlevel][x][y].addMob(content) 668 | return val 669 | 670 | def delTileContent(self, x, y, zlevel, content): 671 | val = self.m.mapdata[zlevel][x][y].removeMob(content) 672 | return val 673 | 674 | def addTileMob(self, x, y, zlevel, mob): 675 | val = self.m.mapdata[zlevel][x][y].addMob(mob) 676 | return val 677 | 678 | def delTileMob(self, x, y, zlevel, mob): 679 | val = self.m.mapdata[zlevel][x][y].removeMob(mob) 680 | return val 681 | 682 | def moveMob(self, x, y, zlevel, mob): 683 | # x, y, z 684 | oldx, oldy, oldz = mob.position[0], mob.position[1], mob.position[2] 685 | self.addTileMob(x, y, zlevel, mob) # this will need to be adjusted 686 | self.delTileMob(oldx, oldy, oldz, mob) # this also will need to be adjusted 687 | mob.position = (x, y, zlevel) 688 | 689 | def idle_dwarves(self): 690 | counter = 0 691 | for mo in self.mobs: 692 | if mo.job is None: 693 | counter = counter + 1 694 | return counter 695 | 696 | def move_mobs(self): 697 | for m in self.mobs: 698 | if len(m.pathlines) > 0: 699 | print("Has a path, walking 1 step of the path") 700 | move = m.pathlines.pop(0) 701 | self.moveMob(move[0], move[1], move[2], m) 702 | else: 703 | if m.job: 704 | print("No pathlines, attempting to snag some") 705 | path = self._recompute_path(self.m, m.position, m.job.move) 706 | if path != []: 707 | print("path found") 708 | m.pathlines = path 709 | else: 710 | m.job = None 711 | 712 | def mob_logic(self): 713 | for m in self.mobs: 714 | if m.job is not None: 715 | if m.position == m.job.move: 716 | if m.job.name == "Channeling": 717 | # Channeling... 718 | digtype = 7 # create an up ramp 719 | diglevel = m.job.dest[2] - 1 # the z level below 720 | self.m.writeMap( 721 | m.job.dest[0], m.job.dest[1], diglevel, digtype 722 | ) # default to a green tile for now. 723 | self.m.setBlocked( 724 | m.job.dest[0], m.job.dest[1], diglevel, False 725 | ) # unblock the tile 726 | digtype = 5 # put an empty tile on top 727 | self.m.writeMap( 728 | m.job.dest[0], m.job.dest[1], m.job.dest[2], digtype 729 | ) # default to a green tile for now. 730 | self.m.writeEMap( 731 | m.job.dest[0], m.job.dest[1], m.job.dest[2], 1 732 | ) # default to a empty tile for now. 733 | self.m.writeEMapQueue( 734 | m.job.dest[0], m.job.dest[1], m.job.dest[2], False 735 | ) 736 | self.m.setBlocked( 737 | m.job.dest[0], m.job.dest[1], m.job.dest[2], True 738 | ) # unblock the tile 739 | m.job = None 740 | elif m.job.name == "Mining": 741 | # Mining... 742 | digtype = 1 743 | self.m.writeMap( 744 | m.job.dest[0], m.job.dest[1], m.job.dest[2], digtype 745 | ) # default to a green tile for now. 746 | self.m.writeEMap( 747 | m.job.dest[0], m.job.dest[1], m.job.dest[2], 1 748 | ) # default to a empty tile for now. 749 | self.m.writeEMapQueue( 750 | m.job.dest[0], m.job.dest[1], m.job.dest[2], False 751 | ) 752 | self.m.setBlocked( 753 | m.job.dest[0], m.job.dest[1], m.job.dest[2], False 754 | ) # unblock the tile 755 | m.job = None 756 | elif m.job.name == "MoveItem": 757 | # Picking up Item 758 | if ( 759 | self.m.get_items_in_queue( 760 | m.position[0], m.position[1], m.position[2] 761 | ) 762 | is not None 763 | ): 764 | val = self.m.mapdata[m.position[2]][m.position[0]][ 765 | m.position[1] 766 | ].pickup() 767 | m.carrying = val 768 | m.job = Job("DropItem", m.job.dest[0], m.job.dest[0]) 769 | m.pathlines = self._recompute_path( 770 | self.m, m.position, m.dest 771 | ) 772 | else: 773 | print("Job Canceled, no items left") 774 | print("SHOULD NOT GET HERE") 775 | # m.job = None #.clearjob() 776 | elif m.job.name == "DropItem": 777 | # Dropping Item 778 | # Item 779 | m.carrying.selected = ( 780 | False # set the item to false before dropping it. 781 | ) 782 | m.carrying.inqueue = ( 783 | False # set the item to false before dropping it. 784 | ) 785 | self.m.mapdata[m.job.dest[2]][m.job.dest[0]][m.job.dest[1]].add( 786 | m.carrying 787 | ) 788 | m.carrying = None 789 | m.job = None # .clearjob() 790 | 791 | else: 792 | # print "no Job" # get one 793 | if len(self.queued_jobs) > 0: 794 | m.job = self.queued_jobs.pop(0) 795 | 796 | def handle_logic(self): 797 | # Move Loop 798 | self.m.startXTile = math.floor(float(self.vpCoordinate[0]) / self.tw) 799 | self.m.startYTile = math.floor(float(self.vpCoordinate[1]) / self.tw) 800 | # tick busy 801 | dt = self.mainclock.tick_busy_loop(self.FPS) 802 | 803 | def render(self): 804 | self.screen.fill((0, 0, 0)) 805 | self.m.drawMap(self.currentZlevel) 806 | self.finalmap = self.m.drawEMap(self.currentZlevel) 807 | self.screen.blit( 808 | self.arialFnt.render("Idle: " + str(self.idle_dwarves()), True, self.white), 809 | self.idleOffset, 810 | ) 811 | # Cursor 812 | if self.selectmode: 813 | self.finalmap.blit(self.selectcursor.image, self.selectcursor.position) 814 | if self.testmode and self.room_tiles: 815 | for pos in self.room_tiles: 816 | self.finalmap.blit( 817 | self.selectcursor.image, 818 | [ 819 | pos[0] * self.tw + self.vpCoordinate[0], 820 | pos[1] * self.tw + self.vpCoordinate[1], 821 | ], 822 | ) 823 | self.screen.blit( 824 | self.arialFnt.render("value: " + str(self.mapvalue), True, self.white), 825 | self.menuOffset, 826 | ) 827 | self.screen.blit( 828 | self.arialFnt.render( 829 | "content: " + str(self.tilecontent), True, self.white 830 | ), 831 | self.menuOffset2, 832 | ) 833 | if self.showmenu: 834 | self.currentmenu.draw(self.screen) 835 | if self.paused: 836 | self.screen.blit( 837 | self.arialFnt.render("Paused", True, self.white), 838 | self.pauseDisplayOffset, 839 | ) 840 | if self.editmode != [None, None]: 841 | self.screen.blit( 842 | self.arialFnt.render( 843 | "Digging: " + str(self.editmode[1]), True, self.white 844 | ), 845 | self.digTypeOffset, 846 | ) 847 | 848 | self.screen.blit( 849 | self.finalmap, 850 | self.vpRenderOffset, 851 | ( 852 | self.vpCoordinate[0] - (self.m.startXTile * self.tw), 853 | (self.vpCoordinate[1] - (self.m.startYTile * self.tw)), 854 | ) 855 | + self.vpDimensions, 856 | ) 857 | self.screen.blit( 858 | self.arialFnt.render( 859 | "coordinates: " 860 | + str(self.vpCoordinate[0]) 861 | + ", " 862 | + str(self.vpCoordinate[1]) 863 | + " Z: " 864 | + str(self.currentZlevel), 865 | True, 866 | self.white, 867 | ), 868 | self.statsOffset, 869 | ) 870 | # screen filling goes here 871 | for m in self.mobs: 872 | if ( 873 | m.position[2] == self.currentZlevel 874 | ): # only render the dorfs on the current level 875 | self.screen.blit( 876 | m.image, 877 | self.vpRenderOffset, 878 | ( 879 | self.vpCoordinate[0] - (m.position[0] * self.tw), 880 | (self.vpCoordinate[1] - (m.position[1] * self.tw)), 881 | ) 882 | + self.vpDimensions, 883 | ) 884 | 885 | self.mainclock.tick(self.FPS) 886 | # pygame.display.update() 887 | pygame.display.flip() 888 | 889 | def run(self): 890 | if self.intro: 891 | self.showIntro() 892 | while self.running: 893 | self.logic() 894 | self.render() 895 | self.cleanup() 896 | 897 | 898 | # this calls the 'main' function when this script is executed 899 | if __name__ == "__main__": 900 | e = Engine() 901 | e.run() 902 | -------------------------------------------------------------------------------- /ezmenu.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | import pygame 3 | 4 | 5 | class EzMenu: 6 | def __init__(self, options): 7 | # def __init__(self, *options): 8 | """Initialise the EzMenu! options should be a sequence of lists in the 9 | format of [option_name, option_function]""" 10 | 11 | self.options = options 12 | self.x = 0 13 | self.y = 0 14 | self.font = pygame.font.Font(None, 32) 15 | self.selected = 0 16 | self.width = 1 17 | self.color = [0, 0, 0] 18 | self.hcolor = [255, 0, 0] 19 | self.height = len(self.options) * self.font.get_height() 20 | for o in self.options: 21 | text = o.name 22 | # text = o[0] 23 | ren = self.font.render(text, 1, (0, 0, 0)) 24 | if ren.get_width() > self.width: 25 | self.width = ren.get_width() 26 | 27 | def draw(self, surface): 28 | """Draw the menu to the surface.""" 29 | i = 0 30 | for o in self.options: 31 | if i == self.selected: 32 | clr = self.hcolor 33 | else: 34 | clr = self.color 35 | text = o.name 36 | # text = o[0] 37 | ren = self.font.render(text, 1, clr) 38 | if ren.get_width() > self.width: 39 | self.width = ren.get_width() 40 | surface.blit(ren, (self.x, self.y + i * self.font.get_height())) 41 | i += 1 42 | 43 | def update(self, event): 44 | print(str(event)) 45 | keymods = pygame.key.get_mods() 46 | """Update the menu and get input for the menu.""" 47 | if event.type == pygame.KEYDOWN: 48 | if event.key == pygame.K_DOWN and keymods & pygame.KMOD_LALT: 49 | print("This is being called") 50 | self.selected += 1 51 | if event.key == pygame.K_UP and keymods & pygame.KMOD_LALT: 52 | print("This is totally not being called") 53 | self.selected -= 1 54 | if event.key == pygame.K_RETURN: 55 | self.result(self.options[self.selected]) # execute 56 | # self.options[self.option][1]() # execute 57 | if self.selected > len(self.options) - 1: 58 | self.selected = 0 59 | if self.selected < 0: 60 | self.selected = len(self.options) - 1 61 | print("options : " + str(len(self.options))) 62 | 63 | def set_pos(self, x, y): 64 | """Set the topleft of the menu at x,y""" 65 | self.x = x 66 | self.y = y 67 | 68 | def set_font(self, font): 69 | """Set the font used for the menu.""" 70 | self.font = font 71 | 72 | def set_highlight_color(self, color): 73 | """Set the highlight color""" 74 | self.hcolor = color 75 | 76 | def set_normal_color(self, color): 77 | """Set the normal color""" 78 | self.color = color 79 | 80 | def center_at(self, x, y): 81 | """Center the center of the menu at x,y""" 82 | self.x = x - (self.width / 2) 83 | self.y = y - (self.height / 2) 84 | 85 | def result(self, value): 86 | print(value) 87 | return value 88 | -------------------------------------------------------------------------------- /gamemap.cfg: -------------------------------------------------------------------------------- 1 | [tiles] 2 | images32:wall1x32.png, grassx32.png, grass2x32.png, grass3x32.png, grass4x32.png, waterx32.png, magmax32.png, uprampx32.png, downrampx32.png, clearx32.png 3 | images16:wall.png, grass.png, grass2.png, grass3.png, grass4.png, start.png, end.png, upramp.png, downramp.png, clear.png 4 | digimages32:digx32.png, channelx32.png, dumpx32.png, selectedx32.png 5 | digimages16:dig.png, channel.png, dump.png, selected.png 6 | [map] 7 | zlevels=10 8 | -------------------------------------------------------------------------------- /gamemap.py: -------------------------------------------------------------------------------- 1 | try: 2 | import pygame 3 | 4 | # from time import time 5 | import pickle 6 | 7 | # from pprint import pprint 8 | import loader 9 | import random 10 | from math import sqrt 11 | import configparser 12 | import maptile 13 | import noise 14 | import selected 15 | import sys 16 | except ImportError as err: 17 | print("couldn't load module, %s" % (err)) 18 | sys.exit(2) 19 | 20 | 21 | class GameMap(object): 22 | """ Gamemap object aka the Grid """ 23 | 24 | def __init__(self, tw, mapw, maph, startXTile, startYTile, numXTiles, numYTiles): 25 | """ NEED TO MOVE THIS SHIT INTO THE RIGHT CONFIG FILE """ 26 | self.tw = tw 27 | self.mapw = mapw 28 | self.maph = maph 29 | self.startXTile = startXTile 30 | self.startYTile = startYTile 31 | self.numXTiles = numXTiles 32 | self.numYTiles = numYTiles 33 | self.tiledBG = pygame.Surface((numXTiles * self.tw, numYTiles * tw)).convert() 34 | 35 | config = configparser.ConfigParser() 36 | config.read_file(open("gamemap.cfg")) 37 | self.zlevels = config.getint("map", "zlevels") 38 | self.currentZlevel = 0 39 | if not pygame.font.get_init(): 40 | pygame.font.init() 41 | self.arialFnt = pygame.font.SysFont("Arial", 12) 42 | imageset = "images" + str(tw) 43 | digset = "digimages" + str(tw) 44 | self.images = str(config.get("tiles", imageset)).split(", ") 45 | self.digimages = str(config.get("tiles", digset)).split(", ") # ['digx32.png'] 46 | self.mapdata = [ 47 | [[0 for cols in range(self.maph)] for rows in range(self.mapw)] 48 | for z in range(self.zlevels) 49 | ] # [row for row in xrange(self.zlevels)] 50 | self.emapdata = [row for row in range(self.zlevels)] 51 | # ["wall1x32.png", "grassx32.png", "grass2x32.png", "grass3x32.png", "grass4x32.png", "waterx32.png", "magmax32.png", 'uprampx32.png', 'downrampx32.png'] 52 | self.tileimages = [] 53 | for i in self.images: 54 | tempimg, temprect = loader.load_png(i) 55 | self.tileimages.append((tempimg, temprect)) 56 | 57 | self.digtileimages = [] 58 | for i in self.digimages: 59 | tempimg, temprect = loader.load_png(i) 60 | self.digtileimages.append((tempimg, temprect)) 61 | 62 | def initMap(self): 63 | mynoise = noise.Noise(self.mapw, self.maph, self.tw) 64 | mylist = mynoise.generate() 65 | # pprint(mylist) 66 | self.maprect = pygame.Rect(0, 0, self.mapw, self.maph) 67 | for z in range(self.zlevels): 68 | for x in range(self.mapw): 69 | for y in range(self.maph): 70 | if self.firstnum(mylist[x][y]) == z: # tile on the current layer 71 | # print "grass" 72 | # self.mapdata[z][x][y] = maptile.MapTile(random.randint(1, 4)) 73 | if self.secondnum(mylist[x][y]) < 7: 74 | self.mapdata[z][x][y] = maptile.MapTile( 75 | random.randint(1, 4) 76 | ) 77 | else: 78 | self.mapdata[z][x][y] = maptile.MapTile(7) 79 | # put some ground 80 | elif self.firstnum(mylist[x][y]) > z: # tiles on the layers above 81 | # print "dirt" 82 | self.mapdata[z][x][y] = maptile.MapTile(0) 83 | # dirt 84 | elif self.firstnum(mylist[x][y]) < z: # tiles below the z level 85 | # print "nothing" 86 | self.mapdata[z][x][y] = maptile.MapTile(5) 87 | else: 88 | print("x:", x) 89 | print(" y:", y) 90 | print("z:", z) 91 | print("BOMBED") 92 | exit() 93 | # put nothing 94 | 95 | # for z in xrange(self.zlevels): 96 | # for x in xrange(self.mapw): 97 | # for y in xrange(self.maph): 98 | # if self.firstnum(mylist[x][y]) == z: 99 | # if self.secondnum(mylist[x][y]) < 8: 100 | # self.mapdata[z][x][y] = maptile.MapTile(random.randint(1, 4)) 101 | # else: 102 | # self.mapdata[z][x][y] = maptile.MapTile(7) 103 | # elif self.firstnum(mylist[x][y]) > z and self.firstnum(mylist[x][y]) == z + 1: 104 | # self.mapdata[z][x][y] = maptile.MapTile(0) 105 | # elif self.firstnum(mylist[x][y]) > z and self.firstnum(mylist[x][y]) != z + 1: 106 | # self.mapdata[z][x][y] = maptile.MapTile(0) 107 | # else: 108 | # self.mapdata[z][x][y] = maptile.MapTile(5) 109 | 110 | def firstnum(self, num): 111 | return int(str(num)[0]) 112 | 113 | def secondnum(self, num): 114 | return int(str(num)[1]) 115 | 116 | def belongs_to(self, num, start, end): 117 | if num >= start and num <= end: 118 | return True 119 | return False 120 | 121 | def initEMap(self): 122 | for z in range(self.zlevels): 123 | self.emapdata[z] = [ 124 | [selected.Selected(1) for col in range(self.maph)] 125 | for row in range(self.mapw) 126 | ] 127 | self.emaprect = pygame.Rect(0, 0, self.mapw, self.maph) 128 | 129 | def drawEMap(self, zlevel): 130 | for x in range(int(self.startXTile), int(self.startXTile + self.numXTiles)): 131 | for y in range(int(self.startYTile), int(self.startYTile + self.numYTiles)): 132 | val = self.checkEMap(x, y, zlevel) 133 | for z in self.mapdata[zlevel][x][y].content: 134 | if z is not None: 135 | if z.selected: 136 | self.tiledBG.blit( 137 | z.image, 138 | ( 139 | (x - self.startXTile) * self.tw, 140 | (y - self.startYTile) * self.tw, 141 | ), 142 | ) 143 | self.tiledBG.blit( 144 | self.digtileimages[3][0], 145 | ( 146 | (x - self.startXTile) * self.tw, 147 | (y - self.startYTile) * self.tw, 148 | ), 149 | ) 150 | if val == 2: # replace this with a big hash of images 151 | image = 0 152 | self.tiledBG.blit( 153 | self.digtileimages[image][0], 154 | ( 155 | (x - self.startXTile) * self.tw, 156 | (y - self.startYTile) * self.tw, 157 | ), 158 | ) 159 | elif val == 3: 160 | image = 1 161 | self.tiledBG.blit( 162 | self.digtileimages[image][0], 163 | ( 164 | (x - self.startXTile) * self.tw, 165 | (y - self.startYTile) * self.tw, 166 | ), 167 | ) 168 | elif val == 4: # Drop location 169 | image = 2 170 | self.tiledBG.blit( 171 | self.digtileimages[image][0], 172 | ( 173 | (x - self.startXTile) * self.tw, 174 | (y - self.startYTile) * self.tw, 175 | ), 176 | ) 177 | elif val == 1: # 1 empty 178 | continue 179 | return self.tiledBG 180 | 181 | def drawMap(self, zlevel): 182 | for x in range(int(self.startXTile), int(self.startXTile + self.numXTiles)): 183 | for y in range(int(self.startYTile), int(self.startYTile + self.numYTiles)): 184 | val = self.checkMap(x, y, zlevel) 185 | if val == 5: 186 | if self.checkMap(x, y, zlevel - 1) == 7: # incline 187 | val = 8 188 | if self.checkMap(x, y, zlevel - 1) == 5: # sky 189 | val = 9 190 | self.tiledBG.blit( 191 | self.tileimages[val][0], 192 | ((x - self.startXTile) * self.tw, (y - self.startYTile) * self.tw), 193 | ) 194 | for z in self.mapdata[zlevel][x][y].content: 195 | if z is not None: 196 | self.tiledBG.blit( 197 | z.image, 198 | ( 199 | (x - self.startXTile) * self.tw, 200 | (y - self.startYTile) * self.tw, 201 | ), 202 | ) 203 | 204 | return self.tiledBG 205 | 206 | def setBlocked(self, x, y, zlevel, blocked=True): 207 | """ True for blocked, False for passable """ 208 | self.mapdata[zlevel][x][y].blocked = blocked 209 | 210 | def isBlocked(self, x, y, zlevel): 211 | x = int(x) 212 | y = int(y) 213 | val = self.mapdata[zlevel][x][y].blocked 214 | return val 215 | 216 | def checkMapContent(self, x, y, zlevel): 217 | x = int(x) 218 | y = int(y) 219 | val = self.mapdata[zlevel][x][y].content 220 | if val != []: 221 | return val 222 | else: 223 | return None 224 | 225 | def checkMap(self, x, y, zlevel): 226 | x = int(x) 227 | y = int(y) 228 | val = self.mapdata[zlevel][x][y].value 229 | # print str(val) 230 | return val 231 | 232 | def checkEMapQueue(self, x, y, zlevel): 233 | x = int(x) 234 | y = int(y) 235 | val = self.emapdata[zlevel][x][y].inqueue 236 | return val 237 | 238 | def checkEMap(self, x, y, zlevel): 239 | x = int(x) 240 | y = int(y) 241 | val = self.emapdata[zlevel][x][y].value 242 | return val 243 | 244 | def writeMap(self, x, y, zlevel, v): 245 | self.mapdata[zlevel][x][y].digTile(v) 246 | return v 247 | 248 | def writeEMapQueue(self, x, y, zlevel, v): 249 | x = int(x) 250 | y = int(y) 251 | # print str(x) + " , " + str(y) + " , " + str(zlevel) 252 | self.emapdata[zlevel][x][y].inqueue = v 253 | return v 254 | 255 | def writeEMap(self, x, y, zlevel, v): 256 | x = int(x) 257 | y = int(y) 258 | self.emapdata[zlevel][x][y].value = v 259 | return v 260 | 261 | def updateEMap(self, x, y, zlevel, v): 262 | mi = self.checkMap(x, y, zlevel) 263 | md = self.checkEMap(x, y, zlevel) 264 | if v[0] == "designate" and v[1] == "mining": 265 | if mi == 0: 266 | # print "Mining here: " + str(x) + ", " + str(y) + ", zlevel: " + str(zlevel) 267 | self.writeEMap(x, y, zlevel, 2) 268 | # else: 269 | # print "Cannot mine here: " + str(x) + ", " + str(y) + ", zlevel: " + str(zlevel) 270 | if v[0] == "designate" and v[1] == "remove": 271 | if md == 2: # set this to just always remove 272 | # print "Removing here: " + str(x) + ", " + str(y) + ", zlevel: " + str(zlevel) 273 | self.writeEMap(x, y, zlevel, 1) 274 | # else: 275 | # print "Cannot mine here: " + str(x) + ", " + str(y) 276 | if v[0] == "designate" and v[1] == "channel": 277 | if ( 278 | mi != 0 279 | ): # will need to fix this to appropriate tiles that can be channeled, righ now anything but walls works. 280 | # print "Channeling here: " + str(x) + ", " + str(y) + ", zlevel: " + str(zlevel) 281 | self.writeEMap(x, y, zlevel, 3) 282 | # else: 283 | # print "Cannot channel here: " + str(x) + ", " + str(y) 284 | if v[0] == "designate" and v[1] == "drop": # dropping items 285 | # only allow 1 drop off location 286 | drops = self.get_selected(4) 287 | for drop in drops: 288 | self.writeEMap(drop[0], drop[1], drop[2], 1) 289 | if mi != 0: 290 | # print "setting Drop location: " + str(x) + ", " + str(y) + ", zlevel: " + str(zlevel) 291 | self.writeEMap(x, y, zlevel, 4) 292 | # else: 293 | # print "Cannot cannot drop here: " + str(x) + ", " + str(y) 294 | 295 | def get_items_in_queue(self, x, y, z): 296 | content = self.checkMapContent(x, y, z) 297 | for item in content: 298 | if item.inqueue: 299 | return item 300 | return None 301 | 302 | def get_items(self, x, y, z): 303 | val = self.checkMapContent(x, y, z) 304 | if val is None: 305 | return None 306 | else: 307 | return val 308 | 309 | def select_items(self, x, y, z): 310 | val = self.checkMapContent(x, y, z) 311 | if val is not None: 312 | for item in val: 313 | if not item.inqueue: 314 | item.selected = True 315 | else: 316 | return None 317 | 318 | def get_selected_items(self): 319 | selected = [] 320 | for z in range(self.zlevels): 321 | for x in range(int(self.startXTile), int(self.startXTile + self.numXTiles)): 322 | for y in range( 323 | int(self.startYTile), int(self.startYTile + self.numYTiles) 324 | ): 325 | val = self.checkMapContent(x, y, z) 326 | if val is not None: 327 | for item in val: 328 | if item.selected and not item.inqueue: 329 | selected.append((x, y, z)) 330 | return selected 331 | 332 | def get_selected(self, type): 333 | # will need to fix this also at some point to adjust for zlevels 334 | selected = [] 335 | for z in range(self.zlevels): 336 | for x in range(int(self.startXTile), int(self.startXTile + self.numXTiles)): 337 | for y in range( 338 | int(self.startYTile), int(self.startYTile + self.numYTiles) 339 | ): 340 | val = self.checkEMap(x, y, z) 341 | if val == 1: 342 | continue 343 | elif val == type: 344 | selected.append((x, y, z)) 345 | return selected 346 | 347 | def move_cost(self, c1, c2): 348 | """ Calculate the cost of moving between spots on the map (Euclidean) """ 349 | return sqrt((c1[0] - c2[0]) ** 2 + (c1[1] - c2[1]) ** 2) 350 | 351 | def successors(self, c): 352 | # def successors(self, c, recurse = True): 353 | """Compute the successors of coordinate 'c': all the 354 | coordinates that can be reached by one step from 'c'. 355 | """ 356 | slist = [] 357 | calc_z = c[2] # zlevel 358 | rangez = list(range(self.zlevels)) 359 | minz = rangez.pop(0) 360 | maxz = rangez.pop() 361 | 362 | for drow in (-1, 0, 1): 363 | for dcol in (-1, 0, 1): 364 | if drow == 0 and dcol == 0: 365 | continue 366 | newrow = c[0] + drow 367 | newcol = c[1] + dcol 368 | if newrow > self.mapw - 1: 369 | continue 370 | if newcol > self.maph - 1: 371 | continue 372 | tilevalue = self.mapdata[calc_z][newrow][newcol].value 373 | tileblocked = self.mapdata[calc_z][newrow][newcol].blocked 374 | if ( 375 | 0 <= newrow <= self.mapw - 1 and 0 <= newcol <= self.maph - 1 376 | ) and not tileblocked: 377 | slist.append((newrow, newcol, calc_z)) # fire the move in the queue 378 | if ( 379 | tilevalue == 7 380 | and calc_z + 1 <= maxz 381 | and self.checkMap(newrow, newcol, calc_z + 1) == 5 382 | ): # up ramp 383 | slist.append((newrow, newcol, calc_z + 1)) 384 | elif ( 385 | tilevalue == 5 386 | and calc_z - 1 >= minz 387 | and self.checkMap(newrow, newcol, calc_z - 1) == 7 388 | ): # down ramp 389 | slist.append((newrow, newcol, calc_z - 1)) 390 | return slist 391 | 392 | def valid_move(self, c): 393 | check = self.checkMap(c[0], c[1], c[2]) 394 | if check == 5 or check == 0: 395 | return False 396 | return True 397 | 398 | def save_map(self): 399 | mapfile = open("./map.dat", "wb") 400 | pickle.dump(self.mapdata, mapfile, 2) 401 | mapfile.close 402 | 403 | def load_map(self): 404 | mapfile = open("./map.dat", "rb") 405 | self.mapdata = pickle.load(mapfile) 406 | mapfile.close 407 | 408 | def find_open_spot(self): 409 | for z in range(self.zlevels): 410 | for x in range(self.mapw): 411 | for y in range(self.maph): 412 | if self.successors((x, y, z)): 413 | val = self.checkMap(x, y, z) 414 | if val == 1: 415 | # if val == 7: 416 | return (x, y, z) 417 | -------------------------------------------------------------------------------- /intro.py: -------------------------------------------------------------------------------- 1 | try: 2 | import pygame 3 | import sys 4 | 5 | except ImportError as err: 6 | print("couldn't load module, %s" % (err)) 7 | sys.exit(2) 8 | 9 | 10 | class Intro: 11 | """This will probably be adjusted to be usable for any text screen 12 | but for now I will use it just for the intro / instructions screen""" 13 | 14 | running = True 15 | 16 | def __init__(self): 17 | self.title = "PyDF" 18 | self.textcolor = (255, 255, 255) 19 | if not pygame.font.get_init(): 20 | pygame.font.init() 21 | self.arialFnt = pygame.font.SysFont("Arial", 16) 22 | 23 | def drawText(self, text, surface, x, y): 24 | textobj = self.arialFnt.render(text, 1, self.textcolor) 25 | textrect = textobj.get_rect() 26 | textrect.topleft = (x, y) 27 | surface.blit(textobj, textrect) 28 | 29 | def waitForKey(self): 30 | while True: 31 | for event in pygame.event.get(): 32 | if event.type == pygame.QUIT: 33 | self.running = False 34 | if event.type == pygame.KEYDOWN: 35 | if event.key == pygame.K_ESCAPE: # pressing escape quits 36 | self.running = False 37 | return 38 | 39 | 40 | if __name__ == "__main__": 41 | pygame.init() 42 | screen = pygame.display.set_mode((640, 480), pygame.RESIZABLE) 43 | intro = Intro() 44 | intro.drawText("hi", screen, 10, 10) 45 | pygame.display.update() 46 | intro.waitForKey() 47 | -------------------------------------------------------------------------------- /item.cfg: -------------------------------------------------------------------------------- 1 | [crumbledwall] 2 | imagename16=crumbledwall.png 3 | imagename32=crumbledwallx32.png 4 | -------------------------------------------------------------------------------- /item.py: -------------------------------------------------------------------------------- 1 | try: 2 | 3 | import pygame 4 | import sys 5 | 6 | # from pygame.locals import * 7 | from loader import load_png 8 | from configparser import ConfigParser 9 | except ImportError as err: 10 | print("couldn't load module. %s" % (err)) 11 | sys.exit(2) 12 | 13 | 14 | class Item(pygame.sprite.Sprite): 15 | """ Item class, generic class for a sprite """ 16 | 17 | def __init__(self, name, tw): 18 | self.tw = tw 19 | config = ConfigParser() 20 | config.read_file(open("item.cfg")) 21 | sectionname = "imagename" + str(self.tw) 22 | self.movable = True # set this to false to make unmovable items. 23 | self.selected = False 24 | self.inqueue = False 25 | 26 | imagename = config.get(name, sectionname) 27 | self.image, self.rect = load_png(imagename) 28 | self.name = name 29 | self.surface = pygame.transform.scale(self.image, (self.tw, self.tw)) 30 | 31 | def __repr__(self): 32 | return self.name 33 | -------------------------------------------------------------------------------- /job.py: -------------------------------------------------------------------------------- 1 | class Job(object): 2 | """ Job class, generic class for a job """ 3 | 4 | def __init__(self, name, move, dest): 5 | self.name = name 6 | self.move = move 7 | self.dest = dest 8 | 9 | def __repr__(self): 10 | return self.name 11 | -------------------------------------------------------------------------------- /loader.py: -------------------------------------------------------------------------------- 1 | try: 2 | import pygame 3 | import sys 4 | import os 5 | except ImportError as err: 6 | print("couldn't load module. %s" % (err)) 7 | sys.exit(2) 8 | 9 | 10 | def load_font(name, size): 11 | """Load up a font file, or try to use the default None(system font)""" 12 | fullname = os.path.join("data", name) 13 | try: 14 | font = pygame.font.Font(fullname, size) 15 | except pygame.error as message: 16 | print(f"Cannot load font file: {fullname}, error: {message}") 17 | else: 18 | font = pygame.font.SysFont(None, size) 19 | return font 20 | 21 | 22 | def load_sound(name): 23 | """ Load the sound file from the data directory, return sound """ 24 | fullname = os.path.join("data", name) 25 | try: 26 | sound = pygame.mixer.Sound(fullname) 27 | except pygame.error as message: 28 | print("Cannot load sound file: ", fullname) 29 | raise SystemExit(message) 30 | return sound 31 | 32 | 33 | def load_png(name): 34 | """ Load image and return image object """ 35 | fullname = os.path.join("data", name) 36 | try: 37 | image = pygame.image.load(fullname) 38 | if image.get_alpha() is None: 39 | image = image.convert() 40 | else: 41 | image = image.convert_alpha() 42 | except pygame.error as message: 43 | print("Cannot load image: ", fullname) 44 | raise SystemExit(message) 45 | return image, image.get_rect() 46 | -------------------------------------------------------------------------------- /main.cfg: -------------------------------------------------------------------------------- 1 | [main] 2 | fullscreen=False 3 | fullscreenwidth=1900 4 | fullscreenheight=1200 5 | windowedwidth=1280 6 | windowedheight=1024 7 | tilewidth=32 8 | mapwidth=100 9 | mapheight=100 10 | -------------------------------------------------------------------------------- /main.py: -------------------------------------------------------------------------------- 1 | try: 2 | import sys 3 | from engine import Engine 4 | except ImportError as err: 5 | print("couldn't load module, %s" % (err)) 6 | sys.exit(2) 7 | 8 | # giver 9 | if __name__ == "__main__": 10 | e = Engine() 11 | e.run() 12 | -------------------------------------------------------------------------------- /maptile.py: -------------------------------------------------------------------------------- 1 | try: 2 | import sys 3 | from item import Item 4 | except ImportError as err: 5 | print("couldn't load module. %s" % (err)) 6 | sys.exit(2) 7 | 8 | 9 | class MapTile: 10 | """ MapTile class, generic class for a tile """ 11 | 12 | def __init__(self, value): 13 | self.value = value 14 | self.content = [] 15 | self.mobs = [] 16 | if int(self.value) == int(0) or int(self.value) == int(5): 17 | self.blocked = True 18 | else: 19 | self.blocked = False 20 | 21 | def digTile(self, value): 22 | self.value = value 23 | self.add(Item("crumbledwall", 16)) 24 | 25 | def addMob(self, mob): 26 | self.mobs.append(mob) 27 | return self.mobs 28 | 29 | def removeMob(self, mob): 30 | self.mobs.append(mob) 31 | return self.mobs 32 | 33 | def add(self, content): 34 | self.content.append(content) 35 | return self.content 36 | 37 | def remove(self, content): 38 | self.content.remove(content) 39 | return self.content 40 | 41 | def pickup(self): 42 | for item in self.content: 43 | if item.selected: 44 | val = item 45 | self.remove(item) 46 | return val 47 | return None 48 | -------------------------------------------------------------------------------- /mob.cfg: -------------------------------------------------------------------------------- 1 | [mob] 2 | imagename16=dorf.png 3 | imagename32=dorfx32.png 4 | -------------------------------------------------------------------------------- /mob.py: -------------------------------------------------------------------------------- 1 | try: 2 | import pygame 3 | import sys 4 | 5 | # from time import time 6 | # import pprint 7 | from loader import load_png 8 | import configparser 9 | except ImportError as err: 10 | print("couldn't load module. %s" % (err)) 11 | sys.exit(2) 12 | 13 | 14 | class Mob(pygame.sprite.Sprite): 15 | """ Mob class, generic class for a sprite """ 16 | 17 | def __init__(self, position, tw): 18 | self.tw = tw 19 | config = configparser.ConfigParser() 20 | config.read_file(open("mob.cfg")) 21 | imageset = "imagename" + str(self.tw) 22 | imagename = config.get("mob", imageset) 23 | self.image, self.rect = load_png(imagename) 24 | self.position = position 25 | self.miningskill = 5 26 | self.name = "Jimmy" 27 | self.surface = pygame.transform.scale(self.image, (self.tw, self.tw)) 28 | self.pathlines = [] 29 | self.job = None 30 | self.skillcounter = 0 31 | self.carrying = None 32 | 33 | def pickupitem(self, item): 34 | self.carrying = item 35 | 36 | def __repr__(self): 37 | return self.name 38 | -------------------------------------------------------------------------------- /noise.py: -------------------------------------------------------------------------------- 1 | from random import shuffle 2 | 3 | # from math import * 4 | 5 | 6 | class Noise(object): 7 | def __init__(self, width, height, tw): 8 | self.width = width 9 | self.height = height 10 | # self.zlevels = zlevels 11 | self.tw = tw # In nodes 12 | self.repeats = 1 # 1 #number of repetitions on screen 13 | 14 | self.tilesize = float(self.width) / self.repeats 15 | self.tilesize /= self.tw 16 | self.p = [] 17 | for x in range(2 * self.tw): 18 | self.p.append(0) 19 | 20 | self.permutation = [] 21 | for value in range(self.tw): 22 | self.permutation.append(value) 23 | shuffle(self.permutation) 24 | 25 | for i in range(self.tw): 26 | self.p[i] = self.permutation[i] 27 | self.p[self.tw + i] = self.p[i] 28 | 29 | def fade(self, t): 30 | return t * t * t * (t * (t * 6 - 15) + 10) 31 | 32 | def lerp(self, t, a, b): 33 | return a + t * (b - a) 34 | 35 | def grad(self, hash, x, y, z): 36 | # CONVERT LO 4 BITS OF HASH CODE INTO 12 GRADIENT DIRECTIONS. 37 | h = hash & 15 38 | if h < 8: 39 | u = x 40 | else: 41 | u = y 42 | if h < 4: 43 | v = y 44 | else: 45 | if h == 12 or h == 14: 46 | v = x 47 | else: 48 | v = z 49 | if h & 1 == 0: 50 | first = u 51 | else: 52 | first = -u 53 | if h & 2 == 0: 54 | second = v 55 | else: 56 | second = -v 57 | return first + second 58 | 59 | def noise(self, x, y, z): 60 | # FIND UNIT CUBE THAT CONTAINS POINT. 61 | X = int(x) & (self.tw - 1) 62 | Y = int(y) & (self.tw - 1) 63 | Z = int(z) & (self.tw - 1) 64 | # FIND RELATIVE X,Y,Z OF POINT IN CUBE. 65 | x -= int(x) 66 | y -= int(y) 67 | z -= int(z) 68 | # COMPUTE FADE CURVES FOR EACH OF X,Y,Z. 69 | u = self.fade(x) 70 | v = self.fade(y) 71 | w = self.fade(z) 72 | # HASH COORDINATES OF THE 8 CUBE CORNERS 73 | A = self.p[X] + Y 74 | AA = self.p[A] + Z 75 | AB = self.p[A + 1] + Z 76 | B = self.p[X + 1] + Y 77 | BA = self.p[B] + Z 78 | BB = self.p[B + 1] + Z 79 | # AND ADD BLENDED RESULTS FROM 8 CORNERS OF CUBE 80 | return self.lerp( 81 | w, 82 | self.lerp( 83 | v, 84 | self.lerp( 85 | u, 86 | self.grad(self.p[AA], x, y, z), 87 | self.grad(self.p[BA], x - 1, y, z), 88 | ), 89 | self.lerp( 90 | u, 91 | self.grad(self.p[AB], x, y - 1, z), 92 | self.grad(self.p[BB], x - 1, y - 1, z), 93 | ), 94 | ), 95 | self.lerp( 96 | v, 97 | self.lerp( 98 | u, 99 | self.grad(self.p[AA + 1], x, y, z - 1), 100 | self.grad(self.p[BA + 1], x - 1, y, z - 1), 101 | ), 102 | self.lerp( 103 | u, 104 | self.grad(self.p[AB + 1], x, y - 1, z - 1), 105 | self.grad(self.p[BB + 1], x - 1, y - 1, z - 1), 106 | ), 107 | ), 108 | ) 109 | 110 | def generate(self): 111 | octaves = 2 # 8 seems decent but using 2 for speed 112 | # octaves = 1 113 | persistence = 0.25 114 | # persistence = 0.8 115 | 116 | amplitude = 1.0 117 | maxamplitude = 1.0 118 | mapdata = [[0 for cols in range(self.height)] for rows in range(self.width)] 119 | for octave in range(octaves): 120 | amplitude *= persistence 121 | maxamplitude += amplitude 122 | for x in range(self.width): 123 | for y in range(self.height): 124 | sc = float(self.width) / self.tilesize 125 | frequency = 1.0 126 | amplitude = 1.0 127 | color = 0.0 128 | for octave in range(octaves): 129 | sc *= frequency 130 | grey = abs( 131 | self.noise( 132 | sc * float(x) / self.width, 133 | sc * float(y) / self.height, 134 | 0.0, 135 | ) 136 | ) # Turbulence noise in theory 137 | # grey = self.noise(sc*float(x)/self.width,sc*float(y)/self.height,0.0) # regular perlin 138 | # grey = self.noise(sc*float(x)/self.width,sc*float(y)/self.height,sc*float(z)/self.zlevels) 139 | # grey = noise(sc*float(x)/width,sc*float(y)/height,0.0) 140 | grey = (grey + 1.0) / 2.0 141 | grey *= amplitude 142 | color += grey 143 | frequency *= 2.0 144 | amplitude *= persistence 145 | color /= maxamplitude 146 | color = int( 147 | round(color * 100.0) 148 | ) # If you adjust the multiplyer you need to adjust the tile mappings in gamemap.py 149 | # color = int(round(color*255.0)) 150 | mapdata[x][y] = color 151 | return mapdata 152 | 153 | def printme(self, mapdata): 154 | for x in range(self.width): 155 | for y in range(self.height): 156 | print(str(mapdata[x][y]), end=" ") 157 | print("") 158 | 159 | 160 | if __name__ == "__main__": 161 | n = Noise(10, 10, 16) 162 | map = n.generate() 163 | n.printme(map) 164 | -------------------------------------------------------------------------------- /pathfinder.py: -------------------------------------------------------------------------------- 1 | from priorityqueueset import PriorityQueueSet 2 | 3 | 4 | class PathFinder: 5 | """Computes a path in a graph using the A* algorithm. 6 | 7 | Initialize the object and then repeatedly compute_path to 8 | get the path between a start point and an end point. 9 | 10 | The points on a graph are required to be hashable and 11 | comparable with __eq__. Other than that, they may be 12 | represented as you wish, as long as the functions 13 | supplied to the constructor know how to handle them. 14 | """ 15 | 16 | def __init__(self, successors, move_cost, heuristic_to_goal): 17 | """Create a new PathFinder. Provided with several 18 | functions that represent your graph and the costs of 19 | moving through it. 20 | 21 | successors: 22 | A function that receives a point as a single 23 | argument and returns a list of "successor" points, 24 | the points on the graph that can be reached from 25 | the given point. 26 | 27 | move_cost: 28 | A function that receives two points as arguments 29 | and returns the numeric cost of moving from the 30 | first to the second. 31 | 32 | heuristic_to_goal: 33 | A function that receives a point and a goal point, 34 | and returns the numeric heuristic estimation of 35 | the cost of reaching the goal from the point. 36 | """ 37 | self.successors = successors 38 | self.move_cost = move_cost 39 | self.heuristic_to_goal = heuristic_to_goal 40 | 41 | def compute_path(self, start, goal): 42 | """Compute the path between the 'start' point and the 43 | 'goal' point. 44 | 45 | The path is returned as an iterator to the points, 46 | including the start and goal points themselves. 47 | 48 | If no path was found, an empty list is returned. 49 | """ 50 | # 51 | # Implementation of the A* algorithm. 52 | # 53 | closed_set = {} 54 | 55 | start_node = self._Node(start) 56 | start_node.g_cost = 0 57 | start_node.f_cost = self._compute_f_cost(start_node, goal) 58 | 59 | open_set = PriorityQueueSet() 60 | open_set.add(start_node) 61 | 62 | while len(open_set) > 0: 63 | # Remove and get the node with the lowest f_score from 64 | # the open set 65 | # 66 | curr_node = open_set.pop_smallest() 67 | 68 | if curr_node.coord == goal: 69 | return self._reconstruct_path(curr_node) 70 | 71 | closed_set[curr_node] = curr_node 72 | 73 | for succ_coord in self.successors(curr_node.coord): 74 | succ_node = self._Node(succ_coord) 75 | succ_node.g_cost = self._compute_g_cost(curr_node, succ_node) 76 | succ_node.f_cost = self._compute_f_cost(succ_node, goal) 77 | 78 | if succ_node in closed_set: 79 | continue 80 | 81 | if open_set.add(succ_node): 82 | succ_node.pred = curr_node 83 | 84 | return [] 85 | 86 | # PRIVATE 87 | 88 | def _compute_g_cost(self, from_node, to_node): 89 | return from_node.g_cost + self.move_cost(from_node.coord, to_node.coord) 90 | 91 | def _compute_f_cost(self, node, goal): 92 | return node.g_cost + self._cost_to_goal(node, goal) 93 | 94 | def _cost_to_goal(self, node, goal): 95 | return self.heuristic_to_goal(node.coord, goal) 96 | 97 | def _reconstruct_path(self, node): 98 | """Reconstructs the path to the node from the start node 99 | (for which .pred is None) 100 | """ 101 | pth = [node.coord] 102 | n = node 103 | while n.pred: 104 | n = n.pred 105 | pth.append(n.coord) 106 | 107 | return reversed(pth) 108 | 109 | class _Node(object): 110 | """Used to represent a node on the searched graph during 111 | the A* search. 112 | 113 | Each Node has its coordinate (the point it represents), 114 | a g_cost (the cumulative cost of reaching the point 115 | from the start point), a f_cost (the estimated cost 116 | from the start to the goal through this point) and 117 | a predecessor Node (for path construction). 118 | 119 | The Node is meant to be used inside PriorityQueueSet, 120 | so it implements equality and hashinig (based on the 121 | coordinate, which is assumed to be unique) and 122 | comparison (based on f_cost) for sorting by cost. 123 | """ 124 | 125 | def __init__(self, coord, g_cost=None, f_cost=None, pred=None): 126 | self.coord = coord 127 | self.g_cost = g_cost 128 | self.f_cost = f_cost 129 | self.pred = pred 130 | 131 | def __eq__(self, other): 132 | return self.coord == other.coord 133 | 134 | def __lt__(self, other): 135 | return self.f_cost < other.f_cost 136 | 137 | def __gt__(self, other): 138 | return self.f_cost > other.f_cost 139 | 140 | # apperantly this isn't in python 3 anymore 141 | # def __cmp__(self, other): 142 | # print(f"self {self}: other: {other}") 143 | # return cmp(self.f_cost, other.f_cost) 144 | 145 | def __hash__(self): 146 | return hash(self.coord) 147 | 148 | def __str__(self): 149 | return "N(%s) -> g: %s, f: %s" % (self.coord, self.g_cost, self.f_cost) 150 | 151 | def __repr__(self): 152 | return self.__str__() 153 | -------------------------------------------------------------------------------- /poetry.lock: -------------------------------------------------------------------------------- 1 | [[package]] 2 | name = "appdirs" 3 | version = "1.4.4" 4 | description = "A small Python module for determining appropriate platform-specific dirs, e.g. a \"user data dir\"." 5 | category = "dev" 6 | optional = false 7 | python-versions = "*" 8 | 9 | [[package]] 10 | name = "appnope" 11 | version = "0.1.2" 12 | description = "Disable App Nap on macOS >= 10.9" 13 | category = "dev" 14 | optional = false 15 | python-versions = "*" 16 | 17 | [[package]] 18 | name = "astroid" 19 | version = "2.4.2" 20 | description = "An abstract syntax tree for Python with inference support." 21 | category = "dev" 22 | optional = false 23 | python-versions = ">=3.5" 24 | 25 | [package.dependencies] 26 | lazy-object-proxy = ">=1.4.0,<1.5.0" 27 | six = ">=1.12,<2.0" 28 | wrapt = ">=1.11,<2.0" 29 | 30 | [[package]] 31 | name = "backcall" 32 | version = "0.2.0" 33 | description = "Specifications for callback functions passed in to an API" 34 | category = "dev" 35 | optional = false 36 | python-versions = "*" 37 | 38 | [[package]] 39 | name = "black" 40 | version = "20.8b1" 41 | description = "The uncompromising code formatter." 42 | category = "dev" 43 | optional = false 44 | python-versions = ">=3.6" 45 | 46 | [package.dependencies] 47 | appdirs = "*" 48 | click = ">=7.1.2" 49 | mypy-extensions = ">=0.4.3" 50 | pathspec = ">=0.6,<1" 51 | regex = ">=2020.1.8" 52 | toml = ">=0.10.1" 53 | typed-ast = ">=1.4.0" 54 | typing-extensions = ">=3.7.4" 55 | 56 | [package.extras] 57 | colorama = ["colorama (>=0.4.3)"] 58 | d = ["aiohttp (>=3.3.2)", "aiohttp-cors"] 59 | 60 | [[package]] 61 | name = "click" 62 | version = "7.1.2" 63 | description = "Composable command line interface toolkit" 64 | category = "dev" 65 | optional = false 66 | python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" 67 | 68 | [[package]] 69 | name = "colorama" 70 | version = "0.4.4" 71 | description = "Cross-platform colored terminal text." 72 | category = "dev" 73 | optional = false 74 | python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" 75 | 76 | [[package]] 77 | name = "decorator" 78 | version = "4.4.2" 79 | description = "Decorators for Humans" 80 | category = "dev" 81 | optional = false 82 | python-versions = ">=2.6, !=3.0.*, !=3.1.*" 83 | 84 | [[package]] 85 | name = "flake8" 86 | version = "3.8.4" 87 | description = "the modular source code checker: pep8 pyflakes and co" 88 | category = "dev" 89 | optional = false 90 | python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,>=2.7" 91 | 92 | [package.dependencies] 93 | mccabe = ">=0.6.0,<0.7.0" 94 | pycodestyle = ">=2.6.0a1,<2.7.0" 95 | pyflakes = ">=2.2.0,<2.3.0" 96 | 97 | [[package]] 98 | name = "greenlet" 99 | version = "1.1.0" 100 | description = "Lightweight in-process concurrent programming" 101 | category = "dev" 102 | optional = false 103 | python-versions = ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*" 104 | 105 | [package.extras] 106 | docs = ["sphinx"] 107 | 108 | [[package]] 109 | name = "ipython" 110 | version = "7.20.0" 111 | description = "IPython: Productive Interactive Computing" 112 | category = "dev" 113 | optional = false 114 | python-versions = ">=3.7" 115 | 116 | [package.dependencies] 117 | appnope = {version = "*", markers = "sys_platform == \"darwin\""} 118 | backcall = "*" 119 | colorama = {version = "*", markers = "sys_platform == \"win32\""} 120 | decorator = "*" 121 | jedi = ">=0.16" 122 | pexpect = {version = ">4.3", markers = "sys_platform != \"win32\""} 123 | pickleshare = "*" 124 | prompt-toolkit = ">=2.0.0,<3.0.0 || >3.0.0,<3.0.1 || >3.0.1,<3.1.0" 125 | pygments = "*" 126 | traitlets = ">=4.2" 127 | 128 | [package.extras] 129 | all = ["Sphinx (>=1.3)", "ipykernel", "ipyparallel", "ipywidgets", "nbconvert", "nbformat", "nose (>=0.10.1)", "notebook", "numpy (>=1.14)", "pygments", "qtconsole", "requests", "testpath"] 130 | doc = ["Sphinx (>=1.3)"] 131 | kernel = ["ipykernel"] 132 | nbconvert = ["nbconvert"] 133 | nbformat = ["nbformat"] 134 | notebook = ["notebook", "ipywidgets"] 135 | parallel = ["ipyparallel"] 136 | qtconsole = ["qtconsole"] 137 | test = ["nose (>=0.10.1)", "requests", "testpath", "pygments", "nbformat", "ipykernel", "numpy (>=1.14)"] 138 | 139 | [[package]] 140 | name = "ipython-genutils" 141 | version = "0.2.0" 142 | description = "Vestigial utilities from IPython" 143 | category = "dev" 144 | optional = false 145 | python-versions = "*" 146 | 147 | [[package]] 148 | name = "isort" 149 | version = "5.7.0" 150 | description = "A Python utility / library to sort Python imports." 151 | category = "dev" 152 | optional = false 153 | python-versions = ">=3.6,<4.0" 154 | 155 | [package.extras] 156 | pipfile_deprecated_finder = ["pipreqs", "requirementslib"] 157 | requirements_deprecated_finder = ["pipreqs", "pip-api"] 158 | colors = ["colorama (>=0.4.3,<0.5.0)"] 159 | 160 | [[package]] 161 | name = "jedi" 162 | version = "0.18.0" 163 | description = "An autocompletion tool for Python that can be used for text editors." 164 | category = "dev" 165 | optional = false 166 | python-versions = ">=3.6" 167 | 168 | [package.dependencies] 169 | parso = ">=0.8.0,<0.9.0" 170 | 171 | [package.extras] 172 | qa = ["flake8 (==3.8.3)", "mypy (==0.782)"] 173 | testing = ["Django (<3.1)", "colorama", "docopt", "pytest (<6.0.0)"] 174 | 175 | [[package]] 176 | name = "lazy-object-proxy" 177 | version = "1.4.3" 178 | description = "A fast and thorough lazy object proxy." 179 | category = "dev" 180 | optional = false 181 | python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" 182 | 183 | [[package]] 184 | name = "mccabe" 185 | version = "0.6.1" 186 | description = "McCabe checker, plugin for flake8" 187 | category = "dev" 188 | optional = false 189 | python-versions = "*" 190 | 191 | [[package]] 192 | name = "msgpack" 193 | version = "1.0.2" 194 | description = "MessagePack (de)serializer." 195 | category = "dev" 196 | optional = false 197 | python-versions = "*" 198 | 199 | [[package]] 200 | name = "mypy-extensions" 201 | version = "0.4.3" 202 | description = "Experimental type system extensions for programs checked with the mypy typechecker." 203 | category = "dev" 204 | optional = false 205 | python-versions = "*" 206 | 207 | [[package]] 208 | name = "neovim" 209 | version = "0.3.1" 210 | description = "Transition packgage for pynvim" 211 | category = "dev" 212 | optional = false 213 | python-versions = "*" 214 | 215 | [package.dependencies] 216 | pynvim = ">=0.3.1" 217 | 218 | [[package]] 219 | name = "parso" 220 | version = "0.8.1" 221 | description = "A Python Parser" 222 | category = "dev" 223 | optional = false 224 | python-versions = ">=3.6" 225 | 226 | [package.extras] 227 | qa = ["flake8 (==3.8.3)", "mypy (==0.782)"] 228 | testing = ["docopt", "pytest (<6.0.0)"] 229 | 230 | [[package]] 231 | name = "pathspec" 232 | version = "0.8.1" 233 | description = "Utility library for gitignore style pattern matching of file paths." 234 | category = "dev" 235 | optional = false 236 | python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" 237 | 238 | [[package]] 239 | name = "pexpect" 240 | version = "4.8.0" 241 | description = "Pexpect allows easy control of interactive console applications." 242 | category = "dev" 243 | optional = false 244 | python-versions = "*" 245 | 246 | [package.dependencies] 247 | ptyprocess = ">=0.5" 248 | 249 | [[package]] 250 | name = "pickleshare" 251 | version = "0.7.5" 252 | description = "Tiny 'shelve'-like database with concurrency support" 253 | category = "dev" 254 | optional = false 255 | python-versions = "*" 256 | 257 | [[package]] 258 | name = "prompt-toolkit" 259 | version = "3.0.14" 260 | description = "Library for building powerful interactive command lines in Python" 261 | category = "dev" 262 | optional = false 263 | python-versions = ">=3.6.1" 264 | 265 | [package.dependencies] 266 | wcwidth = "*" 267 | 268 | [[package]] 269 | name = "ptyprocess" 270 | version = "0.7.0" 271 | description = "Run a subprocess in a pseudo terminal" 272 | category = "dev" 273 | optional = false 274 | python-versions = "*" 275 | 276 | [[package]] 277 | name = "pycodestyle" 278 | version = "2.6.0" 279 | description = "Python style guide checker" 280 | category = "dev" 281 | optional = false 282 | python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" 283 | 284 | [[package]] 285 | name = "pyflakes" 286 | version = "2.2.0" 287 | description = "passive checker of Python programs" 288 | category = "dev" 289 | optional = false 290 | python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" 291 | 292 | [[package]] 293 | name = "pygame" 294 | version = "2.0.1" 295 | description = "Python Game Development" 296 | category = "main" 297 | optional = false 298 | python-versions = "*" 299 | 300 | [[package]] 301 | name = "pygments" 302 | version = "2.7.4" 303 | description = "Pygments is a syntax highlighting package written in Python." 304 | category = "dev" 305 | optional = false 306 | python-versions = ">=3.5" 307 | 308 | [[package]] 309 | name = "pylint" 310 | version = "2.6.0" 311 | description = "python code static checker" 312 | category = "dev" 313 | optional = false 314 | python-versions = ">=3.5.*" 315 | 316 | [package.dependencies] 317 | astroid = ">=2.4.0,<=2.5" 318 | colorama = {version = "*", markers = "sys_platform == \"win32\""} 319 | isort = ">=4.2.5,<6" 320 | mccabe = ">=0.6,<0.7" 321 | toml = ">=0.7.1" 322 | 323 | [[package]] 324 | name = "pynvim" 325 | version = "0.4.3" 326 | description = "Python client to neovim" 327 | category = "dev" 328 | optional = false 329 | python-versions = "*" 330 | 331 | [package.dependencies] 332 | greenlet = "*" 333 | msgpack = ">=0.5.0" 334 | 335 | [package.extras] 336 | pyuv = ["pyuv (>=1.0.0)"] 337 | test = ["pytest (>=3.4.0)"] 338 | 339 | [[package]] 340 | name = "regex" 341 | version = "2020.11.13" 342 | description = "Alternative regular expression module, to replace re." 343 | category = "dev" 344 | optional = false 345 | python-versions = "*" 346 | 347 | [[package]] 348 | name = "six" 349 | version = "1.15.0" 350 | description = "Python 2 and 3 compatibility utilities" 351 | category = "dev" 352 | optional = false 353 | python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*" 354 | 355 | [[package]] 356 | name = "toml" 357 | version = "0.10.2" 358 | description = "Python Library for Tom's Obvious, Minimal Language" 359 | category = "dev" 360 | optional = false 361 | python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*" 362 | 363 | [[package]] 364 | name = "traitlets" 365 | version = "5.0.5" 366 | description = "Traitlets Python configuration system" 367 | category = "dev" 368 | optional = false 369 | python-versions = ">=3.7" 370 | 371 | [package.dependencies] 372 | ipython-genutils = "*" 373 | 374 | [package.extras] 375 | test = ["pytest"] 376 | 377 | [[package]] 378 | name = "typed-ast" 379 | version = "1.4.2" 380 | description = "a fork of Python 2 and 3 ast modules with type comment support" 381 | category = "dev" 382 | optional = false 383 | python-versions = "*" 384 | 385 | [[package]] 386 | name = "typing-extensions" 387 | version = "3.7.4.3" 388 | description = "Backported and Experimental Type Hints for Python 3.5+" 389 | category = "dev" 390 | optional = false 391 | python-versions = "*" 392 | 393 | [[package]] 394 | name = "wcwidth" 395 | version = "0.2.5" 396 | description = "Measures the displayed width of unicode strings in a terminal" 397 | category = "dev" 398 | optional = false 399 | python-versions = "*" 400 | 401 | [[package]] 402 | name = "wrapt" 403 | version = "1.12.1" 404 | description = "Module for decorators, wrappers and monkey patching." 405 | category = "dev" 406 | optional = false 407 | python-versions = "*" 408 | 409 | [metadata] 410 | lock-version = "1.1" 411 | python-versions = "^3.9" 412 | content-hash = "7ae79887152d46b79ba63f8edc9e63341639cecc313a4dcba0ce0ffcbfd20e20" 413 | 414 | [metadata.files] 415 | appdirs = [ 416 | {file = "appdirs-1.4.4-py2.py3-none-any.whl", hash = "sha256:a841dacd6b99318a741b166adb07e19ee71a274450e68237b4650ca1055ab128"}, 417 | {file = "appdirs-1.4.4.tar.gz", hash = "sha256:7d5d0167b2b1ba821647616af46a749d1c653740dd0d2415100fe26e27afdf41"}, 418 | ] 419 | appnope = [ 420 | {file = "appnope-0.1.2-py2.py3-none-any.whl", hash = "sha256:93aa393e9d6c54c5cd570ccadd8edad61ea0c4b9ea7a01409020c9aa019eb442"}, 421 | {file = "appnope-0.1.2.tar.gz", hash = "sha256:dd83cd4b5b460958838f6eb3000c660b1f9caf2a5b1de4264e941512f603258a"}, 422 | ] 423 | astroid = [ 424 | {file = "astroid-2.4.2-py3-none-any.whl", hash = "sha256:bc58d83eb610252fd8de6363e39d4f1d0619c894b0ed24603b881c02e64c7386"}, 425 | {file = "astroid-2.4.2.tar.gz", hash = "sha256:2f4078c2a41bf377eea06d71c9d2ba4eb8f6b1af2135bec27bbbb7d8f12bb703"}, 426 | ] 427 | backcall = [ 428 | {file = "backcall-0.2.0-py2.py3-none-any.whl", hash = "sha256:fbbce6a29f263178a1f7915c1940bde0ec2b2a967566fe1c65c1dfb7422bd255"}, 429 | {file = "backcall-0.2.0.tar.gz", hash = "sha256:5cbdbf27be5e7cfadb448baf0aa95508f91f2bbc6c6437cd9cd06e2a4c215e1e"}, 430 | ] 431 | black = [ 432 | {file = "black-20.8b1.tar.gz", hash = "sha256:1c02557aa099101b9d21496f8a914e9ed2222ef70336404eeeac8edba836fbea"}, 433 | ] 434 | click = [ 435 | {file = "click-7.1.2-py2.py3-none-any.whl", hash = "sha256:dacca89f4bfadd5de3d7489b7c8a566eee0d3676333fbb50030263894c38c0dc"}, 436 | {file = "click-7.1.2.tar.gz", hash = "sha256:d2b5255c7c6349bc1bd1e59e08cd12acbbd63ce649f2588755783aa94dfb6b1a"}, 437 | ] 438 | colorama = [ 439 | {file = "colorama-0.4.4-py2.py3-none-any.whl", hash = "sha256:9f47eda37229f68eee03b24b9748937c7dc3868f906e8ba69fbcbdd3bc5dc3e2"}, 440 | {file = "colorama-0.4.4.tar.gz", hash = "sha256:5941b2b48a20143d2267e95b1c2a7603ce057ee39fd88e7329b0c292aa16869b"}, 441 | ] 442 | decorator = [ 443 | {file = "decorator-4.4.2-py2.py3-none-any.whl", hash = "sha256:41fa54c2a0cc4ba648be4fd43cff00aedf5b9465c9bf18d64325bc225f08f760"}, 444 | {file = "decorator-4.4.2.tar.gz", hash = "sha256:e3a62f0520172440ca0dcc823749319382e377f37f140a0b99ef45fecb84bfe7"}, 445 | ] 446 | flake8 = [ 447 | {file = "flake8-3.8.4-py2.py3-none-any.whl", hash = "sha256:749dbbd6bfd0cf1318af27bf97a14e28e5ff548ef8e5b1566ccfb25a11e7c839"}, 448 | {file = "flake8-3.8.4.tar.gz", hash = "sha256:aadae8761ec651813c24be05c6f7b4680857ef6afaae4651a4eccaef97ce6c3b"}, 449 | ] 450 | greenlet = [ 451 | {file = "greenlet-1.1.0-cp27-cp27m-macosx_10_14_x86_64.whl", hash = "sha256:60848099b76467ef09b62b0f4512e7e6f0a2c977357a036de602b653667f5f4c"}, 452 | {file = "greenlet-1.1.0-cp27-cp27m-manylinux1_x86_64.whl", hash = "sha256:f42ad188466d946f1b3afc0a9e1a266ac8926461ee0786c06baac6bd71f8a6f3"}, 453 | {file = "greenlet-1.1.0-cp27-cp27m-manylinux2010_x86_64.whl", hash = "sha256:76ed710b4e953fc31c663b079d317c18f40235ba2e3d55f70ff80794f7b57922"}, 454 | {file = "greenlet-1.1.0-cp27-cp27m-win32.whl", hash = "sha256:b33b51ab057f8a20b497ffafdb1e79256db0c03ef4f5e3d52e7497200e11f821"}, 455 | {file = "greenlet-1.1.0-cp27-cp27m-win_amd64.whl", hash = "sha256:ed1377feed808c9c1139bdb6a61bcbf030c236dd288d6fca71ac26906ab03ba6"}, 456 | {file = "greenlet-1.1.0-cp27-cp27mu-manylinux1_x86_64.whl", hash = "sha256:da862b8f7de577bc421323714f63276acb2f759ab8c5e33335509f0b89e06b8f"}, 457 | {file = "greenlet-1.1.0-cp27-cp27mu-manylinux2010_x86_64.whl", hash = "sha256:5f75e7f237428755d00e7460239a2482fa7e3970db56c8935bd60da3f0733e56"}, 458 | {file = "greenlet-1.1.0-cp310-cp310-macosx_10_14_x86_64.whl", hash = "sha256:258f9612aba0d06785143ee1cbf2d7361801c95489c0bd10c69d163ec5254a16"}, 459 | {file = "greenlet-1.1.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5d928e2e3c3906e0a29b43dc26d9b3d6e36921eee276786c4e7ad9ff5665c78a"}, 460 | {file = "greenlet-1.1.0-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:cc407b68e0a874e7ece60f6639df46309376882152345508be94da608cc0b831"}, 461 | {file = "greenlet-1.1.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0c557c809eeee215b87e8a7cbfb2d783fb5598a78342c29ade561440abae7d22"}, 462 | {file = "greenlet-1.1.0-cp35-cp35m-macosx_10_14_x86_64.whl", hash = "sha256:3d13da093d44dee7535b91049e44dd2b5540c2a0e15df168404d3dd2626e0ec5"}, 463 | {file = "greenlet-1.1.0-cp35-cp35m-manylinux1_x86_64.whl", hash = "sha256:b3090631fecdf7e983d183d0fad7ea72cfb12fa9212461a9b708ff7907ffff47"}, 464 | {file = "greenlet-1.1.0-cp35-cp35m-manylinux2010_x86_64.whl", hash = "sha256:06ecb43b04480e6bafc45cb1b4b67c785e183ce12c079473359e04a709333b08"}, 465 | {file = "greenlet-1.1.0-cp35-cp35m-win32.whl", hash = "sha256:944fbdd540712d5377a8795c840a97ff71e7f3221d3fddc98769a15a87b36131"}, 466 | {file = "greenlet-1.1.0-cp35-cp35m-win_amd64.whl", hash = "sha256:c767458511a59f6f597bfb0032a1c82a52c29ae228c2c0a6865cfeaeaac4c5f5"}, 467 | {file = "greenlet-1.1.0-cp36-cp36m-macosx_10_14_x86_64.whl", hash = "sha256:2325123ff3a8ecc10ca76f062445efef13b6cf5a23389e2df3c02a4a527b89bc"}, 468 | {file = "greenlet-1.1.0-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:598bcfd841e0b1d88e32e6a5ea48348a2c726461b05ff057c1b8692be9443c6e"}, 469 | {file = "greenlet-1.1.0-cp36-cp36m-manylinux2010_x86_64.whl", hash = "sha256:be9768e56f92d1d7cd94185bab5856f3c5589a50d221c166cc2ad5eb134bd1dc"}, 470 | {file = "greenlet-1.1.0-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:dfe7eac0d253915116ed0cd160a15a88981a1d194c1ef151e862a5c7d2f853d3"}, 471 | {file = "greenlet-1.1.0-cp36-cp36m-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:9a6b035aa2c5fcf3dbbf0e3a8a5bc75286fc2d4e6f9cfa738788b433ec894919"}, 472 | {file = "greenlet-1.1.0-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ca1c4a569232c063615f9e70ff9a1e2fee8c66a6fb5caf0f5e8b21a396deec3e"}, 473 | {file = "greenlet-1.1.0-cp36-cp36m-win32.whl", hash = "sha256:3096286a6072553b5dbd5efbefc22297e9d06a05ac14ba017233fedaed7584a8"}, 474 | {file = "greenlet-1.1.0-cp36-cp36m-win_amd64.whl", hash = "sha256:c35872b2916ab5a240d52a94314c963476c989814ba9b519bc842e5b61b464bb"}, 475 | {file = "greenlet-1.1.0-cp37-cp37m-macosx_10_14_x86_64.whl", hash = "sha256:b97c9a144bbeec7039cca44df117efcbeed7209543f5695201cacf05ba3b5857"}, 476 | {file = "greenlet-1.1.0-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:16183fa53bc1a037c38d75fdc59d6208181fa28024a12a7f64bb0884434c91ea"}, 477 | {file = "greenlet-1.1.0-cp37-cp37m-manylinux2010_x86_64.whl", hash = "sha256:6b1d08f2e7f2048d77343279c4d4faa7aef168b3e36039cba1917fffb781a8ed"}, 478 | {file = "greenlet-1.1.0-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:14927b15c953f8f2d2a8dffa224aa78d7759ef95284d4c39e1745cf36e8cdd2c"}, 479 | {file = "greenlet-1.1.0-cp37-cp37m-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:9bdcff4b9051fb1aa4bba4fceff6a5f770c6be436408efd99b76fc827f2a9319"}, 480 | {file = "greenlet-1.1.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c70c7dd733a4c56838d1f1781e769081a25fade879510c5b5f0df76956abfa05"}, 481 | {file = "greenlet-1.1.0-cp37-cp37m-win32.whl", hash = "sha256:0de64d419b1cb1bfd4ea544bedea4b535ef3ae1e150b0f2609da14bbf48a4a5f"}, 482 | {file = "greenlet-1.1.0-cp37-cp37m-win_amd64.whl", hash = "sha256:8833e27949ea32d27f7e96930fa29404dd4f2feb13cce483daf52e8842ec246a"}, 483 | {file = "greenlet-1.1.0-cp38-cp38-macosx_10_14_x86_64.whl", hash = "sha256:c1580087ab493c6b43e66f2bdd165d9e3c1e86ef83f6c2c44a29f2869d2c5bd5"}, 484 | {file = "greenlet-1.1.0-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:ad80bb338cf9f8129c049837a42a43451fc7c8b57ad56f8e6d32e7697b115505"}, 485 | {file = "greenlet-1.1.0-cp38-cp38-manylinux2010_x86_64.whl", hash = "sha256:a9017ff5fc2522e45562882ff481128631bf35da444775bc2776ac5c61d8bcae"}, 486 | {file = "greenlet-1.1.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:7920e3eccd26b7f4c661b746002f5ec5f0928076bd738d38d894bb359ce51927"}, 487 | {file = "greenlet-1.1.0-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:408071b64e52192869129a205e5b463abda36eff0cebb19d6e63369440e4dc99"}, 488 | {file = "greenlet-1.1.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:be13a18cec649ebaab835dff269e914679ef329204704869f2f167b2c163a9da"}, 489 | {file = "greenlet-1.1.0-cp38-cp38-win32.whl", hash = "sha256:22002259e5b7828b05600a762579fa2f8b33373ad95a0ee57b4d6109d0e589ad"}, 490 | {file = "greenlet-1.1.0-cp38-cp38-win_amd64.whl", hash = "sha256:206295d270f702bc27dbdbd7651e8ebe42d319139e0d90217b2074309a200da8"}, 491 | {file = "greenlet-1.1.0-cp39-cp39-macosx_10_14_x86_64.whl", hash = "sha256:096cb0217d1505826ba3d723e8981096f2622cde1eb91af9ed89a17c10aa1f3e"}, 492 | {file = "greenlet-1.1.0-cp39-cp39-manylinux1_x86_64.whl", hash = "sha256:03f28a5ea20201e70ab70518d151116ce939b412961c33827519ce620957d44c"}, 493 | {file = "greenlet-1.1.0-cp39-cp39-manylinux2010_x86_64.whl", hash = "sha256:7db68f15486d412b8e2cfcd584bf3b3a000911d25779d081cbbae76d71bd1a7e"}, 494 | {file = "greenlet-1.1.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:70bd1bb271e9429e2793902dfd194b653221904a07cbf207c3139e2672d17959"}, 495 | {file = "greenlet-1.1.0-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:f92731609d6625e1cc26ff5757db4d32b6b810d2a3363b0ff94ff573e5901f6f"}, 496 | {file = "greenlet-1.1.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:06d7ac89e6094a0a8f8dc46aa61898e9e1aec79b0f8b47b2400dd51a44dbc832"}, 497 | {file = "greenlet-1.1.0-cp39-cp39-win32.whl", hash = "sha256:adb94a28225005890d4cf73648b5131e885c7b4b17bc762779f061844aabcc11"}, 498 | {file = "greenlet-1.1.0-cp39-cp39-win_amd64.whl", hash = "sha256:aa4230234d02e6f32f189fd40b59d5a968fe77e80f59c9c933384fe8ba535535"}, 499 | {file = "greenlet-1.1.0.tar.gz", hash = "sha256:c87df8ae3f01ffb4483c796fe1b15232ce2b219f0b18126948616224d3f658ee"}, 500 | ] 501 | ipython = [ 502 | {file = "ipython-7.20.0-py3-none-any.whl", hash = "sha256:1918dea4bfdc5d1a830fcfce9a710d1d809cbed123e85eab0539259cb0f56640"}, 503 | {file = "ipython-7.20.0.tar.gz", hash = "sha256:1923af00820a8cf58e91d56b89efc59780a6e81363b94464a0f17c039dffff9e"}, 504 | ] 505 | ipython-genutils = [ 506 | {file = "ipython_genutils-0.2.0-py2.py3-none-any.whl", hash = "sha256:72dd37233799e619666c9f639a9da83c34013a73e8bbc79a7a6348d93c61fab8"}, 507 | {file = "ipython_genutils-0.2.0.tar.gz", hash = "sha256:eb2e116e75ecef9d4d228fdc66af54269afa26ab4463042e33785b887c628ba8"}, 508 | ] 509 | isort = [ 510 | {file = "isort-5.7.0-py3-none-any.whl", hash = "sha256:fff4f0c04e1825522ce6949973e83110a6e907750cd92d128b0d14aaaadbffdc"}, 511 | {file = "isort-5.7.0.tar.gz", hash = "sha256:c729845434366216d320e936b8ad6f9d681aab72dc7cbc2d51bedc3582f3ad1e"}, 512 | ] 513 | jedi = [ 514 | {file = "jedi-0.18.0-py2.py3-none-any.whl", hash = "sha256:18456d83f65f400ab0c2d3319e48520420ef43b23a086fdc05dff34132f0fb93"}, 515 | {file = "jedi-0.18.0.tar.gz", hash = "sha256:92550a404bad8afed881a137ec9a461fed49eca661414be45059329614ed0707"}, 516 | ] 517 | lazy-object-proxy = [ 518 | {file = "lazy-object-proxy-1.4.3.tar.gz", hash = "sha256:f3900e8a5de27447acbf900b4750b0ddfd7ec1ea7fbaf11dfa911141bc522af0"}, 519 | {file = "lazy_object_proxy-1.4.3-cp27-cp27m-macosx_10_13_x86_64.whl", hash = "sha256:a2238e9d1bb71a56cd710611a1614d1194dc10a175c1e08d75e1a7bcc250d442"}, 520 | {file = "lazy_object_proxy-1.4.3-cp27-cp27m-win32.whl", hash = "sha256:efa1909120ce98bbb3777e8b6f92237f5d5c8ea6758efea36a473e1d38f7d3e4"}, 521 | {file = "lazy_object_proxy-1.4.3-cp27-cp27m-win_amd64.whl", hash = "sha256:4677f594e474c91da97f489fea5b7daa17b5517190899cf213697e48d3902f5a"}, 522 | {file = "lazy_object_proxy-1.4.3-cp27-cp27mu-manylinux1_x86_64.whl", hash = "sha256:0c4b206227a8097f05c4dbdd323c50edf81f15db3b8dc064d08c62d37e1a504d"}, 523 | {file = "lazy_object_proxy-1.4.3-cp34-cp34m-manylinux1_x86_64.whl", hash = "sha256:d945239a5639b3ff35b70a88c5f2f491913eb94871780ebfabb2568bd58afc5a"}, 524 | {file = "lazy_object_proxy-1.4.3-cp34-cp34m-win32.whl", hash = "sha256:9651375199045a358eb6741df3e02a651e0330be090b3bc79f6d0de31a80ec3e"}, 525 | {file = "lazy_object_proxy-1.4.3-cp34-cp34m-win_amd64.whl", hash = "sha256:eba7011090323c1dadf18b3b689845fd96a61ba0a1dfbd7f24b921398affc357"}, 526 | {file = "lazy_object_proxy-1.4.3-cp35-cp35m-manylinux1_x86_64.whl", hash = "sha256:48dab84ebd4831077b150572aec802f303117c8cc5c871e182447281ebf3ac50"}, 527 | {file = "lazy_object_proxy-1.4.3-cp35-cp35m-win32.whl", hash = "sha256:ca0a928a3ddbc5725be2dd1cf895ec0a254798915fb3a36af0964a0a4149e3db"}, 528 | {file = "lazy_object_proxy-1.4.3-cp35-cp35m-win_amd64.whl", hash = "sha256:194d092e6f246b906e8f70884e620e459fc54db3259e60cf69a4d66c3fda3449"}, 529 | {file = "lazy_object_proxy-1.4.3-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:97bb5884f6f1cdce0099f86b907aa41c970c3c672ac8b9c8352789e103cf3156"}, 530 | {file = "lazy_object_proxy-1.4.3-cp36-cp36m-win32.whl", hash = "sha256:cb2c7c57005a6804ab66f106ceb8482da55f5314b7fcb06551db1edae4ad1531"}, 531 | {file = "lazy_object_proxy-1.4.3-cp36-cp36m-win_amd64.whl", hash = "sha256:8d859b89baf8ef7f8bc6b00aa20316483d67f0b1cbf422f5b4dc56701c8f2ffb"}, 532 | {file = "lazy_object_proxy-1.4.3-cp37-cp37m-macosx_10_13_x86_64.whl", hash = "sha256:1be7e4c9f96948003609aa6c974ae59830a6baecc5376c25c92d7d697e684c08"}, 533 | {file = "lazy_object_proxy-1.4.3-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:d74bb8693bf9cf75ac3b47a54d716bbb1a92648d5f781fc799347cfc95952383"}, 534 | {file = "lazy_object_proxy-1.4.3-cp37-cp37m-win32.whl", hash = "sha256:9b15f3f4c0f35727d3a0fba4b770b3c4ebbb1fa907dbcc046a1d2799f3edd142"}, 535 | {file = "lazy_object_proxy-1.4.3-cp37-cp37m-win_amd64.whl", hash = "sha256:9254f4358b9b541e3441b007a0ea0764b9d056afdeafc1a5569eee1cc6c1b9ea"}, 536 | {file = "lazy_object_proxy-1.4.3-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:a6ae12d08c0bf9909ce12385803a543bfe99b95fe01e752536a60af2b7797c62"}, 537 | {file = "lazy_object_proxy-1.4.3-cp38-cp38-win32.whl", hash = "sha256:5541cada25cd173702dbd99f8e22434105456314462326f06dba3e180f203dfd"}, 538 | {file = "lazy_object_proxy-1.4.3-cp38-cp38-win_amd64.whl", hash = "sha256:59f79fef100b09564bc2df42ea2d8d21a64fdcda64979c0fa3db7bdaabaf6239"}, 539 | ] 540 | mccabe = [ 541 | {file = "mccabe-0.6.1-py2.py3-none-any.whl", hash = "sha256:ab8a6258860da4b6677da4bd2fe5dc2c659cff31b3ee4f7f5d64e79735b80d42"}, 542 | {file = "mccabe-0.6.1.tar.gz", hash = "sha256:dd8d182285a0fe56bace7f45b5e7d1a6ebcbf524e8f3bd87eb0f125271b8831f"}, 543 | ] 544 | msgpack = [ 545 | {file = "msgpack-1.0.2-cp35-cp35m-manylinux1_i686.whl", hash = "sha256:b6d9e2dae081aa35c44af9c4298de4ee72991305503442a5c74656d82b581fe9"}, 546 | {file = "msgpack-1.0.2-cp35-cp35m-manylinux1_x86_64.whl", hash = "sha256:a99b144475230982aee16b3d249170f1cccebf27fb0a08e9f603b69637a62192"}, 547 | {file = "msgpack-1.0.2-cp35-cp35m-manylinux2014_aarch64.whl", hash = "sha256:1026dcc10537d27dd2d26c327e552f05ce148977e9d7b9f1718748281b38c841"}, 548 | {file = "msgpack-1.0.2-cp36-cp36m-macosx_10_14_x86_64.whl", hash = "sha256:fe07bc6735d08e492a327f496b7850e98cb4d112c56df69b0c844dbebcbb47f6"}, 549 | {file = "msgpack-1.0.2-cp36-cp36m-manylinux1_i686.whl", hash = "sha256:9ea52fff0473f9f3000987f313310208c879493491ef3ccf66268eff8d5a0326"}, 550 | {file = "msgpack-1.0.2-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:26a1759f1a88df5f1d0b393eb582ec022326994e311ba9c5818adc5374736439"}, 551 | {file = "msgpack-1.0.2-cp36-cp36m-manylinux2014_aarch64.whl", hash = "sha256:497d2c12426adcd27ab83144057a705efb6acc7e85957a51d43cdcf7f258900f"}, 552 | {file = "msgpack-1.0.2-cp36-cp36m-win32.whl", hash = "sha256:e89ec55871ed5473a041c0495b7b4e6099f6263438e0bd04ccd8418f92d5d7f2"}, 553 | {file = "msgpack-1.0.2-cp36-cp36m-win_amd64.whl", hash = "sha256:a4355d2193106c7aa77c98fc955252a737d8550320ecdb2e9ac701e15e2943bc"}, 554 | {file = "msgpack-1.0.2-cp37-cp37m-macosx_10_14_x86_64.whl", hash = "sha256:d6c64601af8f3893d17ec233237030e3110f11b8a962cb66720bf70c0141aa54"}, 555 | {file = "msgpack-1.0.2-cp37-cp37m-manylinux1_i686.whl", hash = "sha256:f484cd2dca68502de3704f056fa9b318c94b1539ed17a4c784266df5d6978c87"}, 556 | {file = "msgpack-1.0.2-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:f3e6aaf217ac1c7ce1563cf52a2f4f5d5b1f64e8729d794165db71da57257f0c"}, 557 | {file = "msgpack-1.0.2-cp37-cp37m-manylinux2014_aarch64.whl", hash = "sha256:8521e5be9e3b93d4d5e07cb80b7e32353264d143c1f072309e1863174c6aadb1"}, 558 | {file = "msgpack-1.0.2-cp37-cp37m-win32.whl", hash = "sha256:31c17bbf2ae5e29e48d794c693b7ca7a0c73bd4280976d408c53df421e838d2a"}, 559 | {file = "msgpack-1.0.2-cp37-cp37m-win_amd64.whl", hash = "sha256:8ffb24a3b7518e843cd83538cf859e026d24ec41ac5721c18ed0c55101f9775b"}, 560 | {file = "msgpack-1.0.2-cp38-cp38-macosx_10_14_x86_64.whl", hash = "sha256:b28c0876cce1466d7c2195d7658cf50e4730667196e2f1355c4209444717ee06"}, 561 | {file = "msgpack-1.0.2-cp38-cp38-manylinux1_i686.whl", hash = "sha256:87869ba567fe371c4555d2e11e4948778ab6b59d6cc9d8460d543e4cfbbddd1c"}, 562 | {file = "msgpack-1.0.2-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:b55f7db883530b74c857e50e149126b91bb75d35c08b28db12dcb0346f15e46e"}, 563 | {file = "msgpack-1.0.2-cp38-cp38-manylinux2014_aarch64.whl", hash = "sha256:ac25f3e0513f6673e8b405c3a80500eb7be1cf8f57584be524c4fa78fe8e0c83"}, 564 | {file = "msgpack-1.0.2-cp38-cp38-win32.whl", hash = "sha256:0cb94ee48675a45d3b86e61d13c1e6f1696f0183f0715544976356ff86f741d9"}, 565 | {file = "msgpack-1.0.2-cp38-cp38-win_amd64.whl", hash = "sha256:e36a812ef4705a291cdb4a2fd352f013134f26c6ff63477f20235138d1d21009"}, 566 | {file = "msgpack-1.0.2-cp39-cp39-macosx_10_14_x86_64.whl", hash = "sha256:2a5866bdc88d77f6e1370f82f2371c9bc6fc92fe898fa2dec0c5d4f5435a2694"}, 567 | {file = "msgpack-1.0.2-cp39-cp39-manylinux1_i686.whl", hash = "sha256:92be4b12de4806d3c36810b0fe2aeedd8d493db39e2eb90742b9c09299eb5759"}, 568 | {file = "msgpack-1.0.2-cp39-cp39-manylinux1_x86_64.whl", hash = "sha256:de6bd7990a2c2dabe926b7e62a92886ccbf809425c347ae7de277067f97c2887"}, 569 | {file = "msgpack-1.0.2-cp39-cp39-manylinux2014_aarch64.whl", hash = "sha256:5a9ee2540c78659a1dd0b110f73773533ee3108d4e1219b5a15a8d635b7aca0e"}, 570 | {file = "msgpack-1.0.2-cp39-cp39-win32.whl", hash = "sha256:c747c0cc08bd6d72a586310bda6ea72eeb28e7505990f342552315b229a19b33"}, 571 | {file = "msgpack-1.0.2-cp39-cp39-win_amd64.whl", hash = "sha256:d8167b84af26654c1124857d71650404336f4eb5cc06900667a493fc619ddd9f"}, 572 | {file = "msgpack-1.0.2.tar.gz", hash = "sha256:fae04496f5bc150eefad4e9571d1a76c55d021325dcd484ce45065ebbdd00984"}, 573 | ] 574 | mypy-extensions = [ 575 | {file = "mypy_extensions-0.4.3-py2.py3-none-any.whl", hash = "sha256:090fedd75945a69ae91ce1303b5824f428daf5a028d2f6ab8a299250a846f15d"}, 576 | {file = "mypy_extensions-0.4.3.tar.gz", hash = "sha256:2d82818f5bb3e369420cb3c4060a7970edba416647068eb4c5343488a6c604a8"}, 577 | ] 578 | neovim = [ 579 | {file = "neovim-0.3.1.tar.gz", hash = "sha256:a6a0e7a5b4433bf4e6ddcbc5c5ff44170be7d84259d002b8e8d8fb4ee78af60f"}, 580 | ] 581 | parso = [ 582 | {file = "parso-0.8.1-py2.py3-none-any.whl", hash = "sha256:15b00182f472319383252c18d5913b69269590616c947747bc50bf4ac768f410"}, 583 | {file = "parso-0.8.1.tar.gz", hash = "sha256:8519430ad07087d4c997fda3a7918f7cfa27cb58972a8c89c2a0295a1c940e9e"}, 584 | ] 585 | pathspec = [ 586 | {file = "pathspec-0.8.1-py2.py3-none-any.whl", hash = "sha256:aa0cb481c4041bf52ffa7b0d8fa6cd3e88a2ca4879c533c9153882ee2556790d"}, 587 | {file = "pathspec-0.8.1.tar.gz", hash = "sha256:86379d6b86d75816baba717e64b1a3a3469deb93bb76d613c9ce79edc5cb68fd"}, 588 | ] 589 | pexpect = [ 590 | {file = "pexpect-4.8.0-py2.py3-none-any.whl", hash = "sha256:0b48a55dcb3c05f3329815901ea4fc1537514d6ba867a152b581d69ae3710937"}, 591 | {file = "pexpect-4.8.0.tar.gz", hash = "sha256:fc65a43959d153d0114afe13997d439c22823a27cefceb5ff35c2178c6784c0c"}, 592 | ] 593 | pickleshare = [ 594 | {file = "pickleshare-0.7.5-py2.py3-none-any.whl", hash = "sha256:9649af414d74d4df115d5d718f82acb59c9d418196b7b4290ed47a12ce62df56"}, 595 | {file = "pickleshare-0.7.5.tar.gz", hash = "sha256:87683d47965c1da65cdacaf31c8441d12b8044cdec9aca500cd78fc2c683afca"}, 596 | ] 597 | prompt-toolkit = [ 598 | {file = "prompt_toolkit-3.0.14-py3-none-any.whl", hash = "sha256:c96b30925025a7635471dc083ffb6af0cc67482a00611bd81aeaeeeb7e5a5e12"}, 599 | {file = "prompt_toolkit-3.0.14.tar.gz", hash = "sha256:7e966747c18ececaec785699626b771c1ba8344c8d31759a1915d6b12fad6525"}, 600 | ] 601 | ptyprocess = [ 602 | {file = "ptyprocess-0.7.0-py2.py3-none-any.whl", hash = "sha256:4b41f3967fce3af57cc7e94b888626c18bf37a083e3651ca8feeb66d492fef35"}, 603 | {file = "ptyprocess-0.7.0.tar.gz", hash = "sha256:5c5d0a3b48ceee0b48485e0c26037c0acd7d29765ca3fbb5cb3831d347423220"}, 604 | ] 605 | pycodestyle = [ 606 | {file = "pycodestyle-2.6.0-py2.py3-none-any.whl", hash = "sha256:2295e7b2f6b5bd100585ebcb1f616591b652db8a741695b3d8f5d28bdc934367"}, 607 | {file = "pycodestyle-2.6.0.tar.gz", hash = "sha256:c58a7d2815e0e8d7972bf1803331fb0152f867bd89adf8a01dfd55085434192e"}, 608 | ] 609 | pyflakes = [ 610 | {file = "pyflakes-2.2.0-py2.py3-none-any.whl", hash = "sha256:0d94e0e05a19e57a99444b6ddcf9a6eb2e5c68d3ca1e98e90707af8152c90a92"}, 611 | {file = "pyflakes-2.2.0.tar.gz", hash = "sha256:35b2d75ee967ea93b55750aa9edbbf72813e06a66ba54438df2cfac9e3c27fc8"}, 612 | ] 613 | pygame = [ 614 | {file = "pygame-2.0.1-cp27-cp27m-macosx_10_9_intel.whl", hash = "sha256:49c2f58559c1fbf4ba258e4b141578ccb0e83da3d4f823894f6171a8f0d594ed"}, 615 | {file = "pygame-2.0.1-cp27-cp27m-win32.whl", hash = "sha256:0571dde0277483f5060c8ee43cbfd8df5776b12505e3948eee241c8ce9b93371"}, 616 | {file = "pygame-2.0.1-cp27-cp27m-win_amd64.whl", hash = "sha256:fd5ee0f42d59a290c049f91894e0739f62c2908e7edc028ffb847a105e68bfc3"}, 617 | {file = "pygame-2.0.1-cp27-cp27mu-manylinux1_i686.whl", hash = "sha256:21475405bcdeb20b8a796a3da6704ebb816e06b29749dd64ff619e80816b7932"}, 618 | {file = "pygame-2.0.1-cp27-cp27mu-manylinux1_x86_64.whl", hash = "sha256:ad230911d61f448c09886d3c92b2eae44ca7530babe9c48e74e02a0622ce2d34"}, 619 | {file = "pygame-2.0.1-cp35-cp35m-macosx_10_9_intel.whl", hash = "sha256:9aead3f2eed90260136b201f398965900c5335c974bb7b47c381d98e39284018"}, 620 | {file = "pygame-2.0.1-cp35-cp35m-manylinux1_i686.whl", hash = "sha256:5aeeb6659a7fe7760a78e449566553ae8c949ae29dd907a8eb4171fa0a274c16"}, 621 | {file = "pygame-2.0.1-cp35-cp35m-manylinux1_x86_64.whl", hash = "sha256:3270cbcff40ca2b5622a145346298a33285c91b6d50097e0b85123d9a2bc7c9b"}, 622 | {file = "pygame-2.0.1-cp35-cp35m-win32.whl", hash = "sha256:72625dc949c6d08ba7ce7c37a33163bb498d90ca0d7e626db3cfbf486df4db1d"}, 623 | {file = "pygame-2.0.1-cp35-cp35m-win_amd64.whl", hash = "sha256:bf833c853a0568738ee5d88e1345c17bf3e8db626c36fb895327a35bb1827b0b"}, 624 | {file = "pygame-2.0.1-cp36-cp36m-macosx_10_9_intel.whl", hash = "sha256:44f3ff8224d7cb998642400371c685005c8316b55e87794cbf1f6407b88ec424"}, 625 | {file = "pygame-2.0.1-cp36-cp36m-manylinux1_i686.whl", hash = "sha256:eab18df58dcc8512f1b694f7218146828d7e3dd3f4e73bfd6942a11810293fd5"}, 626 | {file = "pygame-2.0.1-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:19357c826ab94f9ae5b4ec5cb752cc806cfc29ea32cf7bdaacb65fa2615607e8"}, 627 | {file = "pygame-2.0.1-cp36-cp36m-win32.whl", hash = "sha256:328d70d40bc9a6defb9f330f5e7f3d0726af1e7c2308ebca582e69480db2950d"}, 628 | {file = "pygame-2.0.1-cp36-cp36m-win_amd64.whl", hash = "sha256:81510ffb1c31a3827c6be047b1926d81caf36dc734564ca0e14903d6bce60c6f"}, 629 | {file = "pygame-2.0.1-cp37-cp37m-macosx_10_9_intel.whl", hash = "sha256:ece424c83a575c2e0ba25815871458d3bbade46d76b7997236fb51a0251229ab"}, 630 | {file = "pygame-2.0.1-cp37-cp37m-manylinux1_i686.whl", hash = "sha256:e72cdc97a49509ca2298350c2c3a0ac26bc8e943ce003a7d245df42e91439d5d"}, 631 | {file = "pygame-2.0.1-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:9fd0691c4fe58b932674bb6a91d2808790e8269c3183ef16052f13e1c602ac00"}, 632 | {file = "pygame-2.0.1-cp37-cp37m-win32.whl", hash = "sha256:4f41252dfa1e8bb95f2ea51fba710827dde9820a535623d002a65621bafe7e3f"}, 633 | {file = "pygame-2.0.1-cp37-cp37m-win_amd64.whl", hash = "sha256:3b31d088129977885f72037c55cfa1140e9bcf3468e68b46141f6cc2b33d456b"}, 634 | {file = "pygame-2.0.1-cp38-cp38-macosx_10_9_intel.whl", hash = "sha256:30eb5c7adb0b3362024cec2c461be6978fbfc99c3bca974e438b1b540cd09438"}, 635 | {file = "pygame-2.0.1-cp38-cp38-manylinux1_i686.whl", hash = "sha256:845385caf99f8d941607791c60e560d24b4a35c70eef0b01c30cfde0b913ff92"}, 636 | {file = "pygame-2.0.1-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:3c2676b4fd278d632037eacd3b0524ce1a592c048e8e5eb5830475f83585cb3a"}, 637 | {file = "pygame-2.0.1-cp38-cp38-win32.whl", hash = "sha256:4d3135a1f8c76c3fff1ef8b7a51e4c6523748e9bdbd7bca6daa69790ce0e798a"}, 638 | {file = "pygame-2.0.1-cp38-cp38-win_amd64.whl", hash = "sha256:898874521a9be1f9dbc5b036a9755803287c2664e335afd3e10963f7f4ccb853"}, 639 | {file = "pygame-2.0.1-cp39-cp39-macosx_10_9_intel.whl", hash = "sha256:ed80b40da839d60f4c03915bb3638e3c96ea8c30e689d0cc309b7597d82cc217"}, 640 | {file = "pygame-2.0.1-cp39-cp39-manylinux1_i686.whl", hash = "sha256:fd6acd09d2a0fd3f616b18f977f399ed3dd95e2d6754f115837f026d19d62e10"}, 641 | {file = "pygame-2.0.1-cp39-cp39-manylinux1_x86_64.whl", hash = "sha256:d8059084ce54b2c3d7b2c8bacd5f6490db849b2d2d6e7368c160b08504c87e73"}, 642 | {file = "pygame-2.0.1-cp39-cp39-win32.whl", hash = "sha256:107d5f82f471baee4b9522a691cb320dd52dbf329ed7a0e9ab25f75cd3caf890"}, 643 | {file = "pygame-2.0.1-cp39-cp39-win_amd64.whl", hash = "sha256:07ed57062be4bb9741f57dab1751d95574c091c9958ed7e39cdb246d50903283"}, 644 | {file = "pygame-2.0.1-pp27-pypy_73-manylinux2010_i686.whl", hash = "sha256:5f057e5aa4c383fcf18560dcae2c5593e37e3fc941083a0a00a17f7cf25ee522"}, 645 | {file = "pygame-2.0.1-pp27-pypy_73-manylinux2010_x86_64.whl", hash = "sha256:c188ce4bf1544f2758e8b651f4349a0f3dc441e09d8ab7c4863db1ae8f084a32"}, 646 | {file = "pygame-2.0.1-pp27-pypy_73-win32.whl", hash = "sha256:7ea518d8eeb072c77c16977cdee3c59d9fffa750ed9c7c9c533ba520b6b08af7"}, 647 | {file = "pygame-2.0.1-pp36-pypy36_pp73-macosx_10_9_intel.whl", hash = "sha256:10ca736eecedadf492ba1191f9fa3a5e6f30db2b9f8882b3ee7706d5a89c14e0"}, 648 | {file = "pygame-2.0.1-pp36-pypy36_pp73-manylinux2010_i686.whl", hash = "sha256:5afc34f0af0cec09a20b6bb09090054fac5169ab01909e01b06e7e0752ab0153"}, 649 | {file = "pygame-2.0.1-pp36-pypy36_pp73-manylinux2010_x86_64.whl", hash = "sha256:2d9b0a66034fed390ee367a549435853502c9d4fe82ac0fa3a520f0ad5648e6e"}, 650 | {file = "pygame-2.0.1-pp36-pypy36_pp73-win32.whl", hash = "sha256:9de559462aaa68c40bb7625dcd587584b4eb85c4208528dc97b9ee7254945294"}, 651 | {file = "pygame-2.0.1-pp37-pypy37_pp73-macosx_10_9_intel.whl", hash = "sha256:9f48277de1daa83fd58a722b2e3423201b5eb39842227f32702fb78e4bba5a71"}, 652 | {file = "pygame-2.0.1-pp37-pypy37_pp73-manylinux2010_i686.whl", hash = "sha256:a4e35d89b6754941e82df1ce980a1c370943d3c076938d94ed1e48165dd6a11b"}, 653 | {file = "pygame-2.0.1-pp37-pypy37_pp73-manylinux2010_x86_64.whl", hash = "sha256:b812285d23b5644c643a6ae30553a772f935f47f61826660b108b8727936384b"}, 654 | {file = "pygame-2.0.1.tar.gz", hash = "sha256:8b1e7b63f47aafcdd8849933b206778747ef1802bd3d526aca45ed77141e4001"}, 655 | ] 656 | pygments = [ 657 | {file = "Pygments-2.7.4-py3-none-any.whl", hash = "sha256:bc9591213a8f0e0ca1a5e68a479b4887fdc3e75d0774e5c71c31920c427de435"}, 658 | {file = "Pygments-2.7.4.tar.gz", hash = "sha256:df49d09b498e83c1a73128295860250b0b7edd4c723a32e9bc0d295c7c2ec337"}, 659 | ] 660 | pylint = [ 661 | {file = "pylint-2.6.0-py3-none-any.whl", hash = "sha256:bfe68f020f8a0fece830a22dd4d5dddb4ecc6137db04face4c3420a46a52239f"}, 662 | {file = "pylint-2.6.0.tar.gz", hash = "sha256:bb4a908c9dadbc3aac18860550e870f58e1a02c9f2c204fdf5693d73be061210"}, 663 | ] 664 | pynvim = [ 665 | {file = "pynvim-0.4.3.tar.gz", hash = "sha256:3a795378bde5e8092fbeb3a1a99be9c613d2685542f1db0e5c6fd467eed56dff"}, 666 | ] 667 | regex = [ 668 | {file = "regex-2020.11.13-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:8b882a78c320478b12ff024e81dc7d43c1462aa4a3341c754ee65d857a521f85"}, 669 | {file = "regex-2020.11.13-cp36-cp36m-manylinux1_i686.whl", hash = "sha256:a63f1a07932c9686d2d416fb295ec2c01ab246e89b4d58e5fa468089cab44b70"}, 670 | {file = "regex-2020.11.13-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:6e4b08c6f8daca7d8f07c8d24e4331ae7953333dbd09c648ed6ebd24db5a10ee"}, 671 | {file = "regex-2020.11.13-cp36-cp36m-manylinux2010_i686.whl", hash = "sha256:bba349276b126947b014e50ab3316c027cac1495992f10e5682dc677b3dfa0c5"}, 672 | {file = "regex-2020.11.13-cp36-cp36m-manylinux2010_x86_64.whl", hash = "sha256:56e01daca75eae420bce184edd8bb341c8eebb19dd3bce7266332258f9fb9dd7"}, 673 | {file = "regex-2020.11.13-cp36-cp36m-manylinux2014_aarch64.whl", hash = "sha256:6a8ce43923c518c24a2579fda49f093f1397dad5d18346211e46f134fc624e31"}, 674 | {file = "regex-2020.11.13-cp36-cp36m-manylinux2014_i686.whl", hash = "sha256:1ab79fcb02b930de09c76d024d279686ec5d532eb814fd0ed1e0051eb8bd2daa"}, 675 | {file = "regex-2020.11.13-cp36-cp36m-manylinux2014_x86_64.whl", hash = "sha256:9801c4c1d9ae6a70aeb2128e5b4b68c45d4f0af0d1535500884d644fa9b768c6"}, 676 | {file = "regex-2020.11.13-cp36-cp36m-win32.whl", hash = "sha256:49cae022fa13f09be91b2c880e58e14b6da5d10639ed45ca69b85faf039f7a4e"}, 677 | {file = "regex-2020.11.13-cp36-cp36m-win_amd64.whl", hash = "sha256:749078d1eb89484db5f34b4012092ad14b327944ee7f1c4f74d6279a6e4d1884"}, 678 | {file = "regex-2020.11.13-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:b2f4007bff007c96a173e24dcda236e5e83bde4358a557f9ccf5e014439eae4b"}, 679 | {file = "regex-2020.11.13-cp37-cp37m-manylinux1_i686.whl", hash = "sha256:38c8fd190db64f513fe4e1baa59fed086ae71fa45083b6936b52d34df8f86a88"}, 680 | {file = "regex-2020.11.13-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:5862975b45d451b6db51c2e654990c1820523a5b07100fc6903e9c86575202a0"}, 681 | {file = "regex-2020.11.13-cp37-cp37m-manylinux2010_i686.whl", hash = "sha256:262c6825b309e6485ec2493ffc7e62a13cf13fb2a8b6d212f72bd53ad34118f1"}, 682 | {file = "regex-2020.11.13-cp37-cp37m-manylinux2010_x86_64.whl", hash = "sha256:bafb01b4688833e099d79e7efd23f99172f501a15c44f21ea2118681473fdba0"}, 683 | {file = "regex-2020.11.13-cp37-cp37m-manylinux2014_aarch64.whl", hash = "sha256:e32f5f3d1b1c663af7f9c4c1e72e6ffe9a78c03a31e149259f531e0fed826512"}, 684 | {file = "regex-2020.11.13-cp37-cp37m-manylinux2014_i686.whl", hash = "sha256:3bddc701bdd1efa0d5264d2649588cbfda549b2899dc8d50417e47a82e1387ba"}, 685 | {file = "regex-2020.11.13-cp37-cp37m-manylinux2014_x86_64.whl", hash = "sha256:02951b7dacb123d8ea6da44fe45ddd084aa6777d4b2454fa0da61d569c6fa538"}, 686 | {file = "regex-2020.11.13-cp37-cp37m-win32.whl", hash = "sha256:0d08e71e70c0237883d0bef12cad5145b84c3705e9c6a588b2a9c7080e5af2a4"}, 687 | {file = "regex-2020.11.13-cp37-cp37m-win_amd64.whl", hash = "sha256:1fa7ee9c2a0e30405e21031d07d7ba8617bc590d391adfc2b7f1e8b99f46f444"}, 688 | {file = "regex-2020.11.13-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:baf378ba6151f6e272824b86a774326f692bc2ef4cc5ce8d5bc76e38c813a55f"}, 689 | {file = "regex-2020.11.13-cp38-cp38-manylinux1_i686.whl", hash = "sha256:e3faaf10a0d1e8e23a9b51d1900b72e1635c2d5b0e1bea1c18022486a8e2e52d"}, 690 | {file = "regex-2020.11.13-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:2a11a3e90bd9901d70a5b31d7dd85114755a581a5da3fc996abfefa48aee78af"}, 691 | {file = "regex-2020.11.13-cp38-cp38-manylinux2010_i686.whl", hash = "sha256:d1ebb090a426db66dd80df8ca85adc4abfcbad8a7c2e9a5ec7513ede522e0a8f"}, 692 | {file = "regex-2020.11.13-cp38-cp38-manylinux2010_x86_64.whl", hash = "sha256:b2b1a5ddae3677d89b686e5c625fc5547c6e492bd755b520de5332773a8af06b"}, 693 | {file = "regex-2020.11.13-cp38-cp38-manylinux2014_aarch64.whl", hash = "sha256:2c99e97d388cd0a8d30f7c514d67887d8021541b875baf09791a3baad48bb4f8"}, 694 | {file = "regex-2020.11.13-cp38-cp38-manylinux2014_i686.whl", hash = "sha256:c084582d4215593f2f1d28b65d2a2f3aceff8342aa85afd7be23a9cad74a0de5"}, 695 | {file = "regex-2020.11.13-cp38-cp38-manylinux2014_x86_64.whl", hash = "sha256:a3d748383762e56337c39ab35c6ed4deb88df5326f97a38946ddd19028ecce6b"}, 696 | {file = "regex-2020.11.13-cp38-cp38-win32.whl", hash = "sha256:7913bd25f4ab274ba37bc97ad0e21c31004224ccb02765ad984eef43e04acc6c"}, 697 | {file = "regex-2020.11.13-cp38-cp38-win_amd64.whl", hash = "sha256:6c54ce4b5d61a7129bad5c5dc279e222afd00e721bf92f9ef09e4fae28755683"}, 698 | {file = "regex-2020.11.13-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:1862a9d9194fae76a7aaf0150d5f2a8ec1da89e8b55890b1786b8f88a0f619dc"}, 699 | {file = "regex-2020.11.13-cp39-cp39-manylinux1_i686.whl", hash = "sha256:4902e6aa086cbb224241adbc2f06235927d5cdacffb2425c73e6570e8d862364"}, 700 | {file = "regex-2020.11.13-cp39-cp39-manylinux1_x86_64.whl", hash = "sha256:7a25fcbeae08f96a754b45bdc050e1fb94b95cab046bf56b016c25e9ab127b3e"}, 701 | {file = "regex-2020.11.13-cp39-cp39-manylinux2010_i686.whl", hash = "sha256:d2d8ce12b7c12c87e41123997ebaf1a5767a5be3ec545f64675388970f415e2e"}, 702 | {file = "regex-2020.11.13-cp39-cp39-manylinux2010_x86_64.whl", hash = "sha256:f7d29a6fc4760300f86ae329e3b6ca28ea9c20823df123a2ea8693e967b29917"}, 703 | {file = "regex-2020.11.13-cp39-cp39-manylinux2014_aarch64.whl", hash = "sha256:717881211f46de3ab130b58ec0908267961fadc06e44f974466d1887f865bd5b"}, 704 | {file = "regex-2020.11.13-cp39-cp39-manylinux2014_i686.whl", hash = "sha256:3128e30d83f2e70b0bed9b2a34e92707d0877e460b402faca908c6667092ada9"}, 705 | {file = "regex-2020.11.13-cp39-cp39-manylinux2014_x86_64.whl", hash = "sha256:8f6a2229e8ad946e36815f2a03386bb8353d4bde368fdf8ca5f0cb97264d3b5c"}, 706 | {file = "regex-2020.11.13-cp39-cp39-win32.whl", hash = "sha256:f8f295db00ef5f8bae530fc39af0b40486ca6068733fb860b42115052206466f"}, 707 | {file = "regex-2020.11.13-cp39-cp39-win_amd64.whl", hash = "sha256:a15f64ae3a027b64496a71ab1f722355e570c3fac5ba2801cafce846bf5af01d"}, 708 | {file = "regex-2020.11.13.tar.gz", hash = "sha256:83d6b356e116ca119db8e7c6fc2983289d87b27b3fac238cfe5dca529d884562"}, 709 | ] 710 | six = [ 711 | {file = "six-1.15.0-py2.py3-none-any.whl", hash = "sha256:8b74bedcbbbaca38ff6d7491d76f2b06b3592611af620f8426e82dddb04a5ced"}, 712 | {file = "six-1.15.0.tar.gz", hash = "sha256:30639c035cdb23534cd4aa2dd52c3bf48f06e5f4a941509c8bafd8ce11080259"}, 713 | ] 714 | toml = [ 715 | {file = "toml-0.10.2-py2.py3-none-any.whl", hash = "sha256:806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b"}, 716 | {file = "toml-0.10.2.tar.gz", hash = "sha256:b3bda1d108d5dd99f4a20d24d9c348e91c4db7ab1b749200bded2f839ccbe68f"}, 717 | ] 718 | traitlets = [ 719 | {file = "traitlets-5.0.5-py3-none-any.whl", hash = "sha256:69ff3f9d5351f31a7ad80443c2674b7099df13cc41fc5fa6e2f6d3b0330b0426"}, 720 | {file = "traitlets-5.0.5.tar.gz", hash = "sha256:178f4ce988f69189f7e523337a3e11d91c786ded9360174a3d9ca83e79bc5396"}, 721 | ] 722 | typed-ast = [ 723 | {file = "typed_ast-1.4.2-cp35-cp35m-manylinux1_i686.whl", hash = "sha256:7703620125e4fb79b64aa52427ec192822e9f45d37d4b6625ab37ef403e1df70"}, 724 | {file = "typed_ast-1.4.2-cp35-cp35m-manylinux1_x86_64.whl", hash = "sha256:c9aadc4924d4b5799112837b226160428524a9a45f830e0d0f184b19e4090487"}, 725 | {file = "typed_ast-1.4.2-cp35-cp35m-manylinux2014_aarch64.whl", hash = "sha256:9ec45db0c766f196ae629e509f059ff05fc3148f9ffd28f3cfe75d4afb485412"}, 726 | {file = "typed_ast-1.4.2-cp35-cp35m-win32.whl", hash = "sha256:85f95aa97a35bdb2f2f7d10ec5bbdac0aeb9dafdaf88e17492da0504de2e6400"}, 727 | {file = "typed_ast-1.4.2-cp35-cp35m-win_amd64.whl", hash = "sha256:9044ef2df88d7f33692ae3f18d3be63dec69c4fb1b5a4a9ac950f9b4ba571606"}, 728 | {file = "typed_ast-1.4.2-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:c1c876fd795b36126f773db9cbb393f19808edd2637e00fd6caba0e25f2c7b64"}, 729 | {file = "typed_ast-1.4.2-cp36-cp36m-manylinux1_i686.whl", hash = "sha256:5dcfc2e264bd8a1db8b11a892bd1647154ce03eeba94b461effe68790d8b8e07"}, 730 | {file = "typed_ast-1.4.2-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:8db0e856712f79c45956da0c9a40ca4246abc3485ae0d7ecc86a20f5e4c09abc"}, 731 | {file = "typed_ast-1.4.2-cp36-cp36m-manylinux2014_aarch64.whl", hash = "sha256:d003156bb6a59cda9050e983441b7fa2487f7800d76bdc065566b7d728b4581a"}, 732 | {file = "typed_ast-1.4.2-cp36-cp36m-win32.whl", hash = "sha256:4c790331247081ea7c632a76d5b2a265e6d325ecd3179d06e9cf8d46d90dd151"}, 733 | {file = "typed_ast-1.4.2-cp36-cp36m-win_amd64.whl", hash = "sha256:d175297e9533d8d37437abc14e8a83cbc68af93cc9c1c59c2c292ec59a0697a3"}, 734 | {file = "typed_ast-1.4.2-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:cf54cfa843f297991b7388c281cb3855d911137223c6b6d2dd82a47ae5125a41"}, 735 | {file = "typed_ast-1.4.2-cp37-cp37m-manylinux1_i686.whl", hash = "sha256:b4fcdcfa302538f70929eb7b392f536a237cbe2ed9cba88e3bf5027b39f5f77f"}, 736 | {file = "typed_ast-1.4.2-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:987f15737aba2ab5f3928c617ccf1ce412e2e321c77ab16ca5a293e7bbffd581"}, 737 | {file = "typed_ast-1.4.2-cp37-cp37m-manylinux2014_aarch64.whl", hash = "sha256:37f48d46d733d57cc70fd5f30572d11ab8ed92da6e6b28e024e4a3edfb456e37"}, 738 | {file = "typed_ast-1.4.2-cp37-cp37m-win32.whl", hash = "sha256:36d829b31ab67d6fcb30e185ec996e1f72b892255a745d3a82138c97d21ed1cd"}, 739 | {file = "typed_ast-1.4.2-cp37-cp37m-win_amd64.whl", hash = "sha256:8368f83e93c7156ccd40e49a783a6a6850ca25b556c0fa0240ed0f659d2fe496"}, 740 | {file = "typed_ast-1.4.2-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:963c80b583b0661918718b095e02303d8078950b26cc00b5e5ea9ababe0de1fc"}, 741 | {file = "typed_ast-1.4.2-cp38-cp38-manylinux1_i686.whl", hash = "sha256:e683e409e5c45d5c9082dc1daf13f6374300806240719f95dc783d1fc942af10"}, 742 | {file = "typed_ast-1.4.2-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:84aa6223d71012c68d577c83f4e7db50d11d6b1399a9c779046d75e24bed74ea"}, 743 | {file = "typed_ast-1.4.2-cp38-cp38-manylinux2014_aarch64.whl", hash = "sha256:a38878a223bdd37c9709d07cd357bb79f4c760b29210e14ad0fb395294583787"}, 744 | {file = "typed_ast-1.4.2-cp38-cp38-win32.whl", hash = "sha256:a2c927c49f2029291fbabd673d51a2180038f8cd5a5b2f290f78c4516be48be2"}, 745 | {file = "typed_ast-1.4.2-cp38-cp38-win_amd64.whl", hash = "sha256:c0c74e5579af4b977c8b932f40a5464764b2f86681327410aa028a22d2f54937"}, 746 | {file = "typed_ast-1.4.2-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:07d49388d5bf7e863f7fa2f124b1b1d89d8aa0e2f7812faff0a5658c01c59aa1"}, 747 | {file = "typed_ast-1.4.2-cp39-cp39-manylinux1_i686.whl", hash = "sha256:240296b27397e4e37874abb1df2a608a92df85cf3e2a04d0d4d61055c8305ba6"}, 748 | {file = "typed_ast-1.4.2-cp39-cp39-manylinux1_x86_64.whl", hash = "sha256:d746a437cdbca200622385305aedd9aef68e8a645e385cc483bdc5e488f07166"}, 749 | {file = "typed_ast-1.4.2-cp39-cp39-manylinux2014_aarch64.whl", hash = "sha256:14bf1522cdee369e8f5581238edac09150c765ec1cb33615855889cf33dcb92d"}, 750 | {file = "typed_ast-1.4.2-cp39-cp39-win32.whl", hash = "sha256:cc7b98bf58167b7f2db91a4327da24fb93368838eb84a44c472283778fc2446b"}, 751 | {file = "typed_ast-1.4.2-cp39-cp39-win_amd64.whl", hash = "sha256:7147e2a76c75f0f64c4319886e7639e490fee87c9d25cb1d4faef1d8cf83a440"}, 752 | {file = "typed_ast-1.4.2.tar.gz", hash = "sha256:9fc0b3cb5d1720e7141d103cf4819aea239f7d136acf9ee4a69b047b7986175a"}, 753 | ] 754 | typing-extensions = [ 755 | {file = "typing_extensions-3.7.4.3-py2-none-any.whl", hash = "sha256:dafc7639cde7f1b6e1acc0f457842a83e722ccca8eef5270af2d74792619a89f"}, 756 | {file = "typing_extensions-3.7.4.3-py3-none-any.whl", hash = "sha256:7cb407020f00f7bfc3cb3e7881628838e69d8f3fcab2f64742a5e76b2f841918"}, 757 | {file = "typing_extensions-3.7.4.3.tar.gz", hash = "sha256:99d4073b617d30288f569d3f13d2bd7548c3a7e4c8de87db09a9d29bb3a4a60c"}, 758 | ] 759 | wcwidth = [ 760 | {file = "wcwidth-0.2.5-py2.py3-none-any.whl", hash = "sha256:beb4802a9cebb9144e99086eff703a642a13d6a0052920003a230f3294bbe784"}, 761 | {file = "wcwidth-0.2.5.tar.gz", hash = "sha256:c4d647b99872929fdb7bdcaa4fbe7f01413ed3d98077df798530e5b04f116c83"}, 762 | ] 763 | wrapt = [ 764 | {file = "wrapt-1.12.1.tar.gz", hash = "sha256:b62ffa81fb85f4332a4f609cab4ac40709470da05643a082ec1eb88e6d9b97d7"}, 765 | ] 766 | -------------------------------------------------------------------------------- /priorityqueueset.py: -------------------------------------------------------------------------------- 1 | import heapq 2 | 3 | 4 | class PriorityQueueSet: 5 | """Combined priority queue and set data structure. Acts like 6 | a priority queue, except that its items are guaranteed to 7 | be unique. 8 | 9 | Provides O(1) membership test and O(log N) removal of the 10 | *smallest* item. Addition is more complex. When the item 11 | doesn't exist, it's added in O(log N). When it already 12 | exists, its priority is checked against the new item's 13 | priority in O(1). If the new item's priority is smaller, 14 | it is updated in the queue. This takes O(N). 15 | 16 | Important: The items you store in the queue have identity 17 | (that determines when two items are the same, as far as 18 | you're concerned) and priority. Therefore, you must 19 | implement the following operators for them: __hash__, 20 | __cmp__ and __eq__. 21 | 22 | * __eq__ will be used for exact comparison of items. It 23 | must return True if and only if the items are identical 24 | from your point of view (although their priorities can 25 | be different) 26 | * __cmp__ will be used to compare priorities. Two items 27 | can be different and have the same priority, and even 28 | be equal but have different priorities (though they 29 | can't be in the queue at the same time) 30 | * __hash__ will be used to hash the items for 31 | efficiency. To implement it, you almost always have 32 | to just call hash() on the attribute you're comparing 33 | in __eq__ 34 | 35 | Note that for native Python objects (strings, tuples, 36 | etc.) these operators are already defined as needed. 37 | """ 38 | 39 | def __init__(self): 40 | """Create a new PriorityQueueSet""" 41 | self.set = {} 42 | self.heap = [] 43 | 44 | def __len__(self): 45 | return len(self.heap) 46 | 47 | def has_item(self, item): 48 | """Check if *item* exists in the queue""" 49 | return item in self.set 50 | 51 | def pop_smallest(self): 52 | """Remove and return the smallest item from the queue. 53 | IndexError will be thrown if the queue is empty. 54 | """ 55 | smallest = heapq.heappop(self.heap) 56 | del self.set[smallest] 57 | return smallest 58 | 59 | def add(self, item): 60 | """Add *item* to the queue. 61 | 62 | If such an item already exists, its priority will be 63 | checked versus *item*. If *item*'s priority is better 64 | (i.e. lower), the priority of the existing item in the 65 | queue will be updated. 66 | 67 | Returns True if the item was added or updated. 68 | """ 69 | if item not in self.set: 70 | self.set[item] = item 71 | print(f"item {item}") 72 | heapq.heappush(self.heap, item) 73 | return True 74 | elif item < self.set[item]: 75 | # No choice but to search linearly in the heap 76 | for idx, old_item in enumerate(self.heap): 77 | if old_item == item: 78 | del self.heap[idx] 79 | self.heap.append(item) 80 | heapq.heapify(self.heap) 81 | self.set[item] = item 82 | return True 83 | 84 | return False 85 | -------------------------------------------------------------------------------- /pylintrc: -------------------------------------------------------------------------------- 1 | [TYPECHECK] 2 | ignored-classes = pygame 3 | -------------------------------------------------------------------------------- /pyproject.toml: -------------------------------------------------------------------------------- 1 | [tool.poetry] 2 | name = "pydf" 3 | version = "0.1.0" 4 | description = "" 5 | authors = ["mcgillij "] 6 | 7 | [tool.poetry.dependencies] 8 | python = "^3.9" 9 | pygame = "^2.0.1" 10 | 11 | [tool.poetry.dev-dependencies] 12 | black = "^20.8b1" 13 | pylint = "^2.6.0" 14 | flake8 = "^3.8.4" 15 | ipython = "^7.20.0" 16 | neovim = "^0.3.1" 17 | 18 | [build-system] 19 | requires = ["poetry-core>=1.0.0"] 20 | build-backend = "poetry.core.masonry.api" 21 | -------------------------------------------------------------------------------- /room.py: -------------------------------------------------------------------------------- 1 | class Room(object): 2 | """ Room class, generic class for a tile """ 3 | 4 | def __init__(self, value, room_type, room_tiles): 5 | self.value = value 6 | self.room_type = room_type 7 | self.roomtiles = room_tiles 8 | -------------------------------------------------------------------------------- /selected.py: -------------------------------------------------------------------------------- 1 | class Selected(object): 2 | """ Selected class, generic class for a tile """ 3 | 4 | def __init__(self, value): 5 | self.value = value 6 | self.inqueue = False 7 | --------------------------------------------------------------------------------