Basic Mastermind Game - Don't Want Any Colors To Repeat - Values Still Repeat Sometimes

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


ADVERTISEMENT

Repeat Cards Showing Up In Game And Win Evaluating Code For Poker Game?

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

.net - Key Repeat Delay And Key Repeat Rate?

Jan 5, 2010

How do I (programmatically) find out the key repeat delay and key repeat rate for a system?

A solution that works on any/all .Net capable platforms would be ideal, but the key target OSes would be XP, Vista, and 7.

View 1 Replies

.net - Repeat The Row Values?

Feb 10, 2010

How to repeat the row values up to end date For Example

Table1
Date Name Dept
-----------------------
12-02-2009 Raja IT
13-02-2009 Ravi CSE
14-02-2009 Ramu ECE

From the above table value i want to repeat the value between the two dates from 12-02-2009 to 12-03-2009.

Expected Output
Date Name Dept
--------------------------
12-02-2009 Raja IT
13-02-2009 Ravi CSE

[code]....

If StartDate is same value of Date column For EndDate i have to check the time column, if time is greater than 17:00 it should display a next date in EndDate column.

View 1 Replies

Repeat Values In Richtextbox

Dec 10, 2009

There is a richtextbox containing either 'True' or 'False' at each of it's lines. Let's say for example that it contains 100 lines. The 2nd line is 'False'. Through a contextmenustrip I would like to be able to select that 'False' value and have an option saying 'apply to a range' of lines. The program would ask for the number of lines the user would like to apply that value, and apply that value to the lines he specified. [Code]

View 3 Replies

Capture Keysrokes For Web And Desktop Applications In Visual Basic And Repeat Them?

Jun 13, 2011

Record keyboard inputs to fill forms. This feature will allow users to record keyboard sequence

View 1 Replies

MasterMind, Create A String Representing The Colors Of The Comma?

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

Get The Values Of The Basic Colors Used In The ColorDialog?

Aug 16, 2009

I can get the custom colours used in the ColorDialog (vb.net) by using yColorDialog.CustomColors, which will return me an array of colours as integer values

View 2 Replies

How To Repeat A Command

Feb 29, 2012

i have little comand to add values from one table to another like this, but i need to this command to repeat, because table has more than 130 000 records.

Here is my code:

PrivateSubButton1_Click(senderAsSystem.Object,eAsSystem.EventArgs)HandlesButton1.Click
Me.FTADRESBindingSource.Filter =
"[noqeyd]"&

[code]....

what i have to do for repeat this action until last record in table?

View 16 Replies

Get While To Repeat Once With Each Button Click?

Oct 17, 2009

I have a simple program that takes the number of students and calc's the avg. It is suppose to add one student,(female, male,all) with each button click and update the avg. I have a loop set up to do this but I don't know how to get my do/while to work once, each time I press my calc button or can't it be done this way?

I'll try to past my code so far:Public Class frmMain

[Code]...

View 1 Replies

Not Repeat A Random Number More Than Once

Feb 21, 2009

I'm having trouble using the Random class. I have this [code]...

I have this code in a function and everytime I call it it return a random number. The problem is I only want the number to be return/generate once. There be times I call the function and it returns the same number as in the pass. Is there a way to random the number once? I know in C++ you use like "Seed" or something and it will only generate once.

View 6 Replies

Preventing A Message Box Repeat

Feb 26, 2012

I've completed an assignment that requires me to search through two listboxes for a particular number.If the number is found, the text on a label changes to a dollar amount, otherwise a message box is displayed letting the user know that the requested number cannot be found.It works well enough, searches through the listboxes, finds the number, and displays the message box when it can't be found.However, the message box shows repeatedly up to five times.After the user clicks "OK" on the fifth appearance, the program crashed and displays the follow message."Invalid Argument = Value of '5' is not valid for 'index'.Parameter name: index."I don't know what's causing this, or how to fix it.I do use the index as a counter at a portion of the program...but I'm not sure where I went wrong with it.[code]Also there are five items in the second listbox...probably has something to do with it.

View 2 Replies

Random Array That Does Not Repeat?

Aug 3, 2011

Im creating a program that randoms 5 questions and when a certain question is shown then it must not be shown again when the button is clicked. Lets say when "What is my name?"array is shown when the button is clicked then it must not be shown again until the last question that is not shown will be shown.

Public Class Form1
Dim random As New Random
Dim Question() As String = New String(5) {}

[code]....

View 4 Replies

Random Number But Don't Repeat?

Aug 2, 2009

I would like to generate a random number less than 50, but once that number has beengenerated I would like it so that it cannot be generated again.

View 3 Replies

Repeat A Block Of Code?

Feb 25, 2011

now if i've written a code, and then wrote that if a certain condition presents then repeat that code again including that if condition, so what is the code for this?

View 3 Replies

Repeat Gradient PDF Background

Nov 25, 2010

