CS50's Introduction to Artificial Intelligence Test Scripts

Overview

CS50's Introduction to Artificial Intelligence Test Scripts

🤷‍♂️ What's this? 🤷‍♀️

This repository contains Python scripts to automate tests for most of the CS50’s Introduction to Artificial Intelligence with Python projects.

It does not contain any project solution/spoiler, as per the course's Academic Honesty policy.

Disclaimer

This is a student-initiated project. Passing these test cases does not guarantee that you will receive a full grade from the official CS50 AI's teaching team.

📖 Table of Contents

Lecture Concept Project Test Script Description
Search Breadth First Search Degrees degrees_test.py Run test cases given by problem description and this discussion
Search Minimax Tic-Tac-Toe tictactoe_test.py Let your AI play against itself for 10 rounds
Knowledge Model Checking Knights puzzle_test.py Check the correctness of the 4 puzzle results
Knowledge Knowledge Engineering Minesweeper minesweeper_test.py Check if your AI has ≈90% win rate over 1000 simulations
Uncertainty Bayesian Networks Heredity heredity_test.py Run test cases given by problem description and this discussion
Uncertainty Markov Models PageRank pagerank_test.py Compare the output of the 2 implemented functions
Optimization Constraint Satisfaction Crossword generate_test.py Generate crosswords using all 9 different structure + words combination and a special test case from this discussion
Learning Nearest-Neighbor Classification Shopping shopping_test.py Check the information is parsed correctly and result is within a reasonable range
Learning Reinforcement Learning Nim nim_test.py Check if the AI which moves second has a 100% win rate

🛠️ How to Run Tests

Guide

  1. Make sure you have Python3 installed in your machine. Anything above Python 3.4+ should work.
  2. Install pytest by running pip install pytest in a terminal. More information about pip here.
  3. Make a copy of the test file and paste it in the same folder as the project that you want to test.

    For example, if you want to test your code for degrees.py, make a copy of degrees_test.py in the same folder as your degrees.py and other files that came along with the project, like util.py, large/ and small/.

  4. Navigate to the project folder and run pytest or pytest _test.py in a terminal.

    For example, navigate to degrees/ and run pytest or pytest degrees_test.py.

Example

example

🚩 Useful pytest Flags

  • Run pytest -s to show print statements in the console
  • Run pytest -vv for verbose mode
  • Combine both flags pytest -s -vv for extra verbose mode
  • Run pytest --durations=n to see the n slowest execution time
  • Install pytest-repeat with pip and then run pytest --count n to repeat the test for n times

💻 My Setup

Each test should take less than 30 seconds, depending on Python's I/O and your code efficiency.

  • Windows 10 Home Build 19042
  • Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
  • Python 3.9.5 64-bit
  • Visual Studio Code w/Pylance (latest release)

🏆 Acknowledgement

Special thanks to these fellow CS50AI classmates who contributed some of the test cases on the Ed discussion site!

  • Ken Walker
  • Naveena A S
  • Ricardo L
Owner
Jet Kan
Tutor and Computer Science Undergraduate, National University of Singapore (NUS)
Jet Kan
This Deep Learning Model Predicts that from which disease you are suffering.

Deep-Learning-Project This Deep Learning Model Predicts that from which disease you are suffering. This Project Covers the Topics of Deep Learning Int

Jai Viral Doshi 0 Jan 20, 2022
Implementation for Curriculum DeepSDF

Curriculum-DeepSDF This repository is an implementation for Curriculum DeepSDF. Full paper is available here. Preparation Please follow original setti

Haidong Zhu 69 Dec 29, 2022
Provably Rare Gem Miner.

Provably Rare Gem Miner just another random project by yoyoismee.eth useful link main site market contract useful thing you should know read contract

34 Nov 22, 2022
Cervix ROI Segmentation Using U-NET

Cervix ROI Segmentation Using U-NET Overview This code illustrate how to segment the ROI in cervical images using U-NET. The ROI here meant to include

Scotty Kwok 35 Sep 14, 2022
Code for our paper at ECCV 2020: Post-Training Piecewise Linear Quantization for Deep Neural Networks

