CSCE 2004 S19 Assignment 5. Halfway checkin: April 6, 2019, 11:59pm. Final version: Apr. 12, 2019, 11:59pm

Similar documents
Assignment 6 Play A Game: Minesweeper or Battleship!!! Due: Sunday, December 3rd, :59pm

CMSC 201 Fall 2018 Project 3 Sudoku

Programming Project 2

CPSC 217 Assignment 3

Assignment 2 (Part 1 of 2), University of Toronto, CSC384 - Intro to AI, Winter

INTRODUCTION TO COMPUTER SCIENCE I PROJECT 6 Sudoku! Revision 2 [2010-May-04] 1

CPSC 217 Assignment 3 Due Date: Friday March 30, 2018 at 11:59pm

Mobile Application Programming: Android

CS 211 Project 2 Assignment

CIDM 2315 Final Project: Hunt the Wumpus

CMPT 125/128 with Dr. Fraser. Assignment 3

1 Modified Othello. Assignment 2. Total marks: 100. Out: February 10 Due: March 5 at 14:30

Spring 06 Assignment 2: Constraint Satisfaction Problems

YEDITEPE UNIVERSITY CSE331 OPERATING SYSTEMS DESIGN FALL2012 ASSIGNMENT III

2359 (i.e. 11:59:00 pm) on 4/16/18 via Blackboard

Assignment 2, University of Toronto, CSC384 - Intro to AI, Winter

Spring 06 Assignment 2: Constraint Satisfaction Problems

Programming Assignment 4

Pay attention to how flipping of pieces is determined with each move.

CS61B, Fall 2014 Project #2: Jumping Cubes(version 3) P. N. Hilfinger

Final Project: Verify a Sudoku Solution Due Fri Apr 29 (2400 hrs)? Wed May 4 (1200 hrs)? 1

INTRODUCTION TO RADIO, TV & FILM WRITING MRTS 2010 ONLINE Spring 2017 Department of Media Arts

COSC 117 Programming Project 2 Page 1 of 6

Embedded Systems Lab

Periodic Table Battleship Open Inquiry

2 Textual Input Language. 1.1 Notation. Project #2 2

Homework Assignment #1

03/05/14 20:47:19 readme

For slightly more detailed instructions on how to play, visit:

Scratch for Beginners Workbook

You Can Make a Difference! Due November 11/12 (Implementation plans due in class on 11/9)

CS151 - Assignment 2 Mancala Due: Tuesday March 5 at the beginning of class

CS 540-2: Introduction to Artificial Intelligence Homework Assignment #2. Assigned: Monday, February 6 Due: Saturday, February 18

Communications and New Media Title: Writing for Media Catalog Number: CNMS Credit Hours: 3 Total Contact Hours: 45

CMPT 310 Assignment 1

COM 357: Scriptwriting for Serial Media Spring 2014 Tue./Thur. 12-1:50pm Bouillon 106

Building a Personal Portfolio in Blackboard UK SLIS

Due: Sunday 13 November by 10:59pm Worth: 8%

Homework Assignment #2

CHM 152 Lab 1: Plotting with Excel updated: May 2011

CS1301 Individual Homework 5 Olympics Due Monday March 7 th, 2016 before 11:55pm Out of 100 Points

CS Project 1 Fall 2017

Begin this assignment by first creating a new Java Project called Assignment 5.There is only one part to this assignment.

CSE 231 Fall 2012 Programming Project 8

Introduction to Artificial Intelligence CS 151 Programming Assignment 2 Mancala!! Due (in dropbox) Tuesday, September 23, 9:34am

CMPT 310 Assignment 1

Term 1 Assignment. Dates etc. project brief set: 20/11/2006 project tutorials: Assignment Weighting: 30% of coursework mark (15% of overall ES mark)

HW4: The Game of Pig Due date: Thursday, Oct. 29 th at 9pm. Late turn-in deadline is Tuesday, Nov. 3 rd at 9pm.

