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
| """ | |
| filename: highlight_problem.py | |
| author: Tristan Hilbert | |
| desc: This was a problem I brought up to a research fellow. | |
| I was trying to show that storing highlighted text that can | |
| have multiple layers is difficult. Below I have created a python | |
| function and a series of tests. Try to get the tests to pass by | |
| modifying the function below. Feel free to add functions but do not modify the tests! | |
| """ |
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
| class_name Behavior | |
| const behavior_owner_field_name: String = "behaviors" | |
| const behavior_owner_keyed_prefix: String = "behavior_item_" | |
| static func assertAssignParent(self_ref: Node, host: Node): | |
| if host != null: | |
| return host | |
| var possible = self_ref.get_node(NodePath("..")) |
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
| module Text.JsonParser | |
| ( Json (..), | |
| withFileAndMapper, | |
| ) | |
| where | |
| import qualified Data.Either as Either | |
| import qualified Data.Map as Map | |
| import qualified Data.Maybe as Maybe | |
| import qualified Text.Parsec as Parsec |
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
| import time | |
| import logging | |
| import asyncio | |
| def get_generator(): | |
| try: | |
| yield "hello there!" | |
| finally: | |
| logging.info("Finally Block Has Been Run!") |
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
| // Globals for the browser: | |
| // window, document, JSON, String, Math | |
| var canvas = document.getElementById("canvas"); | |
| var turtle = canvas.getContext("2d"); | |
| var score1 = 0; | |
| var score2 = 0; | |
| var ball = { |
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
| """ | |
| TODO | |
| 2nd, Because I used recursion for the Quicksort it seems to run much slower than insertion sort on the last run. | |
| """ | |
| ##################################################################### | |
| # Quicksort | |
| def partition(lst, start, end): | |
| pivot = lst[start] | |
| start_i = start | |
| end_i = end |
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
| # Step 1 Setup the Stage | |
| stage.set_background("winter") | |
| stage.disable_all_walls() | |
| stage.set_gravity(0.2) | |
| snowflakes = [] | |
| # Step 2 Function to Spawn Snowflakes |
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
| answer = random.randint(1,1000) | |
| last_guess = 0 | |
| num_guesses = 0 | |
| def make_a_guess(guess): | |
| global last_guess, answer, num_guesses | |
| last_guess = guess | |
| num_guesses += 1 | |
| # Right Here goes the next lines of code! |
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
| import java.awt.*; | |
| public class LinesMain { | |
| public static void main(String[] args) { | |
| TristansFrame frame = new TristansFrame(); | |
| Window window = new Window(null, null); | |
| Stroke stroke = new BasicStroke(2.0f); |
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
| display = codesters.Text("____________", 0, 0, "red") | |
| display.set_size(2) | |
| wrong_text = codesters.Text("Wrong Guesses: 0", -150, 200, "red") | |
| ## WAY 1 | |
| pool = [] | |
| pool.append("treasure") | |
| pool.append("computer") |
NewerOlder