Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Looney Tunes Race – Planet X 🛰️

CSCI 310 – Introduction to Operations, Fall 2025
Final Project – Option 1 (Multithreaded Race Game)
Group 8

Overview

This project is a multithreaded race game written in C using POSIX threads (pthreads).
Four Looney Tunes characters race on a grid-based board to be the first to carry a golden carrot/flag (C) to the Mountain (F) on Planet X.

Runners (each in their own thread):

  • Bugs Bunny (B)
  • Taz Devil (D)
  • Tweety (T)
  • Marvin the Martian (M)

All runners share the same board and game state, which is protected with a pthread_mutex so the threads don’t corrupt each other’s data.


Game Rules & Mechanics

1. Basic Race Rules

  • Each character moves randomly around the board in its own thread.
  • There are two golden carrots/flags (C) on the board.
  • A runner must:
    1. Step on a C to pick it up.
    2. Then reach the Mountain (F) while carrying the carrot/flag.
  • When a runner is carrying a carrot/flag, they are shown as e.g. B(C).
  • The race ends immediately when any runner reaches F while carrying a carrot/flag.

2. Movement Constraints

  • Only empty squares or special squares (C, F) can be stepped on.
  • No two non-Marvin runners are allowed to stand on the same spot.
  • No one is allowed to step on F unless they are already carrying a carrot/flag.

Special Marvin Mechanics

3. Time Machine – Moving Mountain

  • Marvin can activate the space-time machine after a certain number of full cycles.
  • When the machine activates, the Mountain (F) moves to a new random empty position on the board.
  • This makes the race more chaotic and changes the target location.

4. Shooting & Stealing

  • Marvin is the only character allowed to step onto a square occupied by another runner.
  • If Marvin lands on another runner:
    • That runner is eliminated from the race.
    • If the runner was carrying a carrot/flag, Marvin steals it.
  • Other runners are not allowed to step on each other.

Compilation

You will need:

  • A C compiler (e.g. gcc)
  • POSIX threads support (-pthread)

Compile with:

gcc -pthread race_game.c -o race_game

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages