Dominion Strategy Forum

Please login or register.

Login with username, password and session length
Pages: 1 ... 227 228 [229] 230  All

Author Topic: Random Stuff Part II  (Read 584699 times)

0 Members and 3 Guests are viewing this topic.

Witherweaver

  • Adventurer
  • ******
  • Offline Offline
  • Posts: 6476
  • Shuffle iT Username: Witherweaver
  • Respect: +7839
    • View Profile
Re: Random Stuff Part II
« Reply #5700 on: December 09, 2015, 04:01:08 pm »
0

I asked someone how many seconds there were in six weeks. He correctly replied "There's 10!"

Neat.
Logged

eHalcyon

  • Adventurer
  • ******
  • Offline Offline
  • Posts: 8689
  • Respect: +9156
    • View Profile
Re: Random Stuff Part II
« Reply #5701 on: December 09, 2015, 04:31:13 pm »
+4

I asked someone how many seconds there were in six weeks. He correctly replied "There's 10!"

Someone make this funnier pls. I don't get it.

These jokes always mess me up.  Factorials man.
Logged

silverspawn

  • Governor
  • *****
  • Offline Offline
  • Posts: 4202
  • Shuffle iT Username: sty.silver
  • Respect: +1846
    • View Profile
Re: Random Stuff Part II
« Reply #5702 on: December 09, 2015, 05:38:18 pm »
0

woah
Logged

Tables

  • Margrave
  • *****
  • Offline Offline
  • Posts: 2766
  • Build more Bridges in the King's Court!
  • Respect: +3263
    • View Profile
Re: Random Stuff Part II
« Reply #5703 on: December 09, 2015, 05:52:25 pm »
0

Factorials can be pretty fun.
9! seconds is a little more than 4 days.
11! seconds is over a year and 3 months.
16! seconds is about three times the current lifespan of humanity (homo sapiens)
Logged
...spin-offs are still better for all of the previously cited reasons.
But not strictly better, because the spinoff can have a different cost than the expansion.
I hereby declare myself the best dominion player in the world. Obviously.

Kuildeous

  • Cartographer
  • *****
  • Offline Offline
  • Posts: 3816
  • Respect: +2185
    • View Profile
Re: Random Stuff Part II
« Reply #5704 on: December 10, 2015, 07:37:15 am »
+11

I asked someone how many seconds there were in six weeks. He correctly replied "There's 10!"

I liked that joke! I give it 4.9 out of 5!

Or maybe I didn't like it that much after all!
Logged
A man has no signature

sudgy

  • Cartographer
  • *****
  • Offline Offline
  • Posts: 3386
  • Shuffle iT Username: sudgy
  • It's pronounced "SOO-jee"
  • Respect: +2644
    • View Profile
Re: Random Stuff Part II
« Reply #5705 on: December 13, 2015, 12:02:12 am »
0

Have any of you ever found a good use for gotos?  I just had this type of thing happen in my code:

Code: [Select]
for loop {
    if condition {
        do stuff
        goto end
    }
}
other for loop {
    if other condition {
        do other stuff
        goto end
    }
}
another for loop {
    if another condition {
        do another stuff
        goto end
    }
}
end:
do some more stuff

I can't see a way to make this simpler and more readable without gotos...
Logged
If you're wondering what my avatar is, watch this.

Check out my logic puzzle blog!

   Quote from: sudgy on June 31, 2011, 11:47:46 pm

Kuildeous

  • Cartographer
  • *****
  • Offline Offline
  • Posts: 3816
  • Respect: +2185
    • View Profile
Re: Random Stuff Part II
« Reply #5706 on: December 13, 2015, 01:19:36 am »
0

I suppose you could nest the loops, but I would definitely say that it's more readable with the gotos.
Logged
A man has no signature

Kirian

  • Adventurer
  • ******
  • Offline Offline
  • Posts: 7092
  • Shuffle iT Username: Kirian
  • An Unbalanced Equation
  • Respect: +9371
    • View Profile
Re: Random Stuff Part II
« Reply #5707 on: December 13, 2015, 02:22:10 am »
0

