Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

this is a java based data structures and algorithms any help is greatly appreciated Write a program that lets a user play the game of

this is a java based data structures and algorithms

image text in transcribed

any help is greatly appreciated

image text in transcribed

image text in transcribed

Write a program that lets a user play the game of MovingDay. Here are the rules of the game: there are N Falses on N squares, M Trues on M squares, and one empty square for a total of N+M+ 1 squares - the Falses start out on the right, the Trues start out on the left, the empty square is in the middle - there are two moves JUMP and SLIDE - a False can JUMP over a True or False onto an empty square - a True can JUMP over a False onto an empty square - a False or True can slide onto an empty square - Falses can ONLY move left, Trues can ONLY move right - the user WINS when the Falses occupy the left most N squares, the Trues occupy the rightmost M squares, and the empty square is in the middle - the user LOSES when the user can't make any more moves and the winning condition hasn't been satisfied Sample run (bold indicates user input): ---- MovingDay Game ---- Number of Falses: 3 ources Number of Trues: 3 0 1 2 3 4 5 6 IT|T|T||F|F|FT Choose move: 4 Sliding False @ 4 to the LEFT 0 1 2 3 4 5 6 ITITTIFIFFI Choose move: 2 Jumping True @ 2 to the RIGHT 0 1 2 3 4 5 6 ITITI FITIFIFI Choose move: 0 Cannot Jump True over a True! Choose move: 1 Sliding True @ 1 to the RIGHT Sample run (bold indicates user input): ---- MovingDay Game ---- Number of Falses: 3 Number of Trues: 3 0 1 2 3 4 5 6 ITTT|F|FF| Choose move: 4 Sliding False @ 4 to the LEFT 0 1 2 3 4 5 6 |T|TT|FI|FF| Choose move: 2 Jumping True @2 to the RIGHT 0 1 2 3 4 5 6 T|T||FTIFFI Choose move: 0 Cannot Jump True over a True! Choose move: 1 Sliding True @ 1 to the RIGHT 0 1 2 3 4 5 6 T|TF|T||F Choose move: 2 Cannot Slide True (no empty space). Cannot Jump True (no empty space). Choose move: 0 Sliding True @ O to the RIGHT 0 1 2 3 4 5 6 ||TT|F|TF|FT Choose move: 0 Sliding True @0 to the RIGHT Game Over! You lose! ---- MovingDay Game ---- Number of Falses: 3 Number of Trues: 3 0 1 2 3 4 5 6 |TT|T|FF|FI Choose move: 4 Sliding False @ 4 to the LEFT ... much later... 0 1 2 3 4 5 6 |F|FF|T||TT| Choose move: 3 Sliding True @3 to the RIGHT 0 1 2 3 4 5 6 |E|F|FL|T|TTI Congratulations! You win

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

Online Market Research Cost Effective Searching Of The Internet And Online Databases

Authors: John F. Lescher

1st Edition

0201489295, 978-0201489293

More Books

Students also viewed these Databases questions

Question

Describe the seven standard parts of a letter.

Answered: 1 week ago

Question

Explain how to develop effective Internet-based messages.

Answered: 1 week ago

Question

Identify the advantages and disadvantages of written messages.

Answered: 1 week ago