« first day (31 days earlier)      last day (39 days later) » 

7:03 PM
@OlzhasZhumabek I'm making the project. You'll need Visual Studio or Visual Studio Code to compile and run things, I'm pretty sure.
At least, I don't know of any other F# compilers.
 
@Hosch250, Visual Studio is my main IDE for everything. I really like it
 
OK, I wasn't sure what you ran.
Let's see, I'm only seeing the option to create console applications. Should we just work from the console for now?
I know someone who is porting WPF to F#, but I'm not sure I have the time to take it that far just now.
I'm planning on modelling it after this implementation: mathsisfun.com/games/battleship.html
Any objections?
 
@Hosch250, looks nice
 
5 ships, 1 5-square, 1 4-square, 2 3-square, and 1 2-square ships. Each is 1-square wide.
 
is there any networking library on F#? So users could play it at least on LAN
 
7:07 PM
Yeah, you can do networking with .NET.
No language-specific support needed.
But, I definitely won't have time to be doing that securely and all, and I have no where to host it. Nothing stopping you from doing it, though.
 
@Hosch250, I'm ok with that. Being honest, I wanted to try out some winsockets for that
 
Maybe input could be like (start-x:start-y:direction), without the parens and with a single letter for the direction ([V]ertical and [H]orizontal, maybe?).
BBIAS.
Back.
The prompt will tell the user which ship they are positioning.
 
direction? Didn't know that term direction exists there
 
Yeah, you can position the ships to be horizontal/vertical with that game I linked to.
 
oh, I got what you are talking about
 
7:12 PM
We will need to ensure ships aren't placed on top of each other.
And maybe torpedo input could be like (x:y).
 
it won't be hard, just cumbersome
 
@OlzhasZhumabek Oh, not really.
 
8 messages moved from The 2nd Monitor
17 messages moved from The 2nd Monitor
 
@Hosch250, as I understood F# is kinda functional?
 
1 message moved from The 2nd Monitor
Oh, you're working on Battleship? Nice.
 
7:16 PM
Yeah to both.
 
I had almost forgotten about that challenge, thanks for the reminder.
 
I'll make you an admin too, what's your Git ID?
 
@Hosch250, let me log in. I've reinstalled windows so I'm logged off everywhere
btw, where can I find it?
 
Find what?
Oh, just request access.
Or give me your username, and I'll invite you.
 
simmplecoder
 
7:21 PM
Invitation sent.
 
@Hosch250, accepted. This is really first time for me doing something in a team and on github. I hope I won't be screwing things up too badly
so, lets nail down the architecture?
 
Just don't merge your own PR then.
I'll wait to merge mine until you review them too.
 
@Hosch250 Just saying: There is also a "Code Review" organization on Github. github.com/CodeReviewCommunity it's pretty quiet though since we never figured out what to do with it
 
@SimonForsberg, so we can pull our projects there? Would be nice
 
I'll fix
 
7:23 PM
TBH, I need to figure out how F# works first.
 
@Hosch250, me too. Though I believe it won't be that hard
@SimonForsberg, thanks
 
7:46 PM
it seems like I won't have intellisense support. I feel blinded
 
8:20 PM
OK, here goes.
I'll write the starting input right now and PR.
 
I still can't write a single function
 
LOL, I just wrote FizzBuzz.
Basically, the entry point has to be the last function.
Loops and conditionals can be found on the web.
 
well, I'll dig in more then
 
Fork the repo to your own GitHub account.
That way, you won't just be pushing directly to the main one, but will have to make PRs.
 
I believe I've done it. OK, I'll try to write a few functions
OK I've written a function
 
8:31 PM
Cool.
 
8:50 PM
man that language is kinda crazy
8 MB on dumb while loop, o_O
it seems like F# doesn't have any functions to ask for user input
 
9:11 PM
What about System.Console.ReadLine()?
 
@Hosch250, how can I parse it? I googled around but couldn't find out of a box function
 
@OlzhasZhumabek I'm doing that part.
I'm not very far--just got back from walking my dog.
let inputBattleshipCoord battleshipLength =
    printfn "Please input your ship position:"

    let totalInput = System.Console.ReadLine().Split(':')

    let xInput = System.Int32.Parse(totalInput.[0])
    let yInput = System.Int32.Parse(totalInput.[1])
    let direction = totalInput.[2]

    printfn "xCoord: %d" xInput
    printfn "yCoord: %d" yInput
    printfn "direction: %s" direction
I need to make that return a custom type.
A struct, or something.
@OlzhasZhumabek Uh, where are you seeing that?
I guess you could kind of say we are the blind leading the blind here :P
 
@Hosch250, I'm seeing what? I'm not actually used to the language yet. It's really dizzy
My mind is too imperative
I'm trying to get why this code produces UB:
let main() =
    let mutable x:int = 7
    while x > 0 do
        x <- System.Console.Read()
        let res = x*x
        printfn "%d" res
 
UB?
 
undefined behavior. Really strange things are happening
 
9:18 PM
Is it the <- operator?
I have no idea what that does. Try let x = System.Console.Read().
 
yep. Used on mutable variable
I need to have it on the top, so that I could use it in a while
 
This is the first time I've done anything more than FizzBuzz in F#, so...
@OlzhasZhumabek Yeah, let me see what's up.
Ah, VS is telling me one problem.
It expects x to have type int, but it has type uint.
That warning is on the loop.
 
I don't get any warnings and I explicitly stated that x should be int. Really strange
 
Yeah, the warning isn't on the definition, it is on the loop.
 
oh it's working now. I've used your code to parse the input
 
9:24 PM
It isn't done.
Please don't do the same thing I'm doing. Want to build the board?
 
well I needed only 1 integer, so it worked out fine. Now I have much clearer understanding
 
OK.
 
board? Like printing it out?
 
No, just in memory.
 
So, struct? Yeah, I can
 
9:25 PM
We need to keep track of which squares have ships and which squares were torpedoed.
Actually, do a class.
 
then each square can have 3 states
 
Too much information for a struct, I think.
Yeah, I was thinking a nullable bool, but I'm not sure if F# supports nullables.
If it doesn't you could use an enum to represent the state, maybe.
 
I have no idea what it is. Won't something like enum work?
 
Yeah, an enum will work.
Actually, enum is probably a better choice anyway.
 
so F# has enums?
interesting
 
9:27 PM
No idea.
I would assume so.
 
haskell data types are inherently enum-ish
 
well, quite straightforward then
even though my mind is still trying to consume all of that functional stuff
 
OK, make a union. We don't need to have a specific integer value for the state.
 
it's like discriminated unions?
I have no formal CS education btw
 
9:30 PM
type SizeUnion = Small | Medium | Large         // union
type ColorEnum = Red=0 | Yellow=1 | Blue=2      // enum
Just like that.
 
oh, ok
 
F# terminology.
@OlzhasZhumabek Same here.
I'm an IT Manager major.
 
9:48 PM
I've grabbed a book. I'll complete the board class tomorrow evening for sure. For now I'll go to sleep. See you
 
See you.
I'm learning quite a lot. It is really cool.
I have the optimal-case input done.
@OlzhasZhumabek I want to make this sort of a server-side implementation. That way, I could eventually write a UI in C#/WPF and use this project for the calculations, or you could implement a JS UI for it when you make it able to be played over LAN.
 

« first day (31 days earlier)      last day (39 days later) »