July 16, 2006 Re: Lack of `outer` keyword makes inner class dup implossible | ||||
---|---|---|---|---|
| ||||
Posted in reply to Bruno Medeiros | On 2006-07-16 06:42:32 -0700, Bruno Medeiros <brunodomedeirosATgmail@SPAM.com> said: > S. wrote: >> On 2006-07-14 14:06:35 -0700, "Jarrett Billingsley" <kb3ctd2@yahoo.com> said: >> >>> "S." <S._member@pathlink.com> wrote in message news:e98u9d$oqh$1@digitaldaemon.com... >>>> It seems that because inner classes lack an `outer` keyword it is impossible for >>>> them to create a new instance for the purpose of COW when operators like opCom >>>> are called... >>> >>> It's irritating, isn't it? The workaround is to make the ctor for the inner class take a reference to its owning outer class, then you can use the syntax >>> >>> Inner dup() >>> { >>> Inner n = outerThis.new Inner(outerThis); >>> return n; >>> } >>> >>> That is, you can 'new' the inner class using the outerThis reference. >>> >>> I suppose another way would be to do some terribly ugly, nonportable hacks to _find_ the outer pointer manually. Maybe if we do that, Walter will see that having an 'outer' reference would be useful. >> >> Yes, I thought of that. But Alas, WTF IS THE POINT OF INNER CLASSES IMPLICITLY HAVING THE THING THEN!?!?!?!?!??!!? >> >> -S >> > > I believe he mentioned that as just a "workaround", a temporary solution, not a final one! Hehe, I was just venting my frustration :) His solution seems to generate syntax errors when I tried it anyways though =/ -S. |
July 17, 2006 Re: [OT] Re: Lack of `outer` keyword makes inner class dup implossible | ||||
---|---|---|---|---|
| ||||
Posted in reply to Regan Heath | In article <optcp5p4fx23k2f5@nrage>, Regan Heath says...
>
>------------IvETWbTDu3bk1hw3mOmW4b
>Content-Type: text/plain; format=flowed; delsp=yes; charset=iso-8859-15 Content-Transfer-Encoding: 8bit
>
>On Fri, 14 Jul 2006 17:47:51 -0700, S. <user@pathlink.com> wrote:
>> On 2006-07-14 13:48:14 -0700, BCS <BCS@pathlink.com> said:
>>
>>> S. wrote:
>>>> It seems that because inner classes lack an `outer` keyword it is
>>>> impossible for
>>>> them to create a new instance for the purpose of COW when operators
>>>> like opCom
>>>> are called...
>>>> sudoku.d(318): outer class Foobar 'this' needed to 'new' nested class
>>>> BarBar
>>>>
>>> sudoku.d as in the game? What does the program do? Is it a generator,
>>> a solver, or a player? I ask because I have a solver done and would be
>>> interested in comparing them.
>>
>> Yes, I'm fiddling around with an analytical solver. Mine currently doesn't solve as many as I would like. I only implemented three elimination methods so far.
>
>I wrote a sudoku solver too. It expects the puzzle in a CSV file, example attached.
>
>As far as I know it will solve anything which is 'logically solvable' .. in other words as long as there is always at least one definate next step with no 2+ choices and guessing involved.
>
>Regan
Wow, your code is kind of tricky. It'll take me a bit to understand all of it.
I'll post mine here in a bit. It's ALOT longer though =/ Mine should handle larger grids though, I haven't gotten my hands on any data for 16x16 or whatever yet though.
|
July 17, 2006 Re: [OT] Re: Lack of `outer` keyword makes inner class dup implossible | ||||
---|---|---|---|---|
| ||||
Posted in reply to BCS | In article <e9c20f$271c$1@digitaldaemon.com>, BCS says... > >Regan Heath wrote: >> On Fri, 14 Jul 2006 17:47:51 -0700, S. <user@pathlink.com> wrote: >> >>> On 2006-07-14 13:48:14 -0700, BCS <BCS@pathlink.com> said: >>> >>>> S. wrote: >>>> >>>>> It seems that because inner classes lack an `outer` keyword it is >>>>> impossible for >>>>> them to create a new instance for the purpose of COW when operators >>>>> like opCom >>>>> are called... >>>>> sudoku.d(318): outer class Foobar 'this' needed to 'new' nested >>>>> class BarBar >>>>> >>>> sudoku.d as in the game? What does the program do? Is it a >>>> generator, a solver, or a player? I ask because I have a solver done >>>> and would be interested in comparing them. >>> >>> >>> Yes, I'm fiddling around with an analytical solver. Mine currently doesn't solve as many as I would like. I only implemented three elimination methods so far. >> >> I wrote a sudoku solver too. It expects the puzzle in a CSV file, example attached. >> >> As far as I know it will solve anything which is 'logically solvable' .. in other words as long as there is always at least one definate next step with no 2+ choices and guessing involved. >> >> Regan > > >Mine goes the other direction, only set cells that have only one choice left, when you run out of those, store the state and guess. It uses a stack like system for the states. It was/is solving puzzles in about 2.75 ms. I think it will solve any puzzle that can be solved, and with a little modification, will check if more than one solution exists. Where's the code? -SC |
July 17, 2006 Re: [OT] Re: Lack of `outer` keyword makes inner class dup implossible | ||||
---|---|---|---|---|
| ||||
Posted in reply to S. Attachments: | S. wrote:
> In article <e9c20f$271c$1@digitaldaemon.com>, BCS says...
>
>>
>>Mine goes the other direction, only set cells that have only one choice left, when you run out of those, store the state and guess. It uses a stack like system for the states. It was/is solving puzzles in about 2.75 ms. I think it will solve any puzzle that can be solved, and with a little modification, will check if more than one solution exists.
>
>
> Where's the code?
>
> -SC
>
>
|
July 17, 2006 Re: [OT] Re: Lack of `outer` keyword makes inner class dup implossible - sudoku.d | ||||
---|---|---|---|---|
| ||||
Posted in reply to BCS Attachments: | In article <e9gh4g$gh$11@digitaldaemon.com>, BCS says... > >This is a multi-part message in MIME format. >--------------010201050909040002030603 >Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit > >S. wrote: >> In article <e9c20f$271c$1@digitaldaemon.com>, BCS says... >> >>> >>>Mine goes the other direction, only set cells that have only one choice left, when you run out of those, store the state and guess. It uses a stack like system for the states. It was/is solving puzzles in about 2.75 ms. I think it will solve any puzzle that can be solved, and with a little modification, will check if more than one solution exists. >> >> >> Where's the code? >> >> -SC >> >> Very interesting, here's mine. I'm almost embarrased, it's much more complicated than either of your guys'. I've still got alot of work to do on it though. |
Copyright © 1999-2021 by the D Language Foundation