Coder Social home page Coder Social logo

griffinbaxter / battleships Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 232 KB

This game, Battleships, was created in C with a project partner for ENCE 260 (Computer Systems), during Semester 2 of 2020. Battleships can be played with two players using two ATmega32U2 microcontrollers via IR transmitters, each with a 5x7 LED display.

Makefile 11.86% C 88.14%

battleships's Introduction

BATTLESHIPS

Author: Griffin Baxter (grb96), Mitchell Veale (mjv43)



SETUP

Ensure that both funkits are turned on and have loaded the game with the "make
program" command in the terminal. Next, ensure that both funkits are facing
such that the IR reciever is facing the other's IR transmitter, and vica versa.


PLAYING THE GAME

First of all, the position of all three of your ships must be chosen, in order
of four, three and two dots wide. For each ship, move the placement of it by
using the north, east, south and west directions of the navigation switch. To
rotate the ship, press down on the navigation switch. To place a ship, press
the standalone button on the funkit. Once each ship has been placed, a dim
outline of the previously placed ship(s) are shown, and when the current ship
being placed is overlapping one of the previous ships, the blue LED light will
switch off, and will switch back on once no longer overlapping, indicating that
it is able to be placed in the given spot. The next step is to either wait for
the other player to choose their ship positions, or to continue on.

Next, the main loop of the game will start. The player which chose their ship
positions first will take their turn first, while the other player will wait
for the other to take their turn.

The player taking their turn first chooses where to shoot their shot. This
player can move around the target via the north, east, south and west
directions of the navigation switch. Positions where the player has previously
shot are marked by dim spots on the matrix display, and these positions cannot
be shot again (as the player has already hit or missed here). Additionally, the
player can press the standalone button to swap to a view of their own ship
positions, with their own ships hit by the other player diplayed with a dim
brightness. This view is a toggle, and can be switched back and forth from the
shooting view and ship position views by pressing the standalone button. In the
shooting view, a shot can be taken by pressing down on the navigation switch.
Once a shot has been taken, a message will appear on the display saying either
"HIT!" or "MISS", indicating whether the shot was a hit or a miss. The player
that just shot will then be waiting for the next player to take their shot, and
so on.

Once a player has shot all of the other player's ships (9 dots in total on the
display), the game will show a message on both funkits. One will display the
message "WIN!", indicating a win for shooting all of the other player's ships,
and the other will display the message "LOSS", indicating a loss.

The game can be restarted by pressing the reset button on each funkit, and
repeating the steps above including the setup section.

battleships's People

Contributors

griffinbaxter avatar

Watchers

 avatar

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.