Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C# Please This assignment is building the core of a two-player new game called, linear domination. The first part (due Sept 24) is you algorithm

C# Please

This assignment is building the core of a two-player new game called, linear domination. The first part (due Sept 24) is you algorithm design/document with data structures and core math for how you will compute the key required methods. No code is due, but pseudo-code is a good/common part of the documentation. This is expected to be 3-4 pages of text with likely a few drawings. Can be ascii, pdf or doc. It should be in your program2 repo as well, with the repo name in what you upload here. If your project is a team, each of you should upload the documntation plus 1 page on who did what for the design.

The rules of the game are as follows:

The game board is a grid of NxN cells and starts empty.

Players alternate turns.

Players play a line by choosing a pair of empty cells specifying start then end as sr sc er ec; both cells must be empty, cannot be in a row or column used as start/end in the past K turns (even if invalid), and the angle of the line formed by the pair must not be parallel to any line already played.

If the players line is parallel to an existing line, the line is removed, and the other player plays. If the line is not parallel, then the line connecting the two points is marked with the players color including flipping any cells on the line that are another color. Starting at the highest/leftmost point of the line, the line is drawn as the set of cells as one steps to each successive cells (row/column) positions whose value closest to the line path.

In advanced play, all moves are made in advance, visualizing the game in your head, and the resulting file fed into the scoring program as a file.

Play/scoring continues until either both players make an invalid (parallel) play or no free cells remain.

The winner is the person with the most marked cells. Ties are possible.

For the assignment, you will implement the core of the game.

Define an array for the game board, with a method for generating the board of size N and another for printing/display. For this assignment, you should use printing to display the board and use X and O for the two players. (This makes grading easier)

Define a method accepting input for play, which needs to allow input from a file at least as described below.

Define a representation for lines played in the game.

Define a method for testing each play for validity (empty end cells and not parallel to previous plays).

Define a method for flipping the cells in the grid.

Define a method for computing/display the current score.

Define a control method that calls the other methods, displaying the game board after each play.

Test your game with the five input files that will be provided (two provided now, three more provided 9/22) as well as 2 test files of your own.

Input format:

N K

sr1 sc1 er1 er1

sr2 sc2 er2 er2

srK scK erK erK

This assignment may be done in a pair or by yourself. If done as a pair both must upload a zip that includes the code/documentation, your test files, your output files, and also includes a personal statement of who did what and how the grade should be split. Documentation should include the git repo for the project (which can be from either of the pair).

1.txt:

5 0

1 1 5 5

1 5 5 1

2 1 4 5

1 2 5 4

3 1 3 5

1 3 5 3

4 1 2 5

1 4 5 2

5 3 2 4

4 2 3 5

3 2 4 3

2.txt

5 3

1 1 5 5

3 4 4 3

2 1 4 3

1 2 5 4

2 5 4 5

3 1 2 3

1 2 5 4

2 1 4 5

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Management Databases And Organizations

Authors: Richard T. Watson

3rd Edition

0471418455, 978-0471418450

More Books

Students also viewed these Databases questions

Question

What does Processing of an OLAP Cube accomplish?

Answered: 1 week ago