I am creating a page that auto-creates a pdf file from data in the database. I have the entire pdf working with the exception of the pdf background. The customer wants a gradient which I will need to repeat, but how would I create this? the image is 1px in width 976 in height [Code]. I was hoping that declaring a longer width it would stretch the image across but this failed.

View 1 Replies

Repeat Process In VB Application?

Jan 5, 2011

I have access to the source code of a previously created app that work's as designed, but i am looking to update it for further enhance its ability. The change required may be simple in thought and also in design.Basically the app allows you to read in a data file a confirm the data file is in the correct format.Details fo the data file. All lines of the file are 120 characters long. If they are not then there will be an error returned. The fields within the lines have different properties and vaules and the validation on these fileds and lines work perfectly.

1. The first line of the file is always known as a descriptive ( header record ).

2. The next line will outline a detail record. The could be hundreds of these lines.

3. Finally there is a file total record.

A file could be four lines in total or 40000 lines in total. As mentioned the app works when there is one header and total record.I am looking to see if it can be modified.My intention is to merge multiple data files into a single file. There in lies the problem. There is a line in the code as per below.

Do While Not EOF(1)

As far as i can tell this means to go to the end of the file. When there are more than on set of data , there are errors messages generated because the code is looking only for one set of header and trailer records. As mentioned when there is one set of header total records , the apps will validate the file and return any error messages.What i think i need to do is insert another loop/s that say's read data between the header record and the trailer record , if there are any errors display it , then go to the next header / trailer records and display and errors , and continue to do so until you reach then EOF.

Header
Detail
Detail
Total

[code]....

View 3 Replies

Repeat Some Instructions The Fastest?

Sep 23, 2008

epeat some instructions the fastest?i tried this:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
start()

[code]....

View 7 Replies

Replicate And Repeat A String?

Jul 10, 2010

have string "super" May i know is there a function in vb where i can repeat the string like using the below code and return "supersupersuper"

View 2 Replies

Timer To Repeat Code

Jun 5, 2012

I some code that looks to see if a certain program is running when the form is open. If the program is open it puts Running in a label, if it isn't running it says not running.What I want to do is repeat this process every 5 or 10 seconds. I have never used a Timer before so not sure where to start.

View 1 Replies

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

Mastermind Game - Functions And Procedures

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

Forms :: String Repeat Process

Jun 27, 2009

Here is my string: (not real just made up) Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load WebBrowser1.Hide() End Sub Now if I want to repeat that string the ammount of times I say in TextBox1, how do I code that with that string code above?

View 4 Replies

Get A Do While Loop To Repeat With Each Button Click

Oct 17, 2009

I have a simple project that calculates the grade avg of male, female, and both using a listbox and radio buttoms for male and female. The program needs to update each time I use my btnCalculate button by adding one student and updating the avg.MY question is how to I get my do/while loop to work each time by just hitting my calc button? [code]

View 1 Replies

Make The Sound Repeat Itself After It Is Done Playing?

May 10, 2011

Here is the code that I have that plays a certain sound

Dim Alarm As System.Media.SoundPlayer = New System.Media.SoundPlayer(Steven_Anderson_HW5.My.Resources.Alarm)
Alarm.Play()

Well, is there a way to make the sound repeat itself after it is done playing?

View 2 Replies

Playing Audio In WPF With Repeat On Finish

Apr 15, 2010

I want to create a audio player class but having some problems like when audio is finished it is not repeating. While playing audio some UI controls are not working.

View 1 Replies

Playlist - Go To Next Song And Repeat After Last Item

Aug 19, 2009

If I have songs in listbox. Thats All Play One by One. Repeat When Finish Play List. I am Using This Code For Repeat One Song:
If AxWindowsMediaPlayer1.playState = WMPLib.WMPPlayState.wmppsStopped Then
AxWindowsMediaPlayer1.Ctlcontrols.play()
End If

View 11 Replies

Repeat A Shell Command Every 10 Seconds?

Jan 27, 2011

Just wondering how can i repeat a shell command every 10 or so seconds

View 6 Replies

Repeat A Windows Form (Tab Function)?

Oct 6, 2011

Using VB.Net

I am having the form name as "Employee Entry"

User want to open a Employee Entry from in 5 tabs...

For Example

When the user open a Employee Entry form, while entering the details at that same time, user again open a employee entry form (2nd Employee entry form show like a new employee entry from with out any details)[code]....

View 1 Replies

Repeat Bookings And Retrieving Data?

Jul 21, 2011

how to work multiple bookings into my program. At the minute i have two calendars, one visible (Start date) and one invisible, wich the user can make visible if a repeat booking is required (End date).

How would i work a repeat booking into my SQL Statement, as i only have one BookDate field and one BookDate parameter.

e.g.

Dim BookRoom As New SqlCommand("INSERT INTO bookings ( UserID, RoomID, BookDate, StartTime, EndTime, Reason) " + _
"Values (@UserID, @RoomID, @BookDate, @StartTime, @EndTime, @Reason)")

[Code].....

View 3 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved