Coder Social home page Coder Social logo

man_pac's People

Contributors

chase avatar fantaye-1 avatar yashito avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

chase

man_pac's Issues

Collision Detection

Review shared.h. Note the structures coord_t and dims_t which are used to represent the location and dimensions of a ghost (ghost_t).

Complete the following function in manpac.c, it will return NULL when there is no collision, otherwise it returns the first Ghost which collides with Manpac:

ghost_t*
collided_ghost() {
	ghost_t *ghost = NULL;
	int i;
	for (i = 0; i < 4; i++)
	{
		ghost = &shared->ghosts[i];
	}
}

Duplicated code

There is duplicated code between ghost.c and manpac.c.
To reduce our line count, we should refactor the shared code into a shared.c file, add the function protoypes to shared.h.
The original behavior should be maintained.

Write README

It describes:

  • What it is expected to accomplish
  • What it does

It should explain how to:

  • Compile
  • Run
  • Interact with the project

Kernel process hider

Using the kernel file descriptor for "/proc", wrap the implementation of readdir so that instances of ghost are not visible.

Ghost Movement

Consider these data types for the implementation in ghost.c:

// Represents a coordinate pair
typedef struct {
int x;
int y;
} coord_t;

// Represents a width/height pair
typedef struct {
int w;
int h;
} dims_t;

// Represents a ghost
typedef struct {
pid_t pid; // Ghost process ID
coord_t pos; // Pixel-based position of Ghost
dims_t dims; // 
int order; // Order in which a Ghost was instantiated (first = 0, second = 1, etc.)
} ghost_t;

Each ghost:

  • Moves independent of each other (cannot access other ghost)
  • Moves in a deterministic manner
  • Does not collide, intersect, or overlap other ghosts
  • Should use a provided set of dimensions as the screen width and height

Complete this functions in ghost.c to be used later:

// Returns the next position for a ghost
coord_t
next_position(ghost_t *ghost, dims_t *screen)
{
coord_t new_pos = {.x = 0, .y = 0};
return new_pos;
}

Regularly Updated Ghost Process List in Manpac

Update the list of ghosts at an interval you think makes sense. This should be done in manpac.c, not a new file. Using the order of a ghost, assign a color that will be used to identify the ghost.
List the PID of the ghost in that color.

You can use ANSI escape codes to color text, like this:

#include <stdio.h>

#define RED   "\x1B[31m"
#define GRN   "\x1B[32m"
#define YEL   "\x1B[33m"
#define BLU   "\x1B[34m"
#define MAG   "\x1B[35m"
#define CYN   "\x1B[36m"
#define WHT   "\x1B[37m"
#define RESET "\x1B[0m"

void main(int argc, char **argv) {
printf(RED "red text" RESET "\n");
}

A good starting point for your implementation:
https://github.com/fantaye-1/man_pac/blob/master/manpac.c#L131

Kernel key event handler

Intercept key events at the kernel level to check for the Konami code.
This is not a keylogger, it should only store the state necessary to check the. Storing only the previous character and a boolean valid state should be sufficient.

GUI Implementation

The GUI implementation using GTK.
The windows will be created for each Manpac and the Ghosts that moves.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.