Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Single Dimensional Arrays: The Reversal Game
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
avinash336078




PostPosted: Mon Jun 08, 2009 9:40 pm   Post subject: Single Dimensional Arrays: The Reversal Game

What is it you are trying to achieve?
I need help writing a code for the reversal game. Here are all the instructions someone please help

In the reversal game, the digits 0 through 9 are placed on the screen in a random order. For example:

6 7 1 8 2 4 9 0 35

A number n is subsequently entered, causing the order of the first n numbers in the list to be reversed. For instance, if 4 is chosen the order of the first four numbers is reversed and the displayed becomes:

8 1 7 6 2 4 9 0 3 5

The object of the game is to place the digits in numerical order, 0 through 9, in the fewest possible moves.

a) Word out an algorithim that will reverse the order of the elements in a one-dimensional array, using only that array.

b) Write a program to play the reversal game, using the following:

(i) Generate a list of the ten random numbers. Be careful. The numbers 0 through 9 must appear exactly once in a random order. Display this beginning list.

(ii) Have the user input their choice of a value for n. This value must be between 1 and 10; otherwise it is an error! Use your algorithim from part a) to reverse the first n numbers in this list. Display the value of n along with the corresponding revised list.

(iii) Repeat step (ii), counting the number of times a value needs to be entered, until the list is in correct order.

(iv) Display the number of moves needed to put the list in numerical order.



What is the problem you are having?
<Answer Here>


Describe what you have tried to solve this problem
<Answer Here>


Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
<Answer Here>

Turing:


<Add your code here>



Please specify what version of Turing you are using
<Answer Here>
Sponsor
Sponsor
Sponsor
sponsor
Dusk Eagle




PostPosted: Mon Jun 08, 2009 10:32 pm   Post subject: Re: SINGEL DIMENTIONAL ARRAYS The Reversal Game

We are not going to do your program for you. Period. If you code it yourself but can't figure out one section, then we will help you, but right now, my only impression of you is that you are a lazy cheater, which makes me even less inclined to help you.
nba




PostPosted: Mon Jun 08, 2009 10:52 pm   Post subject: RE:SINGEL DIMENTIONAL ARRAYS The Reversal Game

u cheater y do u want sumone to do ur homework? program looks easy juz try it..
HARNETT




PostPosted: Tue Jun 09, 2009 9:09 am   Post subject: RE:Single Dimensional Arrays: The Reversal Game

u freak cant u do ur own project. i kno who u are avinash! ill giv u 0/120... im too good to be true...my mom told me Twisted Evil BooHoo
Tasoya




PostPosted: Wed Feb 15, 2012 11:40 pm   Post subject: RE:Single Dimensional Arrays: The Reversal Game

Code :
loop
put "Failed cheater"
end loop
Beastinonyou




PostPosted: Thu Feb 16, 2012 3:01 pm   Post subject: Re: RE:Single Dimensional Arrays: The Reversal Game

Tasoya @ Wed Feb 15, 2012 11:40 pm wrote:
Code :
loop
put "Failed cheater"
end loop

And you should run this code:
Turing:
var lessonLearned : boolean := false
loop
     put "I Will Not Necro Old Threads"
     exit when lessonLearned = true
end loop
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 6 Posts ]
Jump to:   


Style:  
Search: