Wrox Programmer Forums
|
Visual Basic 2010 General Discussion For any discussions about Visual Basic 2010 topics which aren't related to a specific Wrox book
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual Basic 2010 General Discussion section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 14th, 2010, 06:58 PM
Authorized User
 
Join Date: Oct 2010
Posts: 29
Thanks: 23
Thanked 0 Times in 0 Posts
Send a message via MSN to SamC
Default

That's crazy! The chess games source codes must be absurdly long! Remember the tale of the mathematician who tricked a king into paying him 2^64 grain lol...
__________________
"Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction."
- Albert Einstein
 
Old November 15th, 2010, 03:02 PM
Authorized User
 
Join Date: Oct 2010
Posts: 29
Thanks: 23
Thanked 0 Times in 0 Posts
Send a message via MSN to SamC
Default

Turns out that he doesn't want me to implement AI, you don't do that until your second year of university (college.)

That's a relief, anyway my next task is to write a console program which can convert individual, 7bit, ASCII characters into Hamming code.
__________________
"Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction."
- Albert Einstein
 
Old November 15th, 2010, 03:30 PM
Friend of Wrox
 
Join Date: Jun 2008
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts
Default

Phooey. More fun to create the AI.

Quote:
The chess games source codes must be absurdly long!
Back in about 1977, Atari released the Atari 2600 game console. It had a whopping 128 bytes (not MB, not KB, *bytes*...you know, 1024 bits, total) of RAM and 4KB or ROM (Read Only Memory).

In 1979, they released Chess for that machine. Really. 4 THOUSAND BYTES. And what's truly impressive is that it probably took at least 1000 to 1500 of those bytes just to drive the display. The fun part of the game was that when the computer was "thinking", it turned off the video display! Because in the 2600, you had to "drive" the video display with your OWN CODE.

Now, it didn't play a particularly good game of chess. Heck, even I could beat it. Most of the time. But it worked.

As a point of comparison, today's video games are many hundreds of MEGA-bytes in size, if not bigger.

Anyway, google for "chess playing computers" to see what the current state of things is. But don't talk to me about "lots of code". I work for a company the builds an *appliance* computer, and just my part of the code is up in the 10s of megabytes.
The Following User Says Thank You to Old Pedant For This Useful Post:
SamC (November 16th, 2010)
 
Old November 16th, 2010, 01:05 PM
Authorized User
 
Join Date: Oct 2010
Posts: 29
Thanks: 23
Thanked 0 Times in 0 Posts
Send a message via MSN to SamC
Default

Ha slow down, you're putting me off a career in programming already!

I'm quite surprised that there isn't a more elegant way of implementing AI...

Just out of interest what is a career in the computing industry like? Quite a vague question but I'd like to know what I can expect. At 17 the only job I've ever had was as a lifeguard for a swimming pool - I absolutely loathed it!

As for my hamming code project, here's what I've done so far:
Code:
Option Strict On
Module Module1

    Sub Main()
        Dim character As Char = "!"c
        Dim denary As Integer = 0
        Dim binary, oddParity, evenParity, hamming As String

        Console.Title = "ASCII to Hamming Converter"
        Console.ForegroundColor = ConsoleColor.Green
        Console.Write("ASCII Character: ") : character = CChar(Console.ReadLine())
        Console.Clear()
        denary = Asc(character)
        binary = Denary2Binary(denary)
        evenParity = Parity(binary, 0)
        oddParity = Parity(binary, 1)

        Console.WriteLine("Character: {0}", character)
        Console.WriteLine("Denary: {0}", denary)
        Console.WriteLine("Binary: {0}", binary)
        Console.WriteLine("Even Parity: {0}", evenParity)
        Console.WriteLine("Odd Parity: {0}", oddParity)
        Console.WriteLine("Hamming: {0}", hamming)
        Console.ReadLine()
    End Sub
    Public Function Denary2Binary(ByVal denary As Integer) As String
        Dim r As Integer = 0 'r for Remainder
        Dim i As Integer = denary 'i for Integer
        Dim binary As String = ""
        Do
            r = i Mod 2
            i = i \ 2
            binary = CStr(r) & binary
        Loop Until i = 0
        Return binary
    End Function
    Public Function Parity(ByVal binary As String, ByVal type As Integer) As String
        Dim quantityOf1s As Integer = 0, parityBit As Integer = 0
        For Each character In binary 'Count the 1s
            If character = "1" Then quantityOf1s += 1
        Next
        Select Case type
            Case 0 'Even Parity
                If quantityOf1s Mod 2 = 0 Then parityBit = 0 Else parityBit = 1
                Return parityBit & binary
            Case 1 'Odd Parity
                If quantityOf1s Mod 2 = 0 Then parityBit = 1 Else parityBit = 0
                Return parityBit & binary
            Case Else
                Return "ERROR" 'To placate the compiler
        End Select
    End Function
End Module
I think converting binary to hexadecimal would be the next step to understanding how to convert binary to hamming. I know how to convert binary to hexadecimal by hand, I just don't know how to do so with VB.NET.
__________________
"Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction."
- Albert Einstein
 
Old November 16th, 2010, 04:24 PM
Friend of Wrox
 
Join Date: Jun 2008
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts
Default

http://www.daniweb.com/forums/thread298170.html

