Complete Some Mastermind Game Code?
Apr 15, 2012
I have an assignment which is asking me to complete some Mastermind game code
Private Function createColourString(ByVal gb As GroupBox) As String
'
' For the groupbox gb, which must be one of the guess
' groupboxes or the master groupbox, create a string
[code]....
View 1 Replies
ADVERTISEMENT
Apr 19, 2010
I have to make a mastermind game in VB 2008 using procedures and functions and not using any public variables. There are 5 procedures and functions:
1)Sub ChooseColors (intPeg1Color, intPeg2Color, intPeg3Color) which generates unique numbers to represent the colours for the secret arrangement of the coloured pegs.
2)Sub GetGuess(intPeg1Guess, intPeg2Guess, intPeg3Guess, blnDuplicateGuesses) which gets the unique guesses of the three peg colours from the user.
3)Function CorrectPegs(intPeg1Guess, intPeg2Guess, intPeg3Guess, intPeg1Color, intPeg2Color, intPeg3Color) which calculates the number of correct pegs chosen by the user.
4)Function CorrectColors(intPeg1Guess, intPeg2Guess, intPeg3Guess, intPeg1Color, intPeg2Color, intPeg3Color) which calculates the number of correct colors chosen by the user.
5)Function HasDuplicates(intPeg1Color, intPeg2Color, intPeg3Color), called from ChooseColors(), which returns True if any of the peg colours is a duplicate with any other peg colour.
Here is my code so far:
Mastermind
Private Sub btnDone_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDone.Click
If MessageBox.Show("Are you sure you want to exit?", "Confirm exit", MessageBoxButtons.YesNo, MessageBoxIcon.Stop) = Windows.Forms.DialogResult.Yes Then
[Code] .....
How I can get the variables from ChooseColors (peg1Color, peg2Color, peg3Color) and the variables from GetGuess (peg1Guess, peg2Guess, peg3Guess) and use them for the functions, CorrectPegs and CorrectColors.
View 8 Replies
Feb 17, 2011
I'm trying to make a mastermind game program with visual basic. I started of creating the combination maker for the start of the game. Hoever, in my version i don't want any colors to repeat. I used the random function independently to get numbers from 1 to 6. Each number has a corresponding color. The problem, the values still repeat sometimes.
Here's my code for that part:
Randomize
a = Fix(Rnd * 6) + 1
txtA = a
If a = 1 Then
[CODE]...
View 2 Replies
Jul 2, 2009
I am working on a poker game and I have the game setup the way I want it in terms of graphics and I have the code programed to deal the cards out exactly how I want them. Granted, the code is very simplistic, but functional for a new programmer like myself. I'm sure there are other more efficient ways to code my game, but I like mine so far because I can at least understand the majority of it. With that being said, here are a few problems and questions that I have.
1. How come when all 12 cards are dealt out I have some cards repeating in the game? For example, I get queen of diamonds in more than one picture box when I only want the card to be dealt once and then removed until the next game.
2. I was hoping to have a button 3 to clear all the boxes, basically resetting the game to the next game. When I hit button 3 it only clears the contents of picturebox 10 and 12.Other notes: I have the deal down the way I want it. It deals the first 10 picture boxes and a second button deals the 11 and 12 picture boxes.
3. I know this is my next step so I want to post it with the code I currently have. I want to start taking my project one step further by evalutating each of the three rows of cards (3 rows of 3 cards each - I'm not worried about the dealers hand (picture box 10, 11, 12 yet). So I want to evaluate a row of pictureboxes against a "pay scale" and display the win in a text box or label next to the 3 card hand. For example, Q of diamonds, Q of Clubs, Q of spades would win 15, etc. ( have a weird feeling I may have to change the names of the cards (I have them named card1, card2, etc. right now) to something that identifies them in order to evaluate the hands.
Here is the code that I currently have. I'm using visual basic.
Public Class Form1
Dim Rndm As New Random
Dim myPB(11) As PictureBox
Dim HiddenCards As New List(Of String)
[code]....
View 1 Replies
Mar 11, 2010
I'm trying to make a 2D platform game and I'm pretty inexperienced at programming. I've coded the player to move left and right and jump, but I can't figure out how to prevent multiple jumps while the player is in the air. Anyone know how to do this?
View 8 Replies
Jan 13, 2012
Check Score: The winner is the one with the highest score less than or equal to 21If both scores(player total and computer total) are over 21, or if both are equal but under 21, the game is declared a draw.
There is something wrong with this line:
If intPlayerCardTotal < intScore And intComputerTotal < intScore Then
MsgBox "Draw"
[code]......
View 6 Replies
Apr 18, 2010
im struggling to work out the code for 3 of a kind in my yahtzee game, i think that if i can work this out i can sort my everest of the full house code!
can someone tell me where ive gone astray?
code:
View 8 Replies
Jun 6, 2011
I just finished my own snake game, and I need some recommendations on how to make this game better.If you see a problem, please tell me.The only problem with this game is that I can't get the code to get longer, other then that its good.EDIT: Sorry I meant : The only problem with this game is that I can't get the SNAKE to get longer, other then that its good.
View 4 Replies
Mar 27, 2012
I have an assignment which is asking me to complete some Mastermind game codeI'm given most of the code and there is one sub that i do not understand what it asking for
it says
Private Function createColourString(ByVal gb As GroupBox) As String
'
[code]....
View 3 Replies
Jun 6, 2011
WHERE IS MY Problem. Develop a COMPLETE algorithm using pseudo code to solve the following problem: Your network contains hundreds of workstations. The primary local drive (C on each of those workstations may contain many folders immediately under the root folder. You need to search each of the folders under the root folder on each of the workstations to see if the file nasty.bug exists. You need to do two things with respect to this file. First, count the number of times this file is actually found and, after all the workstations have been scanned, display a message indicating the total number of occurrences of this file across your network. Second, whenever the file is found, it should be deleted.
View 1 Replies
Jul 6, 2010
Is it possible to populate an AutoComplete text box property in code from an Access query.
View 6 Replies
Feb 14, 2012
I need assistance with a program we have to do in programming class. It is due soon and I am stuck on how to code it and if the extra button is necessary or not. The game is called the Pig Game where each turn, a player repeatedly rolls a die until either a 1 is rolled or the player holds and scores the sum of the rolls (i.e. the turn total). At any time during a player's turn, the player is faced with two options:roll - If the player rolls a
1- the player scores nothing and it becomes the next player's turn.
2 -the number is added to the player's turn total and the player's turn continues.hold - The turn total is added to the player's score and it becomes the next player's turn.The first player to score 100 or more points wins. More info is here: url...
I have no idea where to go from my current position. I think I coded most of it though. I will attach the files in a zip folder for all to see my form and code.The main problem here is: I just need the code to be fixed, so it works and so I don't fail the class. Attaching the new version in a zip file would be nice but you don't have to do that, or you could just tell me the code and form layout directly on here!
View 9 Replies
May 10, 2012
Need code for a moving background for a game
View 4 Replies
May 18, 2010
I am trying to develope a program that simulates a TicTacToe game. Is it between 2 users. I am having a hard time with it.
View 23 Replies
Jul 16, 2011
I have conditional code checking in a card game Im working on and it just feels wrong.I m looking for a better way.Right now, all my functions return a card. If I get a card Im usually done and can fall out of my nested structure.If I dont get a card I have to test a condition If card is nothing.And this condition gets repeated ad-nauseum.Here is a small sample of the code.
card = FindMaxTrump(playableCards)
If Not card Is Nothing Then
'If we found a trump at all[code]....
This might be a fine way to do it, but the constant check for a null card is what has me wondering if there is a better approach I'm missing.
View 2 Replies
Nov 8, 2011
I have to create a game for programming class in school, my teacher said we were allowed to borrow code and then manipulate it our selves to create our own individual game. I chose Tetris so i am wondering if anybody has any code for this game from vb 2008.
View 2 Replies
May 7, 2012
I am creating a type of pacman game, I have entered the code for everything else, but I am struggling with the code for the high score,[code]
View 2 Replies
Jul 27, 2009
This sub moves a rectangle to the center of the form and when it gets there it moves back to its original location. But something weird has happened and the rectangle still moves, but the boolean values dont change. I tested to see if that part of the code was executed by putting a messagebox where the boolean values are supposed to change and the messagebox didnt appear.
Here is the sub:
Public Sub Start()
Dim Energy As New PictureBox
_IsMoving = True 'here is the boolean values along with some other variables
[CODE]...
View 3 Replies
Aug 17, 2010
I'm trying to develop some AI code for a game I'm creating. I have a list of x,y coords and I need help figuring out what I can use/do to build the shortest path between any 2 points in this list. I would like to build a function that I can pass a list of valid X,Y coords to use when generating the path, start point, end point, and have it return a list of points, which would be the shortest path between the start and end point, using the list of points supplied. I have looked at A* and Dijkstra's, but am having problems implementing the algs in code, as all this seems graph based.
View 3 Replies
Oct 23, 2009
What is the code for making a score on a game of rock, paper, scissors on vb2008 and how do you make sure it works?
View 1 Replies
Apr 2, 2008
im trying to make a game in visual basic in which your character can move around, jump, and kill things. I can get the picture box with the character to move and everything is fine. but i did run into one problem. when the character moves over a tree (or something) you can see the gray backround of the character as i made in paint. how do i make the backround of the picturebox transparent?
View 4 Replies
Nov 18, 2011
I want to make a program that enables a game to have more than one instance running, where it would otherwise be unable to be done. How should I go about this? A sandbox? Hack?
View 3 Replies
Oct 3, 2011
Im new to VB. how do I get to add the score.my code is
[Code]...
View 6 Replies
May 4, 2011
I have created a scrabble game that generates random letters. For the user to type in a word using the random letters they have to type it in a text box.
I want my program to prevent users from typing in letters that are not provided in the text box and to allow them to type in the random letters that are provided.
View 4 Replies
Feb 16, 2011
I'm trying to make a simple fruit machine game for windows mobile device.
I can create the game easily enough and flip through pictures in a picture box to display the correct symbol.. but what I'd like to do is do a proper spinning reel, but have no idea where to even start.
What I have is a list of images in an imagelist (or individual files) - what I'd like is them attached to each other and moving downwards, preferably as though it were going around a drum but just them moving would be a start.
View 7 Replies
Feb 1, 2010
I am trying to make a game which basiclly lets you shoot ducks. i have a picture as a background (set as form image) i then have picturebox's with ducks flying flying around you shoot them the disapear etc.
My problem is the image. i have a picture of a duck and a blue square round it. and i would liketo make it transparant because birds dont fly with blue squares.
Below is an image to illistrate my problem
I have tried adding transparent background, transparant key etc
View 2 Replies
Apr 18, 2012
On programming assignment without having any real experience in vb. I guess I don't understand subroutines that well. When the program runs it never goes to the computer's turn and does not update the users score either. This assignment is already in but would like to know what is going wrong. Using VB 2010, and this is windows application.
Code:
Public Class Form1
Dim Myturn As Integer
Dim Computerturn As Integer
[CODE]...
View 6 Replies
Apr 30, 2011
Upon changing the field size a game should restart. Upon trying to do so I see the previous grid (e.g. 10x10) displayed on top of the new one (e.g. 4x4). How would I prevent this and indeed start the game fresh?
View 10 Replies
Feb 4, 2011
So here is my problem. I have a vb game with animated sprites and all, and the character even jumps. However it only works in the y direction. So if i'm moving, he stops in place and jumps, instead of jumping forward. I was wondering if someone knew how to make him move at the same speed forward during the jump.
[Code]...
View 2 Replies
Apr 19, 2011
I currently have a who wants to be a millionaire game that I have made in visual basic 2010. Each question is in its own form. Form1 opens at the start, and question 1 is opened by a button click on Form1. The user has to click on the picture box at the side to show the text for the question each time. If they answer incorrectly, it displays a message box, opens an input box asking for their name, and goes to the form with the high score list, Form17.
Upon opening Form17, I want the scores to load and be displayed in the list box. The high scores are saved in a text file at C: est.txt . Upon clicking menu or end, the high scores are saved to the text file.
View 2 Replies