Friday, 30 September 2011

documents

created and stored away proect plan, feasability and scope and boundarys in red folder

Wednesday, 28 September 2011

deleting arrays

found out how to remove array item by redimming and "sliding" each array item to left if they are larger than card selected.

changes

temporarily abandoned card idea untill basics of code is completed. tried using buttons to help user select card to place in pile, learned about and implemented redim and preserve statements to make the arrays of player1 and pile maleable to number of items in each array.

Tuesday, 20 September 2011

naming cards

put in extra if statements to give meaning to numbers in array
eg. if cards(i) = 1 then
cards(i) = "ace"
end if

also amde to display all cards for player

Monday, 12 September 2011

everyday im shuffelin'

wrote pseudocode and algorithm to generate 52 random numbers in an array and display them neatly (nessesary for main project)

pseudo code: dim global variables, array items and counter
1. when command gets clicked
1.1 set counter to 0
1.2 make a collection
1.3 declare array
1.4 dimention x as integer to store random numbers
1.5 randomize
1.6 make collection a new one to start fresh
1.7 add all possible cards to collection when array item is i
1.7.1 next i
1.8 for all numbers in collection
1.8.1 make x item in collection
1.8.2 add it to array
1.8.3 display number
1.8.4 add 1 to counter
1.8.5 check counter private function
1.8.6 remove number x from collection so next is unique
1.8.7 next x
1.9. end sub
2. random generator code function
2.1 upper - lower
2.2 end function
3. check counter
3.1. when counter gets to 52
3.1.1 take new line for neater text
3.2 end if
3.3 end sub




"Option Explicit 'Force variable declaration

     Dim i As Integer 'Counter for loops
     Dim COUNTER As Integer
      Private Sub cmdstart_click()
   COUNTER = 0
          Dim Collection As Collection 'The collection we will use to store the numbers
 
          Dim cards(1 To 52) As Integer 'The array to store the values from the collection
 
      
 
          Dim X As Integer 'Variable to store the random generated number
 
        
          Randomize 'Just once to ensure that we get random values
        
          Set Collection = New Collection 'Get the collection ready to use
 
        

          For i = 1 To 52 'The possible numbers that we can have as a result is all the numbers from 1 to 52 so
              Collection.Add i 'add all the possible numbers to the collection
          Next
        

          For i = 1 To 52 'Now to get the 52 numbers we added in the previous loop
              X = RandomInteger(1, Collection.Count) 'Get a random item from the collection (that exists for sure)
              cards(i) = Collection.Item(X) 'Add it to the array
TB.Text = TB.Text & " " & cards(i) ' make space for and display each number
COUNTER = COUNTER + 1 ' add 1 to counter
checkcounter ' private sub to make results neater
              Collection.Remove X 'Remove it so we don't add it again
          Next
        

End Sub
Private Function RandomInteger(Lowerbound As Integer, Upperbound As Integer) As Integer 'The random number generator code
 
          RandomInteger = Int((Upperbound - Lowerbound + 1) * Rnd + Lowerbound)

      End Function
 
Private Sub checkcounter()
If COUNTER = 52 Then ' when all numbers picked and put in array
TB.Text = TB.Text & vbCrLf ' take new line for next set
End If

End Sub"

Friday, 9 September 2011

progress and new updated detailed project proposal

updated project proposal so it is more detailed

"
Callum green project proposal

Cheat is a fun game where a group of players are dealt a equal amount of cards and then play in order where a number of cards are placed, if a card is above, the same, or bellow the placed card in a numerical sense then said card(s) may be placed on top of the pile. However the player may add any card, if this card is not above, below or the same as the card previously played then it is called a cheat. If another player calls cheat the player must take the entire pile into their deck. Similarly if a player calls cheat when the play was not a cheat, the accuser must take the pile. This process continues until 2 players are left. By a process of elimination it would be too easy to declare if an opponent is cheating and must be stopped when number of players reaches this number. These are the losers. The first person to have no cards is the winner

In visual basic, the game would begin by creating a 52 part array with a unique card in each place
These are then “shuffeled” into 4 separate arrays and a 5th is created for the middle pile
One array is the players and they may choose which card to place on the pile from their array displayed in a text box. There is a random chance someone will shout cheat and the player can also yell cheat by pressing a button. The arrays will change to accommodate more or less cards respectively. When the first person gives their last card they are deemed the winner and they will be announced at the end of the game. The game ends with the last 2 players and the winner will be announced, number of turns will be recorded on a high score list. Details stored can be sorted using various sorts to find the person who cheated the most, search can be used to find out high score (array = 0 places)
I believe this Is a good enough project for AH due to complexity of the code, the use of saving files (high score) various sorting (finding who cheated the most) and searching (finding details of winning turn etc turns used and wether cheat)"

Wednesday, 7 September 2011

algorithim thinking

considered how to make a unique random number generator from 1 to 52, consulted the website http://www.vbforums.com/showthread.php?t=281172