But the VB.NET *includes* a function for outputting values in hex, you know.
http://msdn.microsoft.com/en-us/library/963zt96e(VS.80).aspx

And conversion FROM any base is trivial:
Code:
Dim foo As Integer = Convert.ToInt32("110111011101", 2)
Dim bar As Integer = Convert.ToInt32("A93E", 16)

Last edited by Old Pedant; November 16th, 2010 at 04:33 PM..
 
Old November 16th, 2010, 04:39 PM
Friend of Wrox
 
Join Date: Jun 2008
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts
Default

Quote:
At 17 the only job I've ever had was as a lifeguard for a swimming pool - I absolutely loathed it!
Must have been a little kids' pool, no teen-aged girls, huh?

Programming is not a career to choose if
(a) you like being outside most of the time,
(b) you like working as few hours as possible,
(c) you get frustrated easily, or
(d) you are not a perfectionist.

Other than that, I think it's a great career choice. I've only been doing it for...ummm...wait a sec...can I borrow your fingers...ummm...okay, and your toes...WOW! Needed all of them! 40 years now. And I still find fun things to do and new things to try and still enjoy it.

But, then, I'm a terrible masochist. www.juncojunction.com
 
Old November 17th, 2010, 01:29 PM
Authorized User
 
Join Date: Oct 2010
Posts: 29
Thanks: 23
Thanked 0 Times in 0 Posts
Send a message via MSN to SamC
Default

Quote:
Originally Posted by Old Pedant View Post
Must have been a little kids' pool, no teen-aged girls, huh?

Programming is not a career to choose if
(a) you like being outside most of the time,
(b) you like working as few hours as possible,
(c) you get frustrated easily, or
(d) you are not a perfectionist.

Other than that, I think it's a great career choice. I've only been doing it for...ummm...wait a sec...can I borrow your fingers...ummm...okay, and your toes...WOW! Needed all of them! 40 years now. And I still find fun things to do and new things to try and still enjoy it.

But, then, I'm a terrible masochist. www.juncojunction.com
No, unfortunately not. I always wanted a chance to utilise my training in cardiopulmonary resuscitation!

(a) That's fine for me, it's miserable outside here most of the time anyway!
(b) I don't mind working for long durations of time if it's something that is challenging and enjoyable.
(c) Unfortunately I am quite easily frustrated, I think this is my Achilles' heel.
(d) I am a serious perfectionist, to a borderline neurotic extent some times! I'm known as a bit of a pedant among my friends myself!

I'm left brain orientated which can only be a plus, and am reasonably intelligent (128 Weschler scale, age 8) just out of interest, are there any figures on the average IQ of programmers?
__________________
"Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction."
- Albert Einstein
 
Old November 17th, 2010, 06:05 PM
Friend of Wrox
 
Join Date: Jun 2008
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts
Default

Quote:
just out of interest, are there any figures on the average IQ of programmers?
No idea. Google for it?

I'm not sure raw IQ is the best measurement, in any case. Certain *areas* of a general exam are likely more pertinent than others. For example, I think spatial relationships is probably a good indicator, even though there's no obvious use of such relationships in most programming.

I would think that 128 would put you up in the top quartile of programmers, as a rough guess. Higher? Dunno.
 
Old November 21st, 2010, 08:35 PM
Authorized User
 
Join Date: Oct 2010
Posts: 29
Thanks: 23
Thanked 0 Times in 0 Posts
Send a message via MSN to SamC
Default

Really, I'd pictured myself at the sort of lower end of Programmers in terms of Intellect, I was under the impression that you need to be incredibly intelligent to get anywhere in the computing industry, lol probably because Bill Gates is rumoured to have an IQ of 160! (I think mines around ~135 when translated to the same scale.)

Math and problem solving are definitely my strong points, although I'm let down by my abysmal organisational skills and poor memory - two things I attribute to my dyslexia.

BTW how important do you consider qualifications to be in your industry? Degree fees have literally just tripled over here, our political and financial situation is dire. I only want to do a Degree and/or Master's if it's going to significantly better my career prospects.
__________________
"Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction."
- Albert Einstein
 
Old November 21st, 2010, 09:03 PM
Friend of Wrox
 
Join Date: Jun 2008
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts
Default

Can't answer about degrees in UK. Check with some recuriters there for an answer.

Here, a degree isn't important after you have 5 to 10 years experience. But good luck *getting* that experience without the degree to get you in the door.

A bare bones minimum is, I think, a two year degree. But four is definitely better if you can at all swing it. Masters is not that important unless you are going to work in some of the more esoteric areas of programming.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Pong Game Help -XM- BOOK: Professional XNA Game Programming: For Xbox 360 and Windows ISBN: 978-0-470-12677-6 4 June 20th, 2007 02:23 PM
How to be a Game Programmer & Animator mmostajab BOOK: Ivor Horton's Beginning Visual C++ 2005 0 April 12th, 2007 03:35 AM
Javascript && keeps turnig into && ayrton Pro VB.NET 2002/2003 3 June 27th, 2005 03:34 PM
Blackjack Game Apocolypse2005 BOOK: Beginning Visual C++ 6 0 June 7th, 2005 12:08 PM
Linux & KDE & C++ & QT & MYSQL & Kdevelop Munnnki Linux 0 January 2nd, 2005 05:41 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.