INTERMEDIATE SCREENWRITING MRTS 4460 Fall 2016 Department of Media Arts

HW4: The Game of Pig Due date: Tuesday, Mar 15 th at 9pm. Late turn-in deadline is Thursday, Mar 17th at 9pm.

Suggested Games and Activities MathShop: Cartesian Coordinate Mat

CS Programming Project 1

This course involves writing and revising a research paper on a topic of your choice, and helping other students with their research papers.

UNIT NAME. Media 0155 T 0150 A 1.0. Media Foundation Skills COURSE NAME CODE VALUE CODE T A

Tac Due: Sep. 26, 2012

Make sure your name and FSUID are in a comment at the top of the file.

EELE 201 Circuits I. Fall 2013 (4 Credits)

Math Spring 2014 Proof Portfolio Instructions And Assessment

CSSE220 BomberMan programming assignment Team Project

A fun way to challenge your math thinking! Grade Levels: 4th - 8th Time: 1 class period. Check out 36 BINGO Snapshot

BIEB 143 Spring 2018 Weeks 8-10 Game Theory Lab

CSC242 Intro to AI Spring 2012 Project 2: Knowledge and Reasoning Handed out: Thu Mar 1 Due: Wed Mar 21 11:59pm

Introduction to Computers and Engineering Problem Solving Spring 2012 Problem Set 10: Electrical Circuits Due: 12 noon, Friday May 11, 2012

[DOING AN ODA: STEP-BY-STEP INSTRUCTIONS]

BCN 1251C Construction Drawing Section: Credits Spring 2016

Lab 7: 3D Tic-Tac-Toe

Game Playing in Prolog

CS Game Programming, Fall 2014

MATH302: Mathematics & Computing Permutation Puzzles: A Mathematical Perspective

1 Introduction. 1.1 Game play. CSC 261 Lab 4: Adversarial Search Fall Assigned: Tuesday 24 September 2013

Project Connect Four (Version 1.1)

EE 4314 Lab 3 Handout Speed Control of the DC Motor System Using a PID Controller Fall Lab Information

CSC C85 Embedded Systems Project # 1 Robot Localization

Mathematics Success Grade 8

Monte Carlo based battleship agent

Certified SOLIDWORKS Professional Advanced Preparation Materials

ECE2049: Foundations of Embedded Systems Lab Exercise #1 C Term 2018 Implementing a Black Jack game

ndash Customer Success Guide

MATHEMATICAL RELATIONAL SKILLS AND COUNTING

Keytar Hero. Bobby Barnett, Katy Kahla, James Kress, and Josh Tate. Teams 9 and 10 1

CSE231 Spring Updated 04/09/2019 Project 10: Basra - A Fishing Card Game

MthSc 103 Test #1 Spring 2011 Version A JIT , 1.8, , , , 8.1, 11.1 ANSWER KEY AND CUID: GRADING GUIDELINES

Homework Week #16 Due January 24, 2019 Grade 2 TLC

Recording your Voice Tutorials 3 - Basic Uses of Audacity Wayne B. Dickerson

BCN 1251C Construction Drawing Section: Credits Fall 2016

CAD RESIDENTIAL AND COMMERCIAL DRAFTING WITH CADD 3 Semester Hours

EE-110 Introduction to Engineering & Laboratory Experience Saeid Rahimi, Ph.D. Labs Introduction to Arduino

UCLA Department of Film, Television and Digital Media FTV 183a: Introduction to Producing

VARVE MEASUREMENT AND ANALYSIS PROGRAMS OPERATION INSTRUCTIONS. USING THE COUPLET MEASUREMENT UTILITY (Varve300.itm)

Advanced Excel. Table of Contents. Lesson 3 Solver

More Challenges These challenges should only be attempted after difficulty challenges have been successfully completed in all the required objectives.

Mathematics Success Level D

1.1 Investigate the capabilities and limitations of a range of digital gaming platforms

Activity Graphics: Image Processing

