Press J to jump to the feed. Press question mark to learn the rest of the keyboard shortcuts
45
Archived

Go Language Official Blog

50 comments
70% Upvoted
This thread is archived
New comments cannot be posted and votes cannot be cast
level 1

Who will be the first to create a Go AI in Go?

Edit: The name should be a no-brainer.

level 2

cagedancer?

level 3

Developed at the nightclub Go Go A Go Go.

level 2

And to start it you say "Go-Go Go Go"?

level 2
3 points · 8 years ago

I know about at least one implementation:

http://github.com/skybrian/Gongo

level 3
4 points · 8 years ago

This is a decent resource btw:

http://go-lang.cat-v.org/

level 2

This depends on your criteria. If you want one that doesn't win I can create it for you today. Making one that can beat a reasonably competent player will take a while longer.

level 3

I think I've laid out a way to serialize a Go game's moves into a 'chromosome' to use in a genetic algorithm. I think that by calculating your average density throughout certain sectors in comparison to enemy density should be good enough throughout time to determine which moves result in more chances of winning.

This'll let you run it a million times to get better I'll get to learning Go tonight.

level 1
-10 points · 8 years ago(More than 25 children)
level 2

:= is not assignment, it's one of the declaration syntaxes. And as a C programmer, don't you like Go's error handling, which is basically a much more elegant version of C-style error handling?

level 3

What is Go's error handling like? Ideally I'd like to see languages move towards Haskell style Maybe a.

level 3
-5 points · 8 years ago(0 children)
level 4
10 points · 8 years ago

foo := 3 is equivalent to var foo int = 3; it lets the compiler infer the type. Later on, if you want to modify the value of foo you would use foo = 7 like you are used to.

level 5

I understand the inference working will in other cases, but in your particular case what does Go actually do? 3 can reprent a slew of different types.

level 6
4 points · 8 years ago

It will infer the type based on how it is used later.

level 4

I'm guessing the downvotes are because the := operator is not assignment, and not like Pascal's := operator. In Go, := can not be used to assign a new value to a variable. It is a way of declaring a variable without having to type ''var''. So in Java/C++ you may have

BigClassName a = new BigClassName();

whereas in Go this could be done with

a := new(BigClassName);

or if you want to be verbose

var a BigClassName*
a = new(BigClassName)
level 2
[deleted]
3 points · 8 years ago

I prefer to differentiate assignment and equality tests in some syntactic way that prevents accidental assignment when a comparison is in order...

level 3

It wouldn't help, the comparison operator is still == and the assignment operator is still =.

What it prevents is typos. If write in Python the following line:

answer = 42

Python infers that the variable holds an int. If I later type:

anwser = 6 * 9

I will create a new variable. This is not what I meant. In go, I will do:

answer := 42

And go will create the variable and initialize it as I wish. I can never use := on that variable since it already exists. And if I do:

anwser = 6 * 9

The compiler will refuse it because it doesn't know the variable anwser.

level 4

Python doesn't infer anything, answer is just a void pointer to an object that has a field that declares what it is. Inference implies that it can know this type at compile time.

level 5

And Python variable don't hold anything, they just reference. I just wrote it that way for simplicity's sake.

level 6

The point is infers has a very well defined meaning in CS and especially when talking about types. What Python does is very different from inference.

level 7

In the case of:

parrot = "dead"

Python can infer the type at compile time. If it does or not is an implementation detail.

level 8

It can't because parrot might be assigned to something else latter. Inference implies static typing. It is meaningless unless you can say parrot will always be a string.

level 9

It can certainly infer that at this point in time parrot will be bound to a string. Bet let just say I said "RPython" which would not let you assign a differently typed value later.

level 10

What happens if you have:

parrot = 1 if random.randrange(2) else "dead"
level 3
1 point · 8 years ago

I've seen recommendations before to change the order of equality tests in C to prevent these errors, like: if(3 == num) instead of if(num == 3). Honestly though I've never seen an error in code because someone accidentally used '=' instead of '==' and doing something like if(num = 3) will generate a warning anyways.

level 4

And this is not at all what the := operator is about.

level 4

There were time when warnings weren't generated. I did such a typo a couple of times. And it was PITA to find out...

level 4
[deleted]
1 point · 8 years ago

Doesn't work for if(a == b).

level 2

I miss decent error handling too; Until there are no exceptions, I won't consider it. I do not share the present excuses exceptions would clutter interfaces etc.

level 3
1 point · 8 years ago

If exceptions do happen, they won't be for error handling. At least not things like "file does not exist". Down that path lies madness. More for things like out of memory or divide by zero or the kind of thing you'd use setjmp/longjmp for in C.

level 4

I'm really glad to hear that.

level 4

I am certain it will be different, if kind-of will ever be part of the language spec. Exception handling without hierarchical types (which go hasn't; types just "are") would be really limiting.

level 1
-13 points · 8 years ago(9 children)
level 2
8 points · 8 years ago

If they haven't fixed it by now...I don't think they are inclined to. It doesn't look like he trademarked the language either, so Google has little incentive to make the change.

level 3
-1 points · 8 years ago

Google has little incentive to make the change

Don't be evil? I guess it's unlikely to be fixed now, but it's a stain on their record.

(Yes, I hold them to a high standard)

level 4

C, C++, C#, ooc, BitC, Objective-C. I think we can manage with Go and Go!

level 5
0 points · 8 years ago

Good point, I guess. Though explicitly handling the situation somehow would be good.

level 6

To me the best compromise would be a link on Go's page saying "Looking for Go!?"

level 2

Ask the Google legal department.

level 2
[deleted]
-2 points · 8 years ago

Maybe someone needs to start an issue9 subreddit.

level 2

i don't understand the downvotes.

would it be miscrosoft or apple ...

level 2
[deleted]
-2 points · 8 years ago

Issue 9 From Outer Space! ...er, From Francis McCabe.

level 1
[deleted]
-14 points · 8 years ago(2 children)
level 2
12 points · 8 years ago

That's wiki page ain't Go. It's Go Bang (Go!).

level 3
[deleted]
-4 points · 8 years ago · edited 8 years ago

Ah. Found some sample code to mess around with: http://99-bottles-of-beer.net/language-go!-289.html

level 1
-11 points · 8 years ago(0 children)
level 2

Works for me.

level 2

I'm confused about why you think a misconfigured web server is so funny?

Community Details

1.4m

Subscribers

5.4k

Online

Computer Programming

Create Post
r/programming Rules
1.
Keep submissions on topic and of high quality
2.
No surveys
3.
No résumés/job listings
4.
/r/programming is not a support forum
5.
Spam
Info

Related reddits

Specific languages

Cookies help us deliver our Services. By using our Services or clicking I agree, you agree to our use of cookies. Learn More.