Are the for loops related in any way?  This seems like the sort of thing that would usually be taken care of by break(n);
Logged
Kirian's Law of f.DS jokes:  Any sufficiently unexplained joke is indistinguishable from serious conversation.

sudgy

  • Cartographer
  • *****
  • Offline Offline
  • Posts: 3386
  • Shuffle iT Username: sudgy
  • It's pronounced "SOO-jee"
  • Respect: +2644
    • View Profile
Re: Random Stuff Part II
« Reply #5708 on: December 13, 2015, 02:49:01 am »
0

Are the for loops related in any way?  This seems like the sort of thing that would usually be taken care of by break(n);

Not really, it's basically trying to do one thing, and if that fails, it does another, and if that fails, then another.
Logged
If you're wondering what my avatar is, watch this.

Check out my logic puzzle blog!

   Quote from: sudgy on June 31, 2011, 11:47:46 pm

eHalcyon

  • Adventurer
  • ******
  • Offline Offline
  • Posts: 8689
  • Respect: +9156
    • View Profile
Re: Random Stuff Part II
« Reply #5709 on: December 13, 2015, 03:00:37 am »
0

Are the for loops related in any way?  This seems like the sort of thing that would usually be taken care of by break(n);

Not really, it's basically trying to do one thing, and if that fails, it does another, and if that fails, then another.

So, this?

loop 1
   if success
      break
end loop

if not success
   loop 2
      if success
         break
   end loop

if not success
   loop 3
      if success
         break
   end loop



Or it may be better to throw and catch errors.
Logged

qmech

  • Torturer
  • *****
  • Offline Offline
  • Posts: 1918
  • Shuffle iT Username: qmech
  • What year is it?
  • Respect: +2315
    • View Profile
Re: Random Stuff Part II
« Reply #5710 on: December 13, 2015, 07:17:40 am »
0

Or it may be better to throw and catch errors.

Yes.  sudgy, this is a very common pattern, and people who think gotos are dangerous designed language features exactly for your situation.  If you're in a language without exceptions (which is what this feature is normally called) try looking up the standard work around.
Logged

Titandrake

  • Mountebank
  • *****
  • Online Online
  • Posts: 2137
  • Respect: +2692
    • View Profile
Re: Random Stuff Part II
« Reply #5711 on: December 13, 2015, 07:52:41 am »
+1

You could put everything from the first for loop to just before end into a separate function, then replace all the gotos with returns. Depends on what exactly you're doing though.
Logged
I have a blog! It's called Sorta Insightful. Check it out?

LastFootnote

  • Adventurer
  • ******
  • Offline Offline
  • Posts: 7083
  • Shuffle iT Username: LastFootnote
  • Respect: +9828
    • View Profile
Re: Random Stuff Part II
« Reply #5712 on: December 13, 2015, 09:26:50 am »
0