Lab Assignment 3. Writing a text-based adventure. February 23, 2010

YourTurnMyTurn.com: Rules Minesweeper. Michael A. Coan Copyright Coan.net

CSEP 573 Applications of Artificial Intelligence Winter 2011 Assignment 3 Due: Wednesday February 16, 6:30PM

GRADE 3 SUPPLEMENT. Set C3 Geometry: Coordinate Systems. Includes. Skills & Concepts

ABET Course Syllabus Template

The Beauty and Joy of Computing Lab Exercise 10: Shall we play a game? Objectives. Background (Pre-Lab Reading)

Transcription:

CSCE 2004 Programming Foundations 1 Spring 2019 University of Arkansas, Fayetteville Objective CSCE 2004 S19 Assignment 5 Halfway checkin: April 6, 2019, 11:59pm Final version: Apr. 12, 2019, 11:59pm This assignment may be done in pairs. If done in pairs, print out both names in the code and in the report but only one of the partners should submit to blackboard. The goal of this assignment is to become familiar with the manipulation of 2-dimensional arrays, as well as file input and output. Description In this assignment you will implement a console version of the game battleship. For those who are not familiar with the game, it is a board game where two people face each other and the goal is to sink all 5 ships of your opponent. To do so, each player has 5 ships that they place on their board. These ships may be placed horizontally or vertically. Each player has two boards: one that keeps track of where his ships are located as well as the enemy s hits, and another board that keeps track of the player s own hits on his opponent s ships. During each round each player fires a rocket at a specific coordinate on the enemy s board to try and sink the opponent s ships. A ship is only sunk when all locations on the ship have been hit. You can read more here: https://en.wikipedia.org/wiki/battleship_(game) Implementation In our version, the user will play against a very basic computer. The game boards are represented by 2-dimensional arrays of size 8x8. Note that the coordinate (0,0) is located in the top left corner. Therefore, the row values ( r ) increase as we move down the board and the column values ( c ) increase as we move to the right. Each player (the user and the computer) has 2 boards: The ship_boards store about that player s fleet, i.e., where their ships are and which of their ships have been hit. The hit_boards store the user s play history, i.e., which locations they have already guessed and whether that location was a water or a hit. So, there are 4 boards in the game each of which is a 2-D char array: user_ship_board user_hit_board computer_ship_board computer_hit_board.

Each ship has a size, a name, and a character representation as indicated by the global constants at the top of the program. Starter code has been provided to you and three functions are also provided to you: - print_board that prints the given board in the console - place_a_ship that is used to correctly place one of the user s ships on the board - place_all_ships that is used to place all 5 of the user s ships on the board - You can copy this start code with: $turing: cp ~sgauch/public_html/2004/s19/hw/hw5/hw5.cpp. You will have to implement sevearl functions as well as parts of the main() function. The starter code has many comments to guide you. Many constant variables are provided to you, try and make use of them as much as you can! Please note that when a new game is selected, the player has to place his ships on the board, but the computer s ships are loaded from the file default_computer_ships.txt. When the player wants to save a game, the files user_ships.txt and computer_ships.txt are use to save the ship boards respectively; the contents of their hit boards will be saved in user_hits.txt and computer_hits.txt. Those are the 4 files that will be read from to fill in the 4 arrays if the user chooses to load a saved game. Your program can assume that the files that store the various ship boards are always properly formatted so no error checking is needed when they are read in. Here is an example of the file that stores the computers ship locations ( default_computer_ships.txt ): C C C C C......... D D..... N... B... N... B... N... B....... B... S S S And here is an example of a file that stores the player s hit board: x -.. -... x. - x x x x. x... -... Please note that each character is separated with a space. Error checking will be necessary when asking the player to select a menu item, and when asking the player to enter the coordinates where to fire.