PWLQ Updates 2020/07/16 - We are working on getting permission from our institution to release our source code. We will release it once we are granted

54 Dec 15, 2022
SingleVC performs any-to-one VC, which is an important component of MediumVC project.

SingleVC performs any-to-one VC, which is an important component of MediumVC project. Here is the official implementation of the paper, MediumVC.

谷下雨 26 Dec 28, 2022
A Python library created to assist programmers with complex mathematical functions

libmaths libmaths was created not only as a learning experience for me, but as a way to make mathematical models in seconds for Python users using mat

Simple 73 Oct 02, 2022
Reading list for research topics in Masked Image Modeling

awesome-MIM Reading list for research topics in Masked Image Modeling(MIM). We list the most popular methods for MIM, if I missed something, please su

ligang 231 Dec 07, 2022
Official PyTorch Implementation for InfoSwap: Information Bottleneck Disentanglement for Identity Swapping

InfoSwap: Information Bottleneck Disentanglement for Identity Swapping Code usage Please check out the user manual page. Paper Gege Gao, Huaibo Huang,

Grace Hešeri 56 Dec 20, 2022
The PyTorch implementation for paper "Neural Texture Extraction and Distribution for Controllable Person Image Synthesis" (CVPR2022 Oral)

ArXiv | Get Start Neural-Texture-Extraction-Distribution The PyTorch implementation for our paper "Neural Texture Extraction and Distribution for Cont

Ren Yurui 111 Dec 10, 2022
Assessing syntactic abilities of BERT

BERT-Syntax Assesing the syntactic abilities of BERT. What Evaluate Google's BERT-Base and BERT-Large models on the syntactic agreement datasets from

Yoav Goldberg 147 Aug 02, 2022
This is a pytorch implementation of the NeurIPS paper GAN Memory with No Forgetting.

GAN Memory for Lifelong learning This is a pytorch implementation of the NeurIPS paper GAN Memory with No Forgetting. Please consider citing our paper

Miaoyun Zhao 43 Dec 27, 2022
Ultra-Data-Efficient GAN Training: Drawing A Lottery Ticket First, Then Training It Toughly

Ultra-Data-Efficient GAN Training: Drawing A Lottery Ticket First, Then Training It Toughly Code for this paper Ultra-Data-Efficient GAN Tra

VITA 77 Oct 05, 2022
Notepy is a full-featured Notepad Python app

Notepy A full featured python text-editor Notable features Autocompletion for parenthesis and quote Auto identation Syntax highlighting Compile and ru

Mirko Rovere 11 Sep 28, 2022
Tidy interface to polars

tidypolars tidypolars is a data frame library built on top of the blazingly fast polars library that gives access to methods and functions familiar to

Mark Fairbanks 144 Jan 08, 2023
A tutorial on training a DarkNet YOLOv4 model for the CrowdHuman dataset

YOLOv4 CrowdHuman Tutorial This is a tutorial demonstrating how to train a YOLOv4 people detector using Darknet and the CrowdHuman dataset. Table of c

JK Jung 118 Nov 10, 2022
An official implementation of the Anchor DETR.

Anchor DETR: Query Design for Transformer-Based Detector Introduction This repository is an official implementation of the Anchor DETR. We encode the

MEGVII Research 276 Dec 28, 2022
This repository collects 100 papers related to negative sampling methods.

Negative-Sampling-Paper This repository collects 100 papers related to negative sampling methods, covering multiple research fields such as Recommenda

RUCAIBox 119 Dec 29, 2022
A PyTorch Implementation of Single Shot Scale-invariant Face Detector.

S³FD: Single Shot Scale-invariant Face Detector A PyTorch Implementation of Single Shot Scale-invariant Face Detector. Eval python wider_eval_pytorch.

carwin 235 Jan 07, 2023
Codes for NeurIPS 2021 paper "On the Equivalence between Neural Network and Support Vector Machine".

On the Equivalence between Neural Network and Support Vector Machine Codes for NeurIPS 2021 paper "On the Equivalence between Neural Network and Suppo

Leslie 8 Oct 25, 2022