This file contains 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 random | |
from enum import Enum | |
class NaC(object): | |
class Levels(Enum): | |
IDIOT = 0 | |
AVERAGE = 1 | |
GENIUS = 2 |
This file contains 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 curses | |
import nac | |
class NaCConsole(object): | |
def __init__(self): | |
self.screen = curses.initscr() |
This file contains 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 numpy | |
def main(): | |
print("------------------") | |
print("| codedrome.com |") | |
print("| NumPy Matrices |") | |
print("------------------\n") |
This file contains 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 Matrix: | |
def __init__(self, entries=None, rowcount=0, columncount=0): | |
""" | |
Create a Matrix object either with the supplied values | |
or with the specified number of rows and columns of 0 values. | |
""" | |
if entries is not None: |
This file contains 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 matrix | |
def main(): | |
print("----------------------") | |
print("| codedrome.com |") | |
print("| Exploring Matrices |") | |
print("----------------------\n") |
This file contains 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 curses | |
def main(): | |
""" | |
The curses.wrapper function is an optional function that | |
encapsulates a number of lower-level setup and teardown | |
functions, and takes a single function to run when | |
the initializations have taken place. |
This file contains 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 turtle | |
import math | |
def main(): | |
print("--------------------") | |
print("| codedrome.com |") | |
print("| Polar Plots with |") | |
print("| Turtle Graphics |") |
This file contains 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 turtle | |
import math | |
def main(): | |
print("--------------------") | |
print("| codedrome.com |") | |
print("| Polar Plots with |") | |
print("| Turtle Graphics |") |
This file contains 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 plot(title, radius, start_degrees, end_degrees, function): | |
""" | |
Draw a polar plot with the given radius | |
from/to the given angles. | |
The plot positions are calculated by | |
the supplied function. | |
Any function can be used but it must |
This file contains 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 cardioid_function(radians, radius): | |
""" | |
Calculate the distance from the origin | |
for the given angle, then calculate | |
its coordinates. | |
""" | |
distance = (1 + math.cos(radians)) * radius |