This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def solve_puzzle(self): | |
| """ | |
| Generate a solution string for a puzzle | |
| Updates the puzzle and returns a move string | |
| """ | |
| total_moves = "" | |
| moves = "" | |
| if self.lower_row_invariant(0, 0): | |
| return moves |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| Loyd's Fifteen puzzle - solver and visualizer | |
| project by TG 13/08/2015 | |
| poc_fifteen_gui and Puzzle class provided by instructors | |
| and modified (random shuffle method added) | |
| Note that solved configuration has the blank (zero) tile in upper left | |
| Use the arrows key to swap this tile with its neighbors. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| Word Wrangler game | |
| WordWranglerGUI class and WordWrangler class provided by instructors | |
| project by TG 26/06/2015 | |
| starts at line 195 | |
| enable pop-up windows!! | |
| hit play to start |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| Monte Carlo metod Tic-Tac-Toe Player | |
| project by TG 12/06/2015 | |
| poc_ttt_provided and poc_ttt_gui provided by instructors | |
| enable pop-up windows!! | |
| deacrease NTRIALS(line 20) to reduce AI and speed up AI moves | |
| player can change the board size (line 23) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| Zombie Apocalypse | |
| -TG 17/07/2015(modifed oct/2015) | |
| -project for PoC course by Rice University | |
| https://www.coursera.org/course/principlescomputing2 | |
| -Zombie template | |
| http://www.codeskulptor.org/#poc_zombie_template.py |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| Clone of 2048 game | |
| http://2048game.com/ | |
| - click Play to Start | |
| - project for PoC course by Rice University | |
| https://www.coursera.org/course/principlescomputing1 | |
| - 2048 template | |
| http://www.codeskulptor.org/#poc_2048_template.py |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| RiceRocks (Asteroids) the Game | |
| An Introduction to Interactive Programming in Python | |
| by Joe Warren, Scott Rixner, John Greiner, Stephen Wong -- Rice Univercity | |
| project by TG | |
| """ | |
| import simplegui | |
| import math | |
| import random |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def add_item(self, click_position): | |
| """ | |
| Event handler to add new obstacles, humans and zombies | |
| """ | |
| row, col = self._simulation.get_index(click_position, CELL_SIZE) | |
| if self._item_type == OBSTACLE: | |
| if not self.is_occupied(row, col): | |
| self._simulation.set_full(row, col) | |
| elif self._item_type == ZOMBIE: | |
| if self._simulation.is_empty(row, col): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Function to generate all strings for the word wrangler game | |
| def gen_all_strings(word): | |
| """ | |
| Generate all strings that can be composed from the letters in word | |
| in any order. | |
| Returns a list of all strings that can be formed from the letters | |
| in word. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def get_best_move(board, scores): | |
| """ | |
| Return best move [tuple (row, column)] for the given board, | |
| based on the given list of scores. | |
| """ | |
| best_moves = [] | |
| for empty_sq in board.get_empty_squares(): | |
| if best_moves: | |
| if scores[empty_sq[0]][empty_sq[1]] > scores[best_moves[0][0]][best_moves[0][1]]: | |
| best_moves = [] |
NewerOlder