Find Jobs
Hire Freelancers

Dave database

$10-30 USD

Completed
Posted over 9 years ago

$10-30 USD

Paid on delivery
You are working on a 2D game called “It’s A Trap!” In the level editor, your designers place traps on the map which apply special effects to any player while the player stands on them. Traps come in two basic shapes: circles and squares. Additionally, some traps are good (have beneficial effects) and some traps are evil (have harmful effects). Any given trap may contain good effects or evil effects, but not both. If a player is standing in the area of two traps overlapping, the effects of both traps are applied to the player. Because each good effect cancels out a corresponding evil effect, you need to generate a report so that designers can detect these situations and adjust their trap placement. 1. Parse the provided trap database (.trp) file per the provided file format specification. 2. Detect all pairs of traps that have both overlapping areas and conflicting effects. 3. Write to the output console (or .txt file) the list of conflicting trap pairs you detected in step 2. Note: Two traps are overlapping if the area of intersection of their physical geometry is > 0. This means that two traps can touch but not be overlapping. What effects conflict with one another? • Healing (good) conflicts with Poison (evil) • Strength (good) conflicts with Weakness (evil) • Bravery (good) conflicts with Fear (evil)   Trap Database File Format File Offset (in Bytes) Value Type Value Description 0 Unsigned Integer (32 bits) Number of traps (N) in the file. 4 Trap Information (80 bytes; see below) Trap 0 84 Trap Information (80 bytes; see below) Trap 1 … … … 4 + (80 * N) Trap Information (80 bytes; see below) Trap N Trap Information Offset (in Bytes) Value Type Value Description 0 Unsigned Byte (8 bits) Shape Type: 0 – Circle, 1 – Square 1 Unsigned Integer (32 bits) Unique ID 5 Unsigned Byte (8 bits) Effects Flags 6 Signed Integer (32 bits) Center X Coordinate 10 Signed Integer (32 bits) Center Y Coordinate 14 char[62] (62 x 8 bits) Trap Name (ascii characters) 76 Signed Integer (32 bits) Radius (circle), Half-extent (square) Effect Flags Bit Value Bit 0 (1 << 0) Trap ‘alignment’ flag. 1 = good trap. (Bits 1-3 represent good effects) 0 = evil trap. (Bits 1-3 represent evil effects) Bit 1 (1 << 1) Healing or Poison flag (depends on alignment) Bit 2 (1 << 2) Strength or Weakness flag (depends on alignment) Bit 3 (1 << 3) Bravery or Fear flag (depends on alignment) Bits 4-7 Reserved Terminology: Number of traps in database: This value gives the total number of traps stored in the database file. Shape Type: The type of shape the current trap is. 0: Circle. 1: Square. Squares are axis- aligned. That is, each edge is parallel to the X or Y axis. Unique ID: Each trap has a unique identifier. This value is guaranteed to be unique for each trap, across the database of traps within the trap database file. Trap Name: Each trap has a name, this null terminated string represents the name. It is not guaranteed to be unique. Effect Flags: Each trap has an Effect Flags value. Bit 0 represents whether or not the trap is good or evil (good = 1, evil = 0). Bits 1-3 represent the effects which are enabled for that trap. Center X: The X coordinate of the center point of the trap. Center Y: The Y coordinate of the center point of the trap. Half-Extent: For Square traps, the Half-Extent represents half the length of one side of the square, which also happens to be the distance from the center point to an edge. Radius: For Circle traps, the Radius is the distance from the center point to the edge of the Circle.
Project ID: 6375072

About the project

1 proposal
Remote project
Active 10 yrs ago

Looking to make some money?

Benefits of bidding on Freelancer

Set your budget and timeframe
Get paid for your work
Outline your proposal
It's free to sign up and bid on jobs
Awarded to:
User Avatar
Hello, I would like to do this project for you. I can write a simple program that would check for overlapping traps with opposite effects and generate a text file listing the conflicting pairs.
$10 USD in 1 day
0.0 (0 reviews)
0.0
0.0

About the client

Flag of UNITED STATES
dallas, United States
5.0
21
Payment method verified
Member since Sep 11, 2013

Client Verification

Thanks! We’ve emailed you a link to claim your free credit.
Something went wrong while sending your email. Please try again.
Registered Users Total Jobs Posted
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Loading preview
Permission granted for Geolocation.
Your login session has expired and you have been logged out. Please log in again.