(base) bash-5.2$ date Mon Oct 9 02:29:29 PM EDT 2023 (base) bash-5.2$ pwd /home/accts/sbs5/cs200/www/lectures (base) bash-5.2$ cd newdir (base) bash-5.2$ ls a (base) bash-5.2$ ls a -f (base) bash-5.2$ rm -f (base) bash-5.2$ ls a -f (base) bash-5.2$ rm "-f" (base) bash-5.2$ ls a -f (base) bash-5.2$ help ls bash: help: no help topics match `ls'. Try `help help' or `man -k ls' or `info ls'. (base) bash-5.2$ ls --help Usage: ls [OPTION]... [FILE]... List information about the FILEs (the current directory by default). Sort entries alphabetically if none of -cftuvSUX nor --sort is specified. Mandatory arguments to long options are mandatory for short options too. -a, --all do not ignore entries starting with . -A, --almost-all do not list implied . and .. --author with -l, print the author of each file -b, --escape print C-style escapes for nongraphic characters --block-size=SIZE with -l, scale sizes by SIZE when printing them; e.g., '--block-size=M'; see SIZE format below -B, --ignore-backups do not list implied entries ending with ~ -c with -lt: sort by, and show, ctime (time of last modification of file status information); with -l: show ctime and sort by name; otherwise: sort by ctime, newest first -C list entries by columns --color[=WHEN] color the output WHEN; more info below -d, --directory list directories themselves, not their contents -D, --dired generate output designed for Emacs' dired mode -f list all entries in directory order -F, --classify[=WHEN] append indicator (one of */=>@|) to entries WHEN --file-type likewise, except do not append '*' --format=WORD across -x, commas -m, horizontal -x, long -l, single-column -1, verbose -l, vertical -C --full-time like -l --time-style=full-iso -g like -l, but do not list owner --group-directories-first group directories before files; can be augmented with a --sort option, but any use of --sort=none (-U) disables grouping -G, --no-group in a long listing, don't print group names -h, --human-readable with -l and -s, print sizes like 1K 234M 2G etc. --si likewise, but use powers of 1000 not 1024 -H, --dereference-command-line follow symbolic links listed on the command line --dereference-command-line-symlink-to-dir follow each command line symbolic link that points to a directory --hide=PATTERN do not list implied entries matching shell PATTERN (overridden by -a or -A) --hyperlink[=WHEN] hyperlink file names WHEN --indicator-style=WORD append indicator with style WORD to entry names: none (default), slash (-p), file-type (--file-type), classify (-F) -i, --inode print the index number of each file -I, --ignore=PATTERN do not list implied entries matching shell PATTERN -k, --kibibytes default to 1024-byte blocks for file system usage; used only with -s and per directory totals -l use a long listing format -L, --dereference when showing file information for a symbolic link, show information for the file the link references rather than for the link itself -m fill width with a comma separated list of entries -n, --numeric-uid-gid like -l, but list numeric user and group IDs -N, --literal print entry names without quoting -o like -l, but do not list group information -p, --indicator-style=slash append / indicator to directories -q, --hide-control-chars print ? instead of nongraphic characters --show-control-chars show nongraphic characters as-is (the default, unless program is 'ls' and output is a terminal) -Q, --quote-name enclose entry names in double quotes --quoting-style=WORD use quoting style WORD for entry names: literal, locale, shell, shell-always, shell-escape, shell-escape-always, c, escape (overrides QUOTING_STYLE environment variable) -r, --reverse reverse order while sorting -R, --recursive list subdirectories recursively -s, --size print the allocated size of each file, in blocks -S sort by file size, largest first --sort=WORD sort by WORD instead of name: none (-U), size (-S), time (-t), version (-v), extension (-X), width --time=WORD change the default of using modification times; access time (-u): atime, access, use; change time (-c): ctime, status; birth time: birth, creation; with -l, WORD determines which time to show; with --sort=time, sort by WORD (newest first) --time-style=TIME_STYLE time/date format with -l; see TIME_STYLE below -t sort by time, newest first; see --time -T, --tabsize=COLS assume tab stops at each COLS instead of 8 -u with -lt: sort by, and show, access time; with -l: show access time and sort by name; otherwise: sort by access time, newest first -U do not sort; list entries in directory order -v natural sort of (version) numbers within text -w, --width=COLS set output width to COLS. 0 means no limit -x list entries by lines instead of by columns -X sort alphabetically by entry extension -Z, --context print any security context of each file --zero end each output line with NUL, not newline -1 list one file per line --help display this help and exit --version output version information and exit The SIZE argument is an integer and optional unit (example: 10K is 10*1024). Units are K,M,G,T,P,E,Z,Y (powers of 1024) or KB,MB,... (powers of 1000). Binary prefixes can be used, too: KiB=K, MiB=M, and so on. The TIME_STYLE argument can be full-iso, long-iso, iso, locale, or +FORMAT. FORMAT is interpreted like in date(1). If FORMAT is FORMAT1FORMAT2, then FORMAT1 applies to non-recent files and FORMAT2 to recent files. TIME_STYLE prefixed with 'posix-' takes effect only outside the POSIX locale. Also the TIME_STYLE environment variable sets the default style to use. The WHEN argument defaults to 'always' and can also be 'auto' or 'never'. Using color to distinguish file types is disabled both by default and with --color=never. With --color=auto, ls emits color codes only when standard output is connected to a terminal. The LS_COLORS environment variable can change the settings. Use the dircolors(1) command to set it. Exit status: 0 if OK, 1 if minor problems (e.g., cannot access subdirectory), 2 if serious trouble (e.g., cannot access command-line argument). GNU coreutils online help: Full documentation or available locally via: info '(coreutils) ls invocation' (base) bash-5.2$ rm --help Usage: rm [OPTION]... [FILE]... Remove (unlink) the FILE(s). -f, --force ignore nonexistent files and arguments, never prompt -i prompt before every removal -I prompt once before removing more than three files, or when removing recursively; less intrusive than -i, while still giving protection against most mistakes --interactive[=WHEN] prompt according to WHEN: never, once (-I), or always (-i); without WHEN, prompt always --one-file-system when removing a hierarchy recursively, skip any directory that is on a file system different from that of the corresponding command line argument --no-preserve-root do not treat '/' specially --preserve-root[=all] do not remove '/' (default); with 'all', reject any command line argument on a separate device from its parent -r, -R, --recursive remove directories and their contents recursively -d, --dir remove empty directories -v, --verbose explain what is being done --help display this help and exit --version output version information and exit By default, rm does not remove directories. Use the --recursive (-r or -R) option to remove each listed directory, too, along with all of its contents. To remove a file whose name starts with a '-', for example '-foo', use one of these commands: rm -- -foo rm ./-foo Note that if you use rm to remove a file, it might be possible to recover some of its contents, given sufficient expertise and/or time. For greater assurance that the contents are truly unrecoverable, consider using shred(1). GNU coreutils online help: Full documentation or available locally via: info '(coreutils) rm invocation' (base) bash-5.2$ ls a -f (base) bash-5.2$ rm -- -f rm: remove regular file '-f'? y (base) bash-5.2$ ls a (base) bash-5.2$ touch -f touch: missing file operand Try 'touch --help' for more information. (base) bash-5.2$ touch -- -f (base) bash-5.2$ ls a -f (base) bash-5.2$ rm ./-f rm: remove regular empty file './-f'? y (base) bash-5.2$ cd /c/cs200/hws (base) bash-5.2$ p Python 3.11.5 (main, Aug 28 2023, 00:00:00) [GCC 12.3.1 20230508 (Red Hat 12.3.1-1)] on linux Type "help", "copyright", "credits" or "license" for more information. >>> from hw3a import * >>> main() hours # is it greater than 0? X got: 0 expected: . at 0x7fbbc42dc4a0> gates OK got: True expected: True OK got: True expected: True OK got: True expected: True OK got: True expected: True OK got: False expected: False OK got: False expected: False OK got: False expected: False OK got: False expected: False circuits OK got: True expected: True OK got: True expected: True OK got: False expected: False OK got: False expected: False all_wires OK got: ['cx', 'cy', 't1', 't2', 'x', 'y', 'z'] expected: ['cx', 'cy', 't1', 't2', 'x', 'y', 'z'] OK got: ['s', 'sc', 'u0', 'u1', 'v0', 'v1', 'x0', 'x1', 'y0', 'y1', 'z0', 'z1'] expected: ['s', 'sc', 'u0', 'u1', 'v0', 'v1', 'x0', 'x1', 'y0', 'y1', 'z0', 'z1'] find_gate OK got: gate('and', ['cx', 'cy'], 't2') expected: gate('and', ['cx', 'cy'], 't2') OK got: gate('xor', ['x', 'y'], 'w') expected: gate('xor', ['x', 'y'], 'w') OK got: False expected: False ha_ckt OK got: True expected: True X got: [] expected: ['x', 'y'] X got: [] expected: ['z', 'c0'] fa_ckt OK got: True expected: True X got: [] expected: ['x', 'y', 'ci'] X got: [] expected: ['z', 'c0'] next_value OK got: 1 expected: 1 OK got: 0 expected: 0 OK got: 0 expected: 0 OK got: 1 expected: 1 OK got: 1 expected: 1 OK got: 0 expected: 0 next_config OK got: {'x': 0, 'y': 1, 'z': 0, 'cx': 1, 'cy': 0, 't1': 0, 't2': 0} expected: {'x': 0, 'y': 1, 'z': 0, 'cx': 1, 'cy': 0, 't1': 0, 't2': 0} OK got: {'x': 0, 'y': 0, 'z': 0, 'cx': 1, 'cy': 1, 't1': 0, 't2': 1} expected: {'x': 0, 'y': 0, 'z': 0, 'cx': 1, 'cy': 1, 't1': 0, 't2': 1} OK got: {'x1': 0, 'x0': 1, 'y1': 1, 'y0': 0, 's': 1, 'z1': 0, 'z0': 0, 'sc': 0, 'u1': 0, 'v1': 1, 'u0': 0, 'v0': 0} expected: {'x1': 0, 'x0': 1, 'y1': 1, 'y0': 0, 's': 1, 'z1': 0, 'z0': 0, 'sc': 0, 'u1': 0, 'v1': 1, 'u0': 0, 'v0': 0} OK got: {'x1': 0, 'x0': 1, 'y1': 1, 'y0': 0, 's': 1, 'z1': 1, 'z0': 0, 'sc': 0, 'u1': 0, 'v1': 1, 'u0': 0, 'v0': 0} expected: {'x1': 0, 'x0': 1, 'y1': 1, 'y0': 0, 's': 1, 'z1': 1, 'z0': 0, 'sc': 0, 'u1': 0, 'v1': 1, 'u0': 0, 'v0': 0} OK got: {'x': 0, 'y': 0, 'q': 1, 'u': 1} expected: {'x': 0, 'y': 0, 'q': 1, 'u': 1} OK got: {'x': 0, 'y': 1, 'q': 1, 'u': 0} expected: {'x': 0, 'y': 1, 'q': 1, 'u': 0} stable OK got: True expected: True OK got: False expected: False all_stable_configs OK got: [{'w': 0, 'x': 0, 'y': 0, 'z': 1}, {'w': 0, 'x': 1, 'y': 1, 'z': 1}, {'w': 1, 'x': 0, 'y': 1, 'z': 0}, {'w': 1, 'x': 1, 'y': 0, 'z': 0}] expected: [{'w': 0, 'x': 0, 'y': 0, 'z': 1}, {'w': 0, 'x': 1, 'y': 1, 'z': 1}, {'w': 1, 'x': 0, 'y': 1, 'z': 0}, {'w': 1, 'x': 1, 'y': 0, 'z': 0}] OK got: [{'x': 0, 'z': 0}, {'x': 0, 'z': 1}, {'x': 1, 'z': 1}] expected: [{'x': 0, 'z': 0}, {'x': 0, 'z': 1}, {'x': 1, 'z': 1}] output_values OK got: [0] expected: [0] OK got: [1, 0] expected: [1, 0] init_config OK got: {'x': 1, 'y': 0, 'cx': 0, 'cy': 0, 't1': 0, 't2': 0, 'z': 0} expected: {'x': 1, 'y': 0, 'cx': 0, 'cy': 0, 't1': 0, 't2': 0, 'z': 0} OK got: {'z': 0} expected: {'z': 0} simulate OK got: [{'z': 0}, {'z': 0}, {'z': 1}, {'z': 0}, {'z': 1}] expected: [{'z': 0}, {'z': 0}, {'z': 1}, {'z': 0}, {'z': 1}] OK got: [{'x': 0, 'y': 1, 'z': 0, 'cx': 0, 'cy': 0, 't1': 0, 't2': 0}, {'x': 0, 'y': 1, 'z': 0, 'cx': 0, 'cy': 0, 't1': 0, 't2': 0}] expected: [{'x': 0, 'y': 1, 'z': 0, 'cx': 0, 'cy': 0, 't1': 0, 't2': 0}, {'x': 0, 'y': 1, 'z': 0, 'cx': 0, 'cy': 0, 't1': 0, 't2': 0}] OK got: [{'x1': 0, 'x0': 1, 'y1': 1, 'y0': 0, 's': 1, 'z1': 0, 'z0': 0, 'sc': 0, 'u1': 0, 'v1': 0, 'u0': 0, 'v0': 0}, {'x1': 0, 'x0': 1, 'y1': 1, 'y0': 0, 's': 1, 'z1': 0, 'z0': 0, 'sc': 0, 'u1': 0, 'v1': 0, 'u0': 0, 'v0': 0}, {'x1': 0, 'x0': 1, 'y1': 1, 'y0': 0, 's': 1, 'z1': 0, 'z0': 0, 'sc': 0, 'u1': 0, 'v1': 1, 'u0': 0, 'v0': 0}] expected: [{'x1': 0, 'x0': 1, 'y1': 1, 'y0': 0, 's': 1, 'z1': 0, 'z0': 0, 'sc': 0, 'u1': 0, 'v1': 0, 'u0': 0, 'v0': 0}, {'x1': 0, 'x0': 1, 'y1': 1, 'y0': 0, 's': 1, 'z1': 0, 'z0': 0, 'sc': 0, 'u1': 0, 'v1': 0, 'u0': 0, 'v0': 0}, {'x1': 0, 'x0': 1, 'y1': 1, 'y0': 0, 's': 1, 'z1': 0, 'z0': 0, 'sc': 0, 'u1': 0, 'v1': 1, 'u0': 0, 'v0': 0}] OK got: [{'x': 0, 'y': 1, 'q': 1, 'u': 0}] expected: [{'x': 0, 'y': 1, 'q': 1, 'u': 0}] OK got: [{'x': 0, 'y': 1, 'w': 0, 'z': 0}, {'x': 0, 'y': 1, 'w': 0, 'z': 0}, {'x': 0, 'y': 1, 'w': 1, 'z': 1}] expected: [{'x': 0, 'y': 1, 'w': 0, 'z': 0}, {'x': 0, 'y': 1, 'w': 0, 'z': 0}, {'x': 0, 'y': 1, 'w': 1, 'z': 1}] final_config OK got: 'none' expected: 'none' OK got: {'x': 1, 'y': 1, 'z': 1, 'cx': 0, 'cy': 0, 't1': 1, 't2': 0} expected: {'x': 1, 'y': 1, 'z': 1, 'cx': 0, 'cy': 0, 't1': 1, 't2': 0} OK got: {'x1': 0, 'x0': 0, 'y1': 1, 'y0': 0, 's': 0, 'z1': 0, 'z0': 0, 'sc': 1, 'u1': 0, 'v1': 0, 'u0': 0, 'v0': 0} expected: {'x1': 0, 'x0': 0, 'y1': 1, 'y0': 0, 's': 0, 'z1': 0, 'z0': 0, 'sc': 1, 'u1': 0, 'v1': 0, 'u0': 0, 'v0': 0} OK got: 'none' expected: 'none' OK got: {'x': 1, 'y': 1, 'q': 0, 'u': 1} expected: {'x': 1, 'y': 1, 'q': 0, 'u': 1} >>> g = gate('not',['x'],'y') >>> g gate('not', ['x'], 'y') >>> g.good_gate() True >>> bg = gate('not',['x','z'],'y') >>> bg gate('not', ['x', 'z'], 'y') >>> bg.good_gate() False >>> g2 = gate('and',['x','z'],'y') >>> g2 gate('and', ['x', 'z'], 'y') >>> g2.good_gate() True >>> bg2 = gate('and',['x'],'y') >>> bg2 gate('and', ['x'], 'y') >>> bg2.good_gate() False >>> bg3 = gate('joe',['x'],'y') >>> bg3 gate('joe', ['x'], 'y') >>> bg3.good_gate() False >>> bg3 gate('joe', ['x'], 'y') >>> g1 Traceback (most recent call last): File "", line 1, in NameError: name 'g1' is not defined. Did you mean: 'g'? >>> g gate('not', ['x'], 'y') >>> g2 gate('and', ['x', 'z'], 'y') >>> g == g2 False >>> g == g True >>> eq1_ckt circuit(['x', 'y'], ['z'], [gate('not', ['x'], 'cx'), gate('not', ['y'], 'cy'), gate('and', ['x', 'y'], 't1'), gate('and', ['cx', 'cy'], 't2'), gate('or', ['t1', 't2'], 'z')]) >>> eq2_ckt circuit(['x', 'y'], ['z'], [gate('xor', ['x', 'y'], 'w'), gate('not', ['w'], 'z')]) >>> eq2_ckt.good_circuit() True >>> eq1_ckt.good_circuit() True >>> nullckt circuit([], [], []) >>> nullckt.good_circuit() True >>> badckt1 circuit([1], [2], [3]) >>> badckt1.good_circuit() False >>> badckt2 circuit([], [], [gate('bad', ['x', 'v'], 'v')]) >>> badckt2.good_circuit() False >>> eq1_ckt.all_wires() ['cx', 'cy', 't1', 't2', 'x', 'y', 'z'] >>> eq1_ckt circuit(['x', 'y'], ['z'], [gate('not', ['x'], 'cx'), gate('not', ['y'], 'cy'), gate('and', ['x', 'y'], 't1'), gate('and', ['cx', 'cy'], 't2'), gate('or', ['t1', 't2'], 'z')]) >>> eq1_ckt.inputs ['x', 'y'] >>> eq1_ckt.outputs ['z'] >>> eq1_ckt.outputs + eq1_ckt.inputs ['z', 'x', 'y'] >>> eq1_ckt.gates [gate('not', ['x'], 'cx'), gate('not', ['y'], 'cy'), gate('and', ['x', 'y'], 't1'), gate('and', ['cx', 'cy'], 't2'), gate('or', ['t1', 't2'], 'z')] >>> map(lambda x: x.inputs, eq1_ckt.gates) >>> list(map(lambda x: x.inputs, eq1_ckt.gates)) [['x'], ['y'], ['x', 'y'], ['cx', 'cy'], ['t1', 't2']] >>> flatten(list(map(lambda x: x.inputs, eq1_ckt.gates))) ['x', 'y', 'x', 'y', 'cx', 'cy', 't1', 't2'] >>> list(map(lambda x: x.output, eq1_ckt.gates)) ['cx', 'cy', 't1', 't2', 'z'] >>> eq1_ckt circuit(['x', 'y'], ['z'], [gate('not', ['x'], 'cx'), gate('not', ['y'], 'cy'), gate('and', ['x', 'y'], 't1'), gate('and', ['cx', 'cy'], 't2'), gate('or', ['t1', 't2'], 'z')]) >>> eq1_ckt.find_gate('t2') gate('and', ['cx', 'cy'], 't2') >>> eq1_ckt.find_gate('c') False >>> eq1_config1 {'x': 0, 'y': 1, 'z': 0, 'cx': 0, 'cy': 0, 't1': 0, 't2': 0} >>> [x for x in eq1_config1] ['x', 'y', 'z', 'cx', 'cy', 't1', 't2'] >>> eq1_ckt circuit(['x', 'y'], ['z'], [gate('not', ['x'], 'cx'), gate('not', ['y'], 'cy'), gate('and', ['x', 'y'], 't1'), gate('and', ['cx', 'cy'], 't2'), gate('or', ['t1', 't2'], 'z')]) >>> eq1_ckt.find_gate('cx') gate('not', ['x'], 'cx') >>> eq1_config1 {'x': 0, 'y': 1, 'z': 0, 'cx': 0, 'cy': 0, 't1': 0, 't2': 0} >>> [eq1_ckt.next_value(w, eq1_config1) for x in eq1_config1] Traceback (most recent call last): File "", line 1, in File "", line 1, in NameError: name 'w' is not defined >>> [eq1_ckt.next_value(w, eq1_config1) for w in eq1_config1] [0, 1, 0, 1, 0, 0, 0] >>> eq1_ckt circuit(['x', 'y'], ['z'], [gate('not', ['x'], 'cx'), gate('not', ['y'], 'cy'), gate('and', ['x', 'y'], 't1'), gate('and', ['cx', 'cy'], 't2'), gate('or', ['t1', 't2'], 'z')]) >>> eq1_ckt.all_wires() ['cx', 'cy', 't1', 't2', 'x', 'y', 'z'] >>> [x for x in eq1_config1] ['x', 'y', 'z', 'cx', 'cy', 't1', 't2'] >>> {w: eq1_ckt.next_value(w, eq1_config1) for w in eq1_config1} {'x': 0, 'y': 1, 'z': 0, 'cx': 1, 'cy': 0, 't1': 0, 't2': 0} >>> all_configs(['a','b','c']) [{'a': 0, 'b': 0, 'c': 0}, {'a': 0, 'b': 0, 'c': 1}, {'a': 0, 'b': 1, 'c': 0}, {'a': 0, 'b': 1, 'c': 1}, {'a': 1, 'b': 0, 'c': 0}, {'a': 1, 'b': 0, 'c': 1}, {'a': 1, 'b': 1, 'c': 0}, {'a': 1, 'b': 1, 'c': 1}] >>> for x in all_configs(['a','b','c']): ... print (x) ... {'a': 0, 'b': 0, 'c': 0} {'a': 0, 'b': 0, 'c': 1} {'a': 0, 'b': 1, 'c': 0} {'a': 0, 'b': 1, 'c': 1} {'a': 1, 'b': 0, 'c': 0} {'a': 1, 'b': 0, 'c': 1} {'a': 1, 'b': 1, 'c': 0} {'a': 1, 'b': 1, 'c': 1} >>> for x in all_configs(['a','b','c',d']): File "", line 1 for x in all_configs(['a','b','c',d']): ^ SyntaxError: unterminated string literal (detected at line 1) >>> for x in all_configs(['a','b','c','d']): ... print (x) ... {'a': 0, 'b': 0, 'c': 0, 'd': 0} {'a': 0, 'b': 0, 'c': 0, 'd': 1} {'a': 0, 'b': 0, 'c': 1, 'd': 0} {'a': 0, 'b': 0, 'c': 1, 'd': 1} {'a': 0, 'b': 1, 'c': 0, 'd': 0} {'a': 0, 'b': 1, 'c': 0, 'd': 1} {'a': 0, 'b': 1, 'c': 1, 'd': 0} {'a': 0, 'b': 1, 'c': 1, 'd': 1} {'a': 1, 'b': 0, 'c': 0, 'd': 0} {'a': 1, 'b': 0, 'c': 0, 'd': 1} {'a': 1, 'b': 0, 'c': 1, 'd': 0} {'a': 1, 'b': 0, 'c': 1, 'd': 1} {'a': 1, 'b': 1, 'c': 0, 'd': 0} {'a': 1, 'b': 1, 'c': 0, 'd': 1} {'a': 1, 'b': 1, 'c': 1, 'd': 0} {'a': 1, 'b': 1, 'c': 1, 'd': 1} >>> all_configs_aux(['a','b','c']) [[['a', 0], ['b', 0], ['c', 0]], [['a', 0], ['b', 0], ['c', 1]], [['a', 0], ['b', 1], ['c', 0]], [['a', 0], ['b', 1], ['c', 1]], [['a', 1], ['b', 0], ['c', 0]], [['a', 1], ['b', 0], ['c', 1]], [['a', 1], ['b', 1], ['c', 0]], [['a', 1], ['b', 1], ['c', 1]]] >>> for x in all_configs_aux(['a','b','c']): ... print (x) ... [['a', 0], ['b', 0], ['c', 0]] [['a', 0], ['b', 0], ['c', 1]] [['a', 0], ['b', 1], ['c', 0]] [['a', 0], ['b', 1], ['c', 1]] [['a', 1], ['b', 0], ['c', 0]] [['a', 1], ['b', 0], ['c', 1]] [['a', 1], ['b', 1], ['c', 0]] [['a', 1], ['b', 1], ['c', 1]] >>> all_configs(latch_ckt.all_wires())) File "", line 1 all_configs(latch_ckt.all_wires())) ^ SyntaxError: unmatched ')' >>> all_configs(latch_ckt.all_wires()) [{'q': 0, 'u': 0, 'x': 0, 'y': 0}, {'q': 0, 'u': 0, 'x': 0, 'y': 1}, {'q': 0, 'u': 0, 'x': 1, 'y': 0}, {'q': 0, 'u': 0, 'x': 1, 'y': 1}, {'q': 0, 'u': 1, 'x': 0, 'y': 0}, {'q': 0, 'u': 1, 'x': 0, 'y': 1}, {'q': 0, 'u': 1, 'x': 1, 'y': 0}, {'q': 0, 'u': 1, 'x': 1, 'y': 1}, {'q': 1, 'u': 0, 'x': 0, 'y': 0}, {'q': 1, 'u': 0, 'x': 0, 'y': 1}, {'q': 1, 'u': 0, 'x': 1, 'y': 0}, {'q': 1, 'u': 0, 'x': 1, 'y': 1}, {'q': 1, 'u': 1, 'x': 0, 'y': 0}, {'q': 1, 'u': 1, 'x': 0, 'y': 1}, {'q': 1, 'u': 1, 'x': 1, 'y': 0}, {'q': 1, 'u': 1, 'x': 1, 'y': 1}] >>> for x in all_configs(latch_ckt.all_wires()): ... print (x) ... {'q': 0, 'u': 0, 'x': 0, 'y': 0} {'q': 0, 'u': 0, 'x': 0, 'y': 1} {'q': 0, 'u': 0, 'x': 1, 'y': 0} {'q': 0, 'u': 0, 'x': 1, 'y': 1} {'q': 0, 'u': 1, 'x': 0, 'y': 0} {'q': 0, 'u': 1, 'x': 0, 'y': 1} {'q': 0, 'u': 1, 'x': 1, 'y': 0} {'q': 0, 'u': 1, 'x': 1, 'y': 1} {'q': 1, 'u': 0, 'x': 0, 'y': 0} {'q': 1, 'u': 0, 'x': 0, 'y': 1} {'q': 1, 'u': 0, 'x': 1, 'y': 0} {'q': 1, 'u': 0, 'x': 1, 'y': 1} {'q': 1, 'u': 1, 'x': 0, 'y': 0} {'q': 1, 'u': 1, 'x': 0, 'y': 1} {'q': 1, 'u': 1, 'x': 1, 'y': 0} {'q': 1, 'u': 1, 'x': 1, 'y': 1} >>> [conf for conf in all_configs(latch_ckt.all_wires()) if latch_ckt.stable(conf)] [{'q': 0, 'u': 1, 'x': 1, 'y': 0}, {'q': 0, 'u': 1, 'x': 1, 'y': 1}, {'q': 1, 'u': 0, 'x': 0, 'y': 1}, {'q': 1, 'u': 0, 'x': 1, 'y': 1}, {'q': 1, 'u': 1, 'x': 0, 'y': 0}] >>> for x in [conf for conf in all_configs(latch_ckt.all_wires()) if latch_ckt.stable(conf)]: ... print (x) ... {'q': 0, 'u': 1, 'x': 1, 'y': 0} {'q': 0, 'u': 1, 'x': 1, 'y': 1} {'q': 1, 'u': 0, 'x': 0, 'y': 1} {'q': 1, 'u': 0, 'x': 1, 'y': 1} {'q': 1, 'u': 1, 'x': 0, 'y': 0} >>> latch_ckt circuit(['x', 'y'], ['q', 'u'], [gate('nand', ['x', 'u'], 'q'), gate('nand', ['y', 'q'], 'u')]) >>> latch_ckt.init_config([1,1]) {'x': 1, 'y': 1, 'q': 0, 'u': 0} >>> latch_ckt.init_config([0,0]) {'x': 0, 'y': 0, 'q': 0, 'u': 0} >>> clock_ckt.simulate({"z": 0}, 4) [{'z': 0}, {'z': 0}, {'z': 1}, {'z': 0}, {'z': 1}] >>> clock_ckt circuit([], ['z'], [gate('not', ['z'], 'z')]) >>> clock_ckt.simulate({"z": 0}, 10) [{'z': 0}, {'z': 0}, {'z': 1}, {'z': 0}, {'z': 1}, {'z': 0}, {'z': 1}, {'z': 0}, {'z': 1}, {'z': 0}, {'z': 1}] >>> eq1_ckt.simulate(eq1_config1, 5) [{'x': 0, 'y': 1, 'z': 0, 'cx': 0, 'cy': 0, 't1': 0, 't2': 0}, {'x': 0, 'y': 1, 'z': 0, 'cx': 0, 'cy': 0, 't1': 0, 't2': 0}] >>> for x in eq1_ckt.simulate(eq1_config1, 5): ... print (x) ... {'x': 0, 'y': 1, 'z': 0, 'cx': 0, 'cy': 0, 't1': 0, 't2': 0} {'x': 0, 'y': 1, 'z': 0, 'cx': 0, 'cy': 0, 't1': 0, 't2': 0} >>> clock_ckt.final_config({"z": 0})) File "", line 1 clock_ckt.final_config({"z": 0})) ^ SyntaxError: unmatched ')' >>> clock_ckt.final_config({"z": 0}) 'none' >>> (base) bash-5.2$ exit Process shell finished