Typically, a game works as follows: The user chooses from quitting, starting a new game, or loading a saved game. The boards get initialized appropriately: New game: both boards are all WATER; computer s ship board is read from default_computer_ships.txt; user places ships by calling place_all_ships and giving orientations and starting locations Load game: all 4 boards are set by reading the 4 save files No, the main function calls play to play the game. You may change the functions in any way you want we provide the headers for your guidance, but they are not meant to restrict your options. For example, the main program could auto-save after each turn or when the user quits, or ask the user about saving before quitting. You may decide what information to display to the user how often. Our starter code is one possible solution, any version that plays battleship properly is fine. But, you need to have play, take_turn, fire, and check_win functions and several others so that you have broken the problem into manageable chunks. Sample Output To observe what one possible final game would look like, you can copy run the following command to copy a finished version of the game: turing$ cp ~sgauch/public_html/2004/s19/hw/hw5/hw5.exe. You don t have to match the output exactly, in fact you are encouraged to communicate with the user in any way you like, as long as it is clear and includes all of the necessary information to play the game. Getting Started You will need to copy the computer s boards and starter code into your directory: turing$ cp ~sgauch/public_html/2004/s19/hw/hw5/default_computer_ships.txt. turing$ cp ~sgauch/public_html/2004/s19/hw/hw5/hw5.cpp. Implementation Strategy You will want to work on one function at a time. Can you initialize one board with water and then display it to the screen? Can you make one hit and echo back to the user what is at that location? Can you then determine that whether or not that one location is a hit or a miss? Don t worry about looping to play multiple turns until you can play a single turn for the user; then a single turn for the computer. This is a much larger and more complex program so you will want to start early and work with your partner. There will be lots of partial credit based on how many of the functions you complete successfully. Halfway Checkin To encourage everyone to start this one early, 10 points of the 50 points will be awarded based on code turned in by April 6 th. On that date, please upload compiling code and a typescript (no report needed). To receive the 10 points, the program must compile and run and do the following steps:

1) ask the use to play a new game, load a saved game, or quit 2) If they choose new game, your program must initialize and print all 4 boards a. Including initializing the computer s ship board from default_computer_ships.txt b. The other 3 boards can be initialized to water c. Then call place_all_ships to place 5 ships on the user s ship board 3) If they choose load a saved game, cout a message a. Optionally load the boards and display them, but this is NOT required by the check in date 4) If they choose quit, the program should end Testing/Requirements Do write a short report for this project describing how much you got done and your approach to implementation. Include at least 2 runs of your game in your typescript, and make sure to demonstrate a starting a new game and also loading a saved game. You will also need to show off your program s error checking during the typescript, by inputting some invalid values. These tests are worth 10% of the assignment grade, and be sure to have MULTIPLE tests.

Submission All late projects will receive reduced credit: 10% off if less than 1 day late 20% off if less than 2 days late 30% off if less than 3 days late No credit if more than 3 days late. IMPORTANT NOTE: You must print both partners name and the assignment number at the very beginning of your program s execution (see the sample code). For full credit, you need to submit the following items to ONLY ONE of the partner s blackboard account: 1. One C++ (.cpp) file that performs the two tasks described Please do not submit code in.docx,.txt, or any other format aside from.cpp! 2. One typescript (.script is recommended) file that includes the compilation of your.cpp files, as well as running the program with multiple tests. 3. One report (.docx or.pdf) that summarizes your approach and your success. Download the necessary files to your desktop from turing (FileZilla is a great tool for this). Then just submit the files to the assignment on Blackboard. Instructions on how to download your code from turing to your laptop/desktop are posted on the class website under Technology Guides. Academic Honesty Statement Students are expected to submit their own work on all programming projects, unless group projects have been explicitly assigned. Students ARE allowed to use any materials on the class website, or in the textbook, or ask the instructor and/or GTAs for assistance This course will be using highly effective program comparison software to calculate the similarity of all programs to each other, and to homework assignments from previous semesters. Please do not be tempted to plagiarize from another student. Violations of the policies above will be reported to the Provost's office and may result in a ZERO on the programming project, an F in the class, or suspension from the university, depending on the severity of the violation and any history of prior violation.