code logs -> 2016 -> Fri, 20 May 2016< code.20160519.log - code.20160521.log >
--- Log opened Fri May 20 00:00:29 2016
00:30 Derakon [chriswei@Nightstar-5mvs4e.ca.comcast.net] has joined #code
00:30 mode/#code [+ao Derakon Derakon] by ChanServ
01:46 himi [fow035@Nightstar-dm0.2ni.203.150.IP] has joined #code
01:46 mode/#code [+o himi] by ChanServ
03:11 Crossfire [Z@Nightstar-r9lk5l.cust.comxnet.dk] has quit [Ping timeout: 121 seconds]
03:28
< [R]>
I writting some code to automate D&D table lookups (for loot generation). The way it basically works is random number from 1-100, check against table. But the table could have some entries that come up on multiple values. I'm trying to figgure out what that cleanest way of coding that is.
03:29
<@Alek>
I recall seeing "case 1 do X case 5 do Y etc" where for example 1-4 would go to X.
03:29
<@Alek>
I forget the language.
03:30
<@Alek>
I also recall seeing in another language "case 1 case 2 case 3 case 4 do X case 5 etc do Y"
03:30
<@Alek>
each case statement being on a separate line, in both cases.
03:30
<~Vornicus>
That is too code and not data enough
03:30
<@Alek>
in the second case each case statement passing down until it reached the one with a do.
03:30
<@Alek>
yeah, sorry.
03:31
< [R]>
That works yeah, but it's pretty ugly.
03:31
<@Alek>
it probably depends on what language you're using.
03:31
<~Vornicus>
thing goes (low, high, entry). You iterate the table for the thing s.t. low <= x <= high and that gives you your entry.
03:31
< [R]>
It's not a hard task, I just don't want to have giant functions, or unreadable functions (as I have a bunch of tables I want to get through)
03:32
<~Vornicus>
...this is a little messy because you basically have to tell it twice for each boundary
03:32
<@Alek>
I'd probably go "for X, if X <=10, Y; if X<=20, Z; etc"
03:33
<@Alek>
or elseif, anyway
03:33
<~Vornicus>
possibly: (width, entity); then you can go if x > width: x -= width; else: do_thin_with_entity
03:33
<@Alek>
nested elseifs. not very elegant, perhaps, but it should work.
03:33
<@Alek>
but yeah, you're looking for more elegance.
03:34
< [R]>
I could probably do something like: [[90, '3'], [60, '2'], [30, '1'], [0, '0']] for a table of: 0-29: 0; 30-59: 1, 60-89: 2, 90-100: 3. Code would just loop through until it rolled on or under the value.
03:34
<~Vornicus>
You can tune widths so they add up to exactly 1, or you can as a first shot iterate over the entire thing.
03:34
<~Vornicus>
and figure out the right scale for rand
03:38 celticminstrel [celticminst@Nightstar-q0f7bb.dsl.bell.ca] has quit [[NS] Quit: And lo! The computer falls into a deep sleep, to awake again some other day!]
03:39
<@Reiv>
Don't have to tell for each boundary
03:39
<@Reiv>
Hell, you can write a naieve one if you want
03:40
<@Reiv>
Data is a tuple: Top value, (ie, 1-5 is listed as '5') and your text as you see fit
03:40
<@Reiv>
check i = val; if no val, i++, loop
03:41
<@Reiv>
So if you roll a 3, it'll look for 3, then 4, then 5
03:41
<@Reiv>
This is terrible code but it demonstrates how simple you can get
03:41
< [R]>
Aye, I decided on something like that, but I don't need to do the increments
03:41
<@Reiv>
Some small amount of work of 'find the smallest value that is greater or equal to the random number generated" is sufficient
03:42
<@Reiv>
Yeah, I was mostly making it explicit for ease of comprehension
03:42
<@Reiv>
(A bit like I might explain sorting with bubble sort for sheer simplicity, but it's still a terrible idea)
03:43 Crossfire [Z@Nightstar-r9lk5l.cust.comxnet.dk] has joined #code
03:43 mode/#code [+o Crossfire] by ChanServ
04:14 Turaiel[Offline] [Brandon@Nightstar-7mqsi0.mi.comcast.net] has quit [Ping timeout: 121 seconds]
04:15 Turaiel[Offline] [Brandon@Nightstar-7mqsi0.mi.comcast.net] has joined #code
04:30 crystalclaw|AFK is now known as crystalclaw
05:07 Derakon is now known as Derakon[AFK]
05:22 Reiv [NSwebIRC@Nightstar-q8avec.kinect.net.nz] has quit [Ping timeout: 121 seconds]
06:38 crystalclaw is now known as crystalclaw|AFK
07:12 Kindamoody[zZz] is now known as Kindamoody
07:37 Kindamoody is now known as Kindamoody|afk
08:07 himi [fow035@Nightstar-dm0.2ni.203.150.IP] has quit [Ping timeout: 121 seconds]
09:14 ion [Owner@Nightstar-6grqph.vs.shawcable.net] has joined #code
09:24 Crossfire [Z@Nightstar-r9lk5l.cust.comxnet.dk] has quit [Ping timeout: 121 seconds]
09:39 gnolam_ [quassel@Nightstar-t1tbf0.cust.bahnhof.se] has joined #code
09:51 ion [Owner@Nightstar-6grqph.vs.shawcable.net] has quit [Connection reset by peer]
09:53 ion [Owner@Nightstar-6grqph.vs.shawcable.net] has joined #code
09:57 himi [fow035@Nightstar-v37cpe.internode.on.net] has joined #code
09:57 mode/#code [+o himi] by ChanServ
10:04 Kindamoody|afk [Kindamoody@Nightstar-0lgkcs.tbcn.telia.com] has quit [Ping timeout: 121 seconds]
10:24 Kindamoody|autojoin [Kindamoody@Nightstar-sak60b.tbcn.telia.com] has joined #code
10:24 mode/#code [+o Kindamoody|autojoin] by ChanServ
10:47 Kindamoody|autojoin [Kindamoody@Nightstar-sak60b.tbcn.telia.com] has quit [Connection closed]
10:48 Kindamoody|autojoin [Kindamoody@Nightstar-sak60b.tbcn.telia.com] has joined #code
10:49 mode/#code [+o Kindamoody|autojoin] by ChanServ
10:51
<~Vornicus>
ErikMesoy: the iphone 5 acts 320px wide.
10:52
<~Vornicus>
Typical modern site design takes into account varying screen sizes by rearranging objects according to browser width. Foundation and Bootstrap are popular; I prefer Foundation.
10:52
<~Vornicus>
are popular libraries for doing this, that is
10:53
<@gnolam>
I don't know which one decides that you're on mobile if width < height, but I want to strangle them with their own intestines.
10:54 thalass_ [thalass@Nightstar-283.o7s.158.104.IP] has joined #code
10:54
<@TheWatcher>
... yeah
10:54
<~Vornicus>
Neither of those
10:54
<@TheWatcher>
Anyone doing that should have their figgin roasted on a spike.
10:54
<~Vornicus>
You can of course rearrange accordingly - landscape and portrait mode are available to media queries
10:55
<~Vornicus>
But generally you should avoid that unless what you *really* want is for everything to fit above the fold.
11:10
<@TheWatcher>
I don't remeber running into Foundation before... that looks like it could be useful, thanks Vorn.
11:20
<~Vornicus>
it's good stuff. If you already run a sass rig it's supposedly even better but I don't have the arsage to do that
11:30 catadroid [catadroid@Nightstar-7mrtqu.dab.02.net] has joined #code
11:31 * Vornicus hatadroids catadroid.
11:31
< catadroid>
Things I have done this week: nearly doubled the performance of our vector::push_back. Fixed a memory smashing bug in vector::insert when users were inserting aliased items
11:31
< catadroid>
I think I'm alright to think of myself as somewhat of an expert
11:32 * Vornicus gives catadroid a pointy purple hat with silver stars and moons on it.
11:32
<~Vornicus>
I'm kind of surprised there's this kind of performance to be gleaned, really
11:34
<@TheWatcher>
catadroid: nice!
11:37 * TheWatcher eyes foundation some more, sighs vaguely at jquery
11:38
<~Vornicus>
don't need it for layout; only for things that say js on there.
11:39 * TheWatcher nod
11:40 thalass_ [thalass@Nightstar-283.o7s.158.104.IP] has quit [[NS] Quit: erg adulthood]
11:42
<@TheWatcher>
(jquery is one of those frameworks I know and can use fine, but don't actually /like/; mootools' approach works so much better in my head, and I think makes for much cleaner code, but apparently I'm in a tiny minority so :/)
11:45
<~Vornicus>
Yeah, jq has a huger install base, I've never actually seen mootools live
11:45
<~Vornicus>
which kinda makes mootools hard to get into
11:46 Vornicus [Vorn@ServerAdministrator.Nightstar.Net] has quit [Connection closed]
11:51 Kindamoody|autojoin [Kindamoody@Nightstar-sak60b.tbcn.telia.com] has quit [Ping timeout: 121 seconds]
11:52 Kindamoody|autojoin [Kindamoody@Nightstar-0lgkcs.tbcn.telia.com] has joined #code
11:52 mode/#code [+o Kindamoody|autojoin] by ChanServ
11:56
< catadroid>
Yeah, I was surprised as well
11:56
< catadroid>
But it was following a generic insert path, which is an inherently slower operation
11:59
< catadroid>
(I was actually exaggerating slightly - it's more like 30% in the general case x))
11:59
< catadroid>
But still
11:59
<@TheWatcher>
30% is still significant
12:16
< catadroid>
Mhm
12:50 gnolam_ [quassel@Nightstar-t1tbf0.cust.bahnhof.se] has quit [A TLS packet with unexpected length was received.]
13:11 Emmy-zZz is now known as Emmy
13:47
<@gnolam>
God I love having a support guy on hand.
13:48 catadroid` [catadroid@Nightstar-uc63kg.dab.02.net] has joined #code
13:50 catadroid [catadroid@Nightstar-7mrtqu.dab.02.net] has quit [Ping timeout: 121 seconds]
14:24 catadroid` is now known as catadroid
14:33 Crossfire [Z@Nightstar-r9lk5l.cust.comxnet.dk] has joined #code
14:33 mode/#code [+o Crossfire] by ChanServ
15:43 Crossfire [Z@Nightstar-r9lk5l.cust.comxnet.dk] has quit [Ping timeout: 121 seconds]
15:58 celticminstrel [celticminst@Nightstar-q0f7bb.dsl.bell.ca] has joined #code
15:58 mode/#code [+o celticminstrel] by ChanServ
16:12 Emmy [M@Nightstar-9p7hb1.direct-adsl.nl] has quit [[NS] Quit: Leaving]
16:14 Emmy [M@Nightstar-9p7hb1.direct-adsl.nl] has joined #code
16:14 Emmy [M@Nightstar-9p7hb1.direct-adsl.nl] has quit [[NS] Quit: Leaving]
16:29 Emmy [M@Nightstar-9p7hb1.direct-adsl.nl] has joined #code
16:53
< catadroid>
Dammit visual studio just inline my code please
17:00
< [R]>
Reminds me of a few years back someone was bitching about MS' compiler not inlining 100 some-odd functions.
17:00
< [R]>
(Different functions)
17:01
< [R]>
Good to hear they've improved things.
17:01
< [R]>
:p
17:05 Kindamoody|autojoin is now known as Kindamoody
17:18
< catadroid>
Eh, I wouldn't mind but i really want it to, even in debug
17:43 gizmore [kvirc@Nightstar-0btafn.dip0.t-ipconnect.de] has joined #code
18:36 macdjord [macdjord@Nightstar-r9vt2h.mc.videotron.ca] has quit [[NS] Quit: Where there's a whip! (Whup-CHA!) There's a way!]
19:08 Emmy [M@Nightstar-9p7hb1.direct-adsl.nl] has quit [Ping timeout: 121 seconds]
20:18 catadroid` [catadroid@Nightstar-umb6kf.dab.02.net] has joined #code
20:20 catadroid [catadroid@Nightstar-uc63kg.dab.02.net] has quit [Ping timeout: 121 seconds]
20:23 Vornicus [Vorn@ServerAdministrator.Nightstar.Net] has joined #code
20:24 mode/#code [+qo Vornicus Vornicus] by ChanServ
20:42 catadroid` [catadroid@Nightstar-umb6kf.dab.02.net] has quit [[NS] Quit: Bye]
20:45 thalass [thalass@Nightstar-283.o7s.158.104.IP] has joined #code
20:46 mode/#code [+o thalass] by ChanServ
21:21 Kindamoody is now known as Kindamoody[zZz]
21:23 gizmore [kvirc@Nightstar-0btafn.dip0.t-ipconnect.de] has quit [Ping timeout: 121 seconds]
21:23 gizmore [kvirc@Nightstar-8damfj.dip0.t-ipconnect.de] has joined #code
21:35 gizmore|2 [kvirc@Nightstar-8damfj.dip0.t-ipconnect.de] has joined #code
21:36 gizmore|3 [kvirc@Nightstar-8damfj.dip0.t-ipconnect.de] has joined #code
21:38 gizmore [kvirc@Nightstar-8damfj.dip0.t-ipconnect.de] has quit [Ping timeout: 121 seconds]
21:39 gizmore|2 [kvirc@Nightstar-8damfj.dip0.t-ipconnect.de] has quit [Ping timeout: 121 seconds]
23:29 gizmore|3 [kvirc@Nightstar-8damfj.dip0.t-ipconnect.de] has quit [[NS] Quit: KVIrc 4.9.2 Aria http://www.kvirc.net/]
--- Log closed Sat May 21 00:00:45 2016
code logs -> 2016 -> Fri, 20 May 2016< code.20160519.log - code.20160521.log >

[ Latest log file ]