I guess it depends on your use case. If you have a proper table you’re right. If you want to have a purely hand held device for places like a crowded subway an integrated keyboard would be superior, I guess.
I do tend to use various phones for multiple tasks as well. That being said, bluetooth fold-out keyboards were never a viable option for me (starting with some early folding ones for Palm handhelds etc up to the current Logitech Key-To-Go that isn’t foldabe but portable). My biggest problem with all of them was, that I use mobile devices mainly via commuting and it is just not really usable on your lap without the phone falling out or it being really shaky. A builtin keyboard might not be as comfortable as a separate bluetooth one, but it is fixed on your phone.
A notable exclusion of the “external keyboards don’t work when commuting” is the ipad Pro with a Smart Keyboard - the magnets are holding it in place as good as a fixed one. (Can’t say anything about the magic keyboard but I assume similar) edit: i actually wrote about my experience using the iPad here - not really using it “fullblown” with a VM and stuff ondevice like you do but rather as a remote shell: https://www.shift-2.com/journal/my-current-setup-learning-and-developing-rust
Here’s a solution for Lua.
local function d6() return math.random(6) end
local function o6()
local function reroll(acc,target,low,high,delta,result,crit)
local roll = d6()
if roll == target then
if crit then
return result
else
return reroll(acc + delta,target,low,high,delta,result,true)
end
elseif roll >= low and roll <= high then
return reroll(acc + delta,target,low,high,delta,result,false)
else
return acc
end
end
local roll = d6()
if roll == 1 then
return reroll(roll,1,1,3,-1,'fumble',true)
elseif roll == 6 then
return reroll(roll,6,4,6, 1,'success',true)
else
return roll
end
end
Since Lua does tail call optimization, the recursion won’t blow out the stack, and it allowed me to write this in a functional style. The function o6()
will return either ‘success’ (for a critical success), ‘fumble’ (for a critical failure) or a number.
I don’t know Lua, but looking at the code, does it return, let’s say “-2 Fumble”, “10” or “8 Critical” (Or ‘success’ as you call it - the reason why it is not called ‘success’ in the Amar RPG is that a successfull roll is when a character’s roll + skill value is equal to or higher than a Difficulty Rating).
It currently returns either ‘success’ (if two consecutive 6s are rolled), ‘fumble’ (if two consecutive 1s are rolled) or a number otherwise. The description on both the github site, and on the Amar RGP site is ambiguous as to what this means, but I have played a number of other RPGs with the concept of an automatic success or fail upon a roll meeting some criteria. The code can be modified to return both the number and the text (if applicable), but it would be nice to know what the difference between rolling “6 6” and “6 4 4 4 1”—if I calculate correctly, one is a “critical” 12, the other just a 12. Is a “critical” not an automatic success? (and conversely, a “fumble” an automatic failure?)
On a general note, one can treat all rolls beyond 1 and 6 in the same loop, with a roll of 4-6 adding 1 to an accumulating “open” score and only afterwards checking if that accumulated open score is to be treated as an addition or subtraction to the original dice roll (if the original dice roll was a 1, subtract the accumulated open score and add if the original roll was a 6). The same goes for Criticals and Fumbles, two consecutive 6s is a Critical if the original roll was a 6 and a Fumble if the original roll was a 1 (but remember to then treat the original roll of 1 as a “6” for this purpose). This is how I wrote the FOCAL program (for the HP-41 calculator).
Here’s the output of my Perl translation of the Nim code. I’ve run the simulation a number of times and discarded sequences that end after 1 roll (first throw is not a 1 or a 6). Do the results look correct (especially with regards to ‘fumble’ and ‘critical’)?
https://gist.github.com/gustafe/2e0b6e32da235ce0f5979a3ff720a407
I haven’t heard of this problem before. Here’s a quick q-implementation (assuming I’m reading the description of the problem right). For reference, my macbook air i5 gets about 600,000 “open” rolls per second (my Xeon 6234 workstation does about 12 million per second). Single core performance only.
o6:{$[not (x:1+rand 6) in 1 6;x;(x+count[r]*-1 1@x=6),(`,`fumble`critical x=6)any 6=r 1+where 6=r:ceiling 6*(0.5<)rand\1.]}
Some things that might be interesting:
not (x:1+rand 6) in 1 6
I check if we’re a 2-5 roll first ,because that’s the shortest path. (return self). Otherwise I have to compute my rolls:
r:ceiling 6*(0.5<)rand\1.
The instructions were a little strange here. It says if I roll a six, I keep rolling while I get 4,5,6 and if I rolled a one, I keep rolling while I get 1,2,3, but then I only ever use the number of rolls, so I think they want a 50% chance of ending the sequence, so I generate random floats until I get one below 0.5. I then multiply by 6 so I get things that look like dice rolls. Because my sequence starts with 1, the sequence will go 6, roll, roll, roll, …
any 6=r 1+where 6=r
Did I get any 6s? That’s the 1/6th chance. 6=r returns a bitmap where 1b is the location of a 6. “where” returns the offsets of the 1-bits. I add one to this value and look up those indexes in r. Are any of those also 6?
(`,`fumble`critical x=6)
This is the two-symbol sequence (blank symbol) or the symbol “fumble” or “critical” if we initially rolled a 1 or a 6. I’m indicating how I’m intending to interpret my “doubles”. Remember in my rolls (r), 1s are 6s.
(x+count[r]*-1 1@x=6)
The “score” is the first roll, plus the number of rolls (if we first rolled a 6) or minus the number of rolls (if we didn’t).
Now that was interesting. I updated the description in the Readme after an other reader here pointed out that it was a bit confusing. Check if you also think this is a better way of describing this.
Now, the reason for the Open-Ended D6 is that when we simplified the MEGA RPG that we published in 1987, we decided to go strictly with D6s. But the range is a bit limiting and we needed criticals and fumbles - and then the O6 was born, and has been with us since the mid-90s.
That updated README is much easier to understand.
Sounds like it’s biased towrads 2-5 for the majority of rolls, with higher extents and lower extents being triggered in roughly 1/3rd of rolls skewing high or low.
Showing examples would really help: A few sequences of rolls (and their outcomes) would be really illustrative for people who aren’t exactly sure what “criticals and fumbles” are.
It might also be fun to think about an O(1) implementation. That is, computing the “score” from a single random number (e.g. chosen from between 0 and 1).
Most of the decision tree is binary (roll 1 or 6 a certain number of times), so if x>1/3, then (6*x)-1, otherwise if x is halfway between 1/6th and 1/3rd, we choose between fumble or critical, leaving if x <1/6 for the “open-ended” part, which represents 1/6th of the scores – but of course, that “open-ended” part isn’t linear. It is easy to analyse, but in other problems it might not be, so looking at the rolling (off by one because the first roll was a 1 or a 6):
q)x:(0#0)!(0#0);do[10000000;x[count (0.5<)rand\1.]+:1];{k!x k:asc key x}x
2 | 5001097
3 | 3464806
4 | 1200716
5 | 277905
6 | 47839
7 | 6748
8 | 787
9 | 94
10| 7
11| 1
we can convert it directly into a function:
f:12-asc[value 0.1667964*x%sum x] bin
That’s using the same “x” as above, and you should see a perfectly normal distribution even though we’re sampling from a linear distribution. And that’s a real function; We can print it back out:
q)f
-[12]bin[`s#2.001557e-05 0.0001050817 0.0007088847 0.003824641 0.01503336 0.0..
and we can use it in our complete, “O(1)” o6 roller:
o1o6:{floor $[x>1%3;(6*x)-1;x<0.1667964;6-f[x]%2;x<0.25;`fumble;`critical]}
which is about 25% faster on my laptop than the iterative solution.
This looks pretty interesting, I bought an S20 Ultra last month had it almost feels underutilized as a smartphone for just browsing, twitter, reddit etc…
Have you looked at DEX? https://www.samsung.com/global/galaxy/what-is/samsung-dex/ Which may be a similar desk-bound method of doing what you want, my guess is that when running a terminal in an OS on the phone will likely need a larger screen to be comfortable so DEX may be an option.
I don’t quite see the benefit of the DEX since I simply use Smart View to get my phone screen onto my 56” TV - and with the bluetooth keyboard, I have all I need for that setup. And when I’m at a customer’s office, it’s just the same - Smart View to any monitor and fliping out the bt keyboard, and off I go.
But, as others have pointed out - a built-in keyboard would be better on the bus or subway.
Have you tried Dex yourself? If so, how do you like it? It’s tempting to buy the dock as a fun accessory, but I’m not sure how much I’d actually use it.
I believe most modern Dex-enabled phones can render the Dex interface over a USB-C cable (or a USB-C to HDMI cable). No need to buy the dock to play around with it!
I have not, similar to the OP I use Smart View from phone to TV but usually only for quick videos or something. I haven’t tried working/writing something on the phone and TV.