def main(): global TOTAL, HALF canvas.init("Game_Snake_AI", 15, 13) canvas.draw_grid() canvas.update() TOTAL = canvas.WIDTH * canvas.HEIGHT HALF = int(TOTAL / 2) input("Press <Enter> to start!") run_game() input("Press <Enter> to close!")
http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. """ from search.bfs import bfs from graph import canvas if __name__ == "__main__": canvas.init("BFS") canvas.draw_bg() canvas.draw_grid() start = (6, 5) end = (12, 10) obstacles = [] for x in range(4, 10): obstacles.append((x, 3)) for x in range(4, 20): obstacles.append((x, 12)) for y in range(2, 14): obstacles.append((10, y)) for y in range(2, 16): obstacles.append((17, y))
http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. """ from search.dfs import dfs from graph import canvas if __name__ == "__main__": canvas.init("DFS") canvas.draw_bg() canvas.draw_grid() start = (6, 5) end = (12, 10) obstacles = [] for x in range(4, 10): obstacles.append((x, 3)) for x in range(4, 20): obstacles.append((x, 12)) for y in range(2, 14): obstacles.append((10, y)) for y in range(2, 16): obstacles.append((17, y))
http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. """ from search.a_star import cal from graph import canvas if __name__ == "__main__": canvas.init("A*") canvas.draw_bg() canvas.draw_grid() start = (6, 5) end = (12, 10) obstacles = [] for x in range(4, 10): obstacles.append((x, 3)) for x in range(4, 20): obstacles.append((x, 12)) for y in range(2, 14): obstacles.append((10, y)) for y in range(2, 16): obstacles.append((17, y))