If you are in e.g. Java (and you don't consider a failure within the loops to be exception-worthy), then what you want it this:

Code: [Select]
label: {
    for loop {
        if condition {
            do stuff
            break label
        }
    }
    other for loop {
        if other condition {
            do other stuff
            break label
        }
    }
    another for loop {
        if another condition {
            do another stuff
            break label
        }
    }
}
do some more stuff

You don't have to have a while, for, if, etc. in order to throw up some brackets. You can just surround all the loops in one set of brackets, label that block of code, and then break out of the entire block by referencing the label.
Logged

pingpongsam

  • Torturer
  • *****
  • Offline Offline
  • Posts: 1753
  • Shuffle iT Username: pingpongsam
  • Respect: +774
    • View Profile
Re: Random Stuff Part II
« Reply #5713 on: December 13, 2015, 09:36:08 am »
+1

I use goto in DOS batch files and the original BASIC language. The latter I have not touched in probably a decade or more. In the former I still write one or three a year. I write in several other languages and goto is something I would never even think of doing.
Logged
You are the brashest scum player on f.ds.

sudgy

  • Cartographer
  • *****
  • Offline Offline
  • Posts: 3386
  • Shuffle iT Username: sudgy
  • It's pronounced "SOO-jee"
  • Respect: +2644
    • View Profile
Re: Random Stuff Part II
« Reply #5714 on: December 13, 2015, 03:25:43 pm »
0

It's c++, so I can't use break label.

I've heard people saying that exceptions can be performance heavy (or something like that), and I usually only use exceptions for actual errors.  I think the if not success way is more confusing and less readable than gotos.

As I said, I can't find a simpler and more readable way to write it.  I already thought of most of these ways, but I think using goto in this case is just more readable (at least more than all of these options).
Logged
If you're wondering what my avatar is, watch this.

Check out my logic puzzle blog!

   Quote from: sudgy on June 31, 2011, 11:47:46 pm

Kirian

  • Adventurer
  • ******
  • Offline Offline
  • Posts: 7092
  • Shuffle iT Username: Kirian
  • An Unbalanced Equation
  • Respect: +9371
    • View Profile
Re: Random Stuff Part II
« Reply #5715 on: December 13, 2015, 04:08:04 pm »
0

Hanabi becomes much, much harder when all the 1s in two suits are in the bottom half of the deck...

Edit:  Oh, and four of the 5s are in our hands already.  (Online game obviously)
« Last Edit: December 13, 2015, 04:16:55 pm by Kirian »
Logged
Kirian's Law of f.DS jokes:  Any sufficiently unexplained joke is indistinguishable from serious conversation.

Witherweaver

  • Adventurer
  • ******
  • Offline Offline
  • Posts: 6476
  • Shuffle iT Username: Witherweaver
  • Respect: +7839
    • View Profile
Re: Random Stuff Part II
« Reply #5716 on: December 13, 2015, 04:17:40 pm »
0

It's c++, so I can't use break label.

I've heard people saying that exceptions can be performance heavy (or something like that), and I usually only use exceptions for actual errors.  I think the if not success way is more confusing and less readable than gotos.

As I said, I can't find a simpler and more readable way to write it.  I already thought of most of these ways, but I think using goto in this case is just more readable (at least more than all of these options).

Are you sure the logic can't be switched?  You have to run each loop separately?
Logged

Kuildeous

  • Cartographer
  • *****
  • Offline Offline
  • Posts: 3816
  • Respect: +2185
    • View Profile
Re: Random Stuff Part II
« Reply #5717 on: December 13, 2015, 09:14:12 pm »
0

Hanabi becomes much, much harder when all the 1s in two suits are in the bottom half of the deck...

Edit:  Oh, and four of the 5s are in our hands already.  (Online game obviously)

I've put aside my deck of cards and play with the tiles, so this comment confused me at first.

That scenario is exactly why I don't like the rules as written. It seems like you are really hoping that the last 1s and 2s are not at the bottom of the deck. I think even the last 3s could be problematic.

So I play where we go through all the cards/tiles based on one of the variants, but we don't declare the game over if we lock ourselves out.
Logged
A man has no signature

Donald X.

  • Dominion Designer
  • *****
  • Offline Offline
  • Posts: 5477
  • Respect: +22102
    • View Profile
Re: Random Stuff Part II
« Reply #5718 on: December 13, 2015, 11:51:50 pm »
0

It's c++, so I can't use break label.

I've heard people saying that exceptions can be performance heavy (or something like that), and I usually only use exceptions for actual errors.  I think the if not success way is more confusing and less readable than gotos.

As I said, I can't find a simpler and more readable way to write it.  I already thought of most of these ways, but I think using goto in this case is just more readable (at least more than all of these options).
Have you considered using self-modifying code?

It would be easier to make fun of your program if you provided actual code. As it stands I recommend making a function for "do a loop but stop if a condition is met and do special stuff then, with a return value telling you if the condition happened." I mean you do it 3 times there.
Logged

Kirian

  • Adventurer
  • ******
  • Offline Offline
  • Posts: 7092
  • Shuffle iT Username: Kirian
  • An Unbalanced Equation
  • Respect: +9371
    • View Profile
Re: Random Stuff Part II
« Reply #5719 on: December 14, 2015, 12:05:52 am »
0

Have you considered using self-modifying code?

Is that... a thing?  I mean, I assume you're not talking about some sort of AI programmer, and I feel like I've heard the concept before... but I'm not certain what that means.
Logged
Kirian's Law of f.DS jokes:  Any sufficiently unexplained joke is indistinguishable from serious conversation.

XerxesPraelor

  • Saboteur
  • *****
  • Offline Offline
  • Posts: 1069
  • Respect: +363
    • View Profile
Re: Random Stuff Part II
« Reply #5720 on: December 14, 2015, 12:10:29 am »
0

It's c++, so I can't use break label.

I've heard people saying that exceptions can be performance heavy (or something like that), and I usually only use exceptions for actual errors.  I think the if not success way is more confusing and less readable than gotos.

As I said, I can't find a simpler and more readable way to write it.  I already thought of most of these ways, but I think using goto in this case is just more readable (at least more than all of these options).

I am probably at about your level or maybe a little lower, but the way I'd do it is make helper bool functions, pass everything in, and then use ||. Feel free to make fun of this too.

Have you considered using self-modifying code?

Is that... a thing?  I mean, I assume you're not talking about some sort of AI programmer, and I feel like I've heard the concept before... but I'm not certain what that means.
I think it's a common example of something that will mess your program really badly if you don't do it exactly right, and so shouldn't be done.
Logged

Titandrake

  • Mountebank
  • *****
  • Online Online
  • Posts: 2137
  • Respect: +2692
    • View Profile
Re: Random Stuff Part II
« Reply #5721 on: December 14, 2015, 03:10:09 am »
+1

Have you considered using self-modifying code?

Is that... a thing?  I mean, I assume you're not talking about some sort of AI programmer, and I feel like I've heard the concept before... but I'm not certain what that means.

It's a thing, but if you actually use it for anything people have the right to punch you in the head, because understanding what it does is so difficult.

The core idea is that in the end, everything breaks down to 0s and 1s arranged in a particular way. That image file is a sequence of bits describing pixel color values. This song file is a sequence of bits describing what frequencies to play at what time. Thus, if you're clever enough about it, there's no reason you can't interpret the same binary data in two different ways. Effectively, that means your program can write some data somewhere, treat that data as code, and start running from there.

Edit: A complicated example of this is http://web.mit.edu/puzzle/www/2014/puzzle/puzzle_with_answer_rice/, where each step modifies the behaviors of other steps.
« Last Edit: December 14, 2015, 03:11:26 am by Titandrake »
Logged
I have a blog! It's called Sorta Insightful. Check it out?

silverspawn

  • Governor
  • *****
  • Offline Offline
  • Posts: 4202
  • Shuffle iT Username: sty.silver
  • Respect: +1846
    • View Profile
Re: Random Stuff Part II
« Reply #5722 on: December 14, 2015, 08:03:42 pm »
0

question: if I walk through an empty land and I come across some kind of structure, is that a 'change in geography?' Also, is it a 'change in landscape?' Also, is the 'change in' phrasing even correct for the latter?

I think the answers are yes / no / yes, but I'm not sure.
Logged

Kirian

  • Adventurer
  • ******
  • Offline Offline
  • Posts: 7092
  • Shuffle iT Username: Kirian
  • An Unbalanced Equation
  • Respect: +9371
    • View Profile
Re: Random Stuff Part II
« Reply #5723 on: December 14, 2015, 08:22:15 pm »
+1

No, no, sometimes.  "Change of [landscape|geography|venue]" is more common in English.

A single structure is a change of neither landscape nor geography.
Logged
Kirian's Law of f.DS jokes:  Any sufficiently unexplained joke is indistinguishable from serious conversation.

silverspawn

  • Governor
  • *****
  • Offline Offline
  • Posts: 4202
  • Shuffle iT Username: sty.silver
  • Respect: +1846
    • View Profile
Re: Random Stuff Part II
« Reply #5724 on: December 14, 2015, 08:57:09 pm »
0

I see, thanks.
Logged
Pages: 1 ... 227 228 [229] 230  All
 

Page created in 0.09 seconds with 21 queries.