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
You might also like...
πŸ”₯ Cannlytics-powered artificial intelligence πŸ€–
πŸ”₯ Cannlytics-powered artificial intelligence πŸ€–

Cannlytics AI πŸ”₯ Cannlytics-powered artificial intelligence πŸ€– πŸ—οΈ Installation πŸƒβ€β™€οΈ Quickstart 🧱 Development 🦾 Automation πŸ’Έ Support πŸ›οΈ License ?

2021 Artificial Intelligence Diabetes Datathon
2021 Artificial Intelligence Diabetes Datathon

A.I.D.D. 2021 2021 Artificial Intelligence Diabetes Datathon A.I.D.D. 2021은 β€˜2021 인곡지λŠ₯ ν•™μŠ΅μš© 데이터 ꡬ좕사업’을 톡해 λ§Œλ“€μ–΄μ§„ ν•™μŠ΅μš© 데이터λ₯Ό ν™œμš©ν•˜μ—¬ 당뇨병을 효과적으둜 μ˜ˆμΈ‘ν•  수 μžˆλŠ”κ°€μ— λŒ€ν•œ A

CasualHealthcare's Pneumonia detection with Artificial Intelligence (Convolutional Neural Network)

CasualHealthcare's Pneumonia detection with Artificial Intelligence (Convolutional Neural Network) This is PneumoniaDiagnose, an artificially intellig

Artificial intelligence technology inferring issues and logically supporting facts from raw text
Artificial intelligence technology inferring issues and logically supporting facts from raw text

κ°œμš” λΉ„μ •ν˜• ν…μŠ€νŠΈλ₯Ό ν•™μŠ΅ν•˜μ—¬ μŸμ λ³„ 사싀과 논리적 κ·Όκ±° 좔둠이 κ°€λŠ₯ν•œ 인곡지λŠ₯ μ›μ²œκΈ°μˆ  Artificial intelligence techno

Tom-the-AI - A compound artificial intelligence software for Linux systems.
Tom-the-AI - A compound artificial intelligence software for Linux systems.

Tom the AI (version 0.82) WARNING: This software is not yet ready to use, I'm still setting up the GitHub repository. Should be ready in a few days. T

An AI made using artificial intelligence (AI) and machine learning algorithms (ML) .

DTech.AIML An AI made using artificial intelligence (AI) and machine learning algorithms (ML) . This is created by help of some members in my team and

This Artificial Intelligence program can take a black and white/grayscale image and generate a realistic or plausible colorized version of the same picture.

Colorizer The point of this project is to write a program capable of taking a black and white / grayscale image, and generating a realistic or plausib

AI Virtual Calculator: This is a simple virtual calculator based on Artificial intelligence.

AI Virtual Calculator: This is a simple virtual calculator that works with gestures using OpenCV. We will use our hand in the air to click on the calc

AI Face Mesh: This is a simple face mesh detection program based on Artificial intelligence.

AI Face Mesh: This is a simple face mesh detection program based on Artificial Intelligence which made with Python. It's able to detect 468 different

Owner
Jet Kan
Tutor and Computer Science Undergraduate, National University of Singapore (NUS)
Jet Kan
simple artificial intelligence utilities

Simple AI Project home: http://github.com/simpleai-team/simpleai This lib implements many of the artificial intelligence algorithms described on the b

null 921 Dec 8, 2022
An Artificial Intelligence trying to drive a car by itself on a user created map

An Artificial Intelligence trying to drive a car by itself on a user created map

Akhil Sahukaru 17 Jan 13, 2022
Wordplay, an artificial Intelligence based crossword puzzle solver.

Wordplay, AI based crossword puzzle solver A crossword is a word puzzle that usually takes the form of a square or a rectangular grid of white- and bl

Vaibhaw 4 Nov 16, 2022
Artificial Intelligence playing minesweeper πŸ€–

AI playing Minesweeper ✨ Minesweeper is a single-player puzzle video game. The objective of the game is to clear a rectangular board containing hidden

Vaibhaw 8 Oct 17, 2022
Framework that uses artificial intelligence applied to mathematical models to make predictions

LiconIA Framework that uses artificial intelligence applied to mathematical models to make predictions Interface Overview Table of contents [TOC] 1 Ar

null 4 Jun 20, 2021
Artificial Intelligence search algorithm base on Pacman

Pacman Search Artificial Intelligence search algorithm base on Pacman Source The Pacman Projects by the University of California, Berkeley. Layouts Di

Day Fundora 6 Nov 17, 2022
AI Flow is an open source framework that bridges big data and artificial intelligence.

Flink AI Flow Introduction Flink AI Flow is an open source framework that bridges big data and artificial intelligence. It manages the entire machine

null 144 Dec 30, 2022
Python Rapid Artificial Intelligence Ab Initio Molecular Dynamics

Python Rapid Artificial Intelligence Ab Initio Molecular Dynamics

null 14 Nov 6, 2022
I created My own Virtual Artificial Intelligence named genesis, He can assist with my Tasks and also perform some analysis,,

Virtual-Artificial-Intelligence-genesis- I created My own Virtual Artificial Intelligence named genesis, He can assist with my Tasks and also perform

AKASH M 1 Nov 5, 2021
Randstad Artificial Intelligence Challenge (powered by VGEN). Soluzione proposta da Stefano Fiorucci (anakin87) - primo classificato

Randstad Artificial Intelligence Challenge (powered by VGEN) Soluzione proposta da Stefano Fiorucci (anakin87) - primo classificato Struttura director

Stefano Fiorucci 1 Nov 13, 2021